/* Coelacanth (Ben Whitmore, SIL OFL 1.1 — see fonts/OFL-Coelacanth.md) is
   a free, direct type revival of Bruce Rogers' Centaur, itself a bona fide
   Jenson/Venetian revival — used for Venetian Oldstyle's specimens since
   the correct classification lineage matters more than any single Google
   Fonts stand-in. Self-hosted since it isn't on Google Fonts. */
@font-face {
  font-family: "Coelacanth";
  src: url("../fonts/Coelacanth.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Coelacanth";
  src: url("../fonts/Coelacanth-Bold.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* Tinos (Steve Matteson, SIL OFL — see fonts/OFL-Tinos.txt) is Google's
   free, metric-compatible match for Times New Roman — the same approach
   already used for Arimo/Helvetica. Self-hosted so Transitional's
   specimens don't depend on Times New Roman being installed locally,
   and without embedding the real (non-redistributable) font file. */
@font-face {
  font-family: "Tinos";
  src: url("../fonts/Tinos-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* ==========================================================================
   Design system: "measured document" — a technical reference, not a book.
   Near-white ground, near-black ink, dashed rule structure, oversized
   condensed display type carrying every name, monospace for anything
   measured (indices, dates, dimensions). Sealing-wax red is the only
   color note, reserved for tags and measurement callouts. Sharp corners
   throughout; no shadows — separation comes from rule lines, not blur.
   ========================================================================== */

:root {
  --paper: #f0ede5;
  --panel: #ffffff;
  --ink: #004643;
  --ink-soft: #2e5c59;
  --ink-faint: #4d6a67;
  --rule: rgba(0, 70, 67, 0.22);
  --rule-solid: #d3dbd8;
  --accent: #bc3a14;
  --focus: #004643;
  --paper-grid: rgba(0, 70, 67, 0.05);
  /* Fixed (not theme-swapped) — the hero photo's own text color. The photo
     and its teal wash look the same in light and dark mode, so the text
     sitting on it stays a fixed cream rather than following --ink. */
  --hero-ink: #f5f2ea;

  --font-ui: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Anton", "Arial Narrow", sans-serif;
  --font-mono: "JetBrains Mono", "Space Mono", monospace;

  --radius: 0px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #004643;
    --panel: #0a5852;
    --ink: #f0ede5;
    --ink-soft: #cddbd8;
    --ink-faint: #a8c2bf;
    --rule: rgba(240, 237, 229, 0.2);
    --rule-solid: #146b64;
    --accent: #ffb27f;
    --focus: #f0ede5;
    --paper-grid: rgba(240, 237, 229, 0.05);
  }
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light dark;
}

body {
  margin: 0;
  background-color: var(--paper);
  /* A faint 28px graph-paper grid instead of a flat color — the same
     structural-line language as the timeline/anatomy dashed rules, applied
     as ambient page texture rather than a functional divider. Chosen over
     a literal newsprint grain or halftone screen (both previewed) as the
     option that reads as "measured document" rather than "aged paper." */
  background-image:
    repeating-linear-gradient(0deg, var(--paper-grid) 0, var(--paper-grid) 1px, transparent 1px, transparent 28px),
    repeating-linear-gradient(90deg, var(--paper-grid) 0, var(--paper-grid) 1px, transparent 1px, transparent 28px);
  color: var(--ink);
  font-family: var(--font-ui);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}

/* ---------- header ---------- */

.site-header {
  padding: 0;
}

/* Hero photo + teal wash + fade-to-paper all live on .site-header itself,
   sized to whatever height the text content actually takes — not a fixed
   aspect-ratio guess. That matters because the text stacks much taller on
   narrow viewports (brand wraps, tagline drops below), and a fixed-height
   photo frame left the tagline spilling onto plain paper below it, still
   styled in the light "on-photo" color and unreadable there. Tying the
   wash/fade to the real content box means the fade always ends exactly
   at the content's own bottom edge, at any width. The photo itself stays
   anchored to the top (background-position: top) so its own crop always
   favors keeping the top of the frame — where his face sits — intact;
   min-height keeps that top slice tall enough on short/compact layouts. */
.site-header {
  position: relative;
  min-height: 13vw;
  background-image:
    linear-gradient(rgba(0, 70, 67, 0.6), rgba(0, 70, 67, 0.6) 60%, var(--paper) 100%),
    url("../images/hero-typographer.jpg");
  background-size: 100% 100%, cover;
  background-position: center top, center top;
  background-repeat: no-repeat, no-repeat;
}

.hero-text {
  position: relative;
  padding-top: 16%;
  padding-bottom: clamp(0.85rem, 2.13vw, 1.28rem);
}

.hero-text .brand,
.hero-text .brand-sub {
  color: var(--hero-ink);
}

.hero-text .brand-sub {
  color: rgba(245, 242, 234, 0.82);
}

.hero-text .tabs {
  border-bottom-color: rgba(245, 242, 234, 0.28);
}

.brand-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--font-display);
  line-height: 0.88;
  text-transform: uppercase;
  letter-spacing: 0.003em;
  margin: 0;
}

.brand-word {
  display: inline-block;
}

/* "Type" reads as a small eyebrow over the much larger "Classified" —
   an asymmetric two-line lockup instead of one uniform size, at the
   user's explicit request. */
.brand-word--type {
  font-size: clamp(2.1rem, 6vw, 3.9rem);
}

.brand-word--classified {
  font-size: clamp(4.4rem, 14vw, 9rem);
}

.brand-sub {
  margin: 0.4rem 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
  max-width: 30ch;
  text-align: right;
}

.tabs {
  display: flex;
  gap: clamp(1.25rem, 4vw, 2.25rem);
  align-items: flex-end;
  margin-top: 2rem;
  border-bottom: 1px solid var(--rule-solid);
}

/* The active indicator is a horizontal underline directly on the tab
   (overlapping .tabs's own 1px baseline via the negative margin) rather
   than the previous vertical dashed rule above the label — a plainer,
   more conventional underline-tab, at the user's explicit request. */
.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: 0 0 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

/* All four labels stay accent-colored at all times now — reverted back
   from the "neutral until active" pass, per explicit request ("should be
   in orange else people might miss the buttons"). The underline alone
   now carries the active/inactive distinction. */
.tab-label {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent);
  transition: color 0.15s ease;
}

.tab:hover {
  border-bottom-color: rgba(188, 58, 20, 0.35);
}

.tab.is-active {
  border-bottom-color: var(--accent);
}

.tab.is-active .tab-label {
  font-weight: 700;
}

.tab:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .brand-sub {
    text-align: left;
    max-width: none;
  }
}

