@font-face { font-family: Fraunces; font-style: normal; font-weight: 300 800; font-display: swap; src: url("fonts/fraunces-normal-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Fraunces; font-style: normal; font-weight: 300 800; font-display: swap; src: url("fonts/fraunces-normal-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: Fraunces; font-style: italic; font-weight: 300 800; font-display: swap; src: url("fonts/fraunces-italic-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: Fraunces; font-style: italic; font-weight: 300 800; font-display: swap; src: url("fonts/fraunces-italic-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/source-serif-4-normal-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-weight: 400 700; font-display: swap; src: url("fonts/source-serif-4-normal-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400 700; font-display: swap; src: url("fonts/source-serif-4-italic-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: italic; font-weight: 400 700; font-display: swap; src: url("fonts/source-serif-4-italic-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20CF, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --paper: #f6f1e8;
  --paper-2: #efe7da;
  --card: rgba(252, 249, 243, 0.94);
  --ink: #221a16;
  --ink-2: #4d423b;
  --muted: #6c5f56;
  --rule: #d9cdbd;
  --accent: #a3401c;
  --accent-ink: #8a3414;
  --gold: #9a6a12;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.06), 0 8px 28px rgba(60, 40, 20, 0.08);
  --bar-h: 3rem;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --display: Fraunces, Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #14161c; --paper-2: #1b1e26; --card: rgba(24, 27, 35, 0.95);
    --ink: #efe8dc; --ink-2: #d4cbbd; --muted: #a99e90; --rule: #343844;
    --accent: #f09a6c; --accent-ink: #f3ae86; --gold: #f0c46a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #14161c; --paper-2: #1b1e26; --card: rgba(24, 27, 35, 0.95);
  --ink: #efe8dc; --ink-2: #d4cbbd; --muted: #a99e90; --rule: #343844;
  --accent: #f09a6c; --accent-ink: #f3ae86; --gold: #f0c46a;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--bar-h) + 0.5rem); }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.125rem/1.62 var(--serif); font-optical-sizing: auto; }
a { color: var(--accent-ink); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
i, em { font-style: italic; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 1rem; top: 0.5rem; z-index: 50; background: var(--paper); padding: 0.4rem 0.8rem; }

/* top bar, one line */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--bar-h); display: flex; align-items: center; gap: 0.9rem; padding: 0 1rem; background: color-mix(in srgb, var(--paper) 92%, transparent); border-bottom: 1px solid var(--rule); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); font-size: 0.92rem; }
.topbar .home { color: var(--ink); text-decoration: none; font-weight: 600; white-space: nowrap; }
.topnav { display: flex; gap: 0.9rem; overflow-x: auto; scrollbar-width: none; min-width: 0; flex: 1 1 auto; }
.topnav::-webkit-scrollbar { display: none; }
.topnav a { color: var(--muted); text-decoration: none; white-space: nowrap; padding: 0.2rem 0; border-bottom: 2px solid transparent; }
.topnav a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
.icon-btn { flex: 0 0 auto; width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 1px solid var(--rule); background: transparent; color: var(--ink); display: grid; place-items: center; cursor: pointer; }
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }

/* opening */
.hero { max-width: 70rem; margin: 0 auto; padding: clamp(2.2rem, 7vw, 5.5rem) 1rem 1.5rem; }
.hero .kicker { font: 600 0.8rem/1.3 var(--serif); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-ink); margin: 0 0 1rem; }
.hero h1 { font: 380 clamp(2.35rem, 7.2vw, 5.4rem)/1.02 var(--display); letter-spacing: -0.02em; margin: 0 0 1.1rem; max-width: 15ch; font-variation-settings: "SOFT" 50, "WONK" 0; }
.hero h1 em { font-style: italic; color: var(--accent-ink); }
.hero .deck { font-size: clamp(1.12rem, 2.4vw, 1.4rem); line-height: 1.5; color: var(--ink-2); max-width: 36rem; margin: 0 0 2rem; }
.trio { list-style: none; margin: 0 0 2rem; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--rule); border: 1px solid var(--rule); border-radius: 14px; overflow: hidden; max-width: 58rem; }
.trio li { background: var(--paper); padding: 1.1rem 1.1rem 1.2rem; }
.trio .w { display: block; font: 420 clamp(1.7rem, 3.6vw, 2.4rem)/1.05 var(--display); margin-bottom: 0.45rem; }
.trio .was { display: block; font-size: 0.98rem; line-height: 1.4; color: var(--ink-2); }
.trio .was i { color: var(--accent-ink); }
.hero .how { font-size: 1rem; color: var(--muted); max-width: 36rem; margin: 0; }
.hero-map { margin: 0 0 1.6rem; max-width: 58rem; }
.hero-map img { display: block; width: 100%; height: auto; border-radius: 14px; box-shadow: var(--shadow); }
.hero-map figcaption { font-size: 0.88rem; color: var(--muted); margin-top: 0.5rem; }
@media (min-width: 64rem) {
  .hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr); column-gap: 3.5rem; align-items: start; max-width: 88rem; }
  .hero > * { grid-column: 1; }
  .hero .hero-map { grid-column: 2; grid-row: 1 / span 5; align-self: center; margin: 0; }
}
@media (max-width: 40rem) {
  .trio { grid-template-columns: 1fr; }
  .trio li { display: grid; grid-template-columns: 6.6rem 1fr; gap: 0.8rem; align-items: baseline; padding: 0.8rem 0.9rem; }
  .trio .w { font-size: 1.6rem; margin: 0; }
}

