/* Journey site — one painted world in the meadow-trail palette. */
:root {
  --ink: #23301f;          /* deep moss: text on light */
  --ink-soft: #4d5a43;
  --paper: #f7f1e3;        /* cloud cream */
  --sky: #cfe6f3;
  --sky-deep: #86bbe0;
  --grass: #9cc26b;
  --grass-deep: #5e8d3d;
  --straw: #e3c472;
  --gold: #c98b3a;         /* warm accent, also the favicon */
  --dusk: #3b3a5e;
  --shadow: rgba(30, 40, 25, 0.35);
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.6 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }

/* ---------- header: name left, pill menu right (tagrobot-style) ---------- */
.top {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px clamp(18px, 4vw, 48px);
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.brand { font: 500 21px/1 var(--serif); text-decoration: none; color: #fff; text-shadow: 0 1px 12px rgba(0, 0, 0, .25); transition: color .3s; }
.top.docked .brand { color: var(--ink); text-shadow: none; }
.pill {
  display: flex; align-items: center; gap: 6px; padding: 6px;
  border-radius: 999px; background: rgba(247, 241, 227, .72);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 6px 24px -10px var(--shadow);
}
.menu { display: flex; gap: 2px; }
.menu a { padding: 8px 14px; border-radius: 999px; font-size: 14px; text-decoration: none; color: var(--ink); transition: background .2s; }
.menu a:hover, .menu a:focus-visible { background: rgba(35, 48, 31, .08); }
.lang { display: flex; padding: 2px; border-radius: 999px; background: rgba(35, 48, 31, .08); }
.lang button {
  appearance: none; border: 0; background: none; color: var(--ink); cursor: pointer;
  padding: 6px 11px; border-radius: 999px; font: 600 12px/1 var(--sans);
}
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--paper); cursor: default; }
.lang button:focus-visible, .menu a:focus-visible, .brand:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
@media (max-width: 640px) { .menu { display: none; } }

/* ---------- full-screen painted panels ---------- */
.panel { position: relative; min-height: 100svh; display: grid; align-content: center; overflow: clip; isolation: isolate; color: #fff; }
.panel-short { min-height: 78svh; }
.scene, .scene video, .scene img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -2; }
.panel::after { /* keeps text legible over bright painted skies */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, rgba(20, 30, 20, .42) 0%, rgba(20, 30, 20, .14) 45%, rgba(20, 30, 20, 0) 70%);
}
/* Painted backdrop under each loop: shows while the poster loads, or if video is unavailable. */
.scene[data-scene] {
  background:
    radial-gradient(60% 30% at 70% 30%, rgba(255, 255, 255, .85), transparent 70%),
    radial-gradient(120% 40% at 30% 105%, var(--grass-deep), transparent 60%),
    radial-gradient(140% 45% at 80% 100%, var(--grass), transparent 62%),
    linear-gradient(180deg, var(--sky-deep), var(--sky) 55%, var(--straw));
}
/* The opening film moves through bright skies and busy towns, so its text gets a deeper
   shade: a band down the left on wide screens, a band across the middle on phones. */
#opening::after { background: linear-gradient(90deg, rgba(14, 22, 16, .62) 0%, rgba(14, 22, 16, .34) 36%, rgba(14, 22, 16, 0) 62%); }
@media (max-width: 640px) {
  #opening::after { background: linear-gradient(180deg, rgba(14, 22, 16, 0) 28%, rgba(14, 22, 16, .5) 44%, rgba(14, 22, 16, .5) 58%, rgba(14, 22, 16, 0) 74%); }
}
#opening .panel-text { text-shadow: 0 2px 22px rgba(0, 0, 0, .45), 0 1px 3px rgba(0, 0, 0, .35); }
.panel-text { padding: 0 clamp(20px, 7vw, 96px); max-width: 760px; text-shadow: 0 2px 18px rgba(0, 0, 0, .25); }
#opening h1 { margin: 0; font: 400 clamp(52px, 9vw, 128px)/.95 var(--serif); letter-spacing: -0.02em; }
.tagline { margin: 18px 0 0; font: 400 clamp(19px, 2vw, 26px)/1.4 var(--serif); font-style: italic; opacity: .95; }
.panel h2 { margin: 0; font: 400 clamp(30px, 4vw, 52px)/1.1 var(--serif); }
.panel h2 + p { margin: 14px 0 0; font-size: clamp(17px, 1.5vw, 20px); max-width: 34ch; }
.cue { position: absolute; left: 50%; bottom: 28px; translate: -50% 0; display: grid; justify-items: center; gap: 8px; font-size: 13px; letter-spacing: .08em; text-decoration: none; opacity: .85; }
.cue i { display: block; width: 1px; height: 40px; background: currentColor; transform-origin: top; animation: cue 2.4s ease-in-out infinite; }
@keyframes cue { 0%, 100% { scale: 1 .35; opacity: .4 } 50% { scale: 1 1; opacity: 1 } }

/* ---------- journey: a pinned 3D map the page scrolls through ---------- */
#journey { position: relative; background: #dce8e4; overflow-anchor: none; }
.js #journey { height: calc(var(--journey-units, 37) * 50svh + 100svh); }
.journey-stage { position: sticky; top: 0; height: 100svh; overflow: hidden; }
.journey-stage canvas { display: block; width: 100%; height: 100%; }
html:not(.js) .journey-caption, html:not(.js) .timeline { display: none; }