/* "Type" and "Classified" scale via two independent clamp() curves with
   different vw coefficients, so a single width-relative padding-top
   only clears the subject's chin at the widths where both happen to hit
   their fixed min (narrow phones) or are both scaling in lockstep (wide
   desktop) — the range between, where one clamp is still climbing and
   the other already isn't, is exactly where "Classified" lands lowest
   relative to its own text block and covers his chin/mouth instead of
   his wrist. Covering that whole gap with one generous value, rather
   than trying to track the curves precisely. */
@media (max-width: 1000px) {
  .hero-text {
    padding-top: 16%;
  }
}

/* Real phones (≤640px, matching this file's other mobile breakpoint)
   need more headroom than the 641-1000px "web at a smaller window" band
   above — a real-device chin-coverage report only showed up at true
   phone widths, and applying the larger value across the whole
   ≤1000px band also reflowed ordinary desktop/tablet browser windows
   in that range, which is not what was reported broken. */
@media (max-width: 640px) {
  .hero-text {
    padding-top: 27%;
  }
}

/* ---------- views ---------- */

main.wrap {
  padding-top: clamp(0.74rem, 1.7vw, 1.06rem);
  padding-bottom: 4rem;
  min-height: 60vh;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
  animation: fade-in 0.2s steps(3, end);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.view-intro h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.4vw, 2.1rem);
  letter-spacing: 0.025em;
  text-transform: uppercase;
  line-height: 1.05;
  margin: 0 0 0.5rem;
}

.view-intro p {
  color: var(--ink-soft);
  max-width: 62ch;
  margin: 0 0 1.75rem;
}

/* Timeline and Anatomy split their intro into two sentences as separate
   <p>s (for a sentence-per-line read), but the shared 1.75rem margin
   above is sized to separate the intro from the next block, not to
   space two sentences of the same intro apart - applied between both
   <p>s here it read as a much bigger gap than normal line leading.
   Collapsing every non-last <p> down to the same rhythm as a line break
   keeps the two-sentence intros reading like one paragraph, matching
   the single-<p> intros elsewhere. */
