/* Cultivate: altitude survey */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin-standard-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-latin-ext-standard-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --mist: #dfe4dc;
  --mist-2: #c9d2c6;
  --mist-3: #eef1ea;
  --ink: #2f4a35;
  --ink-2: #4a6150;
  --deep: #1d2f23;
  --leaf: #5a3b1f;
  --scrim: 16 28 20;

  --sans: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --cjk-zh: "Songti SC", "STSong", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
  --cjk-ja: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", "Source Han Serif JP", serif;
  --face: var(--sans);

  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --rail: clamp(1.25rem, 4vw, 3.5rem);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.75, 0);

  color-scheme: light;
}
@media (min-width: 1100px) {
  :root { --rail: 12.5rem; }
}

html:lang(zh-Hans) { --face: "Archivo", var(--cjk-zh); }
html:lang(ja) { --face: "Archivo", var(--cjk-ja); }

*, *::before, *::after { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-color: var(--ink-2) var(--mist-2);
  background: var(--mist);
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
body {
  margin: 0;
  font-family: var(--face);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--mist);
  caret-color: var(--leaf);
  -webkit-font-smoothing: antialiased;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}
::selection { background: var(--ink); color: var(--mist-3); }
[data-tone="dark"] ::selection { background: var(--mist); color: var(--deep); }

h1, h2, p, dl, dd, ol { margin: 0; }
ol { padding: 0; list-style: none; }
a { color: inherit; text-underline-offset: 0.22em; text-decoration-thickness: 1px; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 1.5px solid currentColor; outline-offset: 4px; border-radius: 2px; }
svg { display: block; }

.skip {
  position: fixed; left: var(--gutter); top: 1rem; z-index: 50;
  padding: 0.6rem 0.9rem; background: var(--ink); color: var(--mist-3);
  transform: translateY(-200%); transition: transform 0.3s var(--ease-out);
}
.skip:focus-visible { transform: none; }

/* ---------- survey labels (shared voice) ---------- */
.ep-meta, .lang button, .alt a, .credits dt, .routes dt, .descend, .play, .act {
  font-stretch: 112%;
  font-weight: 520;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
  line-height: 1.2;
}
html:lang(zh-Hans) :is(.ep-meta, .lang button, .alt a, .credits dt, .routes dt, .descend, .play, .act),
html:lang(ja) :is(.ep-meta, .lang button, .alt a, .credits dt, .routes dt, .descend, .play, .act) {
  letter-spacing: 0.08em;
  font-size: 0.8125rem;
}

/* ---------- tone-aware chrome ---------- */
.lang, .alt, .alt li { color: var(--ink); transition: color 0.5s var(--ease-out); }
/* each piece of chrome reads the surface directly beneath it */
:is(.lang, .alt, .alt li)[data-on="dark"] { color: var(--mist-3); }

/* ---------- language blind ---------- */
.lang {
  position: fixed; z-index: 40;
  top: max(1rem, env(safe-area-inset-top)); right: var(--gutter);
  display: flex; gap: 0.25rem;
}
.lang { transition: color 0.5s var(--ease-out), opacity 0.45s var(--ease-out), transform 0.45s var(--ease-out); }
/* the blind lifts away while reading downward, and returns on any scroll up */
.lang[data-away]:not(:focus-within) { opacity: 0; transform: translateY(-0.6rem); pointer-events: none; }
.lang button {
  position: relative;
  padding: 0.65rem 0.55rem;
  min-height: 44px;
  letter-spacing: 0.12em;
}
.lang button[lang="zh-Hans"], .lang button[lang="ja"] { text-transform: none; letter-spacing: 0.06em; font-size: 0.8125rem; }
.lang button[lang="zh-Hans"] { font-family: "Archivo", var(--cjk-zh); }
.lang button[lang="ja"] { font-family: "Archivo", var(--cjk-ja); }
.lang button::after {
  content: ""; position: absolute; left: 0.55rem; right: 0.55rem; bottom: 0.45rem;
  height: 1px; background: currentColor;
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.45s var(--ease-out);
}
.lang button[aria-pressed="true"]::after { transform: scaleX(1); }
@media (hover: hover) {
  .lang button:hover::after { transform: scaleX(0.4); }
  .lang button[aria-pressed="true"]:hover::after { transform: scaleX(1); }
}

