/* ============================================================
   Layout & components
   ============================================================ */

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--sp-3); }

/* ---------- Top masthead ---------------------------------- */
.masthead {
  position: relative; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
}
.masthead .brand { font-family: var(--font-mono); font-size: var(--t-small); letter-spacing: 0.18em; text-transform: uppercase; }
.masthead .brand b { color: var(--gold-deep); }
.masthead nav a { font-family: var(--font-mono); font-size: var(--t-micro); letter-spacing: 0.16em; text-transform: uppercase; text-decoration: none; color: var(--ink-3); margin-left: var(--sp-3); transition: color .2s; }
.masthead nav a:hover { color: var(--ink); }
.masthead .mast-right { display: inline-flex; align-items: center; gap: var(--sp-3); }

/* language toggle — matches the Observatory's minimal EN·中文 */
.lang-toggle { display: inline-flex; align-items: center; gap: 0.4em; }
.lang-btn {
  font-family: var(--font-mono); font-size: var(--t-micro); letter-spacing: 0.06em;
  color: var(--ink-3); padding: 0.2em 0.35em; line-height: 1;
  border: 0; background: none; cursor: pointer;
  transition: color .2s var(--ease);
}
.lang-btn:hover { color: var(--ink-2); }
.lang-btn.is-active { color: var(--gold-deep); }
.lang-btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 3px; }
.lang-sep { color: var(--ink-3); opacity: 0.5; font-family: var(--font-mono); font-size: var(--t-micro); }

/* ---------- HERO ------------------------------------------ */
.hero { position: relative; padding: var(--sp-6) 0 var(--sp-5); text-align: center; overflow: hidden; }
.hero .kicker { display: block; margin-bottom: var(--sp-3); }
.hero h1 {
  font-size: var(--t-h1);
  max-width: 16ch; margin-inline: auto;
  line-height: 1.04;
  letter-spacing: -0.02em;
}
.hero h1 em { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--gold-deep); }
.hero .dek {
  max-width: 34rem; margin: var(--sp-3) auto 0;
  font-size: var(--t-lead); color: var(--ink-2); line-height: 1.5;
}
.hero .byline { margin-top: var(--sp-3); font-family: var(--font-mono); font-size: var(--t-micro); letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.hero .trophy-hero { width: min(260px, 60vw); margin: var(--sp-4) auto var(--sp-2); }
.hero .scroll-cue { margin-top: var(--sp-4); font-family: var(--font-mono); font-size: var(--t-micro); letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink-3); }
.hero .scroll-cue span { display: block; margin-top: 6px; animation: bob 1.8s var(--ease) infinite; }
@keyframes bob { 0%,100%{transform:translateY(0);opacity:.6} 50%{transform:translateY(5px);opacity:1} }

/* ---------- Thumbnail / champions nav strip --------------- */
.champ-strip { border-block: 1px solid var(--rule); background: var(--paper-2); position: sticky; top: 0; z-index: 25; }
.champ-strip .rail {
  display: flex; gap: 2px; overflow-x: auto; padding: 10px var(--sp-3);
  scrollbar-width: thin; scroll-snap-type: x proximity;
}
.champ-strip .rail::-webkit-scrollbar { height: 5px; }
.champ-strip .rail::-webkit-scrollbar-thumb { background: var(--rule); border-radius: 3px; }
.chip {
  position: relative; flex: 0 0 auto; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 9px 9px; border: 0; background: none; cursor: pointer;
  font-family: var(--font-mono); color: var(--ink-3); border-radius: var(--radius);
  transition: background .2s, color .2s, transform .2s; min-width: 58px;
}
.chip:hover { background: var(--paper-3); color: var(--ink); }
.chip:focus-visible { outline: 2px dashed var(--ink-3); outline-offset: 1px; }
/* active (current section) — must out-rank hover/focus */
.chip[aria-current="true"] { color: var(--ink); }
.chip[aria-current="true"]::after {
  content: ""; position: absolute; left: 9px; right: 9px; bottom: 2px;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.chip[aria-current="true"] .chip-flag { box-shadow: 0 0 0 2px var(--accent); transform: translateY(-1px); }
.chip[aria-current="true"] .chip-year { color: var(--accent); font-weight: 700; }
.chip-flag { width: 30px; height: 20px; border-radius: 2px; object-fit: cover; box-shadow: 0 0 0 1px rgba(255,255,255,.16); transition: box-shadow .2s, transform .2s; }
.chip-year { font-size: 0.62rem; letter-spacing: 0.04em; }

/* ---------- Section intro band ---------------------------- */
.band { padding: var(--sp-6) 0 var(--sp-4); text-align: center; }
.band .kicker { display:block; margin-bottom: var(--sp-2); }
.band h2 { font-size: var(--t-h2); max-width: 18ch; margin-inline: auto; }
.band p { max-width: var(--measure); margin: var(--sp-2) auto 0; color: var(--ink-2); }

/* ---------- SCROLLYTELLING -------------------------------- */
.scrolly { position: relative; }
.scrolly .layout { display: grid; grid-template-columns: 1.05fr 1fr; gap: var(--sp-6); align-items: start; }

/* reading progress through the 22 finals */
.progress {
  position: sticky; top: 60px; z-index: 20; height: 3px;
  background: var(--paper-3); border-radius: 3px; overflow: hidden; margin: 0 0 var(--sp-2);
}
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .12s linear, background .5s var(--ease); }

