/* Normans in Europe — v2 tokens (Norman crimson + mosaic gold) */
:root {
  color-scheme: light;
  --paper: #f4efe4;
  --paper-deep: #e9e1cf;
  --surface: #fbf8f1;
  --ink: #141b21;
  --ink-soft: #2b343c;
  --ink-muted: #3a454d;
  --rule: #d9cfba;
  --rule-strong: #a89b80;
  --accent: #8c1f28;
  --accent-text: #7c1a22;
  --on-accent: #fdf6ee;
  --gold: #8a6d1f;
  --g-a: #8c1f28;
  --g-b: #1b5773;
  --g-c: #6f4a00;
  --g-a-bg: #f3d9d2;
  --g-b-bg: #d4e5ee;
  --g-c-bg: #f0e2bd;
  --sea: #cfdde4;
  --land: #f0e7d2;
  --coast: #7d715a;
  --river: #86a6b6;
  --ring: #9aa9b0;
  --ring-label: #4a5960;
  --route: #8c1f28;
  --route-ghost: #7d715a;
  --label: #1d272d;
  --label-halo: #f0e7d2;
  --sea-label: #48606b;
  --shadow: 0 1px 2px #141b2114, 0 8px 24px #141b2112;
  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --gutter: clamp(1rem, 4vw, 2.5rem);
  --bar: 2.75rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0b1218; --paper-deep: #111c24; --surface: #16222b;
    --ink: #eef3f5; --ink-soft: #d3dce1; --ink-muted: #b4c1c8;
    --rule: #26343d; --rule-strong: #4b5c66;
    --accent: #f08a54; --accent-text: #ffab80; --on-accent: #1a0f09;
    --gold: #e8c56c;
    --g-a: #ff8a57; --g-b: #7fc8ea; --g-c: #e8c56c;
    --g-a-bg: #3a1c12; --g-b-bg: #12303f; --g-c-bg: #3a2c10;
    --sea: #10222c; --land: #1a2830; --coast: #4b5c66;
    --river: #3f6b80; --ring: #3f5560; --ring-label: #93a7b0;
    --route: #f08a54; --route-ghost: #6d8593;
    --label: #e6edf0; --label-halo: #1a2830;
    --sea-label: #7e97a2;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0b1218; --paper-deep: #111c24; --surface: #16222b;
  --ink: #eef3f5; --ink-soft: #d3dce1; --ink-muted: #b4c1c8;
  --rule: #26343d; --rule-strong: #4b5c66;
  --accent: #f08a54; --accent-text: #ffab80; --on-accent: #1a0f09;
  --gold: #e8c56c;
  --g-a: #ff8a57; --g-b: #7fc8ea; --g-c: #e8c56c;
  --g-a-bg: #3a1c12; --g-b-bg: #12303f; --g-c-bg: #3a2c10;
  --sea: #10222c; --land: #1a2830; --coast: #4b5c66;
  --river: #3f6b80; --ring: #3f5560; --ring-label: #93a7b0;
  --route: #f08a54; --route-ghost: #6d8593;
  --label: #e6edf0; --label-halo: #1a2830;
  --sea-label: #7e97a2;
}
@font-face {
  font-family: "Fraunces"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/fraunces-normal-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F;
}
@font-face {
  font-family: "Fraunces"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/fraunces-normal-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-024F, U+1E00-1EFF;
}
@font-face {
  font-family: "Fraunces"; font-style: italic; font-weight: 400 700; font-display: swap;
  src: url("fonts/fraunces-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+2000-206F;
}
@font-face {
  font-family: "Fraunces"; font-style: italic; font-weight: 400 700; font-display: swap;
  src: url("fonts/fraunces-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-024F, U+1E00-1EFF;
}
@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+2000-206F;
}
@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-024F, U+1E00-1EFF;
}
@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+2000-206F;
}
@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-024F, U+1E00-1EFF;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
/* clip, not hidden: hidden turns body into a scroll container and every sticky element stops sticking */
html, body { overflow-x: clip; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-size: 1.125rem; line-height: 1.62;
  font-optical-sizing: auto; text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; color: var(--ink); text-wrap: balance; }
section { scroll-margin-top: calc(var(--bar) + .5rem); }
[hidden] { display: none !important; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 68rem; margin: 0 auto; padding-inline: var(--gutter); }
.prose { max-width: 42rem; }
.skip { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--ink); color: var(--paper); padding: .5rem .8rem; border-radius: 4px; }
.skip:focus { left: .8rem; top: .8rem; }
html:not(.js) .needs-js { display: none; }