/* the destination-blind roll */
[data-i18n] { display: inline-block; }
:is(p, h1, h2, dt, dd)[data-i18n] { display: block; }
.is-rolling-out { animation: roll-out 0.18s var(--ease-in) both; }
.is-rolling-in { animation: roll-in 0.5s var(--ease-out) both; }
@keyframes roll-out { to { transform: translateY(-0.6em); opacity: 0; filter: blur(3px); } }
@keyframes roll-in { from { transform: translateY(0.7em); opacity: 0; filter: blur(3px); } }

/* ---------- altitude scale ---------- */
.alt {
  position: fixed; z-index: 30;
  right: var(--gutter);
  top: 50%;
  height: min(44svh, 22rem);
  transform: translateY(-50%);
  width: 1px;
}
.alt::before {
  content: ""; position: absolute; inset: 0 0 0 0; width: 1px; background: currentColor; opacity: 0.45;
}
.alt ol { position: absolute; inset: 0; }
.alt li { position: absolute; right: 0; top: calc(var(--i) * 100% / 3); transform: translateY(-50%); }
.alt li:nth-child(1) { --i: 0; }
.alt li:nth-child(2) { --i: 1; }
.alt li:nth-child(3) { --i: 2; }
.alt li:nth-child(4) { --i: 3; }
.alt a {
  display: flex; align-items: center; justify-content: flex-end;
  min-height: 44px; padding-right: 1rem;
  text-decoration: none; white-space: nowrap;
  font-weight: 420;
  transition: font-weight 0.4s var(--ease-out), opacity 0.4s var(--ease-out);
}
.alt a::after {
  content: ""; position: absolute; right: 0; top: 50%; width: 0.5rem; height: 1px; background: currentColor;
}
.alt a[aria-current="true"] { font-weight: 680; }
.alt-mark {
  position: absolute; right: -0.4rem; top: 0;
  width: 0.8rem; height: 2px; background: currentColor;
  transform: translateY(calc(var(--m, 0) * min(44svh, 22rem) - 1px));
  will-change: transform;
}
@media (hover: hover) { .alt a:hover { text-decoration: underline; } }
@media (max-width: 1099px) {
  .alt { right: calc(var(--gutter) * 0.6); height: min(36svh, 16rem); }
  .alt-mark { transform: translateY(calc(var(--m, 0) * min(36svh, 16rem) - 1px)); }
  .alt a { padding-right: 0.9rem; }
  .alt a > span { opacity: 0; transform: translateX(0.4rem); transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out); }
  .alt a[aria-current="true"] > span { opacity: 1; transform: none; }
  .alt a:focus-visible > span { opacity: 1; transform: none; }
}