/* === the hero side: trophy + year + champion === */
.scrolly .sticky {
  position: sticky; top: 80px; height: calc(100vh - 80px);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--sp-2);
}
.stage {
  position: relative; width: 100%; max-width: 460px; aspect-ratio: 1 / 1;
  display: grid; place-items: center; overflow: hidden;
  perspective: 1200px; /* turntable depth for the trophy */
}
/* accent glow pulse fired on each tournament change */
.stage.beat .stage-wash { animation: washPulse .8s var(--ease); }
@keyframes washPulse { 0%{transform:scale(1);opacity:.65} 40%{transform:scale(1.12);opacity:1} 100%{transform:scale(1);opacity:1} }
/* huge faint year watermark, tinted by nation accent, behind the trophy */
.stage-year-bg {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 0;
  font-family: var(--font-display); font-weight: 800; font-variant-numeric: tabular-nums;
  font-size: clamp(4rem, 11vw, 10.5rem); line-height: 1; letter-spacing: -0.04em;
  color: var(--accent); opacity: 0.13; user-select: none; pointer-events: none;
  transition: color .5s var(--ease);
}
/* soft accent wash that grounds the trophy */
.stage-wash {
  position: absolute; inset: 10%; z-index: 0; border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 64%);
  filter: blur(10px); transition: background .5s var(--ease);
}
.stage .trophy-wrap {
  position: relative; z-index: 2; width: 50%;
  filter: drop-shadow(0 22px 26px rgba(0,0,0,.55));
}
.stage .trophy-wrap .t-layer svg { width: 100%; height: auto; }

/* Calm by default — motion only on meaningful moments (no idle decoration). */
.trophy-pop { transform-origin: 50% 72%; }
.trophy-pop.pop { animation: trophyPop .7s var(--ease); }   /* arrival of a new champion */
@keyframes trophyPop {
  0%   { transform: translateY(8px) scale(.96); }
  55%  { transform: translateY(-3px) scale(1.018); }
  100% { transform: translateY(0) scale(1); }
}
.trophy-float { position: relative; perspective: 900px; }   /* depth for the 1974 flip */
.t-layer {
  position: absolute; inset: 0; backface-visibility: hidden;
  transition: opacity .6s var(--ease), transform .6s var(--ease);  /* 1974 flip-morph */
}
.t-fifa { opacity: 0; }
/* liquid-gold morph overlay (shown only during the 1974 transition) */
.morph-svg {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4;
  pointer-events: none; opacity: 0; transition: opacity .3s var(--ease);
  filter: drop-shadow(0 18px 22px rgba(0,0,0,.55));
}
.morph-svg.on { opacity: 1; }
.stage .badge {
  position: absolute; z-index: 3; bottom: 3%; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 9px;
  background: rgba(24,27,34,0.82); backdrop-filter: blur(8px);
  border: 1px solid var(--rule);
  padding: 7px 14px; border-radius: 100px; box-shadow: 0 8px 22px rgba(0,0,0,.45);
  font-family: var(--font-mono); font-size: var(--t-small); white-space: nowrap;
}
.stage .badge img { width: 24px; height: 16px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255,255,255,.16); }
.stage .badge b { color: var(--accent); }