.view-intro p:not(:last-child) {
  margin-bottom: 0.35rem;
}

/* ---------- specimen tool ---------- */

.specimen-tool {
  margin-bottom: 1.5rem;
}

.specimen-tool-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
  margin-bottom: 0.4rem;
}

.specimen-tool-row {
  display: flex;
  gap: 0.5rem;
  max-width: 480px;
}

.specimen-tool-input {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 0.92rem;
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--rule-solid);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
}

.specimen-tool-input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--ink-faint);
}

.specimen-tool-input::placeholder {
  color: var(--ink-faint);
}

.specimen-tool-clear {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: none;
  border: 1px solid var(--rule-solid);
  border-radius: var(--radius);
  padding: 0 0.9rem;
  cursor: pointer;
}

.specimen-tool-clear:hover {
  border-color: var(--ink-faint);
  color: var(--ink);
}

/* ---------- filters ---------- */

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.filter-chip {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  background: var(--panel);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.filter-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-chip:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.filter-chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.filter-chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.filter-chip:disabled:hover {
  border-color: var(--rule-solid);
}

/* ---------- explore: numbered list ---------- */

.card-grid {
  display: flex;
  flex-direction: column;
}

.spec-row {
  display: flex;
  align-items: baseline;
  gap: clamp(0.75rem, 3vw, 1.5rem);
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-top: 1px solid var(--rule-solid);
  padding: 1rem 0;
  cursor: pointer;
  transition: background 0.12s steps(2, end);
}

.card-grid .spec-row:last-child {
  border-bottom: 1px solid var(--rule-solid);
}

.spec-row:hover,
.spec-row:focus-visible {
  background: var(--panel);
}

.spec-row:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.spec-row-index {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-faint);
  width: 24px;
  flex-shrink: 0;
  padding-top: 0.4em;
}

.spec-row-main {
  flex: 1;
  min-width: 0;
}

.spec-row-name {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4.4vw, 2.5rem);
  text-transform: uppercase;
  line-height: 1;
  color: var(--ink);
  overflow-wrap: break-word;
}

.spec-row-specimen {
  display: block;
  margin-top: 0.4rem;
  line-height: 1.15;
  color: var(--ink-soft);
}

.spec-row-tagline {
  display: block;
  margin-top: 0.3rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  max-width: 60ch;
}

.spec-row-meta {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
}

.spec-row-era {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

.branch-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  white-space: nowrap;
}

.branch-tag::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--accent);
  flex-shrink: 0;
}

/* ---------- detail overlay ---------- */

.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 70, 67, 0.5);
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: clamp(1rem, 5vh, 4rem) 1rem;
  overflow-y: auto;
  z-index: 100;
}

.detail-overlay.is-open {
  display: flex;
}

.detail-panel {
  background: var(--panel);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  max-width: 640px;
  width: 100%;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  position: relative;
}

.detail-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-faint);
  padding: 0.25rem 0.5rem;
}

.detail-close:hover {
  color: var(--ink);
}

.detail-close:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.detail-era {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-faint);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.detail-name {
  font-family: var(--font-display);
  font-size: clamp(2rem, 6vw, 2.6rem);
  text-transform: uppercase;
  line-height: 0.95;
  margin: 0.35rem 0 0.9rem;
}

.detail-specimen {
  line-height: 1.1;
  padding: 1.25rem 0;
  border-top: 1px solid var(--rule-solid);
  border-bottom: 1px solid var(--rule-solid);
  margin-bottom: 1.25rem;
  word-break: break-word;
}

.detail-description {
  color: var(--ink-soft);
  margin-bottom: 1.25rem;
}

.diagnostics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.diagnostic {
  background: var(--paper);
  border: 1px solid var(--rule-solid);
  border-radius: var(--radius);
  padding: 0.6rem 0.8rem;
}

.diagnostic-label {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
  font-weight: 700;
}

.diagnostic-value {
  font-size: 0.88rem;
  font-weight: 600;
  margin-top: 0.2rem;
}