@media (max-width: 760px) {
  /* on phones the scale keeps only its ticks, tight to the edge, so no label crosses the text column */
  .alt { right: 0.7rem; }
  .alt a { width: 2.25rem; padding-right: 0; }
  .alt a > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* ---------- hero: the descent ---------- */
.hero { position: relative; height: 230svh; --p: 0; }
.hero-stage { position: sticky; top: 0; height: 100svh; overflow: hidden; }
#terrain { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.hero.no-webgl .hero-stage,
.hero:not(.has-webgl) .hero-stage {
  /* no WebGL: the mist alone, with the faint swell of a massif behind it */
  background:
    radial-gradient(ellipse 70% 55% at 66% 34%, var(--mist-2) 0, rgb(201 210 198 / 0) 70%),
    var(--mist);
}
.hero-cloud {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, var(--mist) 0%, rgb(223 228 220 / 0) 22%, rgb(223 228 220 / 0) 70%, var(--mist) 100%);
  opacity: calc(0.35 + var(--p) * 0.65);
}
.hero-cloud::after {
  content: ""; position: absolute; inset: 0; background: var(--mist);
  opacity: clamp(0, calc((var(--p) - 0.72) * 3.6), 1);
}
.hero-copy {
  position: absolute;
  left: var(--gutter);
  right: var(--rail);
  bottom: clamp(2rem, 7svh, 5rem);
  opacity: clamp(0, calc(1 - var(--p) * 2.6), 1);
  transform: translateY(calc(var(--p) * -14svh));
  filter: blur(calc(var(--p) * 10px));
}
/* a mist pool under the title block, so the copy never sits on raw contours */
.hero-copy::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  inset: -40% -18% -30% calc(var(--gutter) * -1);
  background: radial-gradient(ellipse 60% 62% at 22% 62%, var(--mist) 0 34%, rgb(223 228 220 / 0.8) 54%, rgb(223 228 220 / 0) 84%);
}
@media (max-width: 760px) {
  /* on phones the copy spans the screen: the mist rises from below as a full-width bank */
  .hero-copy::before {
    inset: -48% calc(var(--gutter) * -1) -40%;
    background: linear-gradient(to top, var(--mist) 0 60%, rgb(223 228 220 / 0.86) 76%, rgb(223 228 220 / 0) 100%);
  }
}
.title {
  font-family: var(--sans);
  font-stretch: 125%;
  font-weight: 260;
  font-size: clamp(3.4rem, 11.2vw, 11.5rem);
  line-height: 0.86;
  letter-spacing: -0.035em;
  margin-left: -0.05em;
  color: var(--ink);
}
.subtitle {
  margin-top: clamp(1rem, 2.4svh, 1.6rem);
  font-stretch: 112%;
  font-weight: 560;
  font-size: clamp(1.05rem, 1.6vw, 1.45rem);
  letter-spacing: -0.005em;
  line-height: 1.25;
}
.hook {
  margin-top: 0.7rem;
  max-width: 34rem;
  color: var(--ink);
  font-size: clamp(1rem, 1.15vw, 1.125rem);
  line-height: 1.55;
  text-wrap: pretty;
}
.descend {
  display: inline-flex; align-items: center; gap: 0.75rem;
  margin-top: clamp(1.4rem, 3svh, 2.2rem);
  min-height: 44px;
  color: var(--leaf);
  text-decoration: none;
}
.descend svg { width: 0.8rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.5; transition: transform 0.5s var(--ease-out); }
@media (hover: hover) {
  .descend:hover span { text-decoration: underline; }
  .descend:hover svg { transform: translateY(4px); }
}
html:lang(zh-Hans) .subtitle, html:lang(ja) .subtitle { font-weight: 600; letter-spacing: 0.04em; }
html:lang(ja) :is(.hook, .lead, .body, .subtitle, .soon) { word-break: auto-phrase; line-break: strict; }
html:lang(zh-Hans) :is(.hook, .lead, .body, .soon) { line-break: strict; }
html:lang(zh-Hans) .hook, html:lang(ja) .hook { line-height: 1.85; max-width: 30rem; }

