/* Layout: a left-set reading column that opens once into a wide timeline you scroll sideways, like a handscroll. */
:root {
  --paper: #ECEEE9;
  --sheet: #F7F8F5;
  --band: #E4E7E1;
  --ink: #15161A;
  --ink-2: #50555D;
  --rule: #C6CBC3;
  --rule-soft: #DADED7;

  --t-carved: #94602F;
  --t-brush: #B0372B;
  --t-reed: #2B4B9B;
  --t-quill: #276F5D;
  --t-pointed: #4F6679;
  --t-marker: #9E3A82;
  --t-press: #3A3D44;

  --f-display: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --f-body: "Hanken Grotesk", "Helvetica Neue", Arial, sans-serif;
  --f-data: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #111215; --sheet: #191B1F; --band: #15171A; --ink: #E7E7E2; --ink-2: #A3A7AE;
    --rule: #34373D; --rule-soft: #25282C;
    --t-carved: #D39A63; --t-brush: #EC6C5C; --t-reed: #83A0F2; --t-quill: #5FC2A6;
    --t-pointed: #9FB5C9; --t-marker: #E17FC3; --t-press: #C9CCD3;
  }
}
:root[data-theme="dark"] {
  --paper: #111215; --sheet: #191B1F; --band: #15171A; --ink: #E7E7E2; --ink-2: #A3A7AE;
  --rule: #34373D; --rule-soft: #25282C;
  --t-carved: #D39A63; --t-brush: #EC6C5C; --t-reed: #83A0F2; --t-quill: #5FC2A6;
  --t-pointed: #9FB5C9; --t-marker: #E17FC3; --t-press: #C9CCD3;
}
* { box-sizing: border-box; }
body {
  background: var(--wash, var(--paper));
  color: var(--ink);
  font: 400 16px/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
.page { max-width: 1360px; margin: 0 auto; padding-inline: clamp(16px, 4vw, 40px); padding-block: clamp(32px, 6vw, 72px) 64px; }
h1, h2, h3 { font-family: var(--f-display); font-weight: 300; text-wrap: balance; margin: 0; letter-spacing: -0.01em; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

.eyebrow, .kicker {
  font: 500 0.72rem/1.4 var(--f-data);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-2);
}

/* ── Hero ─────────────────────────────────────── */
.hero { display: grid; gap: 20px; max-width: 64rem; }
.hero h1 { font-size: clamp(3.2rem, 9vw, 7rem); line-height: 0.92; font-weight: 400; }
.hero h1 em { font-style: italic; font-weight: 300; }
.dek { font-size: clamp(1.1rem, 1.5vw, 1.3rem); line-height: 1.6; max-width: 76ch; color: var(--ink); }
.dek b { font-weight: 600; }
.hero-row { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(24px, 5vw, 64px); align-items: center; }
.hero-copy { display: grid; gap: 22px; min-width: 0; }
.hero-copy h1 { font-size: clamp(3rem, 6.4vw, 5.6rem); }
.hero-start { margin-top: 4px; }

.hero-specimen {
  position: relative; width: 100%; aspect-ratio: 1 / 1; max-height: 440px;
  border: 1px solid var(--rule); background: var(--sheet);
}
.spec-slide {
  position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: 14px;
  padding: 28px; text-align: center; opacity: 0; transition: opacity 900ms ease;
  border: 0; background: none; color: var(--ink); cursor: pointer;
}
.spec-slide.is-on { opacity: 1; }
.spec-slide:not([data-go]) { cursor: default; }
.spec-slide .glyph { font-size: clamp(4.5rem, 10vw, 7.5rem); line-height: 1.05; }
.spec-slide .cap { font: 400 0.72rem/1.5 var(--f-data); color: var(--ink-2); max-width: 30ch; }
.spec-slide .cap b { display: block; font: 600 0.9rem/1.3 var(--f-body); color: var(--ink); letter-spacing: 0; }
.hero-specimen:hover .spec-slide.is-on, .hero-specimen:focus-within .spec-slide.is-on { transition-duration: 0ms; }
@media (max-width: 760px) {
  .spec-slide .glyph { font-size: 3.2rem; }
  .hero-row { grid-template-columns: minmax(0, 1fr); }
  .hero-specimen { aspect-ratio: 4 / 3; max-height: none; }
}

.reading-guide { margin-top: clamp(32px, 5vw, 56px); display: grid; gap: 22px; }
.stat-row { font: 500 0.74rem/1.5 var(--f-data); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-2); }
.guide-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 20px 28px; }
.guide-steps li { border-top: 1px solid var(--ink); padding-top: 12px; display: grid; gap: 6px; }
.guide-steps a { color: var(--ink); text-decoration: none; font: 600 1rem/1.3 var(--f-body); }
.guide-steps a:hover { text-decoration: underline; text-underline-offset: 4px; }
.guide-steps .kicker { margin-right: 6px; }
.guide-steps p { font-size: 0.92rem; color: var(--ink-2); }

