/* Worldspring landing page. Default rules are the no-motion page (stacked stills); `.zoom-on` (set by
   zoom.js) pins the stage and lays the captions over it. Breakpoints: 760px (phones), and
   1100px for the four points after the zoom (four across, then two). */

:root {
  --frame: #14110e;
  --panel: rgba(20, 16, 12, .9);
  --glass: blur(8px) saturate(.8);
  --text: #f3ecd8;
  --text-2: #d8cfb8;
  --gold: #d9b97a;
  --gold-hi: #e8cc93;
  --teal: #8cc5ad;
  --sketch: #1f6b56;
  --paper: #f3ecd8;
  --ink: #2b241d;
  --ink-accent: #5a4632;
  --line: rgba(243, 236, 216, .18);
  --bar: 3.5rem;
  --gutter: clamp(16px, 4vw, 3rem);
  --radius: 12px;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: var(--bar); }
body {
  margin: 0;
  background: var(--frame);
  color: var(--text);
  font: 400 clamp(1rem, .95rem + .25vw, 1.125rem)/1.55 var(--sans);
  overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
h1, h2 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 1.3rem + 3.2vw, 3.75rem); }
h2 { font-size: clamp(1.4rem, 1.15rem + 1.1vw, 2rem); }
p { margin: 0 0 .75em; }
p:last-child { margin-bottom: 0; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

.skip { position: absolute; left: -999px; top: .5rem; z-index: 20; background: var(--text); color: var(--ink); padding: .5rem 1rem; border-radius: 6px; }
.skip:focus { left: .5rem; }

.btn {
  display: inline-block;
  padding: .7em 1.3em;
  border-radius: 999px;
  background: var(--gold);
  color: var(--frame);
  font-weight: 600;
  text-decoration: none;
  line-height: 1.2;
}
.btn:hover { background: var(--gold-hi); }
.btn--small { padding: .5em 1em; font-size: .9375rem; }
/* Gold is the one main action (open the app); every other button is an outline. */
.btn--ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1.5px rgba(243, 236, 216, .6); }
.btn--ghost:hover { background: rgba(243, 236, 216, .14); }

/* Top bar */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 10;
  height: var(--bar);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 var(--gutter);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}
/* Panels over the map: nearly opaque and blurred behind, so the map's lettering doesn't show through. */
.topbar, .zoom-on .card, .zoom-on .hero-inner, .final-inner { -webkit-backdrop-filter: var(--glass); backdrop-filter: var(--glass); }
.wordmark { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; text-decoration: none; margin-right: auto; }
.topnav { display: flex; gap: 1.25rem; font-size: .9375rem; }
.topnav a { text-decoration: none; }
.topnav a:hover { text-decoration: underline; text-underline-offset: .2em; }

/* Zoom: the no-motion page by default */
.zoom { padding-top: var(--bar); }
.stage { position: relative; }
.stage-still img { width: 100%; max-height: 70svh; object-fit: cover; }
.stage canvas, .overlay, .rail { display: none; }

.beat { padding: clamp(2rem, 6vw, 4rem) var(--gutter); max-width: 64rem; margin: 0 auto; }
.still { margin: 0 0 1.25rem; }
.still img { width: 100%; border-radius: var(--radius); }
.hero { text-align: center; padding-top: clamp(1.5rem, 4vw, 3rem); }
.hero-inner { max-width: 44rem; margin: 0 auto; }
.tagline { color: var(--text-2); font-size: 1.15em; }
.hero-actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .5rem 1.25rem; }
.hint { display: none; color: var(--text-2); font-size: .875rem; letter-spacing: .04em; }

.card { max-width: 30rem; }
.card > p:not(.kicker) { color: var(--text-2); }
.card .btn { margin-top: .5rem; }
.kicker { font-size: .78rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; margin-bottom: .6em; }
.kicker--gen { color: var(--gold); }
.kicker--yours { color: var(--teal); }

