:root {
  --ivory: #f8f6f0;
  --paper: #fffef9;
  --navy: #233b46;
  --muted: #596c63;
  --line: #d6dbd0;
  --accent: #247b79;
  --accent-soft: #edf5f2;
  --accent-hover: #1d6664;
  --serif: Georgia, 'Times New Roman', serif;
  --sans: 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--ivory); color: var(--navy); font-family: var(--sans); }
body { margin: 0; }
button, input, select { font: inherit; }
button, a { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
button:disabled { opacity: .45; cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible + span, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--accent); outline-offset: 5px; }
.page { max-width: 1512px; margin: auto; padding: 0 max(36px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(36px, env(safe-area-inset-left)); }
.masthead { min-height: 113px; display: flex; align-items: center; justify-content: space-between; gap: 25px; border-bottom: 1px solid var(--line); }
.wordmark { display: flex; gap: 17px; align-items: center; font: 24px/1.05 var(--serif); text-decoration: none; letter-spacing: -.7px; }
.brand-ripple { position: relative; width: 42px; height: 42px; display: grid; place-items: center; }
.brand-ripple i { position: absolute; border: 1px solid var(--accent); border-radius: 50%; width: 100%; height: 100%; }
.brand-ripple i:nth-child(2) { width: 68%; height: 68%; }
.brand-ripple i:nth-child(3) { width: 35%; height: 35%; background: var(--accent); }
.client-note { font-size: 11px; line-height: 1.8; color: var(--muted); text-align: right; }
.client-note strong { font-size: 12px; font-weight: 500; color: var(--navy); }
.scene-heading { display: flex; justify-content: space-between; gap: 16px; padding: 25px 0 18px; font-size: 9px; font-weight: 600; letter-spacing: 1.6px; }
.scene-heading > span:first-child { display: flex; align-items: center; gap: 9px; }
.tiny-dot { display: inline-block; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex: none; }
.place-label { color: var(--muted); }
.orientation-note { display: none; }
.experience { position: relative; max-width: 1280px; margin: auto; }
.stage { position: relative; aspect-ratio: 16/9; width: 100%; isolation: isolate; border: 1px solid #e1e3d7; background: #faf8f3; }
/* The supplied image is always static. All movement is in sibling overlays. */
.city { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; }
.overlay-panel { position: absolute; z-index: 10; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 420px; max-width: calc(100% - 32px); padding: 28px 30px; background: #fffef9fa; border: 1px solid #d1d7cc; text-align: center; }
.eyebrow { font-size: 9px; letter-spacing: 1.65px; line-height: 1.6; font-weight: 600; margin: 0 0 14px; }
.intro h1 { font: normal clamp(32px, 3.1vw, 42px)/1.12 var(--serif); letter-spacing: -1.5px; margin: 0 0 15px; }
.intro h1 em, .reveal h2 em { color: var(--accent); font-weight: normal; }
.intro-copy { font-size: 12px; line-height: 1.8; color: #4c6266; margin: 0 auto 22px; max-width: 335px; }
.causes { border: 0; padding: 0; margin: 0; }
#cause-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cause { position: relative; cursor: pointer; }
.cause input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.cause span { display: flex; align-items: center; gap: 9px; padding: 11px 9px; min-height: 43px; border: 1px solid #d5dbd0; background: var(--paper); font-size: 11px; text-align: left; transition: background .25s, border-color .25s; }
.cause svg { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; }
.cause:hover span { background: var(--accent-soft); border-color: var(--accent); }
.cause input:checked + span { background: var(--accent-soft); border-color: var(--accent); }
.intro-hint { font: italic 12px/1.6 var(--serif); color: var(--muted); margin: 18px 0 0; }
.button { min-height: 44px; display: inline-flex; justify-content: center; align-items: center; gap: 22px; padding: 12px 20px; font-size: 11px; font-weight: 600; text-decoration: none; border: 1px solid transparent; transition: background .25s, border-color .25s; }
.primary { background: var(--accent); color: var(--paper); }
.primary:hover { background: var(--accent-hover); }
.primary > span { color: inherit; }
.secondary { border-color: var(--navy); background: transparent; color: var(--navy); }
.secondary:hover { background: var(--accent-soft); border-color: var(--accent); }
.gift-button { position: absolute; z-index: 10; left: 50%; top: 50%; transform: translate(-50%, -50%); width: clamp(116px, 12vw, 144px); aspect-ratio: 1; max-width: calc(100% - 24px); min-height: 0; border-radius: 50%; padding: 16px; white-space: normal; }
.gift-label { font: normal 20px/1.25 var(--serif); letter-spacing: -.35px; text-align: center; }
.text-button { padding: 8px 0; background: transparent; border: 0; color: var(--navy); font-size: 11px; min-height: 44px; }
.text-button:hover { text-decoration: underline; text-underline-offset: 4px; }
.icon-button { font-size: 23px; min-width: 44px; min-height: 44px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--navy); }

/* Explicit visual order: city, centre ripple, connections, markers, stories. */
.ripple-layer { position: absolute; z-index: 1; inset: 0; overflow: hidden; pointer-events: none; }
.initial-ripple { --ripple-size: 64px; position: absolute; left: 50%; top: 50%; width: var(--ripple-size); height: var(--ripple-size); transform: translate(-50%, -50%); pointer-events: none; }
.initial-ripple i { position: absolute; left: 50%; top: 50%; width: var(--ripple-size); height: var(--ripple-size); transform: translate(-50%, -50%); border: 1px solid var(--accent); border-radius: 50%; opacity: 0; animation: city-ripple 8s cubic-bezier(.22,.45,.35,1) infinite both; }
.initial-ripple i:nth-child(2) { animation-delay: 2s; }
.initial-ripple i:nth-child(3) { animation-delay: 4s; }
.initial-ripple i:nth-child(4) { animation-delay: 6s; }
.is-paused .initial-ripple i { animation-play-state: paused; }
.is-paused .marker::after { animation-play-state: paused; }
.connections { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; overflow: hidden; pointer-events: none; }
.story-connection { fill: none; stroke: var(--accent); stroke-width: 1.25; stroke-dasharray: 1.5 5; opacity: .4; }
.story-leader { stroke: var(--accent); stroke-width: .85; opacity: .5; }
.markers { position: absolute; z-index: 3; inset: 0; pointer-events: none; }
.marker { position: absolute; left: var(--x); top: var(--y); width: 21px; height: 21px; transform: translate(-50%, -50%); display: grid; place-items: center; border: 1px solid var(--accent); border-radius: 50%; background: var(--paper); font-size: 8px; font-weight: 600; color: var(--accent); transition: background .5s, color .5s; }
.marker.active { background: var(--accent); color: var(--paper); }
.marker.active::after { content: ''; position: absolute; inset: -4px; border: .75px solid var(--accent); border-radius: 50%; animation: small-ripple 2.5s ease-out both; }
.marker.visited { background: var(--accent-soft); }
.stage-caption { position: absolute; z-index: 4; left: 16px; top: 16px; max-width: calc(100% - 32px); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 11px; border: 1px solid #d7ddd1; background: #fffef9f5; font-size: 10px; line-height: 1.5; }
.caption-separator { color: #829080; }
.story-bubbles { position: absolute; z-index: 5; inset: 0; pointer-events: none; }
.story-bubble { position: absolute; width: clamp(200px, 21vw, 250px); padding: 16px 18px 18px; margin: 0; border: 0; border-radius: 6px; background: var(--paper); color: #18333b; isolation: isolate; pointer-events: auto; overflow-wrap: break-word; }
.bubble-surface { position: absolute; z-index: -1; inset: 0; border: 1px solid var(--accent); border-radius: inherit; background: var(--accent-soft); opacity: 1; transition: opacity .5s ease; }
.bubble-content { position: relative; transition: color .5s ease; }
.bubble-eyebrow { display: block; font: 600 8px/1.65 var(--sans); letter-spacing: 1px; color: var(--accent); text-transform: uppercase; margin: 0; }
.story-bubble p { font: 19px/1.42 var(--serif); letter-spacing: -.2px; margin: 9px 0 0; text-wrap: pretty; }
/* Fade the decorative surface to ~50%, not the text into the artwork.
   Opaque paper and a separately coloured text layer retain readable contrast. */
.is-past .bubble-surface { opacity: .52; }
.is-past .bubble-content { color: #52665e; }
.is-past .bubble-eyebrow { color: #52665e; }
.compact .story-bubble { width: clamp(174px, 23vw, 218px); padding: 11px 13px 13px; }
.compact .story-bubble p { font-size: 16px; line-height: 1.42; margin-top: 7px; }
.compact .bubble-eyebrow { font-size: 8px; letter-spacing: .6px; }
.bubble-tray:empty { display: none; }
.bubble-tray .story-bubbles { position: relative; inset: auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px; margin-top: 18px; }
.bubble-tray .story-bubble { position: relative; inset: auto !important; width: 100%; max-width: none; min-width: 0; padding: 16px 18px; }
.bubble-tray .story-bubble p { font-size: 19px; line-height: 1.5; }

.experience-bar { max-width: 1280px; margin: auto; padding: 20px 0; min-height: 92px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); gap: 20px; }
.bar-intro { display: flex; gap: 14px; align-items: center; }
.small-rings { font: 37px var(--serif); color: var(--accent); }
.bar-intro p { font: 13px/1.5 var(--serif); margin: 0; }
.bar-intro em { color: var(--muted); }
.bar-hint { font-size: 10px; color: var(--muted); letter-spacing: .3px; }
.bar-hint span { color: var(--accent); margin-left: 12px; }
.story-status .eyebrow { display: block; font-size: 8px; margin: 0 0 12px; }
.progress { display: flex; gap: 7px; }
.progress span { height: 2px; width: 42px; background: #d8ddcf; transition: background .5s; }
.progress .complete { background: var(--accent); opacity: .5; }
.progress .current { background: var(--accent); }
.story-controls { display: flex; gap: 20px; align-items: center; }
.pause-button { min-width: 75px; text-align: left; }
.pause-button > span:first-child { margin-right: 7px; }
.story-instruction { text-align: center; font: italic 12px/1.6 var(--serif); color: #56695e; margin: 15px 0 0; }
.reveal { display: grid; grid-template-columns: minmax(0, 1fr) 250px; align-items: center; gap: 50px; padding: 34px 0 24px; text-align: left; }
.reveal-copy { max-width: 650px; }
.reveal .eyebrow { color: var(--accent); margin-bottom: 13px; }
.reveal h2 { font: normal clamp(28px, 3vw, 39px)/1.18 var(--serif); letter-spacing: -1px; margin: 0 0 13px; text-wrap: pretty; }
.reveal-copy > p:last-child { font-size: 13px; line-height: 1.8; max-width: 480px; color: #4c6266; margin: 0; }
.reveal-actions { text-align: center; }
.reveal-actions .primary { width: 100%; }
.reveal-actions .text-button { margin-top: 8px; }
.reveal-actions .text-button span { margin-left: 10px; color: var(--accent); }
.destination-note { font-size: 10px; line-height: 1.6; color: var(--muted); margin: 9px 0 0; }
.footer { display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 24px 0 28px; font-size: 8px; letter-spacing: 1px; }
.footer p { font-size: 10px; letter-spacing: 0; line-height: 1.7; color: #566862; margin: 0; text-align: center; }
.footer-end { font-size: 10px; letter-spacing: 0; white-space: nowrap; }
.footer-end span { color: var(--accent); margin-left: 10px; }

.editor { border: 1px solid var(--line); padding: 22px; margin: 20px auto; max-width: 1280px; background: var(--paper); }
.editor h2 { font: 24px var(--serif); margin: 0 0 8px; }
.editor p { font-size: 12px; color: var(--muted); }
.editor output { display: block; background: var(--accent-soft); padding: 12px; font: 12px/1.8 monospace; margin: 18px 0; overflow-wrap: anywhere; }
.editor-actions { display: flex; gap: 15px; align-items: end; flex-wrap: wrap; }
.editor-actions label { font-size: 11px; display: grid; gap: 7px; }
.editor select { padding: 11px; border: 1px solid var(--line); background: var(--paper); color: var(--navy); }
.calibration-grid { position: absolute; inset: 0; z-index: 6; cursor: crosshair; background-image: linear-gradient(to right, #233b4630 1px, transparent 1px), linear-gradient(to bottom, #233b4630 1px, transparent 1px); background-size: 10% 10%; }
.calibration-grid::before, .calibration-grid::after { position: absolute; left: 0; font: 10px monospace; background: var(--paper); }
.calibration-grid::before { content: 'X → 100%'; top: 0; }
.calibration-grid::after { content: 'Y ↓ 100%'; bottom: 0; }
.editing .story-bubbles { z-index: 7; pointer-events: none; }
.editing .story-bubble { pointer-events: none; }
.editing .markers { z-index: 7; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; top: -100px; left: 20px; z-index: 20; background: var(--navy); color: white; padding: 12px; }
.skip-link:focus { top: 12px; }
.no-script { padding: 20px; border: 1px solid var(--line); line-height: 1.6; }
@keyframes city-ripple {
  0% { width: calc(var(--ripple-size) * .7); height: calc(var(--ripple-size) * .7); opacity: 0; }
  12% { opacity: .25; }
  45% { opacity: .2; }
  75% { opacity: .1; }
  100% { width: calc(var(--ripple-size) * 7); height: calc(var(--ripple-size) * 7); opacity: 0; }
}
@keyframes small-ripple {
  0% { transform: scale(.8); opacity: 0; }
  14% { opacity: .35; }
  100% { transform: scale(1.9); opacity: 0; }
}
@media (min-width: 1500px) {
  .page { padding-left: 60px; padding-right: 60px; }
  .scene-heading { max-width: 1280px; margin: auto; }
  .masthead { min-height: 125px; }
}
@media (max-width: 1000px) {
  .page { padding-left: max(22px, env(safe-area-inset-left)); padding-right: max(22px, env(safe-area-inset-right)); }
  .masthead { min-height: 95px; }
  .intro h1 { font-size: 35px; }
  .story-bubble { width: 220px; padding: 13px 15px; }
  .story-bubble p { font-size: 17px; }
  .reveal { gap: 28px; }
  .footer { flex-wrap: wrap; row-gap: 10px; }
  .footer p { order: 3; width: 100%; text-align: left; }
}
@media (max-width: 650px) {
  .page { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .wordmark { font-size: 21px; gap: 10px; }
  .brand-ripple { width: 31px; height: 31px; }
  .client-note { font-size: 8px; max-width: 132px; }
  .client-note strong { font-size: 9px; }
  .place-label { display: none; }
  .stage-caption { left: 8px; top: 8px; max-width: calc(100% - 16px); font-size: 9px; padding: 6px 8px; }
  .story-bubble { width: 195px; }
  .bubble-tray .story-bubbles { grid-template-columns: 1fr; gap: 10px; }
  .experience-bar { flex-wrap: wrap; padding: 16px 0; gap: 12px; }
  .story-status { width: 100%; }
  .story-controls { gap: 14px; margin-left: auto; }
  .progress span { width: 35px; }
  .bar-hint { font-size: 9px; max-width: 145px; text-align: right; line-height: 1.6; }
  .reveal { grid-template-columns: 1fr; gap: 23px; padding: 26px 0 16px; }
  .reveal-actions { max-width: 320px; text-align: left; }
  .reveal-actions .text-button { display: block; }
  .footer { font-size: 7px; gap: 16px; }
  .footer-end { font-size: 9px; }
  .story-instruction { font-size: 11px; }
}
@media (max-width: 650px) and (orientation: portrait) {
  .masthead { min-height: 88px; }
  .scene-heading { font-size: 8px; padding: 21px 0 12px; letter-spacing: 1px; }
  .orientation-note { display: flex; align-items: center; gap: 9px; font-size: 11px; line-height: 1.6; color: var(--muted); margin: 0 0 15px; }
  .orientation-note span { font-size: 26px; }
  .intro.overlay-panel { position: relative; left: auto; top: auto; transform: none; width: 100%; max-width: none; padding: 26px 21px; margin-top: 14px; }
  .intro h1 { font-size: 36px; }
  .cause span { padding: 12px 9px; }
  .gift-label { font-size: 18px; }
  .initial-ripple { --ripple-size: 36px; }
}
@media (max-height: 600px) and (orientation: landscape) {
  .masthead { min-height: 56px; }
  .wordmark { font-size: 20px; }
  .brand-ripple { width: 30px; height: 30px; }
  .scene-heading { padding: 10px 0; font-size: 8px; }
  /* Natural page scrolling keeps the uncropped image and all stories readable. */
  .intro.overlay-panel { position: relative; left: auto; top: auto; transform: none; width: min(100%, 420px); max-width: none; margin: 20px auto 0; padding: 20px 0; border: 0; background: transparent; }
  .intro h1 { font-size: 33px; }
  .intro-copy { font-size: 12px; line-height: 1.7; }
  .story-bubble { width: 210px; padding: 12px 14px; }
  .story-bubble p { font-size: 17px; }
  .compact .story-bubble { width: 182px; padding: 10px 12px; }
  .compact .story-bubble p { font-size: 16px; }
  .bubble-tray .story-bubbles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .experience-bar { min-height: 68px; padding: 12px 0; flex-wrap: wrap; }
  .story-controls { gap: 15px; margin-left: auto; }
  .stage-caption { left: 10px; top: 10px; padding: 6px 9px; font-size: 9px; }
  .reveal h2 { font-size: 30px; }
  .story-instruction { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .initial-ripple { display: none; }
}
