/* Textus: Fen & Ink, used dark. Tokens come from /tokens.css (the Wroot design system). */
:root {
  --g: var(--ink);            /* ground */
  --g2: #222c35;              /* raised on dark */
  --t: var(--ivory);
  --t2: #aab4bc;
  --line: rgba(251, 248, 241, 0.14);
  --gutter: clamp(18px, 5vw, 72px);
  --measure: 62ch;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { animation: none !important; transition: none !important; } }
body { margin: 0; background: var(--g); color: var(--t); font-family: var(--serif); font-size: 19px; line-height: var(--lh-prose); -webkit-font-smoothing: antialiased; }
a { color: var(--reed); text-underline-offset: 3px; }
a:hover { color: var(--ivory); text-decoration-color: var(--ivory); }
a:focus-visible, button:focus-visible, select:focus-visible, canvas:focus-visible { outline: 2px solid var(--reed); outline-offset: 3px; }
.sans, nav, .eyebrow, .legend, .ctl, .tip, table, .note, .stat small { font-family: var(--sans); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 12px; color: var(--t2); margin: 0 0 var(--space-3); }
h1, h2, h3 { color: var(--t); font-family: var(--serif); font-weight: 500; line-height: var(--lh-display); letter-spacing: 0.2px; margin: 0; }
h1 { font-size: clamp(54px, 10vw, 128px); }
h2 { font-size: clamp(34px, 5vw, 56px); }
h3 { font-size: 24px; }
p { color: inherit; font-size: inherit; line-height: inherit; margin: 0 0 var(--space-4); max-width: var(--measure); }
em { font-style: italic; }

/* header / footer */
.top { display: flex; align-items: baseline; justify-content: space-between; padding: 18px var(--gutter); position: absolute; inset: 0 0 auto 0; z-index: 5; }
.top a.name { font-size: 26px; text-decoration: none; color: var(--t); font-style: italic; }
nav { display: flex; gap: 22px; font-size: 14px; }
nav a { color: var(--t2); text-decoration: none; }
nav a:hover, nav a[aria-current] { color: var(--ivory); }
footer { border-top: 1px solid var(--line); padding: var(--space-7) var(--gutter) var(--space-8); color: var(--t2); font-family: var(--sans); font-size: 14px; display: grid; gap: var(--space-4); }
footer img { height: 40px; }
footer p { max-width: 80ch; margin: 0; }

/* hero */
.hero { min-height: 92vh; padding: 0 var(--gutter); display: flex; flex-direction: column; justify-content: center; position: relative; }
.hero h1 { font-style: italic; }
.lede { font-size: clamp(24px, 3.2vw, 38px); line-height: 1.25; max-width: 24em; margin: var(--space-5) 0 var(--space-4); }
.hero .sub { color: var(--t2); max-width: 44ch; font-size: 18px; }
.cue { font-family: var(--sans); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--t2); margin-top: var(--space-7); }

/* control bar */
.bar { position: sticky; top: 0; z-index: 20; background: rgba(26, 33, 40, 0.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); padding: 10px var(--gutter); display: flex; gap: var(--space-5); align-items: center; flex-wrap: wrap; }
.ctl { font-size: 13px; color: var(--t2); display: flex; align-items: center; gap: 10px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-pill); overflow: hidden; }
.seg button { background: none; color: var(--t2); border: 0; padding: 7px 14px; font: inherit; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--ivory); color: var(--ink); }
.legend { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--t2); flex-wrap: wrap; }
.ramp { width: 150px; height: 10px; border-radius: 2px; background: linear-gradient(90deg, #181c24, #461420 15%, #aa2d1e 40%, #eb9628 70%, #fadc78 90%, #fffaeb); }
.sw { width: 12px; height: 12px; background: #2c3440; display: inline-block; border-radius: 2px; }

/* scriptures */
.scripture { scroll-margin-top: 96px; padding: var(--space-9) var(--gutter) var(--space-7); }
.scripture header { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); margin-bottom: var(--space-6); max-width: 70ch; }
.scripture header p { color: var(--t2); margin: 0; }
.scripture .jump { margin-top: var(--space-3); }
select { background: var(--g2); color: var(--t); border: 1px solid var(--line); border-radius: var(--radius-md); padding: 8px 10px; font: 14px var(--sans); max-width: 100%; }
.mapwrap { position: relative; display: grid; grid-template-columns: 108px 1fr; gap: 12px; }
@media (max-width: 760px) { .mapwrap { grid-template-columns: 1fr; } .gutterlab { display: none; } }
.gutterlab { position: relative; font: 12px var(--sans); color: var(--t2); }
.gutterlab span { position: absolute; right: 0; transform: translateY(-1px); white-space: nowrap; border-top: 1px solid var(--line); padding-top: 2px; width: 100%; text-align: right; }
.canvaswrap { position: relative; clip-path: inset(0 0 100% 0); transition: clip-path 1.6s cubic-bezier(.2, .6, .2, 1); }
.canvaswrap.in { clip-path: inset(0 0 0 0); }
canvas.map { display: block; width: 100%; height: auto; image-rendering: pixelated; cursor: crosshair; background: #11151a; touch-action: manipulation; }
.cap { font: 13px var(--sans); color: var(--t2); margin-top: var(--space-3); max-width: 80ch; }

/* counters */
.counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-6); padding: var(--space-8) var(--gutter); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.stat b { display: block; font-weight: 500; font-size: clamp(38px, 5vw, 64px); line-height: 1; font-variant-numeric: tabular-nums; }
.stat small { display: block; color: var(--t2); font-size: 13px; margin-top: var(--space-2); max-width: 24ch; }

/* findings */
.findings { padding: var(--space-9) var(--gutter); display: grid; gap: var(--space-7); }
.finding { max-width: 34em; font-size: clamp(24px, 3vw, 34px); line-height: 1.3; border-left: 2px solid var(--line); padding-left: var(--space-5); }
.finding.k { border-left-color: var(--reed); }
.limits { font: 14px var(--sans); color: var(--t2); max-width: 70ch; }
.door { padding: 0 var(--gutter) var(--space-9); }
.door a { font-size: 28px; }

/* tooltip + closeup */
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--ivory); color: var(--ink); padding: 10px 12px; border-radius: var(--radius-md); font-size: 13px; line-height: 1.4; max-width: 260px; box-shadow: var(--shadow-pop); opacity: 0; transition: opacity .1s; }
.tip.on { opacity: 1; }
.tip b { font: 500 16px var(--serif); display: block; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; height: min(58vh, 560px); background: var(--g2); border-top: 1px solid var(--line); display: none; grid-template-rows: auto 1fr; }
.sheet.on { display: grid; }
.sheet header { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); padding: 12px var(--gutter); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sheet header .t { font-size: 22px; }
.sheet header .m { font: 13px var(--sans); color: var(--t2); }
.sheet .body { overflow: auto; padding: var(--space-4) var(--gutter); }
.sheet canvas { display: block; max-width: 100%; height: auto; image-rendering: pixelated; cursor: crosshair; }
.sheet button.x { background: none; border: 1px solid var(--line); color: var(--t); border-radius: var(--radius-pill); padding: 6px 14px; font: 13px var(--sans); cursor: pointer; }