.anchor-link { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; min-height: 24px; margin-left: .2rem; vertical-align: middle; color: var(--rule-strong); opacity: 0; transition: opacity .15s; text-decoration: none; }
.anchor-link::before { content: ""; position: absolute; inset: -10px; }
h2:hover .anchor-link, h3:hover .anchor-link, .anchor-link:focus-visible { opacity: 1; color: var(--accent-text); }
@media (hover: none) { .anchor-link { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .anchor-link { transition: none; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: .55rem;
  min-height: var(--bar); padding: .3rem var(--gutter);
  padding-top: calc(.3rem + env(safe-area-inset-top, 0px));
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: saturate(1.3) blur(10px); -webkit-backdrop-filter: saturate(1.3) blur(10px);
  border-bottom: 1px solid var(--rule); font-family: var(--sans); font-size: .78rem;
}
.topbar .home { font-weight: 650; color: var(--ink-soft); text-decoration: none; flex: none; padding: .3rem 0; }
.topbar .spacer { flex: 1; }
.topnav {
  display: flex; gap: .1rem; overflow-x: auto; scrollbar-width: none; min-width: 0; margin-left: .25rem;
  mask-image: linear-gradient(to right, #000 calc(100% - 1.4rem), transparent);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 1.4rem), transparent);
}
.topnav::-webkit-scrollbar { display: none; }
.topnav a { padding: .25rem .55rem; border-radius: 999px; text-decoration: none; color: var(--ink-muted); white-space: nowrap; }
.topnav a:hover { color: var(--accent-text); background: var(--paper-deep); }
.topnav a[aria-current="true"] { color: var(--ink); background: var(--paper-deep); font-weight: 650; }
.langmenu { position: relative; flex: none; }
.langmenu summary {
  display: inline-flex; align-items: center; gap: .3rem; padding: .22rem .6rem; border-radius: 999px;
  border: 1px solid var(--rule-strong); color: var(--ink-soft); background: var(--surface);
  cursor: pointer; list-style: none; white-space: nowrap;
}
.langmenu summary::-webkit-details-marker { display: none; }
.langmenu summary:hover { border-color: var(--accent); color: var(--accent-text); }
.langmenu ul {
  position: absolute; right: 0; top: calc(100% + .4rem); margin: 0; padding: .3rem; list-style: none;
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: .6rem;
  box-shadow: var(--shadow); min-width: 10rem; z-index: 60;
}
.langmenu li a { display: block; padding: .32rem .6rem; border-radius: .4rem; color: var(--ink-soft); text-decoration: none; white-space: nowrap; }
.langmenu li a:hover { color: var(--accent-text); background: var(--paper-deep); }
.langmenu li a[aria-current="true"] { color: var(--ink); font-weight: 650; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 1.95rem; height: 1.95rem; padding: 0; border-radius: 999px; cursor: pointer;
  color: var(--ink-muted); background: var(--surface); border: 1px solid var(--rule-strong);
}
.icon-btn::before { content: ""; position: absolute; inset: -6.5px; }
.icon-btn:hover { color: var(--accent-text); border-color: var(--accent); }
.icon-btn svg { display: block; }
.icon-btn svg[hidden] { display: none; }
@media (max-width: 34rem) {
  .topbar { gap: .35rem; }
  .topbar .home { max-width: 5.4rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topnav a { padding: .25rem .38rem; }
}

/* ---------- reading rail ---------- */
.rail { display: none; position: fixed; top: 50%; right: 1.1rem; transform: translateY(-50%); flex-direction: column; align-items: flex-end; gap: .5rem; z-index: 30; }
@media (min-width: 88rem) { .rail { display: flex; } }
.rail-dot { position: relative; display: flex; align-items: center; justify-content: flex-end; width: 24px; min-height: 24px; text-decoration: none; }
.rail-dot::before { content: ""; position: absolute; inset: -10px; }
.rail-dot .dot { display: block; width: 6px; height: 6px; border-radius: 50%; background: var(--rule-strong); transition: background-color .15s, transform .15s; }
.rail-dot:hover .dot, .rail-dot:focus-visible .dot { background: var(--ink-soft); }
.rail-dot.active .dot { background: var(--accent); transform: scale(1.5); }
.rail-label {
  position: absolute; right: 100%; top: 50%; margin-top: -.85rem; margin-right: .5rem;
  font-family: var(--sans); font-size: .75rem; line-height: 1.2; color: var(--ink-soft); white-space: nowrap;
  background: var(--surface); border: 1px solid var(--rule); border-radius: 4px; padding: .25rem .55rem; box-shadow: var(--shadow);
  opacity: 0; transform: translateX(6px); pointer-events: none; transition: opacity .12s, transform .12s;
}
.rail-dot:hover .rail-label, .rail-dot:focus-visible .rail-label { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .rail-dot .dot, .rail-label { transition: none; } }
@media print { .rail, .topbar { display: none; } }

/* ---------- hero ---------- */
.hero {
  position: relative; display: grid; gap: 1.1rem 2.2rem; grid-template-columns: minmax(0, 1fr);
  padding: clamp(1.6rem, 4vw, 3rem) var(--gutter) 1.6rem; max-width: 96rem; margin: 0 auto;
}
.hero-text { grid-area: text; }
.hero-map { grid-area: map; margin: 0; }
.finder { grid-area: finder; min-width: 0; }
.finder-result { grid-area: result; min-width: 0; }
.hero { grid-template-areas: "text" "finder" "map" "result"; }
@media (min-width: 64rem) {
  .hero {
    grid-template-columns: minmax(0, 33rem) minmax(0, 1fr);
    grid-template-areas: "text map" "finder map" "result map";
    grid-template-rows: auto auto 1fr; align-items: start;
    padding-bottom: 2.4rem;
  }
  .hero-map { position: sticky; top: calc(var(--bar) + 1rem); align-self: start; }
}
.kicker { font-family: var(--sans); font-size: .76rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); margin: 0 0 .9rem; }
.hero h1 { font-size: clamp(2.05rem, 4.6vw, 3.4rem); line-height: 1.03; letter-spacing: -.02em; margin: 0 0 1.1rem; font-weight: 640; font-variation-settings: "SOFT" 40, "WONK" 0; }
.deck { font-size: clamp(1.04rem, 1.6vw, 1.2rem); line-height: 1.5; color: var(--ink-soft); margin: 0 0 .9rem; }
.byline { font-family: var(--sans); font-size: .8rem; color: var(--ink-muted); margin: 0; display: flex; flex-wrap: wrap; gap: .2rem .8rem; align-items: center; }
.share-line { display: inline-flex; align-items: center; gap: .35rem; padding: 0; border: 0; background: none; font: inherit; color: var(--accent-text); cursor: pointer; text-decoration: underline; text-underline-offset: .18em; min-height: 2rem; }
.hero-canvas { position: relative; background: var(--sea); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
.hero-canvas .map { display: block; width: 100%; height: auto; }
.hero-year {
  position: absolute; right: 3.5%; bottom: 5%; display: flex; flex-direction: column; align-items: flex-end; pointer-events: none;
  font-family: var(--display); color: var(--ink); line-height: 1; text-align: right;
}
.hero-year-num { font-size: clamp(2.2rem, 6vw, 4rem); font-weight: 700; font-variant-numeric: tabular-nums lining-nums; letter-spacing: -.03em; }
.hero-year-count { margin-top: .3rem; font: 600 .78rem var(--sans); letter-spacing: .04em; color: var(--ink-muted); }
.player { display: flex; align-items: center; gap: .7rem; margin-top: .6rem; font-family: var(--sans); }
.player button {
  flex: none; height: 2.5rem; padding: 0 1rem 0 .85rem; border-radius: 999px; display: inline-flex; gap: .45rem; align-items: center; cursor: pointer;
  color: var(--on-accent); background: var(--accent); border: 0; font: 700 .85rem var(--sans);
}
.player button:hover { filter: brightness(1.1); }
.player input[type="range"] { flex: 1; min-width: 0; height: 2.5rem; accent-color: var(--accent); cursor: pointer; }
.player output { flex: none; min-width: 3rem; text-align: right; font: 700 .95rem var(--display); font-variant-numeric: tabular-nums lining-nums; }
.hero-key { display: flex; flex-wrap: wrap; gap: .25rem 1rem; margin-top: .55rem; font-family: var(--sans); font-size: .76rem; line-height: 1.35; color: var(--ink-muted); }
.key { display: inline-flex; align-items: center; gap: .4rem; }
.key svg { flex: none; }

/* find your town */
.finder { margin-top: .4rem; padding: 1.1rem 1.1rem 1rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow); }
.finder h2 { margin: 0 0 .5rem; font-size: 1.25rem; line-height: 1.2; }
.finder label { display: block; font: 650 .85rem var(--sans); color: var(--ink-soft); margin-bottom: .35rem; }
.combo { position: relative; }
.combo input {
  width: 100%; min-height: 3rem; padding: .55rem .9rem; font: 500 1.05rem var(--serif); color: var(--ink);
  background: var(--paper); border: 1.5px solid var(--rule-strong); border-radius: 999px;
}
.combo input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-color: var(--accent); }
.combo ul {
  position: absolute; left: 0; right: 0; top: calc(100% + .35rem); z-index: 20; margin: 0; padding: .3rem; list-style: none;
  background: var(--surface); border: 1px solid var(--rule-strong); border-radius: .8rem; box-shadow: var(--shadow); max-height: 15rem; overflow-y: auto;
}
.combo li { display: flex; justify-content: space-between; gap: .8rem; padding: .5rem .7rem; border-radius: .5rem; cursor: pointer; font-size: 1rem; }
.combo li small { font: .75rem var(--sans); color: var(--ink-muted); align-self: center; }
.combo li[aria-selected="true"], .combo li:hover { background: var(--paper-deep); }
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.chip-btn { font: 600 .82rem var(--sans); padding: .4rem .8rem; min-height: 2.25rem; border-radius: 999px; cursor: pointer; color: var(--ink-soft); background: var(--paper); border: 1px solid var(--rule-strong); }
.chip-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.chip-btn[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.finder-result { padding: 1rem 1.1rem .9rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow); }
.result { margin: 0; }
.result-eyebrow { margin: 0 0 .25rem; font: 700 .72rem var(--sans); letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); }
.result-head { margin: 0 0 .4rem; font-family: var(--display); font-weight: 640; font-size: clamp(1.35rem, 2.6vw, 1.75rem); line-height: 1.12; text-wrap: balance; }
.result-head b { color: var(--accent-text); font-weight: 700; }
.result p { margin: 0 0 .55rem; font-size: 1rem; color: var(--ink-soft); }
.result .near { list-style: none; margin: .6rem 0; padding: 0; display: grid; gap: .5rem; }
.result .near li { padding: .55rem .7rem; border-radius: 8px; background: var(--paper); border: 1px solid var(--rule); font-size: .96rem; }
.result .near .d { float: right; margin-left: .6rem; font: 700 .85rem var(--sans); font-variant-numeric: tabular-nums; color: var(--ink); }
.result .near .n { font-family: var(--display); font-weight: 650; }
.result .near .m { display: block; color: var(--ink-muted); font-size: .88rem; line-height: 1.4; margin-top: .1rem; }
.result-limit { font: .8rem/1.45 var(--sans) !important; color: var(--ink-muted) !important; }
.result-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; }