.tell-box {
  background: var(--paper);
  border: 1px solid var(--rule-solid);
  border-left: 2px solid var(--accent);
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

.tell-box strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.key-typefaces {
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.key-typefaces b {
  color: var(--ink);
}

.substyle-list {
  margin: 0.5rem 0 1.25rem;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.substyle-list li {
  font-size: 0.85rem;
  background: var(--paper);
  border: 1px solid var(--rule-solid);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}

.substyle-list b {
  color: var(--accent);
}

.visual-characteristics {
  margin-top: 1.25rem;
}

.additional-features-heading {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-bottom: 0.6rem;
}

.visual-characteristics-heading {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 0.6rem;
}

.visual-characteristics-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.visual-characteristics-list li {
  font-size: 0.85rem;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1px solid var(--rule-solid);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
}

.visual-characteristics-list b {
  color: var(--accent);
}

.additional-features {
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule-solid);
}

.additional-features-list {
  margin: 0;
  padding-left: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.additional-features-list li {
  padding-left: 0.15rem;
}

/* ---------- serif spectrum ---------- */

.serif-spectrum {
  margin-bottom: 1.25rem;
}

.serif-spectrum-heading {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-bottom: 0.6rem;
}

.serif-spectrum-hint {
  font-family: var(--font-ui);
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  font-style: italic;
}

.serif-spectrum-zoom {
  position: fixed;
  z-index: 250;
  width: 260px;
  padding: 1.25rem 1.25rem 0.75rem;
  background: var(--panel);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s steps(2, end);
}

.serif-spectrum-zoom.is-visible {
  opacity: 1;
}

.serif-spectrum-zoom svg {
  width: 100%;
  height: auto;
  display: block;
}

.serif-spectrum-zoom svg path {
  fill: var(--accent);
}

.serif-spectrum-zoom-label {
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink);
  margin-top: 0.5rem;
}

.serif-spectrum-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
}

.serif-spectrum-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.25rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  /* Without this, a grid item's minimum width defaults to its content's
     min-content size — "Transitional" (the longest label, one word with
     no break point) then forces its 1fr column wider than the other
     four's equal share, and since the SVG is width:100%, its shape
     renders visibly bigger too. */
  min-width: 0;
}

.serif-spectrum-item.is-current {
  border-color: var(--accent);
}

.serif-spectrum-svg {
  width: 100%;
  height: 44px;
}

.serif-spectrum-svg path {
  fill: var(--ink-faint);
}

.serif-spectrum-item.is-current .serif-spectrum-svg path {
  fill: var(--accent);
}

.serif-spectrum-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 600;
  color: var(--ink-faint);
  text-align: center;
  overflow-wrap: break-word;
}

.serif-spectrum-item.is-current .serif-spectrum-label {
  color: var(--accent);
  font-weight: 700;
}

/* ---------- anatomy diagram ---------- */

.anatomy-heading {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
  margin-bottom: 0.6rem;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}

.anatomy-hint {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: none;
  letter-spacing: normal;
  color: var(--ink-faint);
  font-style: italic;
}

.anatomy-lens {
  position: fixed;
  border-radius: 50%;
  border: 2px solid var(--ink);
  overflow: hidden;
  background: var(--panel);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.1s steps(2, end);
  z-index: 200;
}

.anatomy-lens.is-visible {
  opacity: 1;
  transform: scale(1);
}

.anatomy-lens-inner {
  position: absolute;
  top: 0;
  left: 0;
}

.anatomy-lens-inner svg {
  display: block;
}

.anatomy-loading {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-faint);
  padding: 1.5rem 0;
  text-align: center;
}

.anatomy-block {
  background: var(--paper);
  border: 1px solid var(--rule-solid);
  border-radius: var(--radius);
  padding: 0.75rem 0.375rem 1rem;
  margin-bottom: 1.25rem;
  /* Bleeds flush with the detail panel's own edge instead of sitting
     inside its padding — since the diagram inside scales to 100% of
     this block's width, widening the block is the only way to make the
     drawing itself read bigger without hardcoding a fixed size that
     would stop being responsive. */
  margin-left: calc(-1 * clamp(1.5rem, 4vw, 2.5rem));
  margin-right: calc(-1 * clamp(1.5rem, 4vw, 2.5rem));
}

.anatomy-svg-wrap {
  width: 100%;
  overflow-x: auto;
}

/* No pixel height on the <svg> itself (js/anatomy.js) — with only a
   viewBox, width:100%/height:auto lets the diagram scale UP to fill the
   panel's full width, not just cap at its own natural rendered size. */
