/* the-enterprise
   ---------------------------------------------------------------------------
   The look is the TNG *Technical Manual*, not LCARS: drafting stock, blue
   annotation, a serif set at reading size. Deliberately the opposite of the
   LCARS theme that is coming later, so the theme switch is a transformation
   rather than a recolour.

   The one loud element is the designation in the rail — s954e12, s1.073x10e8,
   s247e47. The absurd numbers are the best thing in the archive and they are
   set at a size that says so. Everything around them is quiet.
*/

:root {
  --paper:  #e7ebee;   /* drafting stock */
  --panel:  #f6f8f9;
  --ink:    #0e1519;
  --muted:  #5d6e7a;
  --rule:   #bac6ce;
  --blue:   #1d4e89;   /* annotation blue: designations, links */
  --amber:  #a8551d;   /* used once: entries with no designation */

  --measure: 62ch;
  --rail: 7rem;
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --condensed: "Antonio", "Haettenschweiler", "Arial Narrow", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:  #0f151a;
    --panel:  #151d24;
    --ink:    #e3e9ed;
    --muted:  #8ba0ad;
    --rule:   #2a3841;
    --blue:   #7fb6e8;
    --amber:  #d08a4f;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;  /* nothing should reach for it; belt and braces */
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  line-height: 1.55;
  font-synthesis-weight: none;
}

a { color: var(--blue); text-underline-offset: 0.18em; }
a:focus-visible, .source:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem; top: 1rem;
  z-index: 10;
  background: var(--panel);
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--rule);
}

/* --- masthead ---------------------------------------------------------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  padding: clamp(2rem, 6vw, 4.5rem) 1.5rem 1.75rem;
}

.masthead-inner, .orders, main, .colophon {
  max-width: 62rem;
  margin-inline: auto;
}

.wordmark {
  margin: 0;
  font-family: var(--condensed);
  font-weight: 600;
  font-size: clamp(3rem, 12vw, 7.5rem);
  line-height: 0.88;
  letter-spacing: 0.005em;
  text-transform: uppercase;
}

.standfirst {
  max-width: min(46ch, 100%);
  margin: 1.6rem 0 0;
  font-size: 1.0625em;
}
.standfirst cite { font-style: italic; }

.ledger {
  display: flex;
  flex-wrap: wrap;
  gap: 0 2.25rem;
  margin: 1.75rem 0 0;
}
.ledger div { margin: 0.35rem 0 0; }
.ledger dt {
  font-family: var(--condensed);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.ledger dd {
  margin: 0;
  font-family: var(--condensed);
  font-size: 1.5rem;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

/* --- order nav --------------------------------------------------------- */

.orders {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  padding: 0.9rem 1.5rem;
  border-bottom: 1px solid var(--rule);
  max-width: none;
}
.orders > * { max-width: 62rem; }

.orders-label,
.orders a {
  font-family: var(--condensed);
  font-size: 0.8125rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.orders-label { color: var(--muted); }

.orders ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.orders a {
  color: var(--ink);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 2px solid transparent;
}
.orders a:hover { border-bottom-color: var(--rule); }
.orders a[aria-current="page"] {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

/* the nav is centred by an inner max-width instead of the shared one,
   because its rule has to run the full width of the page */
.orders { justify-content: flex-start; }
@media (min-width: 66rem) {
  .orders {
    padding-inline: max(1.5rem, calc((100vw - 62rem) / 2));
  }
}

/* --- entries ----------------------------------------------------------- */

main { padding: 0 1.5rem 4rem; }

.view-note {
  color: var(--muted);
  font-style: italic;
  margin: 1.75rem 0 0.5rem;
}

.entry {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: 0 2.25rem;
  padding: 1.15rem 0.75rem 1.25rem;
  margin-inline: -0.75rem;
  border-top: 1px solid var(--rule);
}
.entry:first-child { border-top: none; }
.entry:hover { background: var(--panel); }

.stamp {
  display: inline-flex;
  align-items: baseline;
  gap: 0.3rem;
  font-family: var(--condensed);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-decoration: none;
}
/* No link to give, so nothing that looks like one — same position, same
   size, no affordance. */
.stamp--unlinked { margin: 0; cursor: default; }

.stamp-mark { opacity: 0; transition: opacity 120ms ease; }
.stamp:hover { color: var(--blue); }
.stamp:hover time { text-decoration: underline; text-underline-offset: 0.25em; }
.entry:hover .stamp-mark, .stamp:focus-visible .stamp-mark { opacity: 1; }

.designation {
  margin: 0.3rem 0 0;
  font-family: var(--condensed);
  font-weight: 600;
  font-size: clamp(1.9rem, 5vw, 2.5rem);
  line-height: 0.95;
  letter-spacing: -0.01em;
  color: var(--blue);
  overflow-wrap: anywhere;
}
.designation .s, .designation .e {
  font-weight: 400;
  opacity: 0.5;
}

/* An empty field, ruled and left empty — 57 of the 75 episodes carry no
   season or episode number, and that absence is a fact about the archive
   rather than a gap in it. */
.designation--none {
  height: 0;
  margin-top: 1.5rem;
  border-top: 3px solid var(--amber);
  width: 2.75rem;
  opacity: 0.7;
}

.episode-title {
  margin: 0 0 0.3rem;
  font-size: 1.3125em;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.synopsis {
  margin: 0;
  /* A comfortable measure on a wide screen, never wider than the screen. */
  max-width: min(var(--measure), 100%);
  white-space: pre-line;
  overflow-wrap: break-word;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- season groups ----------------------------------------------------- */

.season { margin-top: 3.5rem; }

.season-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0 0.6rem;
  margin: 0 0 0.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--ink);
  font-weight: 400;
}
.season-word {
  font-family: var(--condensed);
  font-size: 0.8125rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}
.season-number {
  font-family: var(--condensed);
  font-weight: 600;
  font-size: clamp(2.5rem, 8vw, 4rem);
  line-height: 1;
  letter-spacing: -0.02em;
}
.season-count {
  font-size: 0.875rem;
  font-style: italic;
  color: var(--muted);
  margin-left: auto;
}
.season--undesignated .season-number { color: var(--amber); }

/* --- colophon ---------------------------------------------------------- */

.colophon {
  border-top: 1px solid var(--rule);
  padding: 1.75rem 1.5rem 3rem;
  font-size: 0.875rem;
  color: var(--muted);
  max-width: none;
}
.colophon p { margin: 0.35rem auto; max-width: 62rem; }

/* --- narrow ------------------------------------------------------------ */

@media (max-width: 40rem) {
  .entry {
    /* minmax(0, 1fr), not 1fr: a bare 1fr floors at max-content, and one long
       synopsis then widens the whole page instead of wrapping. */
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
  }
  .rail {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
  }
  .designation { font-size: 1.5rem; margin: 0; }
  .designation--none { margin: 0; align-self: center; width: 2rem; }
  .stamp-mark { opacity: 1; }
  .season-count { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