.badge { display: inline-flex; align-items: center; gap: .35rem; font: 700 .7rem var(--sans); letter-spacing: .06em; text-transform: uppercase; padding: .15rem .55rem .15rem .4rem; border-radius: 999px; white-space: nowrap; }
.badge svg { flex: none; }
.badge.g-A { color: var(--ink); background: var(--g-a-bg); border: 1px solid var(--g-a); }
.badge.g-B { color: var(--ink); background: var(--g-b-bg); border: 1px solid var(--g-b); }
.badge.g-C { color: var(--ink); background: var(--g-c-bg); border: 1px dashed var(--g-c); }
/* grade chips in prelude prose and the catalogue */
.gr { display: inline-block; font-family: var(--sans); font-size: 0.78rem; font-weight: 700; border-radius: 0.3rem; padding: 0.05em 0.45em; white-space: nowrap; }
.gr.gA { background: var(--g-a-bg); color: var(--g-a); }
.gr.gB { background: var(--g-b-bg); color: var(--g-b); }
.gr.gC { background: var(--g-c-bg); color: var(--g-c); }

/* ---------- maps ---------- */
.map { overflow: visible; --k: 2.2; }
/* markers, labels and rings are drawn in screen pixels: --k is user units per pixel, set by the script at every zoom */
.map .s { transform: scale(var(--k)); }
.bm-sea { fill: var(--sea); }
.bm-land { fill: var(--land); stroke: var(--coast); stroke-width: .7; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.bm-lake { fill: var(--sea); stroke: var(--coast); stroke-width: .5; vector-effect: non-scaling-stroke; }
.bm-river { fill: none; stroke: var(--river); stroke-width: .7; vector-effect: non-scaling-stroke; stroke-linecap: round; opacity: .8; }
.ring { fill: none; stroke: var(--ring); stroke-width: 1; stroke-dasharray: 2 5; vector-effect: non-scaling-stroke; }
.ring-lbl { font: 600 10px var(--sans); fill: var(--ring-label); paint-order: stroke; stroke: var(--sea); stroke-width: 3px; }
.sea { font-family: var(--display); font-style: italic; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; fill: var(--sea-label); paint-order: stroke; stroke: var(--sea); stroke-width: 3px; stroke-linejoin: round; }
.home-star { fill: var(--gold); stroke: var(--surface); stroke-width: 1.4; }

.mask-path { fill: none; stroke: #fff; stroke-width: 14; stroke-linecap: round; stroke-linejoin: round; }
.seg { fill: none; stroke: var(--route); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.route { transition: opacity .35s ease; }
.map .route.ghost { opacity: .12; }
.map.finding .routes { opacity: .3; }

/* places: grade is drawn as circle / square / triangle as well as coloured */
.pl { cursor: pointer; }
.pl .dot { fill: var(--paper); stroke: var(--route); stroke-width: 2; vector-effect: non-scaling-stroke; }
.pl.g-A .dot { fill: var(--g-a); stroke: var(--paper); stroke-width: 1.6; }
.pl.g-B .dot { fill: var(--surface); stroke: var(--g-b); stroke-width: 2.4; }
.pl.g-C .dot { fill: var(--surface); stroke: var(--g-c); stroke-width: 2; stroke-dasharray: 2.4 2; }
.pl .hit { fill: transparent; }
.pl.lab .lb, .pl.sel .lb, .pl:hover .lb, .pl:focus-visible .lb { display: block; }
.map[data-lz="2"] .pl.f .lb, .map[data-lz="3"] .pl.f .lb { display: block; }
.pl .lb { display: none; font: 650 11px var(--sans); fill: var(--label); paint-order: stroke; stroke: var(--label-halo); stroke-width: 3.2px; stroke-linejoin: round; pointer-events: none; }
.pl:hover .dot, .pl:focus-visible .dot, .pl.sel .dot { stroke: var(--ink); stroke-width: 2.6; }
.pl:focus-visible { outline: none; }
.pl:focus-visible .hit { stroke: var(--accent); stroke-width: 2; }
.pl.sel .halo { display: block; }
.pl .halo { display: none; fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.map.ready .pl.off { opacity: 0; pointer-events: none; }
.map.ready .pl { transition: opacity .25s; }
.map.ready .pl.dim { opacity: .28; }

.map.ready .pl.new .dot { animation: ping .9s ease-out; }
@keyframes ping { 0% { stroke-width: 9; } 100% { } }
@media (prefers-reduced-motion: reduce) { .map.ready .pl.new .dot { animation: none; } .map.ready .pl, .route { transition: none; } }
.you { pointer-events: none; }
.you circle { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
.you text { font: 750 12px var(--sans); fill: var(--label); paint-order: stroke; stroke: var(--label-halo); stroke-width: 3.4px; }
.you-line { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; pointer-events: none; }

/* ---------- prelude ---------- */
.prelude { padding: 3.5rem 0 2.5rem; border-top: 1px solid var(--rule); }
.prelude h2, .reach h2, .game h2, .catalog h2, .sources h2, .atlas-intro h2 { font-size: clamp(1.6rem, 3.4vw, 2.4rem); line-height: 1.12; letter-spacing: -.015em; margin: 0 0 1rem; }
.prelude p { color: var(--ink-soft); margin: 0 0 1rem; max-width: 44rem; }

/* ---------- atlas ---------- */
.atlas { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); max-width: 96rem; margin: 0 auto; }
.atlas-map {
  position: sticky; top: var(--bar); z-index: 5; height: 46svh; min-height: min(14rem, 55vh);
  background: var(--paper); border-bottom: 1px solid var(--rule); display: flex; flex-direction: column;
}
.map-frame { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--sea); }
.map-frame .map { position: absolute; inset: 0; width: 100%; height: 100%; }
.hud { position: absolute; left: .6rem; top: .6rem; background: color-mix(in srgb, var(--surface) 92%, transparent); border: 1px solid var(--rule); border-radius: 8px; padding: .35rem .6rem; box-shadow: var(--shadow); max-width: calc(100% - 1.2rem); pointer-events: none; }
.hud-name { font-family: var(--display); font-weight: 650; font-size: .96rem; line-height: 1.25; display: block; }
.hud-sub { display: block; font: .72rem var(--sans); color: var(--ink-muted); }
.map-legend { display: flex; margin: 0; padding: .35rem var(--gutter) .45rem; background: var(--paper); border-top: 1px solid var(--rule); font-family: var(--sans); font-size: .68rem; color: var(--ink-muted); gap: .18rem .9rem; flex-wrap: wrap; }
.zoom-reset { position: absolute; right: .6rem; top: .6rem; font: 650 .74rem var(--sans); padding: .35rem .7rem; min-height: 2rem; border-radius: 999px; cursor: pointer; color: var(--ink-soft); background: var(--surface); border: 1px solid var(--rule-strong); box-shadow: var(--shadow); }
.zoom-reset:hover { color: var(--accent-text); border-color: var(--accent); }
.hero-canvas .zoom-reset { top: auto; bottom: .6rem; right: auto; left: .6rem; }
.atlas-text { position: relative; z-index: 1; padding: 0 var(--gutter); }
@media (min-width: 64rem) {
  .atlas { grid-template-columns: minmax(0, 36rem) minmax(0, 1fr); column-gap: 2.5rem; padding-inline: var(--gutter); }
  .atlas-map { grid-column: 2; grid-row: 1; top: calc(var(--bar) + 1rem); height: calc(100svh - var(--bar) - 2rem); border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; }
  .atlas-text { grid-column: 1; grid-row: 1; padding: 0; }
  .map-legend { padding-inline: .7rem; font-size: .72rem; gap: .3rem 1.1rem; }
}
.atlas-intro { padding: 3rem 0 1rem; }
.atlas-intro p { color: var(--ink-soft); }
.chapter { padding: 3.5rem 0 2rem; border-top: 1px solid var(--rule); }
.ch-head { margin-bottom: 1.2rem; }
.ch-kicker { margin: 0 0 .35rem; font-family: var(--sans); font-weight: 700; font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); }
.ch-head h2 { margin: 0; font-size: clamp(1.8rem, 4.2vw, 2.7rem); line-height: 1.05; letter-spacing: -.02em; }
.ch-lede { margin: .5rem 0 0; font-size: 1.08rem; color: var(--ink-soft); }
.chapter > p { margin: 0 0 1.1rem; }
.chapter .stat { display: flex; flex-wrap: wrap; gap: .4rem 1.4rem; margin: 1rem 0 1.4rem; padding: .7rem .9rem; background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; font-family: var(--sans); font-size: .82rem; color: var(--ink-muted); }
.chapter .stat b { display: block; font: 700 1.25rem var(--display); color: var(--ink); font-variant-numeric: lining-nums; }
.map-note { font-family: var(--sans); font-size: .85rem; color: var(--ink-muted); border-left: 3px dashed var(--accent); padding-left: .7rem; }

.pcards { display: grid; gap: .9rem; margin: 1.6rem 0; }
.pcard { position: relative; padding: 1rem 1.1rem .9rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--rule); border-left-width: 4px; scroll-margin-top: calc(var(--bar) + 47svh); }
.pcard.g-A { border-left-color: var(--g-a); }
.pcard.g-B { border-left-color: var(--g-b); }
.pcard.g-C { border-left-color: var(--g-c); border-left-style: dashed; }
.pcard.active { box-shadow: var(--shadow); }
.pcard header { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .7rem; margin-bottom: .3rem; }
.pcard h3 { margin: 0; font-size: 1.28rem; line-height: 1.2; flex-basis: 100%; }
.pcard .when { font: 600 .82rem var(--sans); color: var(--ink-muted); }
.pcard .what { margin: 0 0 .55rem; font-size: 1.02rem; color: var(--ink-soft); }
details.src { margin-top: .3rem; }
details.src summary { font: 600 .8rem var(--sans); color: var(--ink-muted); cursor: pointer; padding: .3rem 0; }
details.src ul { margin: .2rem 0 0; padding-left: 1.1rem; font: .82rem/1.5 var(--sans); color: var(--ink-soft); }
details.src li { margin-bottom: .4rem; overflow-wrap: anywhere; }

.figure { margin: 1.6rem 0; }
.figure img { width: 100%; height: auto; border-radius: 6px; background: var(--paper-deep); box-shadow: var(--shadow); }
figcaption, .cap { font-family: var(--sans); font-size: .98rem; line-height: 1.45; color: var(--ink-muted); margin-top: .6rem; max-width: 46rem; }
.credit { display: block; margin-top: .15rem; font-size: .82rem; }
.credit a { color: var(--ink-muted); }
.figure.wide { margin: 1.4rem 0; }

/* the record that opens when a dot is chosen */
.tip { position: absolute; left: .6rem; right: .6rem; bottom: .6rem; z-index: 8; max-width: 30rem; background: var(--surface); border: 1px solid var(--rule-strong); border-radius: 10px; box-shadow: var(--shadow); padding: .65rem 2.4rem .7rem .85rem; font-family: var(--serif); font-size: .95rem; }
.tip-x { position: absolute; right: .3rem; top: .25rem; width: 2.2rem; height: 2.2rem; border: 0; background: none; font-size: 1.5rem; line-height: 1; cursor: pointer; color: var(--ink-muted); border-radius: 999px; }
.tip-x:hover { color: var(--accent-text); }
.tip-meta { margin: 0 0 .25rem; font: 600 .74rem var(--sans); color: var(--ink-muted); }
.tip-meta .badge { margin-right: .3rem; }
.tip-name { margin: 0 0 .2rem; font: 650 1.1rem var(--display); }
.tip-what { margin: 0 0 .35rem; color: var(--ink-soft); line-height: 1.4; }
.tip a { font: 650 .82rem var(--sans); }

/* ---------- reach ---------- */
.reach, .game, .catalog, .sources { padding: 4.5rem 0 3.5rem; border-top: 1px solid var(--rule); }
.reach > .wrap > p, .game > .wrap > p, .catalog > .wrap > p, .sources > .wrap > p { max-width: 44rem; color: var(--ink-soft); }
.strip { display: block; width: 100%; height: auto; background: var(--surface); border: 1px solid var(--rule); border-radius: 0.9rem; }
.tick { stroke: var(--rule); stroke-width: 1; }
.tick-lbl { fill: var(--ink-muted); font-family: var(--sans); font-size: 13px; font-variant-numeric: tabular-nums; }
.row-lbl { fill: var(--ink-soft); font-family: var(--sans); font-size: 13px; font-weight: 700; }
.sdot.gA { fill: var(--g-a); }
.sdot.gB { fill: var(--g-b); }
.sdot.gC { fill: var(--g-c); }
.far8 { columns: 2; column-gap: 2rem; max-width: 46rem; padding-left: 1.2rem; }
.far8 li { margin-bottom: 0.25rem; break-inside: avoid; }

/* ---------- quiz ---------- */
.game { background: var(--paper-deep); }
.cards { list-style: none; margin: 1.6rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 19rem), 1fr)); gap: 1rem; }
.card { position: relative; display: flex; flex-direction: column; padding: 1.1rem 1.1rem 1rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--rule); box-shadow: var(--shadow); transition: transform .25s, border-color .25s; }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } }
.card-num { position: absolute; right: .9rem; top: .7rem; margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.6rem; color: var(--ink-muted); line-height: 1; opacity: .7; }
.card-claim { margin: 0 2.2rem 1rem 0; font-size: 1.16rem; line-height: 1.25; font-family: var(--display); font-weight: 600; }
.card-buttons { display: flex; gap: .5rem; margin-top: auto; }
.card-buttons button, .btn {
  flex: 1; font: 650 .92rem var(--sans); padding: .6rem .8rem; border-radius: 999px; cursor: pointer; text-decoration: none; text-align: center;
  color: var(--ink); background: var(--paper); border: 1.5px solid var(--rule-strong); min-height: 2.75rem;
  transition: background-color .15s, border-color .15s, color .15s, transform .1s;
}
.card-buttons button:hover, .btn:hover { border-color: var(--accent); color: var(--accent-text); }
.card-buttons button:active, .btn:active { transform: scale(.97); }
.card-buttons button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.card-buttons button:disabled { cursor: default; }
.card-buttons button:disabled:not([aria-pressed="true"]) { opacity: .45; }
.card-verdict { margin: .6rem 0 0; font: 700 .8rem var(--sans); letter-spacing: .12em; text-transform: uppercase; }
.card-verdict:empty { display: none; }
.card.right { border-color: var(--g-b); }
.card.right .card-verdict { color: var(--g-b); }
.card.wrong { border-color: var(--accent); }
.card.wrong .card-verdict { color: var(--accent-text); }
.card.answered { transform: translateY(-2px); }
.card-answer { margin-top: .6rem; font-size: .98rem; }
.card-answer summary { font: 600 .82rem var(--sans); color: var(--ink-muted); cursor: pointer; }
.card-answer p { margin: .4rem 0 .5rem; }
.game.ready .card-answer summary { display: none; }
.game.ready .card:not(.answered) .card-answer { display: none; }
.scoreboard { margin-top: 1.6rem; padding: 1.2rem; border-radius: 10px; background: var(--surface); border: 1px solid var(--rule); display: grid; gap: .6rem; }
.score { margin: 0; font-family: var(--display); font-weight: 650; font-size: 1.35rem; }
.score-done { margin: 0; color: var(--ink-soft); }
.score-done:empty { display: none; }
.score-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.score-actions .btn { flex: 0 1 auto; }
.btn.share { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.share:hover { color: var(--on-accent); filter: brightness(1.08); }
.btn.ghost { background: transparent; }

/* ---------- catalogue ---------- */
.cat-tools { display: flex; gap: 0.7rem; align-items: center; flex-wrap: wrap; margin: 1.4rem 0 1rem; font-family: var(--sans); font-size: 0.92rem; }
.cat-tools input, .cat-tools select {
  font: inherit; padding: 0.4rem 0.6rem; border-radius: 0.5rem;
  border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink);
}
.table-scroll { overflow-x: auto; border: 1px solid var(--rule); border-radius: 0.9rem; background: var(--surface); }
table.cat { border-collapse: collapse; width: 100%; min-width: 52rem; font-size: 1rem; }
table.cat caption { text-align: left; padding: 0.8rem 1rem; color: var(--ink-muted); font-size: 0.95rem; }
table.cat th, table.cat td { text-align: left; padding: 0.55rem 0.8rem; border-top: 1px solid var(--rule); vertical-align: top; }
table.cat thead th { border-top: none; font-family: var(--sans); font-size: 0.85rem; color: var(--ink-muted); white-space: nowrap; }
table.cat tbody th { font-family: var(--display); font-size: 1.02rem; white-space: nowrap; }
table.cat tr:target { background: var(--g-c-bg); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.nug { min-width: 22rem; }
.csrc { display: block; font-size: 0.88rem; color: var(--ink-muted); margin-top: 0.2rem; }
.none { font-style: italic; }

/* ---------- sources ---------- */
.sources { font-size: 1rem; }
.sources > .wrap > p, .sources .prose p { max-width: 46rem; color: var(--ink-soft); }
.sources .prose ul { max-width: 46rem; }
.img-heading { font-family: var(--sans); font-size: .76rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-muted); margin: 2.2rem 0 .5rem; }
.img-credits { margin: 0; padding-left: 1.1rem; font-family: var(--sans); font-size: .84rem; line-height: 1.5; color: var(--ink-soft); }
.img-credits li { margin-bottom: .6rem; overflow-wrap: anywhere; }

