:root {
  --bg: #0f1116;
  --bg-2: #161a22;
  --ink: #ece7de;
  --ink-2: #a9a49a;
  --ink-3: #6f6b64;
  --line: rgba(236, 231, 222, .10);
  --vermilion: #c0392b;
  --vermilion-2: #e0533f;
  --sakura: #f2b8b5;
  --amber: #e8a24a;
  --serif: "Cormorant Garamond", "Noto Serif TC", Georgia, serif;
  --tc: "Noto Serif TC", "Cormorant Garamond", serif;
  --sans: "Inter", -apple-system, "PingFang TC", "Noto Sans TC", system-ui, sans-serif;
  --wrap: 1180px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img, video { max-width: 100%; display: block; }
code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .92em; color: var(--sakura); }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; letter-spacing: .005em; margin: 0; }
:lang(zh-Hant) h1, :lang(zh-Hant) h2, :lang(zh-Hant) h3 { font-family: var(--tc); font-weight: 600; }
h2 { font-size: clamp(30px, 3.6vw, 44px); line-height: 1.15; }
h3 { font-size: 22px; }
.kicker {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--amber);
  margin: 0 0 12px;
}
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(20px, 4vw, 48px); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(28px, 5vw, 72px); align-items: start; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }
section { padding: clamp(64px, 9vw, 120px) 0; border-top: 1px solid var(--line); }
.prose p { color: var(--ink-2); margin: 0 0 1em; max-width: 62ch; }
.prose h3 { color: var(--ink); margin-bottom: 8px; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 3vw, 32px);
  background: linear-gradient(to bottom, rgba(15,17,22,.85), rgba(15,17,22,0));
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--serif); font-size: 20px; letter-spacing: .02em; }
.brand-mark { font-size: 18px; }
.topnav { display: flex; align-items: center; gap: 4px; }
.topnav a, .topnav button {
  color: var(--ink-2); text-decoration: none; font-size: 13px; padding: 6px 10px;
  border-radius: 6px; background: none; border: 0; font-family: inherit; cursor: pointer;
}
.topnav a:hover, .topnav button:hover { color: var(--ink); background: rgba(255,255,255,.06); }
.topnav .gh { color: var(--ink); }
.topnav .lang { border: 1px solid var(--line); margin-left: 6px; min-width: 40px; }
@media (max-width: 720px) { .topnav a:not(.gh) { display: none; } }