/* ---------- episodes: full-bleed film ---------- */
.ep { position: relative; }
.ep-frame {
  position: relative;
  height: 100svh;
  min-height: 32rem;
  background: var(--deep);
  overflow: hidden;
  color: var(--mist-3);
  transition: height 0.9s var(--ease-out), min-height 0.9s var(--ease-out);
}
#nanbaoshan .ep-frame {
  /* the film rises out of the cloud bank */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 22svh);
  mask-image: linear-gradient(to bottom, transparent 0, #000 22svh);
  background: transparent;
}
#nanbaoshan .ep-frame.is-playing { -webkit-mask-image: none; mask-image: none; background: #000; }
.ep-loop {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover;
  transition: opacity 0.6s var(--ease-out);
}
.ep-frame::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(to top, rgb(var(--scrim) / 0.78) 0%, rgb(var(--scrim) / 0.35) 34%, rgb(var(--scrim) / 0) 62%);
  transition: opacity 0.6s var(--ease-out);
}
.ep-over {
  position: absolute; z-index: 2;
  left: var(--gutter); right: var(--rail);
  bottom: clamp(2rem, 8svh, 5.5rem);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  column-gap: 2rem;
  transition: opacity 0.5s var(--ease-out), transform 0.7s var(--ease-out);
}
.ep-title {
  grid-column: 1 / -1;
  font-stretch: 125%;
  font-weight: 250;
  font-size: clamp(3rem, 9.4vw, 9.5rem);
  line-height: 0.88;
  letter-spacing: -0.035em;
  margin-left: -0.04em;
  text-wrap: balance;
}
html:lang(zh-Hans) .ep-title, html:lang(ja) .ep-title { font-weight: 400; letter-spacing: 0.02em; line-height: 1; }
html:lang(zh-Hans) .title, html:lang(ja) .title { font-family: var(--sans); }
.ep-meta { margin-top: 1.1rem; align-self: center; }
.play {
  display: inline-flex; align-items: center; gap: 0.9rem;
  margin-top: 1.1rem;
  min-height: 48px;
  justify-self: end;
}
.play svg { width: 3rem; height: 3rem; flex: none; }
.play circle { fill: none; stroke: currentColor; stroke-width: 1; transition: fill 0.4s var(--ease-out); }
.play path { fill: currentColor; transition: fill 0.4s var(--ease-out); }
@media (hover: hover) {
  .play:hover circle { fill: var(--mist-3); }
  .play:hover path { fill: var(--deep); }
}
.play:active svg { transform: scale(0.96); }
@media (max-width: 640px) {
  .ep-over { grid-template-columns: 1fr; }
  .play { justify-self: start; }
}

.ep-frame iframe {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; z-index: 3;
  opacity: 0; transition: opacity 0.6s var(--ease-out) 0.35s;
}
.ep-frame.is-playing {
  height: min(56.25vw, 100svh);
  min-height: 0;
  background: #000;
}
.ep-frame.is-playing iframe { opacity: 1; }
.ep-frame.is-playing .ep-loop,
.ep-frame.is-playing::after { opacity: 0; }
.ep-frame.is-playing .ep-over { opacity: 0; transform: translateY(1.5rem); pointer-events: none; }

/* ---------- episode notes: editorial ---------- */
.ep-notes {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(1rem, 2vw, 2rem);
  row-gap: 1.75rem;
  padding: clamp(4.5rem, 12vw, 10rem) var(--rail) clamp(5rem, 14vw, 12rem) var(--gutter);
  align-items: end;
}
.ep-notes .lead {
  grid-column: 1 / span 8;
  font-stretch: 100%;
  font-weight: 330;
  font-size: clamp(1.6rem, 3.1vw, 3rem);
  line-height: 1.14;
  letter-spacing: -0.02em;
  text-wrap: balance;
  max-width: 24ch;
}
.ep-notes .body {
  grid-column: 9 / span 4;
  color: var(--ink-2);
  max-width: 34ch;
  text-wrap: pretty;
}
.ep-notes--flip .lead { grid-column: 5 / span 8; justify-self: end; text-align: right; }
.ep-notes--flip .body { grid-column: 1 / span 4; grid-row: 1; }
html:lang(zh-Hans) .ep-notes .lead, html:lang(ja) .ep-notes .lead { font-weight: 400; line-height: 1.45; letter-spacing: 0.01em; max-width: 20em; font-size: clamp(1.4rem, 2.5vw, 2.4rem); }
html:lang(zh-Hans) .ep-notes .body, html:lang(ja) .ep-notes .body { line-height: 1.9; }
@media (max-width: 860px) {
  .ep-notes { grid-template-columns: 1fr; }
  .ep-notes > *, .ep-notes--flip > * { grid-column: 1 !important; grid-row: auto !important; justify-self: start !important; text-align: left !important; }
}