/* pages */
.page { padding: 140px var(--gutter) var(--space-9); }
.page h1 { font-size: clamp(40px, 6vw, 72px); margin-bottom: var(--space-6); }
.page h2 { font-size: clamp(26px, 3vw, 36px); margin: var(--space-7) 0 var(--space-4); }
.page p, .page li { max-width: var(--measure); }
.note { font-size: 14px; color: var(--t2); max-width: 80ch; }
table { border-collapse: collapse; font-size: 13px; width: 100%; }
th, td { text-align: left; vertical-align: top; padding: 10px 12px 10px 0; border-bottom: 1px solid var(--line); }
th { color: var(--t2); font-weight: 500; }
td.q { color: var(--t2); max-width: 46ch; font-size: 12.5px; }
.river { width: 100%; height: auto; display: block; }
.tags span { display: inline-block; border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 1px 10px; font-size: 12px; }

canvas.map.herostrip { height: 56px; width: 100%; margin-top: var(--space-6); }
.hero .canvaswrap { margin-top: var(--space-6); }

select.jump { width: min(100%, 460px); }
@media (max-width: 760px) {
  .scalenote { display: none; }
  .legend span:nth-child(n+4) { display: none; }
  .bar { gap: var(--space-3); padding: 8px var(--gutter); }
  .seg button { padding: 6px 10px; font-size: 12px; }
}

/* story */
.story { max-width: 1100px; }
.story h2 { margin-top: var(--space-8); }
.lede2 { font-size: clamp(21px, 2.2vw, 26px); line-height: 1.45; max-width: 36em; }
.story p strong { font-weight: 500; color: var(--ivory); }
sup.nr { font: 600 11px var(--sans); line-height: 0; margin-left: 1px; }
sup.nr a { text-decoration: none; color: var(--reed); padding: 0 2px; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-6); margin: var(--space-5) 0; }
.two > div { border-top: 1px solid var(--line); padding-top: var(--space-4); }
.two h3 { margin-bottom: var(--space-3); }
.two p { font-size: 17px; }
.fig { margin: var(--space-6) 0; }
.fig figcaption { font: 13px var(--sans); color: var(--t2); margin-top: var(--space-2); }
.bars { margin: var(--space-6) 0; display: grid; gap: 14px; max-width: 900px; font-family: var(--sans); }
.bars .row { display: grid; grid-template-columns: 120px 1fr; gap: 4px 14px; align-items: center; font-size: 13px; color: var(--t2); }
.bars .row span { grid-row: span 3; color: var(--t); }
.bars i { display: block; height: 9px; border-radius: 1px; }
.bars i.w, .bars .key i.w { background: #5B6B76; }
.bars i.m, .bars .key i.m { background: var(--reed); }
.bars b { font-weight: 400; font-size: 12px; }
.bars .key { font-size: 12px; color: var(--t2); display: flex; gap: 8px; align-items: center; }
.bars .key i { width: 18px; display: inline-block; }
.notes { margin-top: var(--space-8); border-top: 1px solid var(--line); padding-top: var(--space-4); }
.notes h2 { margin-top: var(--space-4); font-size: 24px; }
.notes ol { font: 14px/1.55 var(--sans); color: var(--t2); padding-left: 1.4em; max-width: 80ch; }
.notes li { margin-bottom: var(--space-3); }
.notes li:target { color: var(--ivory); }
.notes a[aria-label] { text-decoration: none; }
.page table.data td, .page table.data th { padding-right: 18px; }
.page table.data td.n { font-variant-numeric: tabular-nums; text-align: right; }
ol.lim { font-size: 17px; max-width: 70ch; }
ol.lim li { margin-bottom: var(--space-2); }
.page table.data { margin: var(--space-5) 0; }