/* ---------------------------------------------------------------- viewer */
.viewer {
  position: relative; height: 100svh; min-height: 520px; padding: 0; border: 0;
  background: #1b1f27; overflow: hidden;
}
#stage { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.viewer-fallback { position: absolute; inset: 0; }
.viewer-fallback img { width: 100%; height: 100%; object-fit: cover; }
.viewer-fallback p { position: absolute; left: 0; right: 0; bottom: 24px; text-align: center; margin: 0; text-shadow: 0 1px 8px #000; }

.loader {
  position: absolute; inset: 0; z-index: 20; display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 100%, #2b2620 0%, #14161c 55%, #0f1116 100%);
  transition: opacity .9s ease, visibility .9s;
}
.loader.is-done { opacity: 0; visibility: hidden; }
.loader-inner { text-align: center; width: min(360px, 80vw); }
.loader-kicker { font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 8px; }
.loader-title { font-size: clamp(44px, 8vw, 72px); font-style: italic; font-weight: 500; line-height: 1; margin-bottom: 28px; color: var(--sakura); }
.bar { height: 1px; background: var(--line); overflow: hidden; }
.bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--amber), var(--sakura)); transition: width .25s ease; }
.bar.indeterminate .bar-fill { width: 40%; animation: slide 1.2s ease-in-out infinite alternate; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
.loader-status { margin: 12px 0 0; font-size: 12px; color: var(--ink-3); letter-spacing: .06em; }

.hud { position: absolute; left: 0; right: 0; z-index: 10; pointer-events: none; padding: 0 clamp(16px, 3vw, 32px); }
.hud > * { pointer-events: auto; }
.hud-top { top: 84px; }
.hud-title h2 { font-size: clamp(26px, 3.2vw, 40px); text-shadow: 0 2px 20px rgba(0,0,0,.55); max-width: 18ch; }
.hud-title .kicker { text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.hud-hint { margin: 10px 0 0; font-size: 12px; color: var(--ink-2); letter-spacing: .04em; text-shadow: 0 1px 8px rgba(0,0,0,.6); }
.hud-bottom {
  bottom: 0; padding-bottom: max(18px, env(safe-area-inset-bottom));
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  background: linear-gradient(to top, rgba(15,17,22,.7), rgba(15,17,22,0));
  padding-top: 40px;
}
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.btn {
  font: 500 13px/1 var(--sans); color: var(--ink);
  background: rgba(20,22,28,.55); border: 1px solid rgba(236,231,222,.18);
  padding: 10px 14px; border-radius: 999px; cursor: pointer;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background .15s, border-color .15s, color .15s;
}
.btn:hover { background: rgba(40,44,54,.75); border-color: rgba(236,231,222,.35); }
.btn.primary { background: var(--vermilion); border-color: transparent; }
.btn.primary:hover { background: var(--vermilion-2); }
.btn.toggle { color: var(--ink-3); }
.btn.toggle.is-on { color: var(--ink); border-color: rgba(242,184,181,.55); }
.btn.toggle.is-on::before { content: "●"; font-size: 8px; color: var(--sakura); margin-right: 7px; vertical-align: 2px; }
.btn.toggle::before { content: "○"; font-size: 8px; color: var(--ink-3); margin-right: 7px; vertical-align: 2px; }
.stats { display: flex; gap: 14px; font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; letter-spacing: .04em; }
@media (max-width: 720px) { .stats { display: none; } .hud-top { top: 70px; } .hud-title h2 { font-size: 22px; } }

/* ---------------------------------------------------------------- intro */
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px 24px; margin: 32px 0 0; padding: 24px 0 0; border-top: 1px solid var(--line); }
.facts div { display: flex; flex-direction: column-reverse; }
.facts dt { font-size: 12px; color: var(--ink-3); letter-spacing: .06em; }
.facts dd { margin: 0; font-family: var(--serif); font-size: 28px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.1; }
@media (max-width: 520px) { .facts { grid-template-columns: repeat(2, 1fr); } }

/* ---------------------------------------------------------------- renders */
.still { margin: 32px 0 0; }
.still img { border-radius: 4px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
figcaption { margin-top: 12px; font-size: 13px; color: var(--ink-3); }
.video-row { margin-top: clamp(32px, 5vw, 64px); }
.video video { width: 100%; border-radius: 4px; background: #000; }

/* ---------------------------------------------------------------- pipeline */
.steps { list-style: none; margin: 40px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.steps li { background: var(--bg); padding: 28px 24px 32px; }
.steps .num { font-family: var(--serif); font-size: 32px; color: var(--vermilion-2); display: block; margin-bottom: 14px; line-height: 1; }
.steps h3 { font-size: 15px; margin-bottom: 10px; font-family: var(--sans); font-weight: 500; }
.steps p { margin: 0; color: var(--ink-2); font-size: 14px; }

/* ---------------------------------------------------------------- download */
.dl-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.dl-list a { display: flex; justify-content: space-between; gap: 16px; align-items: baseline; padding: 16px 0; border-bottom: 1px solid var(--line); text-decoration: none; }
.dl-list a:hover strong { color: var(--sakura); }
.dl-list strong { font-weight: 500; transition: color .15s; }
.dl-list span { color: var(--ink-3); font-size: 13px; text-align: right; }

/* ---------------------------------------------------------------- footer */
.footer { border-top: 1px solid var(--line); padding: 32px 0 48px; font-size: 13px; color: var(--ink-3); }
.footer p { margin: 0 0 6px; }
.footer a { color: var(--ink-2); text-decoration: none; }