/* Zoom: pinned (zoom.js took over) */
.zoom-on .zoom { padding-top: 0; }
.zoom-on .stage { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.zoom-on .stage-still, .zoom-on .stage-still img, .zoom-on .stage canvas, .zoom-on .overlay {
  position: absolute; inset: 0; width: 100%; height: 100%; max-height: none;
}
.zoom-on .stage-still img { object-fit: cover; }
.zoom-on .stage canvas, .zoom-on .overlay { display: block; }
.zoom-on .overlay { pointer-events: none; }
.zoom-on .hint { display: inline; }
.zoom-on .still { display: none; }

.zoom-on .beats { position: relative; z-index: 1; margin-top: -100svh; pointer-events: none; }
.zoom-on .beat {
  max-width: none;
  margin: 0;
  min-height: 170svh;
  padding: 0 var(--gutter) 2.5rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.zoom-on .beat--long { min-height: 230svh; }
.zoom-on .beat--zoom { min-height: 320svh; }
.zoom-on .card, .zoom-on .hero-inner { pointer-events: auto; }
.zoom-on .card {
  position: sticky;
  bottom: 2.5rem;
  max-width: 25rem;
  padding: clamp(1.1rem, 2vw, 1.6rem);
  background: var(--panel);
  border-radius: var(--radius);
}
/* The hero sits low and left, where the caption cards will, and leaves the continent in view. */
.zoom-on .hero { min-height: 100svh; align-items: flex-start; padding-top: var(--bar); text-align: left; }
.zoom-on .hero-inner { max-width: 40rem; margin: 0; padding: clamp(1.5rem, 3vw, 2.25rem); background: var(--panel); border-radius: var(--radius); }
.zoom-on .hero h1 { font-size: clamp(1.9rem, 1.2rem + 2.2vw, 3rem); }
.zoom-on .hero-actions { justify-content: flex-start; }

/* Rail: the six levels */
.zoom-on .rail { display: block; position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%); }
.rail ol { list-style: none; margin: 0; padding: .5rem 0; display: grid; gap: .25rem; }
.rail a {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .6rem;
  padding: .35rem .7rem;
  border-radius: 999px;
  background: var(--panel);
  color: var(--text-2);
  font-size: .875rem;
  text-decoration: none;
}
.rail a::after { content: ""; width: .5rem; height: .5rem; border-radius: 50%; border: 1px solid currentColor; }
.rail a:hover { color: var(--text); }
.rail a[aria-current] { color: var(--text); }
.rail a[aria-current]::after { background: var(--gold); border-color: var(--gold); }
.rail-now { display: none; }

/* Overlays: the edits drawn on the frames. zoom.js sets --p (progress) and --o (opacity) on each overlay,
   fills the SVGs from frames.json and gives .ov-frame the frame's own transform (cover scale, focus, drift). */
.overlay [id] { opacity: calc(var(--o, 0) * min(1, var(--p, 0) * 4)); }
.ov-frame { position: absolute; left: 0; top: 0; width: 1600px; height: 900px; transform-origin: 0 0; }
.ov-frame svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 0 2px rgba(10, 8, 6, .7)); }
.sketch path {
  fill: none;
  stroke: var(--sketch);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1 1;
  /* each path draws over its own share of --p: from --a, for --l */
  stroke-dashoffset: calc(1 - clamp(0, (var(--p, 0) - var(--a, 0)) / var(--l, 1), 1));
}
.sketch path.thin { stroke-width: 4; }
.sketch path.peak { stroke-width: 4.5; }
.sketch path.wall { stroke-width: 9; }
/* Each stroke is drawn twice: a wider parchment casing under the ink, so it shows on pale land and dark roofs. */
.sketch path.case { stroke: var(--paper); stroke-opacity: .9; stroke-width: 12; }
.sketch path.case.thin { stroke-width: 9; }
.sketch path.case.peak { stroke-width: 9.5; }
.sketch path.case.wall { stroke-width: 15; }
/* Labels: dark ink on a small parchment plate, so they read over the map's own lettering. zoom.js sizes
   them (font-size in frame units, 15 px on screen, 13 on phones) and moves them inside the free area. */