/* identity caption under the stage */
.stage-caption { text-align: center; max-width: 460px; }
.stage-edition { display: block; margin-bottom: 7px; }
.stage-champ {
  font-family: var(--font-display); font-weight: 700; font-size: var(--t-h3);
  display: flex; align-items: center; justify-content: center; gap: 10px; line-height: 1.1;
}
.stage-champ .flagmini { width: 30px; height: 20px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(255,255,255,.16); }
.stage-champ small { font-family: var(--font-serif); font-weight: 400; color: var(--ink-3); font-size: .8rem; }
.stage-foot {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 10px;
  font-family: var(--font-mono); font-size: var(--t-micro); letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3);
}
.stage-foot .stage-count { color: var(--accent); font-weight: 700; }

/* === continent pendulum: the prize swinging between two continents === */
.continent {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px;
  font-family: var(--font-mono); font-size: var(--t-micro); letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3);
}
.cont-end { transition: color .5s var(--ease); white-space: nowrap; }
.cont-track {
  position: relative; width: 132px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--rule), var(--paper-3), var(--rule));
}
.cont-track::before { /* faint centre tick */
  content: ""; position: absolute; left: 50%; top: -3px; width: 1px; height: 8px;
  background: var(--rule); transform: translateX(-50%);
}
.cont-dot {
  position: absolute; top: 50%; left: 50%; width: 12px; height: 12px; border-radius: 50%;
  background: var(--accent); transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
  transition: left .75s cubic-bezier(.5,1.5,.5,1), background .5s var(--ease); /* a little overshoot = pendulum */
}
.continent.is-eu .cont-dot { left: 6px; }
.continent.is-sa .cont-dot { left: calc(100% - 6px); }
.continent.is-eu .cont-eu,
.continent.is-sa .cont-sa { color: var(--accent); font-weight: 700; }

/* === scrolling steps: narrative + metadata only === */
.steps { display: flex; flex-direction: column; }
.step {
  min-height: 88vh; display: flex; flex-direction: column; justify-content: center;
  padding: var(--sp-5) 0; opacity: 0.4; transition: opacity .45s var(--ease);
}
.step.active { opacity: 1; }
.step .step-head {
  font-family: var(--font-mono); font-size: var(--t-small); letter-spacing: .18em;
  text-transform: uppercase; color: var(--accent); margin-bottom: var(--sp-1);
}
.step .step-head b { font-family: var(--font-display); font-weight: 700; }
.step .narr {
  font-family: var(--font-serif); font-size: var(--t-lead); color: var(--ink);
  max-width: var(--measure); line-height: 1.55; margin: 0;
}
.step .narr .lead { font-weight: 600; }
.step .star { margin-top: var(--sp-2); font-style: italic; color: var(--ink-2); }
.step .star::before { content: "★ "; color: var(--gold); font-style: normal; }

/* metadata grid (the museum-catalogue block) */
.meta {
  margin-top: var(--sp-3); display: grid; grid-template-columns: repeat(2, 1fr);
  gap: 0; border-top: 1px solid var(--rule); max-width: 32rem;
}
.meta .cell { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--rule); }
.meta .cell:nth-child(odd) { padding-left: 0; }
.meta .cell:nth-child(even) { padding-left: 14px; border-left: 1px solid var(--rule); }
.meta .k { font-family: var(--font-mono); font-size: var(--t-micro); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.meta .v { font-family: var(--font-display); font-weight: 600; font-size: 1.02rem; margin-top: 3px; font-variant-numeric: tabular-nums; }
.meta .v small { font-family: var(--font-serif); font-weight: 400; color: var(--ink-2); font-size: .82rem; }

/* trophy-era callout that fires at 1974 */
.era-flag {
  margin-top: var(--sp-3); padding: 12px 16px; border-left: 3px solid var(--gold);
  background: var(--gold-soft); border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--t-small); color: var(--ink); max-width: 32rem;
}
.era-flag b { font-family: var(--font-display); }