/* caption: a small card that appears when the plane lands */
.journey-caption {
  position: absolute; z-index: 2; left: clamp(16px, 5vw, 72px); top: clamp(88px, 16svh, 160px); max-width: min(78vw, 420px);
  padding: 16px 20px 14px; border-radius: 18px; background: rgba(247, 241, 227, .86); backdrop-filter: blur(6px);
  box-shadow: 0 12px 32px -18px var(--shadow); color: var(--ink);
  opacity: 0; transform: translateY(8px); transition: opacity .45s ease, transform .45s ease; pointer-events: none;
}
.journey-caption.is-shown { opacity: 1; transform: none; }
.jc-year { font: 600 13px/1 var(--sans); letter-spacing: .12em; color: var(--gold); }
.jc-name { margin: 6px 0 0; font: 400 clamp(28px, 3.4vw, 40px)/1.05 var(--serif); }
.jc-text { margin: 6px 0 0; font-size: 16px; color: var(--ink-soft); }
.jc-text:empty { display: none; }

/* timeline: years along the bottom, filling in as the plane goes */
.timeline { position: absolute; z-index: 2; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  width: min(92vw, 880px); padding: 10px 14px 8px; border-radius: 999px; background: rgba(247, 241, 227, .86); backdrop-filter: blur(6px);
  box-shadow: 0 10px 28px -16px var(--shadow); overflow-x: auto; scrollbar-width: none; }
.timeline::-webkit-scrollbar { display: none; }
.timeline ol { position: relative; display: flex; margin: 0; padding: 0; list-style: none; min-width: 560px; }
.timeline li { flex: 1 1 0; display: grid; justify-items: center; }
/* the line runs from the first dot to the last: each stop gets an equal column, dots at column centres */
.tl-track { position: absolute; z-index: -1; left: calc(50% / var(--n)); right: calc(50% / var(--n)); top: 25px; height: 2px; background: rgba(35, 48, 31, .15); border-radius: 2px; }
.tl-fill { position: absolute; inset: 0; background: var(--gold); transform-origin: left; transform: scaleX(0); transition: transform .3s ease; }
.timeline ol { isolation: isolate; }
.timeline button { appearance: none; border: 0; background: none; cursor: pointer; display: grid; justify-items: center; gap: 4px;
  padding: 4px 6px; border-radius: 12px; color: var(--ink-soft); font: 400 12px/1.1 var(--sans); min-width: 64px; }
.timeline button::before { content: ""; order: 1; width: 10px; height: 10px; border-radius: 50%; background: var(--paper); border: 2px solid rgba(35, 48, 31, .35); transition: background .3s, border-color .3s; }
.tl-year { order: 0; font-weight: 600; letter-spacing: .04em; }
.tl-name { order: 2; white-space: nowrap; }
.timeline button.is-past::before { background: var(--gold); border-color: var(--gold); }
.timeline button[aria-current="step"] { color: var(--ink); }
.timeline button[aria-current="step"]::before { box-shadow: 0 0 0 4px rgba(201, 139, 58, .25); }
.timeline button:hover, .timeline button:focus-visible { color: var(--ink); background: rgba(255, 255, 255, .5); outline: none; }
.timeline button:focus-visible { box-shadow: 0 0 0 2px var(--gold); }

/* still painted map when WebGL is unavailable */
.journey-fallback { position: absolute; inset: 0; display: grid; place-items: center; background: #dce8e4; }
.journey-fallback svg { width: 100%; height: 100%; }
.fb-route { fill: none; stroke: #9c3b2a; stroke-width: 3; stroke-dasharray: 10 7; stroke-linecap: round; }
.fb-stop circle { fill: var(--paper); stroke: var(--ink); stroke-width: 2.5; }
.fb-stop.is-current circle { fill: var(--gold); }

/* ---------- ending ---------- */
.contact, .sites { list-style: none; display: flex; flex-wrap: wrap; gap: 10px; margin: 22px 0 0; padding: 0; }
.contact a, .sites a {
  display: inline-block; padding: 10px 18px; border-radius: 999px; text-decoration: none; font-weight: 600; font-size: 15px;
  background: rgba(247, 241, 227, .16); border: 1px solid rgba(255, 255, 255, .45); backdrop-filter: blur(6px);
  transition: background .2s, color .2s;
}
.contact a:hover, .contact a:focus-visible { background: var(--paper); color: var(--ink); }
.sites a { font-weight: 400; font-size: 14px; border-color: rgba(255, 255, 255, .25); }

[hidden] { display: none !important; }

/* ---------- 中文 ---------- */
:lang(zh-CN) body { font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", var(--sans); }
:lang(zh-CN) h1, :lang(zh-CN) h2, :lang(zh-CN) .tagline, :lang(zh-CN) .brand { font-family: "Noto Serif SC", "Songti SC", var(--serif); font-style: normal; letter-spacing: .02em; }
:lang(zh-CN) #opening h1 { font-weight: 700; font-size: clamp(46px, 8vw, 112px); line-height: 1.1; }
:lang(zh-CN) .panel h2 + p { line-height: 1.85; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cue i { animation: none; }
}