.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity 700ms ease, transform 700ms ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .spec-slide, .js .reveal { transition: none; }
}

/* ── Specimen strip: one baseline, many hands ── */
.strip {
  margin-block: clamp(40px, 6vw, 64px) clamp(48px, 7vw, 80px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  row-gap: 36px;
}
@media (min-width: 700px) { .strip { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1000px) { .strip { grid-template-columns: repeat(5, minmax(0, 1fr)); column-gap: 20px; } }
.strip figure { margin: 0; display: grid; gap: 10px; min-width: 0; }
.strip .glyph {
  height: 6.2rem;
  display: flex; align-items: flex-end;
  padding: 0 12px 10px 2px;
  border-bottom: 1px solid var(--ink);
  font-size: 3.4rem; line-height: 1;
  white-space: nowrap; overflow: visible;
}
.strip .glyph.w { font-size: 2.3rem; }
.strip .glyph.xw { font-size: 1.9rem; }
.strip figcaption { font: 400 0.72rem/1.45 var(--f-data); color: var(--ink-2); padding-right: 12px; }
.strip figcaption b { display: block; font: 600 0.8rem/1.4 var(--f-body); color: var(--ink); letter-spacing: 0; }

/* ── Section heads ────────────────────────────── */
.section-head { display: grid; gap: 10px; margin-bottom: 24px; }
.section-head h2 { font-size: clamp(2rem, 4.2vw, 3rem); line-height: 1.02; }
.section-head p { max-width: 80ch; font-size: clamp(1.05rem, 1.25vw, 1.2rem); line-height: 1.65; color: var(--ink); }

/* ── Tool filter ──────────────────────────────── */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; align-items: center; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px 6px 10px;
  border: 1px solid var(--rule); border-radius: 999px;
  background: var(--sheet); cursor: pointer;
  font-size: 0.82rem; line-height: 1.2;
  transition: opacity .15s, border-color .15s;
}
.chip .sw { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; }
.chip .n { font: 400 0.7rem var(--f-data); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.chip[aria-pressed="false"] { opacity: 0.45; }
.chip[aria-pressed="false"] .sw { background: transparent; box-shadow: inset 0 0 0 1.5px var(--c); }
.chip:hover { border-color: var(--ink-2); }
.chip.reset { background: transparent; border-style: dashed; }

/* ── Chart ────────────────────────────────────── */
.chart-scroll {
  overflow-x: auto; overflow-y: hidden;
  background: var(--sheet);
  border: 1px solid var(--rule);
  scrollbar-color: var(--rule) transparent;
}
.chart { position: relative; }
.band { position: absolute; top: 0; }
.band.alt { background: var(--band); }
.gridline { position: absolute; top: 0; width: 0; border-left: 1px solid var(--rule-soft); }
.lane { position: absolute; left: 0; border-top: 1px solid var(--rule-soft); }
.lane:first-of-type { border-top: 0; }
.lane-name {
  position: sticky; left: 0; z-index: 4;
  display: inline-grid; gap: 1px;
  padding: 8px 14px 6px 12px;
  background: color-mix(in srgb, var(--sheet) 90%, transparent);
  pointer-events: none;
}
.lane-name b { font: 600 0.8rem/1.2 var(--f-body); }
.lane-name span { font: 400 0.64rem/1.3 var(--f-data); color: var(--ink-2); letter-spacing: 0.02em; }
.lane-line { position: absolute; height: 0; border-top: 1px dotted var(--rule); }

.links { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 1; }
.links path { fill: none; stroke: var(--ink-2); stroke-width: 1.1; opacity: 0.22; transition: opacity .2s, stroke-width .2s; }
.links path.on { opacity: 0.95; stroke-width: 2; }
.links path.off { opacity: 0; }

.node {
  position: absolute; z-index: 3;
  width: 14px; height: 14px; margin: -7px 0 0 -7px; padding: 0;
  border-radius: 50%;
  background: var(--c);
  border: 2px solid var(--sheet);
  box-shadow: 0 0 0 1px var(--c);
  cursor: pointer;
  transition: transform .15s ease, opacity .2s;
}
.node[data-tool="press"] { border-radius: 2px; }
.node:hover { transform: scale(1.35); }
.node.is-sel { transform: scale(1.6); box-shadow: 0 0 0 1px var(--c), 0 0 0 5px color-mix(in srgb, var(--c) 28%, transparent); z-index: 5; }
.node.is-dim { opacity: 0.16; }
.node-label {
  position: absolute; z-index: 2;
  transform: translate(-50%, -100%);
  padding: 1px 5px;
  font: 500 0.7rem/1.2 var(--f-body);
  white-space: nowrap; color: var(--ink-2);
  background: color-mix(in srgb, var(--sheet) 85%, transparent);
  pointer-events: none; opacity: 0; transition: opacity .15s;
}
.node-label.key { opacity: 1; }
.node:hover + .node-label, .node:focus-visible + .node-label { opacity: 1; z-index: 6; color: var(--ink); }
.node.is-sel + .node-label { opacity: 1; z-index: 6; color: var(--ink); font-weight: 600; }
.node.is-dim + .node-label { opacity: 0; }

.tick {
  position: absolute; transform: translateX(-50%);
  font: 400 0.66rem/1 var(--f-data); color: var(--ink-2);
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.axis-rule { position: absolute; left: 0; height: 0; border-top: 1px solid var(--rule); }
.scale-note { margin-top: 10px; font: 400 0.72rem/1.5 var(--f-data); color: var(--ink-2); }

/* ── Detail ───────────────────────────────────── */
.detail {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.4fr);
  gap: clamp(24px, 4vw, 56px);
  padding-block: 36px 8px;
}
.spec {
  position: relative;
  min-height: 300px;
  display: grid; grid-template-rows: 1fr auto;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-bottom: 3px solid var(--c);
  padding: 20px 22px 18px;
  min-width: 0;
}
.spec-glyph {
  display: grid; place-items: center;
  line-height: 1.15; text-align: center;
  padding-block: 12px;
  overflow-wrap: anywhere; min-width: 0;
}
.spec-none { display: grid; place-items: center; text-align: center; gap: 6px; }
.spec-none .yr { font: 400 clamp(2.4rem, 6vw, 3.6rem)/1 var(--f-display); font-style: italic; }
.spec-cap { font: 400 0.74rem/1.5 var(--f-data); color: var(--ink-2); border-top: 1px solid var(--rule-soft); padding-top: 12px; }

.d-body { display: grid; gap: 18px; align-content: start; min-width: 0; }
.d-body h3 { font-size: clamp(2rem, 4vw, 2.9rem); line-height: 1.02; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; font-size: 0.9rem; }
.facts dt { font: 500 0.68rem/1.9 var(--f-data); text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-2); }
.facts dd { margin: 0; }
.tool-tag { display: inline-flex; align-items: center; gap: 7px; }
.tool-tag i { width: 9px; height: 9px; border-radius: 50%; background: var(--c); }
.note { font-size: 1.05rem; line-height: 1.65; max-width: 66ch; }
.unit { border: 1px solid var(--rule); padding: 12px 16px; max-width: 62ch; font-size: 0.92rem; background: var(--sheet); }
.unit .kicker { display: block; margin-bottom: 4px; }
.lineage { display: grid; gap: 8px; }
.lineage-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.lineage-row .kicker { min-width: 86px; }
.go {
  border: 0; background: none; padding: 2px 0; cursor: pointer;
  font-size: 0.88rem; text-decoration: underline; text-decoration-color: var(--c);
  text-underline-offset: 3px; text-decoration-thickness: 2px;
}
.go:hover { color: var(--ink-2); }
.none { font-size: 0.85rem; color: var(--ink-2); }
.pager { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding-top: 6px; }
.pager button {
  border: 1px solid var(--rule); background: transparent; cursor: pointer;
  padding: 10px 18px; min-height: 44px; font-size: 0.92rem;
}
.pager button:hover { border-color: var(--ink); }
.pager .pos { align-self: center; font: 400 0.8rem var(--f-data); color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ── Units of measure ─────────────────────────── */
.measure { margin-top: clamp(24px, 4vw, 40px); }
.units { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); }
.units figure { margin: 0; background: var(--sheet); padding: 20px 20px 22px; display: grid; gap: 12px; align-content: start; min-width: 0; }
.units svg { width: 100%; max-width: 260px; height: auto; display: block; }
.units h3 { font-size: 1.45rem; line-height: 1.1; }
.units p { font-size: 0.88rem; color: var(--ink-2); }
.units .go { justify-self: start; font-size: 0.82rem; }
.dg-ink { fill: var(--ink); stroke: var(--ink); stroke-width: 0.6; stroke-linejoin: round; }
.dg-guide { fill: none; stroke: var(--ink-2); stroke-width: 0.7; opacity: 0.55; }
.dg-dash { fill: none; stroke: var(--ink-2); stroke-width: 0.7; stroke-dasharray: 3 3; opacity: 0.7; }
.dg-acc { fill: none; stroke: var(--c); stroke-width: 1.2; }
.dg-label { fill: var(--ink-2); font: 400 9px var(--f-data); }
.dg-glyph { fill: var(--ink); }

/* ── Now ──────────────────────────────────────── */
.now { margin-top: clamp(24px, 4vw, 40px); display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: clamp(24px, 5vw, 72px); }
.now .section-head { align-content: start; }
.now .cols { display: grid; gap: 22px; }
.now .cols p { max-width: 62ch; }
.now .cols p b { font-weight: 600; }
footer { margin-top: 72px; padding-top: 18px; border-top: 1px solid var(--rule); font: 400 0.72rem/1.6 var(--f-data); color: var(--ink-2); max-width: 90ch; }

/* ── Specimen faces (modern digital typefaces, captioned as such) ── */
.f-cune { font-family: "Noto Sans Cuneiform", serif; }
.f-hiero { font-family: "Noto Sans Egyptian Hieroglyphs", serif; }
.f-phoen { font-family: "Noto Sans Phoenician", serif; }
.f-brahmi { font-family: "Noto Sans Brahmi", serif; }
.f-deva { font-family: "Tiro Devanagari Hindi", "Noto Serif Devanagari", serif; }
.f-wang { font-family: "Zhi Mang Xing", "STXingkai", serif; }
.f-kai { font-family: "Ma Shan Zheng", "KaiTi", "Kaiti SC", serif; }
.f-cao { font-family: "Liu Jian Mao Cao", "STXingkai", serif; }
.f-kana { font-family: "Yuji Syuku", "Hiragino Mincho ProN", serif; }
.f-zen { font-family: "Yuji Boku", "Hiragino Mincho ProN", serif; }
.f-hangul { font-family: "Nanum Brush Script", "Nanum Myeongjo", serif; }
.f-kufi { font-family: "Reem Kufi", "Geeza Pro", serif; }
.f-naskh { font-family: "Amiri", "Noto Naskh Arabic", serif; }
.f-nastaliq { font-family: "Noto Nastaliq Urdu", "Amiri", serif; line-height: 1.6; }
.f-ruqaa { font-family: "Aref Ruqaa", "Amiri", serif; }
.f-roman { font-family: "Cinzel", "Trajan Pro", serif; }
.f-uncial { font-family: "Uncial Antiqua", serif; }
.f-textura { font-family: "UnifrakturMaguntia", serif; }
.f-copper { font-family: "Pinyon Script", cursive; }

@media (max-width: 760px) {
  .detail { grid-template-columns: minmax(0, 1fr); }
  .spec { min-height: 220px; }
  .now { grid-template-columns: minmax(0, 1fr); }
  .strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}

@media (min-width: 900px) {
  .section-head { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: clamp(32px, 4vw, 72px); align-items: start; }
  .section-head > .kicker { grid-column: 1; grid-row: 1; }
  .section-head > h2 { grid-column: 1; grid-row: 2; }
  .section-head > p { grid-column: 2; grid-row: 1 / span 2; max-width: none; }
  .section-head > p + p { grid-row: 3; margin-top: 12px; }
}
