/* 3Abroad. (SCPO 3A Destination Tracker). Engraved cobalt: one ink, one paper, one cream. */
:root {
  --cobalt: #2a30c8;
  --ink: #1e2496;
  --muted: #4a50c4;
  --paper: #fbfbf8;
  --cream: #f3eee2;
  --line: #c9cbee;
  --wash: #eceefb;
  --second: #8f93e6;
  --danger: #a3172c;
  --serif: 'IM Fell English', Garamond, 'Times New Roman', serif;
  --sc: 'IM Fell English SC', Garamond, 'Times New Roman', serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sc);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- Reveal layers ----------
   Each section and the footer is a full-width layer stacked above the ones after it (app.js
   sets z-index). Each layer slides out from under the one above it: rising slower than the
   page from up to 35% of a screen (at most 320px) under, dimmed (.layer-dim), shaded by the
   layer above (its .layer-shade). Every layer is at least 4/3 of a screen tall, so a quarter
   of it scrolls by before the next one's edge can show.
   Where the browser supports scroll-driven animations with pixel ranges (.sd), the browser
   runs it all in step with the scroll itself, so nothing lags; app.js only writes each
   animation's start and end scroll offsets onto the elements as plain pixel values.
   Elsewhere app.js sets the transform, --dim and --shade on every scroll frame instead.
   The hero and footer keep their own blue backgrounds (set later in this file). */
.layer { position: relative; background: var(--paper); min-height: calc(100vh * 4 / 3); min-height: calc(100svh * 4 / 3); }
/* A short section (Stats) sits centred in its layer. */
.layer-center { display: flex; flex-direction: column; justify-content: center; }
.layer-dim {
  position: absolute; inset: 0; z-index: 10; pointer-events: none;
  background: var(--ink); opacity: calc(var(--dim, 0) * .35);
}
/* The shadow this layer casts on the one sliding out from under it. */
.layer-shade {
  position: absolute; left: 0; right: 0; top: 100%; height: 48px; z-index: 10; pointer-events: none;
  background: linear-gradient(rgba(14, 18, 90, .32), rgba(14, 18, 90, 0)); opacity: var(--shade, 0);
}
@keyframes layer-reveal { from { translate: 0 calc(-1 * min(35vh, 320px)); } to { translate: 0 0; } }
@keyframes layer-dim { from { opacity: .35; } to { opacity: 0; } }
@keyframes layer-shade { from { opacity: 1; } to { opacity: 0; } }
@supports (animation-timeline: scroll()) and (animation-range: 10px 20px) {
  .layer.sd { animation: layer-reveal linear both; animation-timeline: scroll(root); }
  .layer.sd > .layer-dim { animation: layer-dim linear both; animation-timeline: scroll(root); }
  .layer.sd > .layer-shade { animation: layer-shade linear both; animation-timeline: scroll(root); }
}
img { max-width: 100%; }
a { color: var(--cobalt); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 3px; }
[hidden] { display: none !important; }

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding-left: max(24px, env(safe-area-inset-left, 0px));
  padding-right: max(24px, env(safe-area-inset-right, 0px));
}
.section { padding-block: 88px 72px; display: flex; flex-direction: column; gap: 36px; }

.kicker { font-family: var(--serif); font-style: italic; font-size: 20px; color: var(--muted); }
h2 { margin: 0; font-family: var(--sc); font-weight: 400; font-size: clamp(44px, 6vw, 64px); line-height: 1; }
.section-head { display: flex; flex-direction: column; gap: 6px; }
.section-head.center { align-items: center; text-align: center; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px;
  padding: 12px 28px; border-radius: 3px; text-decoration: none; font-family: var(--sc); font-size: 18px;
  border: 1px solid transparent; cursor: pointer;
}
.btn-cobalt { background: var(--cobalt); color: var(--paper); border: 0; }
.btn-cobalt:disabled { opacity: .5; cursor: not-allowed; }
.btn-outline { color: var(--cobalt); border-color: var(--cobalt); background: transparent; }