.anatomy-svg-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

.anatomy-guide {
  stroke: var(--ink-faint);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

.anatomy-leader {
  stroke: var(--ink-faint);
  stroke-width: 1;
  stroke-dasharray: 2 2;
}

.anatomy-guide-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.03em;
  fill: var(--ink-faint);
}

.anatomy-specimen-text {
  fill: var(--ink);
}

.anatomy-ref-glyph {
  fill: var(--ink-faint);
  opacity: 0.55;
}

.anatomy-ref-caption {
  font-family: var(--font-mono);
  font-size: 8px;
  font-style: italic;
  fill: var(--ink-faint);
}

.anatomy-stress {
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-dasharray: 4 3;
}

.anatomy-xheight-arrow {
  stroke: var(--accent);
  stroke-width: 1.5;
}

.anatomy-xheight-label {
  font-family: var(--font-mono);
  font-size: 7px;
  font-weight: 700;
  letter-spacing: 0.03em;
  fill: var(--accent);
}

.anatomy-stress-dot {
  fill: var(--accent);
}

.anatomy-stress-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  fill: var(--accent);
  letter-spacing: 0.03em;
}

.anatomy-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  padding-left: calc(clamp(1.5rem, 4vw, 2.5rem) - 0.375rem);
  padding-right: calc(clamp(1.5rem, 4vw, 2.5rem) - 0.375rem);
  border-top: 1px solid var(--rule-solid);
}

.anatomy-fact {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 130px;
}

.anatomy-fact--wide {
  flex: 1;
  min-width: 220px;
}

.anatomy-fact-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-faint);
}

.anatomy-fact-value {
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* ---------- Anatomy primer (standalone view) ---------- */

.anatomy-primer {
  max-width: 720px;
}

.anatomy-primer-card {
  /* Fixed, not var(--paper)/var(--panel): the diagram's ink (specimen
     letters, labels) is baked into anatomy_r7.svg as hardcoded hex, not
     CSS variables, so it only reads correctly against a light ground.
     In dark mode --paper and --panel both flip dark — one of them
     (--paper) happens to exactly match the SVG's own specimen-letter
     fill, which would make the letters invisible. This card stays a
     light "paper" surface regardless of site theme, the way a printed
     diagram would. */
  background: color-mix(in srgb, white 50%, #f4f1ea);
  border: 1px solid var(--rule-solid);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  margin-bottom: 1.5rem;
}

.anatomy-primer-pending {
  margin: 0;
  padding: 3rem 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink-faint);
}

.anatomy-primer-image-wrap {
  cursor: zoom-in;
}

.anatomy-primer-image {
  display: block;
  width: 100%;
  height: auto;
}

.anatomy-primer-glossary .visual-characteristics-heading {
  margin-bottom: 0.75rem;
}

/* A subtle ink-tinted box instead of the plain paper-colored one Explore
   uses for the same list markup — distinguishes Anatomy's glossary at a
   glance without inventing a new color outside the palette. */
.anatomy-primer-glossary .visual-characteristics-list li {
  background: color-mix(in srgb, var(--ink) 8%, var(--paper));
}

/* ---------- identify (quiz) ---------- */

.quiz-card {
  background: var(--panel);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 4vw, 2rem);
  max-width: 680px;
}

.quiz-score-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  font-family: var(--font-mono);
}

.quiz-score {
  font-size: 0.78rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.quiz-score strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.quiz-restart {
  background: none;
  border: none;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0.4rem 0;
}

.quiz-restart:hover {
  color: var(--ink);
}

.quiz-game-prompt {
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 3.4vw, 1.5rem);
  text-transform: uppercase;
  line-height: 1.05;
  margin: 0 0 1.25rem;
  text-align: center;
}

.quiz-game-prompt strong {
  color: var(--accent);
}

.quiz-game-choices {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.6rem;
  width: 85%;
  margin: 0 auto 1.25rem;
}

/* Big square tiles - each shows the candidate's own specimen (same
   neutral "Aa Gg Qy" sample as the question above, so it's a genuine
   like-for-like visual comparison) with its name as a caption, not just
   a name to read. */
.quiz-game-choice {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 0.5rem;
  text-align: center;
  background: none;
  border: 1px solid var(--rule-solid);
  border-radius: var(--radius);
  padding: 0.5rem;
  cursor: pointer;
  color: var(--ink);
  font-family: var(--font-ui);
  transition: border-color 0.15s ease, color 0.15s ease, opacity 0.15s ease;
}