/* ---------- Upcoming (2026) treatment --------------------- */
.chip-flag--up {
  width: 30px; height: 20px; box-sizing: border-box;
  border: 1.5px dashed var(--gold-deep); border-radius: 2px;
  background: repeating-linear-gradient(45deg,
    transparent, transparent 3px,
    color-mix(in srgb, var(--gold-soft) 75%, transparent) 3px,
    color-mix(in srgb, var(--gold-soft) 75%, transparent) 6px);
}
/* not-yet-lifted trophy reads dimmer; year watermark softer */
.scrolly.is-upcoming .trophy-wrap { opacity: .5; filter: grayscale(.25) drop-shadow(0 14px 20px rgba(0,0,0,.55)); }
.scrolly.is-upcoming .stage-year-bg { opacity: .1; }
.scrolly.is-upcoming .stage-wash { opacity: .6; }
.stage-champ .to-come { font-family: var(--font-serif); font-style: italic; font-weight: 400; color: var(--ink-3); }
.meta .v .tbd { font-family: var(--font-serif); font-weight: 400; font-style: italic; color: var(--ink-3); }
.upcoming-flag {
  margin-top: var(--sp-3); padding: 12px 16px;
  border-left: 3px dashed var(--gold-deep); background: var(--paper-2);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: var(--t-small); color: var(--ink-2); max-width: 32rem;
}
.upcoming-flag b { font-family: var(--font-display); color: var(--ink); }

/* ---------- DNA / data-viz section ------------------------ */
.dna { padding: var(--sp-6) 0; }
#dna-mount { margin-top: var(--sp-4); }

/* ---------- Road to 2026 section -------------------------- */
.road { padding: var(--sp-6) 0 0; }
#road2026-mount { margin-top: var(--sp-4); }

/* ---------- Footer ---------------------------------------- */
.colophon { border-top: 1px solid var(--rule); background: var(--paper-2); padding: var(--sp-5) 0 var(--sp-6); margin-top: var(--sp-6); }
.colophon h3 { font-size: var(--t-h3); }
.colophon .cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--sp-4); margin-top: var(--sp-3); }
.colophon p, .colophon li { font-size: var(--t-small); color: var(--ink-2); line-height: 1.55; }
.colophon ul { list-style: none; padding: 0; margin: var(--sp-1) 0 0; }
.colophon .kicker { display:block; margin-bottom: var(--sp-1); }
.colophon a { color: var(--gold-deep); text-decoration: none; border-bottom: 1px solid var(--rule); }
.colophon .fine { margin-top: var(--sp-4); padding-top: var(--sp-2); border-top: 1px solid var(--rule); font-family: var(--font-mono); font-size: var(--t-micro); letter-spacing: .08em; color: var(--ink-3); }

/* ---------- Responsive ------------------------------------ */
@media (max-width: 860px) {
  .scrolly .layout { grid-template-columns: 1fr; gap: 0; }

  /* hero side becomes a compact sticky header bar that updates as you scroll */
  .scrolly .sticky {
    position: sticky; top: 58px; height: auto; z-index: 15;
    flex-direction: row; align-items: center; gap: var(--sp-2);
    padding: 10px var(--sp-1); border-bottom: 1px solid var(--rule);
    background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px);
  }
  .stage { width: 88px; max-width: 88px; aspect-ratio: 3/4; flex: 0 0 auto; }
  .stage-year-bg { font-size: 2.6rem; opacity: .14; }
  .stage-wash { inset: 4%; }
  .stage .trophy-wrap { width: 58%; }
  .stage .badge { display: none; }
  .stage-caption { text-align: left; flex: 1 1 auto; }
  .stage-edition { margin-bottom: 3px; }
  .stage-champ { justify-content: flex-start; font-size: 1.1rem; gap: 7px; }
  .stage-champ .flagmini { width: 24px; height: 16px; }
  .stage-foot { justify-content: flex-start; margin-top: 4px; }

  .progress { top: 58px; }
  .step { min-height: auto; padding: var(--sp-3) 0 var(--sp-4); opacity: 1; }
  .step.active { opacity: 1; }
  .meta, .era-flag, .step .narr { max-width: none; }

  .colophon .cols { grid-template-columns: 1fr; gap: var(--sp-3); }
  .masthead nav { display: none; }
}