/* ---------- Hero ---------- */
.hero { position: relative; isolation: isolate; background: var(--cobalt); color: var(--cream); display: flex; flex-direction: column; }
/* Star field drawn by app.js, behind everything else in the hero. */
.hero-stars { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.hero > :not(.hero-stars, .layer-dim, .layer-shade, .scroll-cue) { position: relative; z-index: 1; }
.hero a { color: var(--cream); }
/* Brand at the left edge, section links at the right, across the whole window
   (wider than the page's content column). */
.topbar {
  max-width: none; margin: 0; align-self: stretch; padding: 22px max(28px, 3vw);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px 32px;
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { display: block; }
.brand-text { display: flex; flex-direction: column; gap: 2px; line-height: 1.05; }
/* The wordmark, with the one-line description under it. */
.brand-name { font-family: var(--serif); font-size: 28px; letter-spacing: -.01em; white-space: nowrap; }
.brand-desc { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; white-space: nowrap; opacity: .85; }
/* Section links: just the words. On hover an underline grows out from the middle of the word
   (after fancycomponents.dev's Underline Animation, centre variant); the current section's
   link keeps it (app.js sets aria-current). --nav-ink sets the colour: cream on the blue bars. */
.section-nav { --nav-ink: var(--cream); display: flex; justify-content: center; gap: 8px 30px; flex-wrap: wrap; }
.nav-link {
  display: flex; align-items: center; min-height: 44px; padding: 0 2px;
  font-size: 19px; text-decoration: none;
}
a.nav-link, .hero a.nav-link { color: var(--nav-ink); }
.nav-link > span { position: relative; }
.nav-link > span::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -.12em; height: .1em; border-radius: 1px;
  background: currentColor; transform: scaleX(0); transform-origin: center;
  transition: transform .25s ease-in-out;
}
.nav-link:hover > span::after, .nav-link:focus-visible > span::after, .nav-link[aria-current="true"] > span::after { transform: scaleX(1); }
.nav-link:focus-visible { outline: 2px solid var(--nav-ink); outline-offset: 4px; border-radius: 2px; }
@media (prefers-reduced-motion: reduce) { .nav-link, .nav-link > span::after { transition: none; } }
/* The hero fills the screen: its text is centred in the space above the mountains. */
.hero-body { flex: 1; justify-content: center; padding-block: 48px 8px; display: flex; flex-direction: column; align-items: center; gap: 26px; text-align: center; }
/* The compass above the headline, about as tall as one line of it. */
.hero-mark { display: block; width: clamp(56px, 7.6vw, 110px); height: auto; }
.hero h1 {
  margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(50px, 8vw, 116px);
  line-height: .96; letter-spacing: -.01em; max-width: 13ch; text-wrap: balance;
}
/* Cursor proximity on the title (app.js sets --p from 0 to 1 per letter). */
.hero h1 .prox-word { white-space: nowrap; }
.hero h1 .prox-ch {
  display: inline-block; transform: scale(calc(1 + .35 * var(--p, 0)));
  /* Room for italic overhang (the "?" of "next?"), which scaled letters would otherwise clip. */
  padding: .1em .15em; margin: -.1em -.15em;
  color: color-mix(in srgb, #fff calc(var(--p, 0) * 100%), var(--cream));
  transition: transform .12s ease-out, color .12s ease-out;
}
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.hero-body p { margin: 0; max-width: 50ch; font-size: 19px; color: #dcd8f0; }
.hero-art { display: block; width: 100%; height: auto; margin-top: -40px; }

/* ---------- Stats ---------- */
.stats-section { align-items: center; }
.source-pill { margin-top: 6px; border: 1px solid var(--cobalt); border-radius: 999px; padding: 1px 12px; font-size: 14px; letter-spacing: .08em; }
.stats { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 3px double var(--cobalt); border-bottom: 3px double var(--cobalt); }
.stat { padding: 34px 16px; text-align: center; display: flex; flex-direction: column; gap: 4px; }
.stat + .stat { border-left: 1px solid var(--cobalt); }
.stat-n { font-family: var(--serif); font-size: clamp(56px, 8vw, 96px); line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.stat-l { font-size: 21px; }

/* ---------- Map ---------- */
.map-layout { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.map-figure { flex: 999 1 640px; min-width: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.map-frame {
  position: relative; width: 100%; aspect-ratio: 1600 / 860; max-width: 100%;
  border: 1px solid var(--cobalt); outline: 1px solid var(--cobalt); outline-offset: 5px;
  background: var(--paper); overflow: hidden; touch-action: none; cursor: grab; user-select: none;
}
.map-frame:active { cursor: grabbing; }
#mapSvg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.bubbles { position: absolute; inset: 0; pointer-events: none; }
.bubble {
  position: absolute; left: 0; top: 0; pointer-events: auto;
  width: var(--d); height: var(--d); margin: calc(var(--d) / -2) 0 0 calc(var(--d) / -2);
  border-radius: 50%; border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--cobalt);
  background: var(--cobalt); color: var(--paper); font-family: var(--serif); font-size: var(--fs, 15px); line-height: 1;
  display: flex; align-items: center; justify-content: center; padding: 0; cursor: pointer;
  transition: box-shadow .15s ease, background-color .15s ease;
}
.bubble::before { content: ''; position: absolute; inset: -6px; border-radius: 50%; } /* larger hit area */
.bubble:hover { box-shadow: 0 0 0 1px var(--cobalt), 0 0 0 5px rgba(42, 48, 200, .18); }
.bubble.is-open { background: var(--paper); color: var(--cobalt); box-shadow: 0 0 0 2px var(--cobalt), 0 0 0 7px rgba(42, 48, 200, .2); z-index: 2; }
/* A group of nearby universities: engraved double ring, paper fill. */
.bubble.is-cluster {
  background: var(--paper); color: var(--cobalt); border: 0;
  box-shadow: 0 0 0 1.5px var(--cobalt), 0 0 0 4px var(--paper), 0 0 0 5px var(--cobalt);
}
.bubble.is-cluster:hover { box-shadow: 0 0 0 1.5px var(--cobalt), 0 0 0 4px var(--paper), 0 0 0 5px var(--cobalt), 0 0 0 9px rgba(42, 48, 200, .16); }
.bubble.is-cluster.is-open { background: var(--cobalt); color: var(--paper); }

.group-list { list-style: none; margin: 0; padding: 0; border-top: 3px double var(--cobalt); max-height: 260px; overflow-y: auto; }
.group-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 9px 0; min-height: 44px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; }
.group-item:hover .group-name { text-decoration: underline; }
.group-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.group-name { font-family: var(--serif); font-size: 19px; }
.group-meta { font-size: 14px; color: var(--muted); }
.group-n { flex: none; width: 32px; height: 32px; border-radius: 50%; background: var(--cobalt); color: var(--paper); display: inline-flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 15px; }

.card {
  position: absolute; z-index: 5; width: 300px; max-width: calc(100% - 24px);
  background: var(--paper); color: var(--ink); border: 1px solid var(--cobalt); outline: 1px solid var(--cobalt); outline-offset: 3px;
  padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 12px; cursor: auto; user-select: text;
  overflow-y: auto; overscroll-behavior: contain;
  box-shadow: 0 12px 32px rgba(20, 24, 90, .18);
  transform-origin: var(--ox, 0) var(--oy, 50%);
  animation: card-in .22s ease-out;
}
@keyframes card-in { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } .bubble { transition: none; } }
.card.is-docked { left: 12px !important; right: 12px; top: auto !important; bottom: 12px; width: auto; max-width: none; max-height: calc(100% - 24px); overflow: auto; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.card-eyebrow { font-size: 14px; letter-spacing: .1em; color: var(--muted); }
.card-close { width: 36px; height: 36px; margin: -8px -8px -8px 0; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.card-close svg { width: 16px; height: 16px; stroke: var(--cobalt); stroke-width: 1.6; fill: none; }
.card h3 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 27px; line-height: 1.1; text-wrap: balance; }
.card-place { margin: -6px 0 0; color: var(--muted); }
.card-figs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 3px double var(--cobalt); border-bottom: 1px solid var(--cobalt); }
.card-figs div { padding: 8px 4px; text-align: center; display: flex; flex-direction: column; }
.card-figs div + div { border-left: 1px solid var(--line); }
.card-figs b { font-family: var(--serif); font-weight: 400; font-size: 32px; line-height: 1.05; }
.card-figs span { font-size: 14px; }
.card-gpa { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; align-items: end; }
.card-gpa .gpa-label { grid-column: 1 / -1; font-size: 15px; }
.card-gpa .gpa-value { font-family: var(--serif); font-size: 46px; line-height: .95; }
.card-gpa .gpa-value small { font-size: 18px; color: var(--muted); }
.gpa-scale { position: relative; height: 18px; align-self: center; }
.gpa-scale::before { content: ''; position: absolute; left: 0; right: 0; top: 8px; height: 1px; background: var(--cobalt); }
.gpa-scale i { position: absolute; top: 2px; width: 2px; height: 14px; background: var(--cobalt); }
.gpa-scale .tick { position: absolute; top: 5px; width: 1px; height: 7px; background: var(--cobalt); }
.gpa-scale .tick-l { position: absolute; top: 14px; font-size: 11px; transform: translateX(-50%); color: var(--muted); }
.card-gpa .gpa-note { grid-column: 1 / -1; font-size: 14px; color: var(--muted); margin-top: 10px; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.card-actions button { border: 1px solid var(--cobalt); background: var(--cobalt); color: var(--paper); border-radius: 2px; padding: 8px 14px; min-height: 40px; cursor: pointer; }
.card-actions a { font-size: 16px; }

.map-controls {
  position: absolute; right: 12px; top: 12px; z-index: 4; display: flex; flex-direction: column;
  border: 1px solid var(--cobalt); background: var(--paper);
}
.map-controls button { width: 44px; height: 44px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.map-controls button + button { border-top: 1px solid var(--line); }
.map-controls button:hover { background: var(--wash); }
.map-controls svg { width: 20px; height: 20px; fill: none; stroke: var(--cobalt); stroke-width: 1.6; }
.wheel-hint, .map-loading {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6;
  background: var(--cobalt); color: var(--paper); padding: 10px 18px; border-radius: 3px; font-size: 17px;
  pointer-events: none; text-align: center; max-width: calc(100% - 32px);
}
.map-loading { background: var(--paper); color: var(--cobalt); border: 1px solid var(--cobalt); font-family: var(--serif); font-style: italic; }
.map-caption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 24px; font-size: 16px; color: var(--muted); padding-top: 6px; }
.legends { display: flex; flex-wrap: wrap; gap: 14px 28px; }
.legend { display: inline-flex; align-items: center; gap: 12px; }
.legend-dot.is-cluster { background: var(--paper); color: var(--cobalt); border: 0; box-shadow: 0 0 0 1.5px var(--cobalt), 0 0 0 3.5px var(--paper), 0 0 0 4.5px var(--cobalt); margin: 0 3px; }
.legend-dot { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--cobalt); color: var(--paper); border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--cobalt); display: inline-flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 13px; }
.map-status.is-warn { color: var(--danger); }

.top5 { flex: 1 1 300px; min-width: 0; display: flex; flex-direction: column; }
.top5 h3 { margin: 0 0 4px; font-family: var(--sc); font-weight: 400; font-size: 28px; border-bottom: 3px double var(--cobalt); padding-bottom: 8px; }
.top5-list { list-style: none; margin: 0; padding: 0; }
.top5-item {
  width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 14px; align-items: center;
  padding: 14px 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer;
}
.top5-item:hover .top5-name { text-decoration: underline; }
.top5-rank { font-family: var(--serif); font-style: italic; font-size: 34px; line-height: 1; text-align: center; }
.top5-text { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.top5-name { font-family: var(--serif); font-size: 21px; line-height: 1.15; }
.top5-place { font-size: 14px; color: var(--muted); }
.top5-bar { height: 4px; background: #e2e4f8; display: block; }
.top5-bar i { display: block; height: 4px; background: var(--cobalt); }
.top5-total { width: 44px; height: 44px; border-radius: 50%; background: var(--cobalt); color: var(--paper); display: inline-flex; align-items: center; justify-content: center; font-family: var(--serif); font-size: 17px; }
.top5-empty { padding: 14px 0; color: var(--muted); font-family: var(--serif); font-style: italic; }

/* ---------- List ---------- */
.list-top { display: flex; flex-direction: column; gap: 14px; }
.list-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.table-key { display: flex; flex-wrap: wrap; gap: 8px 22px; font-size: 15px; color: var(--muted); }
.table-note { margin: -4px 0 0; font-size: 15px; color: var(--muted); }
.list-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; border-bottom: 3px double var(--cobalt); padding-bottom: 12px; }
.list-title { display: flex; flex-direction: column; gap: 2px; }
.list-title h2 { font-size: clamp(40px, 5vw, 52px); }
.sort-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sort-dir {
  min-height: 36px; padding: 0 14px; border: 1px solid var(--cobalt); border-radius: 999px;
  background: transparent; color: var(--cobalt); font-size: 16px; cursor: pointer; white-space: nowrap;
}
.sort-dir:hover { background: var(--wash); }
.sort-dir:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.sort-filter { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 6px; font-size: 19px; color: var(--cobalt); cursor: pointer; }
.sort-filter:focus-within { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.sort-filter svg { fill: none; stroke: var(--cobalt); stroke-width: 1.6; stroke-linejoin: round; }
.sort-filter select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; border: 0; }
.table-scroll { overflow-x: auto; }
.dest-table { width: 100%; min-width: 920px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.dest-table th { font-size: 15px; letter-spacing: .06em; font-weight: 400; text-align: left; padding: 0 12px; border-bottom: 1px solid var(--cobalt); white-space: nowrap; }
.dest-table th.num, .dest-table td.num { text-align: right; }
.dest-table th.c-rank { width: 40px; padding-left: 0; }
.dest-table th.c-total { width: 24%; padding-right: 0; }
.th-sort { background: transparent; border: 0; padding: 0; min-height: 44px; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.th-sort:hover { text-decoration: underline; }
.th-sort[aria-pressed="true"]::after { content: attr(data-arrow); }
.dest-table td { padding: 14px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dest-table td:first-child { padding-left: 0; font-family: var(--serif); font-style: italic; font-size: 20px; }
.dest-table td:last-child { padding-right: 0; }
.uni-link { background: transparent; border: 0; padding: 0; text-align: left; cursor: pointer; font-family: var(--serif); font-size: 20px; line-height: 1.2; color: var(--ink); }
/* Underline that grows into a background on hover
   (after fancycomponents.dev's Underline To Background, without React). */
.uni-link { position: relative; isolation: isolate; display: inline-block; }
.uni-link::before {
  content: ""; position: absolute; z-index: -1; left: 0; right: 0; bottom: -.01em;
  height: .1em; background: var(--ink); transition: height .35s cubic-bezier(.2, .9, .3, 1);
}
.uni-link > span { transition: color .35s cubic-bezier(.2, .9, .3, 1); }
.uni-link:hover::before, .uni-link:focus-visible::before { height: 100%; }
.uni-link:hover > span, .uni-link:focus-visible > span { color: var(--paper); }
@media (prefers-reduced-motion: reduce) { .uni-link::before, .uni-link > span { transition: none; } }
.country-cell { display: flex; flex-direction: column; line-height: 1.3; }
.country-cell small { font-size: 14px; color: var(--muted); }
.gpa-cell b { font-family: var(--serif); font-weight: 400; font-size: 20px; }
.gpa-cell small { font-size: 13px; color: var(--muted); }
.total-cell { display: flex; align-items: center; gap: 12px; }
.total-bar { flex: 1; height: 10px; display: flex; background: var(--wash); }
.total-bar i { display: block; height: 10px; }
.total-bar .b1 { background: var(--cobalt); }
.total-bar .b2 { background: var(--second); }
.total-n { width: 30px; text-align: right; font-family: var(--serif); font-size: 19px; }
.table-limit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 17px; color: var(--muted); }
.table-limit button {
  min-width: 44px; min-height: 36px; padding: 0 12px; border: 1px solid var(--cobalt); border-radius: 999px;
  background: transparent; color: var(--cobalt); font: inherit; cursor: pointer;
}
.table-limit button:hover { background: var(--wash); }
.table-limit button[aria-pressed="true"] { background: var(--cobalt); color: var(--paper); }
.table-count { margin-left: 8px; font-family: var(--serif); font-style: italic; }
.key { display: inline-flex; align-items: center; gap: 8px; }
.key i { width: 18px; height: 10px; display: inline-block; }
.key-first { background: var(--cobalt); }
.key-second { background: var(--second); }

/* ---------- Form ---------- */
.form-section { border-top: 3px double var(--cobalt); }
.form-layout { flex-direction: row; flex-wrap: wrap; gap: 56px; align-items: center; }
.form-art { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; }
.form-art img { width: 100%; max-width: 420px; height: auto; display: block; }
.form-art p { margin: 0; font-family: var(--serif); font-style: italic; font-size: 22px; max-width: 28ch; }
.form-body { flex: 1.3 1 460px; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
#choiceForm { display: flex; flex-direction: column; gap: 20px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-narrow { max-width: 280px; }
.field label { font-size: 20px; display: flex; align-items: center; gap: 10px; }
.optional { font-size: 13px; letter-spacing: .1em; border: 1px solid var(--cobalt); border-radius: 999px; padding: 0 9px; }
.field input { border: 1px solid var(--cobalt); background: #fff; color: var(--ink); padding: 13px 14px; border-radius: 2px; min-height: 50px; }
.field input::placeholder { color: #7a7fc4; }
.field-hint { font-size: 15px; color: var(--muted); }
.field input[aria-invalid="true"] { border-color: var(--danger); outline: 1px solid var(--danger); }
#choiceForm .btn { align-self: flex-start; }
.form-error { margin: 0; color: var(--danger); }
.form-note { margin: 0; color: var(--muted); font-family: var(--serif); font-style: italic; }
.form-done { border: 3px double var(--cobalt); padding: 28px; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.form-done-title { font-family: var(--serif); font-size: 32px; line-height: 1.1; }

/* ---------- Floating header ----------
   A copy of the hero's top bar that slides down when you scroll up below the hero (app.js). */
.float-nav {
  position: fixed; z-index: 30; top: 0; left: 0; right: 0;
  background: var(--cobalt); color: var(--cream); box-shadow: 0 6px 24px rgba(14, 18, 90, .25);
  transform: translateY(-110%); transition: transform .25s ease-out;
}
.float-nav.is-shown { transform: none; }
.float-nav .topbar { padding-block: 22px; }
.float-nav a { color: var(--cream); }
@media (max-width: 680px) {
  /* One slim row on phones: the compass, then the links. */
  .float-nav .topbar { flex-wrap: nowrap; }
  .float-nav .brand-text { display: none; }
}
@media (prefers-reduced-motion: reduce) { .float-nav { transition: none; } }

/* ---------- Scroll index ----------
   A rail of ticks on the right, one per heading, placed where that heading sits in the page.
   Ticks swell near the pointer; dragging the rail scrubs the page (after kokonutui's Scroll
   Index). Shown on wide screens once the hero is behind you. */
.scroll-index {
  /* Inside the page's 24px side gutter, clear of the content. */
  position: fixed; z-index: 20; right: 6px; top: calc(50vh - 140px); width: 40px;
  opacity: 0; visibility: hidden; transition: opacity .25s ease, visibility 0s linear .25s;
}
.scroll-index.is-on { opacity: 1; visibility: visible; transition: opacity .25s ease; }
.si-rail { position: relative; width: 100%; height: 280px; cursor: pointer; touch-action: none; user-select: none; }
.si-rail[data-dragging] { cursor: grabbing; }
.si-tick {
  position: absolute; right: 0; width: 14px; height: 16px; padding: 0; border: 0; border-radius: 2px;
  background: transparent; cursor: pointer; transform: translateY(-50%);
}
.si-tick.is-minor { width: 8px; }
.si-tick::before {
  content: ""; position: absolute; top: 50%; right: 0; width: 100%; height: 1.5px; border-radius: 1px;
  background: var(--line); transform: translateY(-50%) scaleX(var(--swell, 1)); transform-origin: right;
  transition: background-color .2s ease-out;
}
.si-tick[data-state="passed"]::before { background: var(--ink); }
.si-tick[data-state="current"]::before { background: var(--cobalt); height: 2.5px; }
.si-tick:focus-visible { outline: 2px solid var(--cobalt); outline-offset: 2px; }
.si-head {
  position: absolute; top: 0; right: 0; width: 24px; height: 2px; border-radius: 1px;
  background: var(--cobalt); pointer-events: none; transform: translateY(-50%); will-change: transform;
}
.si-label {
  position: absolute; top: 0; right: 32px; white-space: nowrap; pointer-events: none; opacity: 0;
  padding: 3px 10px; border: 1px solid var(--cobalt); outline: 1px solid var(--cobalt); outline-offset: 2px;
  border-radius: 2px; background: var(--paper); color: var(--ink);
  font-family: var(--serif); font-style: italic; font-size: 16px; line-height: 1.3;
  transition: opacity .15s ease-out, transform .15s ease-out;
}
@media (max-width: 960px) { .scroll-index { display: none; } }
@media (prefers-reduced-motion: reduce) { .scroll-index, .si-label, .si-tick::before { transition: none; } }

/* ---------- Scroll cues ----------
   A small down arrow at the bottom of each section, linking to the next. app.js fades it in
   as it comes up the screen and out as it moves on up (--cue, 0 to 1). */
.scroll-cue {
  position: absolute; left: 50%; bottom: 28px; z-index: 5; width: 44px; height: 44px; margin-left: -22px;
  display: grid; place-items: center; color: var(--cobalt); opacity: var(--cue, 0);
}
.hero .scroll-cue { color: var(--cream); }
.scroll-cue svg { width: 26px; height: 26px; animation: cue-bob 1.8s ease-in-out infinite; }
.scroll-cue:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 50%; opacity: 1; }
@keyframes cue-bob { 0%, 100% { transform: translateY(-3px); } 50% { transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .scroll-cue svg { animation: none; } }

/* ---------- Footer ---------- */
.footer {
  background: var(--cobalt); color: var(--cream); overflow: hidden;
  min-height: max(760px, 100vh); padding-bottom: env(safe-area-inset-bottom, 0px);
}
.footer-main {
  position: relative; z-index: 1; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 96px;
}
.footer-compass { width: clamp(88px, 11vw, 132px); height: auto; display: block; }
/* A hand-drawn note beside the compass, pointing at it. */
.spin-wrap { position: relative; margin-bottom: 18px; }
.spin-hint {
  position: absolute; left: calc(100% + 2px); top: -22px; width: 104px; pointer-events: none;
  display: flex; flex-direction: column; align-items: flex-end; color: var(--cream);
}
.spin-hint-text { font-family: var(--serif); font-style: italic; font-size: 18px; line-height: 1; transform: rotate(-6deg); margin-right: 2px; }
.spin-hint svg { display: block; width: 96px; height: 58px; margin-top: 2px; }
/* Hold it to spin it (app.js). */
#footerCompass {
  pointer-events: auto; cursor: grab; touch-action: none; user-select: none;
  -webkit-user-drag: none; -webkit-touch-callout: none; will-change: transform;
}
#footerCompass:active { cursor: grabbing; }
.footer-mark { margin: 0; font-family: var(--serif); font-size: clamp(76px, 15vw, 196px); line-height: .9; letter-spacing: -.02em; }
.footer-desc { margin: 18px 0 0; font-size: clamp(15px, 1.6vw, 19px); letter-spacing: .2em; text-transform: uppercase; }
.footer-note { margin-top: 22px; display: flex; flex-direction: column; gap: 4px; font-family: var(--serif); font-style: italic; font-size: 19px; color: #dcd8f0; }
.footer-note p { margin: 0; }
.footer-note a { color: var(--cream); pointer-events: auto; text-underline-offset: 3px; }
.footer-note a:hover { text-decoration-thickness: 2px; }
/* The compass pile: a layer over the whole footer, under its text. */
.footer-play { position: absolute; inset: 0; z-index: 0; touch-action: pan-y; }
.footer-play .toss {
  position: absolute; top: 0; left: 0; visibility: hidden; border-radius: 50%;
  cursor: grab; touch-action: none; user-select: none; will-change: transform;
}
.footer-play .toss img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
.footer-play[data-dragging] .toss { cursor: grabbing; }

@media (max-width: 720px) {
  .section { padding-block: 64px 48px; }
  .map-frame { aspect-ratio: auto; height: 460px; }
  .stat-l { font-size: 17px; }
  .hero-art { margin-top: 0; }
}

/* Too narrow for the brand and the links side by side: stack the hero's top bar. */
/* The hamburger only shows on phones (below). */
.menu-toggle { display: none; }

/* Phones: the hero's bar becomes brand + menu button, with the links in a drop-down;
   the hero is one screen tall with its content near the top and the arrow above the
   mountains. (The scroll-up header keeps its own compact row.) */
@media (max-width: 680px) {
  .hero .topbar { flex-wrap: nowrap; padding-block: 16px; z-index: 3; }
  .hero .brand-desc { font-size: 10px; letter-spacing: .12em; }
  .hero .brand img { width: 38px; height: 38px; }
  .menu-toggle {
    display: grid; align-content: center; gap: 6px; width: 44px; height: 44px; padding: 0 9px; margin-right: -9px;
    background: transparent; border: 0; cursor: pointer; flex: none;
  }
  .menu-toggle span {
    display: block; height: 2px; border-radius: 1px; background: var(--cream);
    transition: transform .25s ease, opacity .2s ease;
  }
  .menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
  .menu-toggle:focus-visible { outline: 2px solid var(--cream); outline-offset: 2px; border-radius: 4px; }
  .hero .section-nav {
    position: absolute; top: 100%; left: 0; right: 0; flex-direction: column; align-items: flex-end; gap: 0;
    padding: 6px max(28px, 3vw) 18px; background: var(--cobalt); border-bottom: 3px double var(--cream);
    visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
  }
  .hero .section-nav.is-open { visibility: visible; opacity: 1; transform: none; transition: opacity .2s ease, transform .2s ease; }
  .hero .section-nav .nav-link { font-size: 22px; min-height: 48px; }

  .hero.layer { min-height: 100vh; min-height: 100svh; }
  .hero-body { justify-content: flex-start; padding-top: 28px; gap: 22px; }
  .hero-mark { width: 84px; }
  .hero .scroll-cue { bottom: max(150px, 22svh); }
}
@media (max-width: 680px) and (prefers-reduced-motion: reduce) {
  .menu-toggle span, .hero .section-nav, .hero .section-nav.is-open { transition: none; }
}