/* A small filled badge (accent) or outlined badge (ink) marks the
   correct/chosen-wrong tile - kept as a small corner mark, never a
   fill across the whole tile, per the Small Mark Rule. */
.quiz-game-choice-mark {
  position: absolute;
  top: -1px;
  left: -1px;
  z-index: 1;
  width: 1.7rem;
  height: 1.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1rem;
  line-height: 1;
}

/* Empty until a classification gets an exampleImage field (js/data.js) -
   shows as this square's background then, cropped to fill via cover. */
.quiz-game-choice-image {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  background-color: var(--paper);
  background-size: cover;
  background-position: center;
  border: 1px dashed var(--rule-solid);
}

/* Describes one cropped, abstract diagnostic detail to look for (and to
   go photograph) - never the classification's own name or a whole-word
   description, which would give the round away at a glance. Disappears
   once that example gets a real photo (js/data.js: examples[].image). */
.quiz-game-choice-prompt {
  font-size: 0.72rem;
  font-style: italic;
  color: var(--ink-faint);
  line-height: 1.3;
}

.quiz-game-choice-name {
  font-weight: 600;
  font-size: 0.85rem;
}

.quiz-game-choice:hover:not(:disabled) {
  border-color: var(--accent);
}

.quiz-game-choice:hover:not(:disabled) .quiz-game-choice-name {
  color: var(--accent);
}

.quiz-game-choice:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.quiz-game-choice.is-correct {
  border-width: 2px;
  border-color: var(--accent);
}

.quiz-game-choice.is-correct .quiz-game-choice-name {
  color: var(--accent);
  font-weight: 700;
}

.quiz-game-choice.is-correct .quiz-game-choice-mark {
  background: var(--accent);
  color: var(--panel);
}

.quiz-game-choice.is-incorrect {
  border-width: 2px;
  border-color: var(--ink-faint);
}

.quiz-game-choice.is-incorrect .quiz-game-choice-image {
  opacity: 0.5;
}

.quiz-game-choice.is-incorrect .quiz-game-choice-name {
  color: var(--ink-faint);
  text-decoration: line-through;
}

.quiz-game-choice.is-incorrect .quiz-game-choice-mark {
  background: var(--panel);
  color: var(--ink-faint);
  border: 1px solid var(--ink-faint);
}

.quiz-game-choice:disabled:not(.is-correct):not(.is-incorrect) {
  opacity: 0.4;
}

.quiz-game-feedback {
  animation: fade-in 0.2s steps(3, end);
}

.quiz-game-feedback-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 1rem;
}

.quiz-game-feedback-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.quiz-game-feedback.is-correct .quiz-game-feedback-label {
  color: var(--accent);
}

.quiz-game-feedback.is-correct .quiz-game-feedback-mark {
  background: var(--accent);
  color: var(--panel);
}

.quiz-game-feedback.is-incorrect .quiz-game-feedback-label {
  color: var(--ink-soft);
}

.quiz-game-feedback.is-incorrect .quiz-game-feedback-mark {
  border: 1px solid var(--ink-soft);
  color: var(--ink-soft);
}

/* The Key tell callout borrows .tell-box (shared with the Detail
   panel, which stays accent-styled) but is restyled here to match the
   round's own correct/incorrect state, so every one of the 13
   questions reads the same way within each group: a boxed callout in
   accent orange when right, plain dark-green text with no box when
   wrong. */
.quiz-game-feedback.is-correct .tell-box {
  border-color: var(--accent);
}

.quiz-game-feedback.is-incorrect .tell-box {
  background: none;
  border: none;
  padding: 0;
  color: var(--ink);
}

.quiz-game-feedback.is-incorrect .tell-box strong {
  color: var(--ink);
}