/* the story: text column and sticky map */
.story { position: relative; display: grid; grid-template-columns: minmax(0, 34rem) minmax(0, 1fr); gap: 0 3rem; max-width: 92rem; margin: 0 auto; padding: 0 1rem 0 max(1rem, calc((100vw - 92rem) / 2 + 1rem)); }
.stage { position: sticky; top: calc(var(--bar-h) + 1rem); height: calc(100svh - var(--bar-h) - 2rem); grid-column: 2; grid-row: 1 / span 999; border-radius: 18px; overflow: hidden; background: var(--paper-2); box-shadow: var(--shadow); align-self: start; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.stage .hud { position: absolute; left: 0.8rem; top: 0.7rem; display: flex; gap: 0.6rem; align-items: baseline; font: 600 0.82rem/1 var(--serif); letter-spacing: 0.06em; padding: 0.45rem 0.7rem; border-radius: 99px; background: color-mix(in srgb, var(--card) 88%, transparent); color: var(--ink); box-shadow: var(--shadow); }
.stage .hud #clock { font: 500 1.02rem/1 var(--display); font-variant-numeric: tabular-nums; letter-spacing: 0; }
.stage .fallback { position: absolute; inset: auto 1rem 1rem 1rem; margin: 0; font-size: 0.9rem; color: var(--muted); }
.map-ready .stage .fallback { display: none; }
.stage .credit { position: absolute; right: 0.7rem; bottom: 0.5rem; margin: 0; font-size: 0.72rem; color: var(--muted); opacity: 0.8; }
.stage[data-phase="night"] .credit { color: #b9b2a3; }
.flow { grid-column: 1; min-width: 0; }

.chapter > header { padding: 5rem 0 1rem; }
.chapter > header .time { font: 500 1rem/1 var(--display); color: var(--accent-ink); font-variant-numeric: tabular-nums; letter-spacing: 0.04em; }
.chapter > header h2 { font: 400 clamp(2rem, 4.5vw, 3.2rem)/1.05 var(--display); letter-spacing: -0.015em; margin: 0.35rem 0 0.8rem; }
.chapter > header p { color: var(--ink-2); margin: 0; max-width: 34rem; }

.step { position: relative; margin: 0 0 42vh; padding: 1.3rem 1.3rem 1.2rem; border-radius: 16px; background: var(--card); box-shadow: var(--shadow); border: 1px solid var(--rule); transition: border-color 0.4s; }
.step:last-child { margin-bottom: 30vh; }
.step.is-active { border-color: color-mix(in srgb, var(--accent) 55%, var(--rule)); }
.step .when { margin: 0 0 0.3rem; font: 600 0.78rem/1.3 var(--serif); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.step h3 { margin: 0 0 0.5rem; font: 420 clamp(2.3rem, 5.4vw, 3.3rem)/1 var(--display); letter-spacing: -0.02em; }
.step h3 .and { font-weight: 300; color: var(--muted); }
.chain { margin: 0 0 0.9rem; font-size: 0.98rem; line-height: 1.5; color: var(--ink-2); padding: 0.55rem 0.75rem; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 0 8px 8px 0; }
.chain i { color: var(--ink); }
.chain .arr { color: var(--accent); padding: 0 0.15em; }
.chain .doubt { font-style: normal; color: var(--muted); font-size: 0.92em; }
.step p { margin: 0 0 0.8rem; }
.step p:last-child { margin-bottom: 0; }
.more { display: inline-block; margin-top: 0.2rem; font-size: 0.98rem; font-weight: 600; text-decoration: none; }
.more::after { content: " \2192"; }
.more:hover { text-decoration: underline; }
.also { font-size: 0.95rem; color: var(--muted); }

.overview { background: #161c2b; color: #ece4d2; border-color: #2c3550; }
.overview h3, .overview .when { color: #f3c669; }
.overview .big { font: 400 clamp(1.5rem, 3.4vw, 2.1rem)/1.2 var(--display); margin: 0 0 0.7rem; }
.overview a { color: #f5cf85; }
.overview p { color: #ddd5c4; }

/* reading rail */
.rail { position: fixed; right: 1.1rem; top: 50%; transform: translateY(-50%); z-index: 20; display: none; flex-direction: column; gap: 0.75rem; }
.rail a { position: relative; display: block; width: 7px; height: 7px; border-radius: 50%; background: var(--rule); }
.rail a[aria-current] { background: var(--accent); transform: scale(1.45); }
.rail a span { position: absolute; right: 1.2rem; top: 50%; transform: translateY(-50%); white-space: nowrap; font-size: 0.8rem; background: var(--paper); color: var(--ink); padding: 0.15rem 0.5rem; border-radius: 6px; border: 1px solid var(--rule); opacity: 0; pointer-events: none; transition: opacity 0.15s; }
.rail a:hover span, .rail a:focus-visible span { opacity: 1; }
@media (min-width: 76rem) { .rail { display: flex; } .story { padding-right: 3.2rem; } }

/* after the story */
.prose { max-width: 38rem; margin: 0 auto; padding: 4rem 1rem 1rem; }
.prose h2 { font: 400 clamp(2rem, 4.6vw, 3rem)/1.08 var(--display); letter-spacing: -0.015em; margin: 0 0 1rem; }
.prose p { margin: 0 0 1.05rem; }
.ending { max-width: 42rem; margin: 0 auto; padding: 5rem 1rem 3rem; text-align: left; }
.ending p { font: 360 clamp(1.4rem, 3.4vw, 2rem)/1.36 var(--display); margin: 0 0 1.2rem; }
.ending p.last { color: var(--accent-ink); }

.shelf { max-width: 76rem; margin: 0 auto; padding: 3rem 1rem 2rem; }
.shelf > h2 { font: 400 clamp(2rem, 4.6vw, 3rem)/1.08 var(--display); margin: 0 0 0.6rem; }
.shelf > p { max-width: 40rem; color: var(--ink-2); margin: 0 0 2rem; }
.shelf h3 { font: 600 0.8rem/1.3 var(--serif); letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-ink); margin: 2.2rem 0 0.8rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.shelf ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 0.2rem 2rem; }
.shelf li { padding: 0.55rem 0; border-bottom: 1px dotted var(--rule); }
.shelf li a { font-weight: 600; text-decoration: none; color: var(--ink); display: block; line-height: 1.3; }
.shelf li a:hover { color: var(--accent-ink); text-decoration: underline; }
.shelf li span { display: block; font-size: 0.92rem; color: var(--muted); line-height: 1.4; margin-top: 0.15rem; }

.method { max-width: 42rem; margin: 0 auto; padding: 3rem 1rem 2rem; font-size: 0.98rem; color: var(--ink-2); }
.method h2 { font: 400 1.8rem/1.1 var(--display); color: var(--ink); margin: 0 0 1rem; }
.method p { margin: 0 0 0.9rem; }
footer { max-width: 76rem; margin: 2rem auto 0; padding: 2rem 1rem 3rem; border-top: 1px solid var(--rule); font-size: 0.92rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.6rem 1.4rem; }
footer a { color: var(--muted); }

/* phones: map sticks under the bar, text scrolls below it */
@media (max-width: 56rem) {
  .story { display: block; padding: 0 1rem; }
  .stage { top: var(--bar-h); height: 40svh; min-height: min(14rem, 38svh); max-height: 26rem; margin: 0 -1rem; border-radius: 0; z-index: 5; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12); }
  .chapter > header { padding: 3.5rem 0 0.8rem; }
  .step { margin-bottom: 34svh; padding: 1.05rem 1.05rem 1rem; }
  .step h3 { font-size: 2.35rem; }
}
@media (max-height: 30rem) and (max-width: 56rem) {
  .stage { height: 34svh; min-height: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .step { transition: none; }
  html { scroll-behavior: auto; }
}
html:not(.js) .stage { display: none; }
html:not(.js) .story { display: block; }
html:not(.js) .step { margin-bottom: 1.2rem; }
.map-failed .stage canvas { display: none; }
.map-failed .stage { height: auto; min-height: 0; position: static; }
@media print { .stage, .rail, .topbar { display: none; } .story { display: block; } .step { margin: 0 0 1rem; box-shadow: none; } }