/* ---------- footer, 404 ---------- */
.site-footer { border-top: 1px solid var(--rule); padding: 2rem var(--gutter) calc(2.5rem + env(safe-area-inset-bottom, 0px)); text-align: center; font-family: var(--sans); font-size: .88rem; color: var(--ink-muted); }
.site-footer p { margin: 0; }
.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
body.nf { display: grid; place-items: center; min-height: 100vh; }
.nf-main { text-align: center; padding: 3rem 0; max-width: 40rem; }
.nf-main .btn { display: inline-block; }
.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); z-index: 90; background: var(--ink); color: var(--paper); font: 600 .85rem var(--sans); padding: .55rem 1rem; border-radius: 999px; box-shadow: var(--shadow); }

/* phones: a section reached by a link must land below the pinned map as well as the bar */
@media (max-width: 63.99rem) {
  .atlas-text section { scroll-margin-top: calc(var(--bar) + max(46svh, 14rem) + .75rem); }
  .hero-year-num { font-size: clamp(1.8rem, 9vw, 2.6rem); }
}

/* phones: the whole frame is only about 350px wide, so the overview carries fewer marks */
@media (max-width: 40rem) {
  body { font-size: 1.05rem; }
  .far8 { columns: 1; }
  .map[data-lz="1"] .pl .lb { font-size: 10px; }
  .map[data-lz="1"] .sea, .map[data-lz="1"] .ring-lbl { display: none; }
  .hero h1 { font-size: clamp(1.95rem, 8.6vw, 2.5rem); }
  .hero-canvas { margin-inline: calc(-1 * var(--gutter)); border-radius: 0; border-inline: 0; }
  .hero-year { right: auto; left: 3%; top: 3%; bottom: auto; align-items: flex-start; text-align: left; }
  .hud { max-width: calc(100% - 8.2rem); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