.sketch .label { opacity: clamp(0, (var(--p, 0) - var(--a, 0)) * 8, 1); }
.sketch .label rect { fill: var(--paper); fill-opacity: .93; stroke: #2f5e4e; stroke-opacity: .5; stroke-width: .06em; }
.sketch .label text { fill: #234a3d; font-family: var(--serif); font-style: italic; font-weight: 600; }
.pattern { position: absolute; inset: 0; display: flex; justify-content: center; align-items: flex-start; padding-top: calc(var(--bar) + 12svh); }
.chip {
  margin: 0;
  padding: .55rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--teal);
  background: var(--panel);
  color: var(--text);
  font-size: .9375rem;
}
.chip s { color: var(--text-2); }

/* The search example in the street caption */
.search { margin-top: .6rem; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; font-size: .875rem; }
.card .search p { margin: 0; color: var(--text); }
.search-q { padding: .35rem .75rem; background: rgba(243, 236, 216, .08); border-bottom: 1px solid var(--line); }
.search-q::before { content: ""; display: inline-block; width: .6em; height: .6em; margin-right: .55em; border: 1.5px solid var(--text-2); border-radius: 50%; }
.search-hit { padding: .4rem .75rem; line-height: 1.4; }
.search-hit b { display: block; font-weight: 600; }
.card .search-hit span { color: var(--text-2); }

/* After the zoom: paper and ink */
.later {
  background: var(--paper);
  color: var(--ink);
  padding: clamp(3rem, 8vw, 6rem) var(--gutter);
  position: relative;
  z-index: 2;
  color-scheme: light;
}
.later + .later { padding-top: 0; }
/* The paper lies on the map: a gold edge and a shadow where the two meet. */
.zoom + .later { border-top: 2px solid var(--gold); box-shadow: 0 -10px 28px rgba(10, 8, 6, .5); }
.later h2, .later h3 { color: var(--ink); }
.later p { color: var(--ink-accent); }
.later a:not(.btn) { color: var(--ink); text-underline-offset: .2em; }
.later :focus-visible { outline-color: var(--ink-accent); }
.later-inner { max-width: 68ch; margin: 0 auto; }
.why .later-inner, .yours .later-inner { text-align: center; }
.lede { font-size: 1.1em; }

/* What sets it apart: four short points under gold rules */
.points {
  list-style: none;
  margin: clamp(1.5rem, 4vw, 2.5rem) auto 0;
  padding: 0;
  max-width: 76rem;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
}
.points li { padding-top: .9rem; border-top: 2px solid var(--gold); }
.points h3, .tool h3 { font-family: var(--serif); font-weight: 600; font-size: 1.2rem; line-height: 1.2; margin: 0 0 .4rem; }
.points p, .tool p { font-size: .9375rem; }

/* Make it yours: each edit as the same piece of map before and after */
.tools {
  list-style: none;
  margin: clamp(2rem, 5vw, 3rem) auto 0;
  padding: 0;
  max-width: 68rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1.75rem, 4vw, 2.75rem) clamp(1.25rem, 3vw, 2.5rem);
}
.tool h3 { margin-top: .9rem; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.pair figure { margin: 0; }
.pair img {
  width: 100%;
  aspect-ratio: 8 / 5;
  object-fit: cover;
  border-radius: 8px;
  background: #e6dcc2;
  border: 1px solid rgba(43, 36, 29, .15);
  color: var(--ink-accent);
  font-size: .8125rem;
}
.pair figcaption { margin-top: .35rem; font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-accent); }
.pair-yours figcaption { color: var(--sketch); }

.faq details { border-bottom: 1px solid rgba(43, 36, 29, .18); }
.faq details:first-of-type { border-top: 1px solid rgba(43, 36, 29, .18); }
.faq summary {
  cursor: pointer;
  padding: 1rem 2rem 1rem 0;
  position: relative;
  list-style: none;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.1rem;
  line-height: 1.3;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  position: absolute;
  right: .25rem;
  top: .9rem;
  font-family: var(--sans);
  font-weight: 400;
  color: var(--ink-accent);
}
.faq details[open] summary::after { content: "\2212"; }
.faq summary:hover { color: var(--ink-accent); }
.faq details p { padding: 0 0 1.1rem; margin: 0; }

