/* Backstory: San Francisco hillside in the fog, ink and watercolor.
   One accent (International Orange, the door). Verdict colors are semantic state only. */
/* light-mode tokens live in tokens.css */

/* Night in the fog: same street, windows lit */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sky-top: #141c25; --sky-bottom: #222a2f; --surface: #1b2228; --card: #232b31;
    --ink: #eeeae1; --ink-2: #c4c1b9; --muted: #969a9c; --rule: rgba(238, 234, 225, 0.16);
    --accent: #d9493d; --title-accent: #9fb8d1; --swash: rgba(184, 154, 76, 0.55); --ink-line: #0f1215;
    --fog: #8a96a3; --hill: #4b4a42; --blue: #5d7a91; --yellow: #b89a4c; --pink: #a8747c; --trim: #cfc6ad;
    --win: #f2c46b; --sign: #e7dcc0; --door2: #2a3644; --door3: #5a2c35; --step: #7d776c; --leaf: #4d6a35; --tag: #e9e4d6;
    --verified: #7cc5a0; --disputed: #e7b462; --legend: #8db6e6;
    --shadow: 0 14px 30px -18px rgba(0, 0, 0, 0.8);
  }
}
:root[data-theme="dark"] {
  --sky-top: #141c25; --sky-bottom: #222a2f; --surface: #1b2228; --card: #232b31;
  --ink: #eeeae1; --ink-2: #c4c1b9; --muted: #969a9c; --rule: rgba(238, 234, 225, 0.16);
  --accent: #d9493d; --title-accent: #9fb8d1; --swash: rgba(184, 154, 76, 0.55); --ink-line: #0f1215;
  --fog: #8a96a3; --hill: #4b4a42; --blue: #5d7a91; --yellow: #b89a4c; --pink: #a8747c; --trim: #cfc6ad;
  --win: #f2c46b; --sign: #e7dcc0; --door2: #2a3644; --door3: #5a2c35; --step: #7d776c; --leaf: #4d6a35; --tag: #e9e4d6;
  --verified: #7cc5a0; --disputed: #e7b462; --legend: #8db6e6;
}

* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: hidden; }
body {
  min-height: 100dvh;
  color: var(--ink);
  font: var(--fs-body)/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  background: linear-gradient(var(--sky-top), var(--sky-bottom) 55%) fixed, var(--sky-bottom);
}
/* paper grain lives on a fixed layer, never on the scrolling content */
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.18; mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .45 0 0 0 0 .35 0 0 0 .4 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
}
#app { position: relative; z-index: 2; max-width: 480px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 16px 40px; }
.screen { display: none; }
.screen.active { display: block; animation: rise var(--dur-slow) var(--ease) backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

h1, h2, h3 { margin: 0; font-family: var(--sans); letter-spacing: -0.02em; }
h1 { font-size: clamp(28px, 8vw, 34px); line-height: 1.1; font-weight: 700; }
h2 { font-size: var(--fs-3xl); line-height: 1.15; font-weight: 700; }
.lede { margin: 8px 0 0; color: var(--ink-2); font-size: var(--fs-md); max-width: 34ch; }
.muted { color: var(--muted); }
.hero { padding: 18px 0 0; }
.title { font-family: "Young Serif", Georgia, serif; font-weight: 400; font-size: clamp(32px, 9.4vw, 40px); line-height: 1.04; letter-spacing: -0.01em; max-width: 11ch; }
.title span { color: var(--title-accent); }
.hero .lede { font-size: var(--fs-body); line-height: 1.45; color: var(--ink-2); max-width: 30ch; margin-top: 10px; }

/* ---------- scene ---------- */
.scene { display: block; width: calc(100% + 32px); margin: 4px -16px 0; height: auto; overflow: visible; }
.k { fill: none; stroke: var(--ink-line); stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; filter: url(#ink); }
.k2 { fill: none; stroke: var(--ink-line); stroke-width: 0.8; stroke-linecap: round; filter: url(#ink); }
.w { filter: url(#wash); }
.hand { font-family: var(--hand); fill: var(--ink-line); }
.hand-read { font-family: var(--hand-read); fill: var(--ink-on-paper); }
.sign { font-family: var(--sign-font); font-size: 10.5px; letter-spacing: 0.5px; fill: var(--ink-on-paper); }
.hint { font-size: var(--fs-2xl); fill: var(--ink); }
.hint-arrow { stroke: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .tower { opacity: 0.35; } }

.door-hit { cursor: pointer; outline: none; }
.door { transform-box: fill-box; transform-origin: left center; transition: transform var(--dur-slow) cubic-bezier(0.2, 0.8, 0.2, 1); }
.door-hit.open .door { transform: skewY(-10deg) scaleX(0.28); }
@media (hover: hover) { .door-hit:hover .door { transform: skewY(-10deg) scaleX(0.28); } .door-hit:hover .glow { opacity: 1; } }
.glow { opacity: 0; transition: opacity 0.5s 0.15s; }
.door-hit.open .glow { opacity: 1; }
.door-hit:focus-visible .door-frame { stroke: var(--accent); stroke-width: 3; }
.tag { cursor: pointer; outline: none; }
.tag rect { transition: fill var(--dur-fast) var(--ease); }
.tag:hover rect, .tag:focus-visible rect { fill: #fff3c9; }
.tag:active > g { transform: translateY(1px); }

.guide-pos, #guide-bubble { pointer-events: none; }
/* the hill keeps going under the chips, edge to edge and down to the bottom of the page */
.ground { position: relative; margin: -14px -16px 0; padding: 22px 16px 28px; background: var(--hill);
  box-shadow: 0 0 0 100vmax var(--hill); clip-path: inset(0 -100vmax -100vmax -100vmax); }
.ground .chip { background: color-mix(in srgb, var(--card) 88%, transparent); }
.snap-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin: 0 0 18px; padding: 14px 18px;
  border: none; border-radius: var(--r-pill); background: var(--accent); color: var(--accent-ink); font: 600 var(--fs-lg) var(--sans);
  cursor: pointer; box-shadow: var(--shadow); transition: transform var(--dur-fast) var(--ease);
}
.snap-btn i { font-size: var(--fs-2xl); }
.snap-btn:active { transform: scale(0.98); }
.snap-btn:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; }
.more { margin-top: 0; }
.label { font: 500 var(--fs-sm) var(--sans); color: var(--ink-2); margin: 0 0 10px; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: -6px -16px 0; padding: 6px 16px 8px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font: 500 var(--fs-md) var(--sans); padding: 10px 14px; border-radius: var(--r-pill); cursor: pointer;
  border: 1px solid var(--rule); background: color-mix(in srgb, var(--card) 75%, transparent); color: var(--ink);
  transition: transform var(--dur-fast) var(--ease), border-color var(--dur) var(--ease);
}
.chip:hover { border-color: var(--accent); }
.chip:active { transform: scale(0.97); }
.credits { margin-top: 36px; font: 400 var(--fs-sm)/1.5 var(--sans); color: var(--ink-2); text-align: center; }

/* ---------- working ---------- */
.print-photo {
  position: relative; margin: 12px auto 24px; width: 72%; aspect-ratio: 4 / 5; background: var(--card);
  padding: 10px 10px 36px; box-shadow: var(--shadow); transform: rotate(-2deg); border-radius: var(--r-sm); overflow: hidden;
}
.print-photo img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: var(--r-sm); background: color-mix(in srgb, var(--yellow) 35%, var(--card)); }
.print-photo img:not([src]) { visibility: hidden; }
.scan { position: absolute; left: 10px; right: 10px; top: 10px; height: 3px; background: var(--accent); opacity: 0.85; animation: scan 2.2s ease-in-out infinite; }
@keyframes scan { 0%, 100% { top: 10px; } 50% { top: calc(100% - 40px); } }
.working-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.working-title { font-size: var(--fs-2xl); }
.guide-mini { flex: none; width: 76px; height: auto; overflow: hidden; }
/* demo stories have no photo: drop the empty frame and let her take the stage */
#working:has(#preview:not([src])) .print-photo { display: none; }
#working:has(#preview:not([src])) .working-head { flex-direction: column; align-items: flex-start; margin-top: 28px; }
#working:has(#preview:not([src])) .guide-mini { width: 150px; }
.narrator-row { display: flex; align-items: center; gap: 10px; margin: 18px 0 14px; }
.narrator-row .play { margin: 0; flex: 1; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: center; color: var(--muted); font-size: var(--fs-md); transition: color var(--dur) var(--ease); }
.steps li::before { content: ""; width: 18px; height: 18px; flex: none; border-radius: 50%; border: 1.5px solid var(--rule); }
.steps li.doing { color: var(--ink); font-weight: 500; }
.steps li.doing::before { border-color: var(--accent); border-top-color: transparent; animation: spin 0.8s linear infinite; }
.steps li.done { color: var(--ink-2); }
.steps li.done::before { background: var(--verified); border-color: var(--verified); box-shadow: inset 0 0 0 4px var(--surface); }
.steps li.skip { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- confirm ---------- */
#confirm h2 { margin-top: 24px; }
.stack { display: grid; gap: 10px; margin: 20px 0; }
.option { text-align: left; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--rule); background: var(--card); color: var(--ink); cursor: pointer; font: inherit; }
.option strong { display: block; font: 600 var(--fs-lg)/1.3 var(--sans); }
.option small { color: var(--muted); }
.text-btn { background: none; border: none; color: var(--ink-2); text-decoration: underline; font: inherit; cursor: pointer; padding: 8px 0; }

/* ---------- result ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; background: none; border: none; color: var(--ink-2); font: 500 var(--fs-md) var(--sans); padding: 8px 0 14px; cursor: pointer; }
.plaque { background: var(--card); border-radius: var(--r-md); padding: 22px 20px 18px; box-shadow: var(--shadow); position: relative; }
.plaque::after { content: ""; position: absolute; inset: 6px; border: 1.5px solid var(--ink); border-radius: calc(var(--r-md) - 4px); opacity: 0.55; pointer-events: none; filter: url(#ink); }
.address { margin: 0 0 6px; font: 500 var(--fs-sm) var(--sans); color: var(--muted); }
.plaque h2 { font-family: var(--sign-font); font-weight: 400; font-size: var(--fs-display); letter-spacing: 0; line-height: 1.1; }
.hook { font: 400 var(--fs-xl)/1.35 var(--hand-read); color: var(--ink-2); margin: 10px 0 16px; }
.meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; border-top: 1px solid var(--rule); padding-top: 14px; }
.meta dt { font: 500 var(--fs-xs) var(--sans); color: var(--muted); }
.meta dd { margin: 2px 0 0; font: 600 var(--fs-md)/1.3 var(--sans); overflow-wrap: anywhere; }

.play {
  display: flex; align-items: center; gap: 12px; width: 100%; margin: 20px 0 14px; padding: 12px 16px; border: none; border-radius: var(--r-md);
  background: var(--accent); color: var(--accent-ink); font: 600 var(--fs-body) var(--sans); cursor: pointer; box-shadow: var(--shadow); transition: transform var(--dur-fast) var(--ease);
}
.play:active { transform: scale(0.98); }
.play-icon { width: 34px; height: 34px; border-radius: 50%; background: rgba(255, 255, 255, 0.2); display: grid; place-items: center; font-size: var(--fs-md); }
.play .dur { margin-left: auto; font: 400 var(--fs-sm) var(--sans); opacity: 0.9; }
.play[disabled] { opacity: 0.75; }
.story { font: 400 var(--fs-lg)/1.7 var(--sans); color: var(--ink); margin: 0 0 8px; max-width: 65ch; }

.section-title { font-size: var(--fs-2xl); margin: 34px 0 2px; }
.by { margin: 0 0 12px; font-size: var(--fs-sm); color: var(--muted); }
.tally { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.mini { font: 700 var(--fs-xs)/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; padding: 7px 10px; border-radius: var(--r-pill); border: 1.5px solid currentColor; }
.mini.verified { color: var(--verified); } .mini.disputed { color: var(--disputed); } .mini.legend { color: var(--legend); }

.claims { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.claim { background: var(--card); border-radius: var(--r-md); padding: 14px 14px 12px; box-shadow: var(--shadow); }
.claim-top { display: flex; gap: 12px; align-items: flex-start; }
.claim p { margin: 0; flex: 1; font-size: var(--fs-md); }
.claim .year { font: 700 var(--fs-xs) var(--mono); color: var(--muted); display: block; margin-bottom: 2px; }
.stamp {
  flex: none; font: 700 var(--fs-xs)/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  padding: 7px 8px; border: 2px solid currentColor; border-radius: var(--r-sm); transform: rotate(-6deg);
  opacity: 0; animation: stamp 0.35s cubic-bezier(0.2, 1.6, 0.4, 1) forwards;
}
.stamp.verified { color: var(--verified); } .stamp.disputed { color: var(--disputed); } .stamp.legend { color: var(--legend); }
@keyframes stamp { from { opacity: 0; transform: rotate(-6deg) scale(1.8); } to { opacity: 0.92; transform: rotate(-6deg) scale(1); } }
.claim details { margin-top: 10px; font-size: var(--fs-sm); color: var(--ink-2); }
.claim summary { cursor: pointer; color: var(--muted); font: 500 var(--fs-xs) var(--sans); }
.claim ul { margin: 8px 0 0; padding-left: 18px; }
.claim li { margin-bottom: 4px; }
.claim a, .sources a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }
.sources { padding-left: 18px; margin: 10px 0 0; font-size: var(--fs-md); display: grid; gap: 6px; }
.sources small { color: var(--muted); }
.fineprint { font-size: var(--fs-xs); color: var(--muted); margin-top: 16px; }

.toast { position: fixed; z-index: 3; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(140px); background: var(--ink); color: var(--surface); padding: 12px 16px; border-radius: var(--r-md); font-size: var(--fs-md); max-width: calc(100% - 32px); transition: transform var(--dur) var(--ease); }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast { cursor: pointer; line-height: 1.4; width: min(420px, calc(100% - 32px)); text-align: center; }
.toast.error { background: var(--card); color: var(--ink); border: 1.5px solid var(--accent); box-shadow: var(--shadow); }

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
  .stamp { opacity: 0.92; }
}
.play[disabled] .dur { visibility: hidden; }

/* ---------- desktop (the demo runs on a laptop) ----------
   Centered composition: the title sits in the sky over the street, the street stays
   the hero image, and the story screens keep a comfortable reading column. */
@media (min-width: 900px) {
  #app { max-width: 1120px; padding-top: 36px; }
  .hero { position: relative; z-index: 1; text-align: center; padding-top: 12px; }
  .title { max-width: none; font-size: clamp(46px, 4.6vw, 62px); line-height: 1.05; }
  .hero .lede { max-width: 38ch; margin: 14px auto 0; font-size: var(--fs-xl); line-height: 1.45; }
  /* sized from the window height so the chips stay above the fold (viewBox is 340 x 480) */
  .scene { width: clamp(400px, calc((100vh - 270px) * 0.708), 560px); margin: -22px auto 0; }
  .ground { margin-top: -18px; }
  .more { max-width: 620px; margin: 0 auto; text-align: center; }
  .snap-btn { width: auto; margin: 0 auto 18px; padding: 14px 30px; }
  .chips { flex-wrap: wrap; }
  .chips { justify-content: center; overflow: visible; margin: 0; padding: 0; }
  .label { font-size: var(--fs-md); }
  #working, #confirm, #result { max-width: 560px; margin: 0 auto; }
}

.story p { margin: 0 0 12px; }
.label { color: var(--ink); }

/* Quiet, see-through buttons: an ink outline over a thin wash, like a paper card on the street.
   Applies to "Snap a photo" and the story's Play button so they stay consistent. */
.snap-btn, .play {
  background: color-mix(in srgb, var(--card) 38%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--ink); border: 1.5px solid var(--ink);
  box-shadow: 0 2px 0 color-mix(in srgb, var(--ink) 14%, transparent);
}
.snap-btn:hover, .play:hover { background: color-mix(in srgb, var(--card) 62%, transparent); }
.play-icon { background: color-mix(in srgb, var(--ink) 8%, transparent); }
@media (prefers-reduced-transparency: reduce) { .snap-btn, .play { background: var(--card); -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* ---------- buttons: one base, four variants ----------
   .btn          shared behavior: cursor, timing, press, keyboard focus
   .btn-ghost    main actions (Snap a photo, Play): ink outline over a thin wash
   .btn-chip     story shortcuts
   .btn-option   choices on the "which one is it?" screen
   .btn-text     quiet links (Back, Start over) */
.btn { cursor: pointer; font-family: var(--sans); -webkit-tap-highlight-color: transparent;
  transition: transform var(--dur-fast) var(--ease), background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), color var(--dur) var(--ease); }
.btn:active { transform: scale(0.98); }
.btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.btn[disabled] { cursor: progress; }
.btn-chip:hover, .btn-option:hover { border-color: var(--ink); }
.btn-option:active { transform: scale(0.99); }
.btn-text:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
/* keep the Play button on one line at phone width */
.play { gap: 10px; padding: 12px 14px; }
#play-label, .play .dur { white-space: nowrap; }
.play .dur { font-size: var(--fs-xs); }

/* ---------- sky by theme: sun and birds by day, stars by night ---------- */
.night-only { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .day-only { display: none; }
  :root:not([data-theme="light"]) .night-only { display: inline; }
}
:root[data-theme="dark"] .day-only { display: none; }
:root[data-theme="dark"] .night-only { display: inline; }
:root[data-theme="light"] .night-only { display: none; }

.birds { stroke-width: 1.1; animation: birds-drift 14s ease-in-out infinite alternate; }
.flock-1 { animation-duration: 18s; animation-delay: -6s; }
.flock-2 { animation-duration: 16s; animation-delay: -3s; }
.flock-3 { animation-duration: 12s; animation-delay: -8s; }
/* the sun sits in the top-right corner of the screen, behind the content */
.sky-sun { position: absolute; top: 14px; right: 14px; width: clamp(64px, 9vw, 120px); height: auto; z-index: 1; pointer-events: none; }
.bird { animation: flap 0.9s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: 50% 100%; }
.bird.b2 { animation-duration: 1.1s; animation-delay: -0.4s; }
.bird.b3 { animation-duration: 0.8s; animation-delay: -0.2s; }
@keyframes birds-drift { from { transform: translate(0, 0); } to { transform: translate(34px, -6px); } }
@keyframes flap { to { transform: scaleY(0.45); } }

.stars circle { animation: twinkle 3.5s ease-in-out infinite alternate; }
.stars .sparkle { animation: twinkle 2.8s ease-in-out infinite alternate; }
@keyframes twinkle { from { opacity: 0.25; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .birds, .bird, .stars circle, .stars .sparkle { animation: none !important; }
}

/* ---------- sketchbook heading: watercolor swash + handwritten margin note ---------- */
.title { position: relative; z-index: 1; }
.swash { position: relative; white-space: nowrap; }
.swash svg { position: absolute; left: -6px; bottom: -2px; width: calc(100% + 14px); height: 0.62em; z-index: -1; overflow: visible; }
.hero .lede.note-hand { font: 400 20px/1.28 var(--hand-read); color: var(--ink); margin: 12px 0 0 6px; max-width: 24ch; transform: rotate(-1.5deg); }
@media (min-width: 900px) {
  .hero .lede.note-hand { margin: 14px auto 0; max-width: 40ch; font-size: 22px; }
}

/* ---------- story page: read-along, timeline, next stop, pinned player ---------- */
.story .s { transition: background-color var(--dur) var(--ease); border-radius: 3px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.story .s.now { background: var(--swash); }

/* timeline: one swipeable row of stamped cards, oldest first */
.timeline { display: grid; grid-auto-flow: column; grid-auto-columns: min(78%, 280px); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 -16px; padding: 6px 16px 14px; scrollbar-width: none; overscroll-behavior-x: contain; }
.timeline::-webkit-scrollbar { display: none; }
.t-card { scroll-snap-align: start; position: relative; background: var(--card); border-radius: var(--r-md); padding: 14px 14px 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 210px; border-top: 4px solid currentColor; }
.t-card.verified { color: var(--verified); } .t-card.disputed { color: var(--disputed); } .t-card.legend { color: var(--legend); }
.t-year { margin: 0; font-family: var(--sign-font); font-size: var(--fs-3xl); line-height: 1; color: var(--ink); }
.t-text { margin: 10px 0 12px; font-size: var(--fs-md); line-height: 1.45; color: var(--ink); flex: 1; }
.t-card .stamp { align-self: flex-start; }
.t-card details { margin-top: 10px; font-size: var(--fs-sm); color: var(--ink-2); }
.t-card summary { cursor: pointer; color: var(--muted); font: 500 var(--fs-xs) var(--sans); }
.t-card ul { margin: 8px 0 0; padding-left: 18px; }
.t-card a { color: var(--ink); text-decoration-color: var(--accent); text-underline-offset: 3px; }
@media (min-width: 900px) { .timeline { margin: 0; padding: 6px 2px 14px; grid-auto-columns: 250px; } }

/* next stop */
.next-list { display: grid; gap: 10px; }
.next-card { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; background: var(--card); border-radius: var(--r-md); padding: 14px; box-shadow: var(--shadow); }
.n-name { margin: 0; font: 400 var(--fs-lg)/1.25 var(--sign-font); color: var(--ink); }
.n-desc { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--muted); }
.n-walk { margin: 0; font-size: var(--fs-sm); color: var(--ink); display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  text-decoration: none; padding: 6px 2px; border-radius: var(--r-sm); }
.n-walk span { text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 3px; }
.n-walk:hover { color: var(--accent); }
.n-walk:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.n-go { grid-column: 1 / -1; justify-self: start; padding: 9px 14px; border-radius: var(--r-pill); font: 600 var(--fs-sm) var(--sans); }

/* pinned player */
.mini-player { position: fixed; z-index: 3; left: 0; right: 0; margin: 0 auto; bottom: max(14px, env(safe-area-inset-bottom));
  width: min(528px, calc(100% - 24px)); display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: var(--r-pill);
  background: color-mix(in srgb, var(--card) 88%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border: 1.5px solid var(--ink); box-shadow: var(--shadow); animation: rise var(--dur) var(--ease) both; }
.mini-player[hidden] { display: none; }
.mini-face { width: 40px; height: 40px; border-radius: 50%; background: color-mix(in srgb, var(--yellow) 35%, var(--card)); flex: none; }
.mini-toggle { width: 36px; height: 36px; border-radius: 50%; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); display: grid; place-items: center; flex: none; font-size: 16px; padding: 0; }
.mini-track { flex: 1; height: 3px; border-radius: 2px; background: color-mix(in srgb, var(--ink) 14%, transparent); overflow: hidden; }
.mini-track span { display: block; height: 100%; background: var(--ink); transform-origin: left; transform: scaleX(0); transition: transform 0.25s linear; }
.mini-time { font: 500 var(--fs-xs) var(--mono); color: var(--ink-2); min-width: 32px; text-align: right; }
#result { padding-bottom: 70px; }
@media (prefers-reduced-motion: reduce) { .mini-track span, .story .s { transition: none; } }

/* ---------- your photo, pinned to the story card like a print ---------- */
.plaque-photo { float: right; width: 108px; margin: -34px -10px 8px 12px; padding: 6px 6px 18px; background: #fbfaf6; border-radius: 3px;
  box-shadow: 0 1px 0 rgba(31, 29, 26, 0.08), 0 10px 22px -12px rgba(31, 29, 26, 0.55); transform: rotate(3.5deg); position: relative; z-index: 1; }
.plaque-photo img { display: block; width: 100%; aspect-ratio: 4 / 5; object-fit: cover; border-radius: 1px; }
.plaque-photo::before { content: ""; position: absolute; top: -8px; left: 50%; width: 46px; height: 16px; transform: translateX(-50%) rotate(-4deg);
  background: color-mix(in srgb, var(--swash) 80%, #fff); opacity: 0.85; } /* a strip of tape */
.plaque-photo[hidden] { display: none; }
.plaque { margin-top: 10px; }

/* ---------- story page on desktop: story on the left, the facts on the right ---------- */
@media (min-width: 900px) {
  #result { max-width: 1080px; }
  .result-grid { display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(0, 1fr); gap: 48px; align-items: start; }
  .facts-col > .section-title:first-child { margin-top: 6px; }
  .story-col .story { font-size: var(--fs-lg); }
  /* the timeline becomes a vertical list in the narrower right column */
  .timeline { grid-auto-flow: row; grid-auto-columns: auto; overflow: visible; margin: 0; padding: 6px 0 4px; scroll-snap-type: none; }
  .t-card { min-height: 0; display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: start; }
  .t-card .t-year { grid-row: 1 / span 2; font-size: var(--fs-2xl); padding-top: 2px; }
  .t-card .t-text { margin: 0 0 10px; }
  .t-card .stamp, .t-card details { grid-column: 2; }
  .t-card .stamp { justify-self: start; }
  .plaque-photo { width: 132px; }
}
/* the sun belongs to the street scene; hide it on the loading and story pages */
body:has(#home:not(.active)) .sky-sun { display: none; }

/* ---------- verdicts as handwritten paper tape (replaces the rubber stamps) ----------
   A torn strip of tinted masking tape, stuck on slightly crooked, with the verdict written in pen. */
.stamp, .mini {
  --tape: color-mix(in srgb, currentColor 26%, #f6efdc);
  position: relative; display: inline-block; border: none; border-radius: 0; text-transform: none; letter-spacing: 0.01em;
  font-family: var(--hand-read); font-weight: 400; color: color-mix(in srgb, currentColor 88%, #1f1d1a);
  background:
    repeating-linear-gradient(100deg, transparent 0 7px, rgba(255, 255, 255, 0.18) 7px 8px),
    linear-gradient(var(--tape), var(--tape));
  /* torn, zigzag ends */
  clip-path: polygon(3% 0, 97% 0, 100% 14%, 97% 30%, 100% 46%, 97% 62%, 100% 78%, 97% 100%, 3% 100%, 0 84%, 3% 68%, 0 52%, 3% 36%, 0 20%);
}
.stamp { font-size: 19px; line-height: 1; padding: 7px 16px 6px; transform: rotate(-3deg); opacity: 0; animation: tape-on 0.45s cubic-bezier(0.2, 1.3, 0.4, 1) forwards; }
.stamp.verified { color: var(--verified); } .stamp.disputed { color: var(--disputed); } .stamp.legend { color: var(--legend); }
@keyframes tape-on { from { opacity: 0; transform: rotate(-9deg) translateY(-6px) scale(1.06); } to { opacity: 1; transform: rotate(-3deg); } }
.t-card:nth-child(even) .stamp { transform: rotate(2.5deg); animation-name: tape-on-alt; }
@keyframes tape-on-alt { from { opacity: 0; transform: rotate(8deg) translateY(-6px) scale(1.06); } to { opacity: 1; transform: rotate(2.5deg); } }

/* the counts above the timeline: smaller strips of the same tape */
.tally { gap: 10px; }
.mini { font-size: 16px; line-height: 1; padding: 6px 13px 5px; }
.mini:nth-child(1) { transform: rotate(-2deg); } .mini:nth-child(2) { transform: rotate(1.5deg); } .mini:nth-child(3) { transform: rotate(-1deg); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stamp, :root:not([data-theme="light"]) .mini { --tape: color-mix(in srgb, currentColor 30%, #2b3237); }
}
:root[data-theme="dark"] .stamp, :root[data-theme="dark"] .mini { --tape: color-mix(in srgb, currentColor 30%, #2b3237); }
@media (prefers-reduced-motion: reduce) { .stamp { opacity: 1; } }
