/* The source library. Two surfaces on one page: a scanning surface for finding
   a work, and a reading surface for reading one. They want opposite measures —
   the finder wants every column the viewport affords, the reader wants a single
   narrow one — so each sets its own and neither inherits the other's.

   No colour is declared here: the section palette arrives from the site
   stylesheet, which the build selects by entrance. */

/* --- The controls -------------------------------------------------------
   Eight controls will not fit one line on a phone and must not be forced to.
   The shared `.controls` already wraps and already sets `align-items: end`;
   the shared `.field input` already spans its field. Only the narrowing is
   this page's. */

.sources-page .field {
  flex: 1 1 12rem;
}

/* The checkbox is not a field with a label above it, so it keeps its content
   width against the narrowing above. How it is set — the box and its name on
   one baseline — is the shared `.field-check`. */
.sources-page .field-check {
  flex: 0 1 auto;
}

/* --- The finder --------------------------------------------------------- */

.finder {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(20rem, 1fr));
  align-items: start;
}

.finder > .placeholder,
.finder > .error {
  grid-column: 1 / -1;
}

.finder[hidden] { display: none; }

/* The card a work sits in is shared with the catalogue page. */

.work-title {
  margin: 0 0 0.2rem;
  font-size: 1.02rem;
  line-height: 1.25;
  color: var(--section-ink);
}

.work-author {
  margin: 0 0 0.3rem;
  font-size: 0.86rem;
  font-weight: 600;
}

.work-kind {
  margin: 0 0 0.4rem;
  font-size: 0.76rem;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  opacity: 0.8;
}

/* The aliases a work is also catalogued under. Quiet, because they are not the
   name — but present, because a reader searching for one of them needs to see
   that this is the record they found. */
.work-aliases {
  margin: 0 0 0.55rem;
  font-size: 0.78rem;
  opacity: 0.78;
  line-height: 1.4;
}

.edition-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.edition {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.4rem;
}

.edition-open {
  flex: 1 1 auto;
  text-align: left;
  font: inherit;
  font-size: 0.84rem;
  padding: 0.35rem 0.55rem;
  border: 1px solid var(--section-pale);
  border-radius: 0.2rem;
  background: var(--section-row);
  color: inherit;
  cursor: pointer;
}

.edition-open:hover,
.edition-open:focus-visible {
  border-color: var(--section-accent);
}

/* An edition holding nothing readable says so on the row, before it is opened.
   A control that looks identical whether or not it leads to text is a control
   that misleads by omission. */
.edition-withheld {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  opacity: 0.72;
}

/* --- The reader --------------------------------------------------------- */

.reader[hidden] { display: none; }

.reader {
  max-width: 42rem;
  margin: 0 auto;
}

.back {
  font: inherit;
  font-size: 0.82rem;
  padding: 0.3rem 0.6rem;
  margin-bottom: 1rem;
  border: 1px solid var(--section-pale);
  border-radius: 0.2rem;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.reader-head {
  border-bottom: 1px solid var(--section-line);
  padding-bottom: 0.8rem;
  margin-bottom: 1rem;
}

.reader-title {
  margin: 0 0 0.15rem;
  color: var(--section-ink);
}

.reader-author {
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.reader-edition {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
}

.reader-facts {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  font-variant: small-caps;
  letter-spacing: 0.05em;
  opacity: 0.85;
}

.reader-publication {
  margin: 0;
  font-size: 0.8rem;
  opacity: 0.78;
  line-height: 1.45;
}

/* --- Stepping through the passages -------------------------------------- */

.passage-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.6rem;
  padding: 0.6rem 0.75rem;
  margin-bottom: 1.2rem;
  border: 1px solid var(--section-line);
  border-radius: 0.2rem;
  background: var(--section-row);
}

/* The same control as in the bar above, in a tighter row: the shared `.field`
   sets how it stacks, and these two lines are all this row wants differently. */
.passage-nav .field {
  flex: 1 1 14rem;
  gap: 0.2rem;
}

.passage-nav select {
  width: 100%;
  font: inherit;
  font-size: 0.84rem;
}

.step {
  font: inherit;
  font-size: 0.84rem;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--section-pale);
  border-radius: 0.2rem;
  background: var(--panel);
  color: inherit;
  cursor: pointer;
}

.step:disabled {
  opacity: 0.4;
  cursor: default;
}

.passage-count {
  flex: 1 0 100%;
  margin: 0;
  font-size: 0.75rem;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  opacity: 0.75;
}

/* --- One passage -------------------------------------------------------- */

.passage-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}

.passage-locus {
  margin: 0;
  font-size: 1rem;
  color: var(--section-ink);
}

/* cataloged, acquired, inspected, verified. Cumulative only where the record
   actually establishes each one, so the list is printed as the record has it
   and never summarised into a single word. */
.passage-states {
  font-size: 0.72rem;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  opacity: 0.75;
}

.passage-context {
  margin: 0 0 1rem;
  font-size: 0.84rem;
  line-height: 1.5;
  padding-left: 0.75rem;
  border-left: 2px solid var(--section-pale);
  opacity: 0.9;
}

.passage-text {
  margin: 1rem 0;
  line-height: 1.62;
}

.passage-paragraph {
  margin: 0 0 0.85rem;
}

/* The licence, at the point of use. It sits ABOVE the words it covers and is
   marked strongly enough to be copied with them: a reader who takes the passage
   away has to take the condition too, and a page footer does not travel with a
   selection. */
.acknowledgement {
  margin: 0 0 0.9rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.8rem;
  line-height: 1.5;
  border: 1px solid var(--section-line);
  border-left: 0.3rem solid var(--section-accent);
  border-radius: 0.2rem;
  background: var(--section-wash);
}

.passage-source {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  margin: 1rem 0 0;
  padding-top: 0.6rem;
  border-top: 1px solid var(--section-pale);
  font-size: 0.76rem;
  line-height: 1.45;
  opacity: 0.85;
}

.source-facts {
  font-variant: small-caps;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.source-url {
  overflow-wrap: anywhere;
}

.passage-notes {
  margin: 0.7rem 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  opacity: 0.8;
}

/* --- The apparatus, collapsed ------------------------------------------- */

.apparatus {
  margin-top: 1.5rem;
  border-top: 1px solid var(--section-pale);
  padding-top: 0.7rem;
  font-size: 0.8rem;
}

.apparatus summary {
  cursor: pointer;
  font-variant: small-caps;
  letter-spacing: 0.06em;
  color: var(--section-ink);
}

.artifact-list {
  margin: 0.7rem 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.artifact {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-left: 0.7rem;
  border-left: 2px solid var(--section-pale);
  line-height: 1.45;
}

.artifact-type,
.artifact-rights {
  font-variant: small-caps;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.artifact-storage,
.artifact-basis {
  opacity: 0.82;
}