/* The ending: back on the map, with the same panel and gold button as the top of the page */
.final {
  position: relative;
  z-index: 2;
  min-height: min(72svh, 36rem);
  display: grid;
  place-items: center;
  padding: clamp(3rem, 8vw, 5rem) var(--gutter);
  background: var(--frame);
  border-top: 2px solid var(--gold);
  text-align: center;
  overflow: hidden;
}
.final-map, .final-map img { position: absolute; inset: 0; width: 100%; height: 100%; }
.final-map img { object-fit: cover; }
.final::after { content: ""; position: absolute; inset: 0; background: rgba(20, 16, 12, .25); box-shadow: inset 0 14px 28px -12px rgba(10, 8, 6, .7); pointer-events: none; }
.final-inner { position: relative; z-index: 1; max-width: 36rem; padding: clamp(1.5rem, 3vw, 2.5rem); background: var(--panel); border-radius: var(--radius); }
.actions { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: .75rem 1rem; margin-top: 1.25rem; }

.footer {
  position: relative;
  z-index: 2;
  background: var(--frame);
  color: var(--text-2);
  border-top: 1px solid var(--line);
  padding: 2rem var(--gutter) 2.5rem;
  font-size: .9375rem;
  text-align: center;
}
.footer nav { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.5rem; margin-bottom: .75rem; }
.footer p { max-width: 68ch; margin-left: auto; margin-right: auto; }
.footer a { color: var(--text); text-underline-offset: .2em; }

@media (max-width: 1099px) {
  .points { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 44rem; }
}

/* Phones: the picture on top (a window between the bars and the card zone), the captions below it on the
   dark ground. The stage sits above the beats, so the bars and the picture cover a card that scrolls up;
   zoom.js also fades a card out before it reaches the picture. --zone fits the tallest card at 375 x 667. */
@media (max-width: 759px) {
  :root { --rail-h: 2rem; --top: calc(var(--bar) + var(--rail-h)); --zone: 20rem; --pic: max(9rem, calc(100svh - var(--top) - var(--zone))); }
  .topbar { background: var(--frame); }
  .topbar, .zoom-on .card, .zoom-on .hero-inner { -webkit-backdrop-filter: none; backdrop-filter: none; }
  .topnav { display: none; }
  .zoom-on .stage { z-index: 2; pointer-events: none; }
  .zoom-on .stage canvas, .zoom-on .overlay, .zoom-on .stage-still { top: var(--top); bottom: auto; height: var(--pic); }
  .zoom-on .beat { padding: 0 12px 12px; }
  .zoom-on .hero { align-items: stretch; padding: 0 12px 12px; text-align: center; }
  .zoom-on .hero-inner { max-width: none; padding: 1.1rem 1.25rem; }
  .zoom-on .hero h1 { font-size: 1.6rem; }
  .zoom-on .hero-actions { justify-content: center; }
  /* cards sit right under the picture, not at the foot of the screen */
  .zoom-on .beat:not(.hero) { justify-content: flex-start; }
  .zoom-on .card { top: calc(var(--top) + var(--pic) + 28px); bottom: auto; max-width: none; }
  /* The last card fills the zone under the picture, so it leaves with the picture (no gap opens between them). */
  .zoom-on #table-play .card { min-height: calc(100svh - var(--top) - var(--pic) - 40px); }
  .zoom-on .rail { top: var(--bar); right: 0; left: 0; transform: none; }
  .zoom-on .rail ol { display: none; }
  .zoom-on .rail-now {
    display: block;
    margin: 0;
    height: var(--rail-h);
    padding: 0 var(--gutter);
    line-height: var(--rail-h);
    background: var(--frame);
    color: var(--text);
    font-size: .8125rem;
    letter-spacing: .06em;
    text-transform: uppercase;
  }
  .zoom-on .rail::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 100%;
    background: var(--gold);
    transform-origin: left;
    transform: scaleX(var(--progress, 0));
  }
  .pattern { padding-top: 12px; }
  .points, .tools { grid-template-columns: 1fr; max-width: 28rem; }
}