.quiz-nav {
  margin-top: 0.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.quiz-view-full-inline {
  background: none;
  border: none;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0.4rem 0;
}

.quiz-view-full-inline:hover {
  color: var(--ink);
}

/* The primary next action always lands last in its row (quiz-nav is
   space-between), reading as the natural next step at the extreme right. */
.quiz-game-next {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: none;
  border: 1px solid var(--rule-solid);
  border-radius: var(--radius);
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.quiz-game-next:hover,
.quiz-game-next:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.quiz-game-next:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.quiz-results {
  text-align: center;
  padding: 1.5rem 0 0.5rem;
  animation: fade-in 0.2s steps(3, end);
}

.quiz-results-score {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 8vw, 3.2rem);
  color: var(--accent);
  line-height: 1;
  margin-bottom: 0.5rem;
}

.quiz-results-label {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 0 0 1.5rem;
}

.quiz-play-again {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: none;
  border: 1px solid var(--rule-solid);
  border-radius: var(--radius);
  padding: 0.65rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.quiz-play-again:hover,
.quiz-play-again:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

.quiz-play-again:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* ---------- timeline ---------- */

.tl-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-faint);
}

.tl-legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.tl-legend-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex-shrink: 0;
}

.tl-legend-swatch.is-solid {
  background: var(--ink);
}

.tl-legend-swatch.is-dashed {
  background: none;
  border: 1px dashed var(--ink-faint);
}

.tl-lg-chart-wrap {
  border: 1px solid var(--rule-solid);
  border-radius: var(--radius);
  background: var(--panel);
  overflow-x: auto;
}

.tl-lg-svg {
  display: block;
}

.tl-era-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  fill: var(--ink);
}

.tl-lg-era-header {
  cursor: help;
}

.tl-lg-node-box {
  fill: var(--panel);
  fill-opacity: 0.8;
  stroke: var(--ink);
  stroke-width: 1;
}

.tl-lg-node-box.is-standalone {
  stroke: var(--ink-faint);
  stroke-dasharray: 3 3;
}

.tl-lg-node-name {
  font-family: var(--font-display);
  text-transform: uppercase;
  fill: var(--ink);
}

.tl-lg-node-era {
  font-family: var(--font-mono);
  font-weight: 700;
  fill: var(--ink-faint);
}

.tl-lg-node {
  cursor: pointer;
}

.tl-lg-node:hover .tl-lg-node-box {
  stroke-width: 1.6;
}

.tl-lg-node:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.tl-lg-connector {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
}

.tl-lg-connector-dot {
  fill: var(--accent);
}

.tl-lg-era-sep {
  stroke: var(--rule-solid);
  stroke-width: 1;
}

.tl-lg-strip-icon {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  opacity: 0.18;
}

.tl-era-tooltip {
  position: fixed;
  z-index: 250;
  max-width: 230px;
  background: var(--panel);
  border: 1px solid var(--ink);
  border-radius: var(--radius);
  padding: 0.65rem 0.8rem;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  line-height: 1.45;
  color: var(--ink-soft);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.1s steps(2, end);
}

.tl-era-tooltip.is-visible {
  opacity: 1;
}

.tl-era-tooltip strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

.tl-tooltip-years {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-faint);
  margin-bottom: 0.4rem;
}

.tl-tooltip-closes {
  margin-top: 0.4rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--rule-solid);
}

.tl-tooltip-closes b {
  color: var(--ink);
}

/* .tl-era-tooltip itself is pointer-events: none - this button opts
   back into pointer-events so it's tappable without changing the
   tooltip's own (deliberately inert) hit-testing. */
.tl-tooltip-open-detail {
  display: block;
  margin-top: 0.5rem;
  background: none;
  border: none;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  padding: 0.4rem 0 0;
  pointer-events: auto;
}

.tl-tooltip-open-detail:hover {
  color: var(--ink);
}

.tl-tooltip-open-detail:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* Era tooltip: a reversed card (ink background, panel-colored text)
   instead of the classification tooltip's light panel — a visitor
   should be able to tell at a glance which kind of info they're
   looking at (the backdrop era vs. a specific classification) before
   reading a word of it. */
.tl-era-tooltip--era {
  background: var(--ink);
  color: var(--panel);
  border-color: var(--panel);
}

.tl-era-tooltip--era strong {
  color: var(--panel);
}

.tl-era-tooltip--era .tl-tooltip-closes {
  border-top-color: var(--ink-faint);
}

.tl-era-tooltip::after {
  display: none;
}

/* ---------- compare ---------- */

.compare-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1px;
  background: var(--rule-solid);
  border: 1px solid var(--rule-solid);
}

.compare-col {
  background: var(--panel);
  padding: 1.25rem;
}