/* ---------- invest: the ground ---------- */
.invest {
  background: var(--ink);
  color: var(--mist-3);
  padding: clamp(5rem, 13vw, 11rem) var(--rail) clamp(4rem, 10vw, 8rem) var(--gutter);
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(1rem, 2vw, 2rem);
}
.invest-title {
  grid-column: 1 / -1;
  font-stretch: 125%;
  font-weight: 250;
  font-size: clamp(2.6rem, 7.2vw, 7.25rem);
  line-height: 0.92;
  letter-spacing: -0.035em;
  margin-left: -0.04em;
  text-wrap: balance;
}
html:lang(zh-Hans) .invest-title, html:lang(ja) .invest-title { font-weight: 400; letter-spacing: 0.02em; line-height: 1.1; }
.invest-case {
  grid-column: 1 / span 7;
  margin-top: clamp(2.5rem, 5vw, 4rem);
}
.invest-case .lead {
  font-weight: 380;
  font-size: clamp(1.35rem, 2.1vw, 2rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
  max-width: 26ch;
  text-wrap: balance;
}
.invest-case .body { margin-top: 1.25rem; max-width: 46ch; color: #c6d1c5; text-wrap: pretty; }
html:lang(zh-Hans) .invest-case .lead, html:lang(ja) .invest-case .lead { line-height: 1.55; font-weight: 400; }
html:lang(zh-Hans) .invest-case .body, html:lang(ja) .invest-case .body { line-height: 1.9; }
.routes {
  grid-column: 1 / -1;
  margin-top: clamp(3.5rem, 7vw, 6rem);
  border-top: 1px solid rgb(238 241 234 / 0.35);
}
.route {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(1rem, 2vw, 2rem);
  row-gap: 0.75rem;
  padding: clamp(1.5rem, 3vw, 2.25rem) 0;
  border-bottom: 1px solid rgb(238 241 234 / 0.35);
  align-items: baseline;
}
.route dt { grid-column: 1 / span 3; }
.route dd { grid-column: 4 / span 5; color: #c6d1c5; max-width: 40ch; }
.route .route-act { grid-column: 9 / span 4; justify-self: end; color: var(--mist-3); text-align: right; }
.act {
  display: inline-flex; align-items: center; gap: 0.7rem;
  min-height: 44px; padding: 0 1.1rem;
  border: 1px solid currentColor;
  border-radius: 999px;
  text-decoration: none;
  transition: background-color 0.35s var(--ease-out), color 0.35s var(--ease-out);
}
.act svg { width: 1.1rem; height: 0.7rem; fill: none; stroke: currentColor; stroke-width: 1.4; transition: transform 0.45s var(--ease-out); }
.act--pay { background: var(--mist-3); color: var(--deep); border-color: var(--mist-3); }
@media (hover: hover) {
  .act:hover { background: var(--mist-3); color: var(--deep); }
  .act--pay:hover { background: transparent; color: var(--mist-3); }
  .act:hover svg { transform: translateX(3px); }
}
.act:active { transform: scale(0.98); }
.soon { font-size: 0.9375rem; color: #c6d1c5; max-width: 24ch; margin: 0 0 1rem auto; }
@media (max-width: 860px) {
  .invest-case { grid-column: 1 / -1; }
  .route dt, .route dd, .route .route-act { grid-column: 1 / -1; justify-self: start; text-align: left; }
  .soon { margin-left: 0; }
}

/* ---------- credits ---------- */
.credits {
  background: var(--deep);
  color: #c6d1c5;
  padding: clamp(3rem, 6vw, 5rem) var(--rail) max(2.5rem, env(safe-area-inset-bottom)) var(--gutter);
}
.credits dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1.75rem clamp(1rem, 2vw, 2rem);
}
.credits dt { color: var(--mist-3); margin-bottom: 0.5rem; font-size: 0.6875rem; }
.credits dd { font-size: 0.9375rem; }
.credits-mark {
  margin-top: clamp(3rem, 8vw, 6rem);
  font-stretch: 125%;
  font-weight: 250;
  font-size: clamp(2.6rem, 14vw, 13rem);
  line-height: 0.8;
  letter-spacing: -0.04em;
  margin-left: -0.05em;
  color: rgb(238 241 234 / 0.14);
  user-select: none;
}

@media (prefers-reduced-motion: reduce) {
  .hero { height: 100svh; }
  .hero-copy { opacity: 1; transform: none; filter: none; }
  .hero-cloud { opacity: 0.35; }
  .hero-cloud::after { opacity: 0; }
  .is-rolling-out, .is-rolling-in { animation: none; }
  .ep-frame, .ep-over, .ep-loop { transition: none; }
}