.compare-col-name {
  font-family: var(--font-display);
  font-size: 1.3rem;
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 0.6rem;
}

.compare-col-specimen {
  line-height: 1.15;
  min-height: 3.2rem;
  margin-bottom: 0.75rem;
}

.compare-empty {
  color: var(--ink-faint);
  font-size: 0.9rem;
  padding: 2rem 0;
}

.compare-diff-heading {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.6rem;
}

.compare-diff {
  margin-top: 1.75rem;
}

.compare-diff-wrap {
  /* Fixed dark teal, not var(--paper)/var(--panel) — a deliberately
     "reversed" box regardless of site theme, the same treatment the
     footer and era tooltip already use. */
  position: relative;
  height: clamp(160px, 26vw, 260px);
  border: 1px solid var(--ink);
  background: #004643;
  overflow: hidden;
  cursor: ew-resize;
  touch-action: none;
  user-select: none;
}

.compare-diff-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2.7rem, 10.8vw, 6.1rem); /* "Typography" sizing, 80% bigger */
  line-height: 1;
  color: #bc3a14; /* fixed accent — see .compare-diff-wrap's fixed-dark note */
  white-space: nowrap;
  pointer-events: none;
}

.compare-diff-layer--b {
  clip-path: inset(0 0 0 50%);
  color: #ffffff;
}

.compare-diff-label {
  position: absolute;
  top: 0.6rem;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  pointer-events: none;
}

.compare-diff-label--a {
  left: 0.75rem;
  color: #bc3a14;
}

.compare-diff-label--b {
  right: 0.75rem;
  color: #ffffff;
}

.compare-diff-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: var(--accent);
  transform: translateX(-1px);
  pointer-events: none;
}

.compare-diff-handle::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 34px;
  height: 34px;
  background: var(--accent);
}

.compare-diff-handle::after {
  content: "\2194";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--panel);
  font-size: 1rem;
  font-weight: 700;
}

.compare-radar {
  margin-top: 1.75rem;
}

.compare-radar-unavailable {
  color: var(--ink-faint);
  font-size: 0.85rem;
}

.compare-radar-row {
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.compare-radar-svg {
  width: 100%;
  /* Grown in step with the viewBox (320 -> 415) so the render scale (px
     per viewBox unit) holds steady — the chart geometry is 25% bigger in
     viewBox units, so it ends up 25% bigger on screen too, while the
     axis-label font-size (fixed in viewBox units) renders at the same
     size as before. */
  max-width: 523px;
  height: auto;
}

.compare-radar-ring {
  fill: none;
  stroke: var(--rule-solid);
  stroke-width: 1;
}

.compare-radar-axis-label {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  fill: var(--ink-faint);
}

.compare-radar-shape {
  stroke-width: 2;
}

.compare-radar-shape--a {
  fill: color-mix(in srgb, var(--ink) 20%, transparent);
  stroke: var(--ink);
}

.compare-radar-shape--b {
  fill: color-mix(in srgb, var(--accent) 18%, transparent);
  stroke: var(--accent);
}

.compare-radar-legend {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.compare-radar-legend-item {
  position: relative;
  padding-left: 1.2rem;
}

.compare-radar-legend-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.2rem;
  width: 12px;
  height: 12px;
}

.compare-radar-legend-item--a::before {
  background: var(--ink);
}

.compare-radar-legend-item--b::before {
  background: var(--accent);
}

/* ---------- footer ---------- */

/* Fixed dark teal + reversed cream, not theme-swapped — a deliberately
   "always dark" closing block (a colophon/masthead credit panel), at the
   user's request, rather than following --ink/--paper's usual light/dark
   swap. The strong tone-shift from paper to this solid block is itself
   the separator, so no border is needed (The Line, Not Light Rule). */
.site-footer {
  background: #004643;
  padding: 1.5rem 0 2.5rem;
}

.site-footer p {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--hero-ink);
  max-width: 62ch;
  margin: 0;
  line-height: 1.6;
}

.site-footer p + p {
  margin-top: 0.5rem;
}

.site-footer a {
  color: inherit;
  text-decoration-color: rgba(245, 242, 234, 0.4);
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

@media (max-width: 520px) {
  .tabs {
    flex-wrap: wrap;
    row-gap: 0.6rem;
    gap: clamp(0.85rem, 5vw, 1.5rem);
  }
}
