:root {
  --ink: #05070a;
  --ivory: #f0e7d8;
  --ivory-dim: rgba(240, 231, 216, .62);
  --amber: #d9ae72;
  --teal: #83b6b5;
  --serif: "Noto Serif TC", "Songti TC", serif;
  --sans: "Noto Sans TC", "PingFang TC", system-ui, sans-serif;
  --ui: Manrope, "Noto Sans TC", sans-serif;
  --en: "Cormorant Garamond", var(--serif);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ink); color: var(--ivory); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

/* ------------------------------------------------ film mode */
.is-film body { overscroll-behavior: none; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 0; }
#track { position: relative; width: 1px; pointer-events: none; }
.is-static #gl, .is-static #track, .is-static #hud, .is-static #subs, .is-static #credits, .is-static #final, .is-static #loader, .is-static #work { display: none !important; }
.is-film #static { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* loader: film leader countdown */
#loader { position: fixed; inset: 0; z-index: 50; display: grid; place-content: center; justify-items: center; gap: 18px; background: #000; transition: opacity 1.2s ease .2s, visibility 0s 1.4s; }
#loader.done { opacity: 0; visibility: hidden; }
#loader p { margin: 0; font: 500 12px/1 var(--ui); letter-spacing: .5em; color: rgba(240, 231, 216, .5); }
.leader { position: relative; width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; border: 1px solid rgba(240, 231, 216, .25); }
.leader::before, .leader::after { content: ""; position: absolute; background: rgba(240, 231, 216, .2); }
.leader::before { left: 50%; top: -30px; bottom: -30px; width: 1px; }
.leader::after { top: 50%; left: -30px; right: -30px; height: 1px; }
.leader i { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(rgba(217, 174, 114, .35) 0deg, transparent 0deg); animation: sweep 1s linear infinite; }
.leader .count { position: relative; font: 300 44px/1 var(--ui); letter-spacing: .04em; font-variant-numeric: tabular-nums; }
@keyframes sweep { to { transform: rotate(360deg); } from { transform: rotate(0deg); } }
.leader i { background: conic-gradient(rgba(217, 174, 114, .4) 0 90deg, transparent 90deg); }

/* HUD */
#hud { position: fixed; inset: 0; z-index: 10; pointer-events: none; opacity: 0; transition: opacity 1.6s ease 1.2s; }
.is-ready #hud { opacity: 1; }
#hud > * { pointer-events: auto; }
.brand { position: absolute; top: max(18px, env(safe-area-inset-top)); left: 22px; font: 700 18px/1 var(--ui); letter-spacing: .02em; text-decoration: none; color: var(--ivory); mix-blend-mode: difference; }
.brand b { color: var(--amber); }
.hud-r { position: absolute; top: max(12px, env(safe-area-inset-top)); right: 14px; display: flex; gap: 4px; }
.hud-r button { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 12px; font: 500 13px/1 var(--sans); letter-spacing: .08em; color: var(--ivory-dim); border-radius: 999px; transition: color .3s, background .3s; }
.hud-r button:hover, .hud-r button:focus-visible { color: var(--ivory); background: rgba(240, 231, 216, .08); }
.hud-r svg { width: 18px; height: 18px; fill: currentColor; }
.hud-r svg .w { fill: none; stroke: currentColor; stroke-width: 1.6; opacity: .35; }
#sound[aria-pressed="true"] { color: var(--amber); }
#sound[aria-pressed="true"] svg .w { opacity: 1; }
#chapters { position: absolute; top: 60px; right: 14px; display: grid; gap: 2px; padding: 10px; background: rgba(8, 10, 12, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid rgba(240, 231, 216, .1); border-radius: 14px; opacity: 0; visibility: hidden; transform: translateY(-6px); transition: .3s; }
#chapters.open { opacity: 1; visibility: visible; transform: none; }
#chapters button { display: flex; gap: 14px; align-items: baseline; padding: 10px 14px; border-radius: 9px; text-align: left; font: 500 14px/1.2 var(--serif); color: var(--ivory-dim); }
#chapters button span { font: 500 11px/1 var(--ui); letter-spacing: .2em; color: rgba(240, 231, 216, .4); }
#chapters button:hover, #chapters button.on { color: var(--ivory); background: rgba(240, 231, 216, .06); }
#chapters button.on span { color: var(--amber); }
#reel { position: absolute; left: 22px; bottom: max(20px, env(safe-area-inset-bottom)); display: flex; align-items: baseline; gap: 8px; font: 500 11px/1 var(--ui); letter-spacing: .22em; color: var(--ivory-dim); }
#reel .no { font-size: 13px; color: var(--ivory); }
#reel .name { font: 500 12px/1 var(--serif); letter-spacing: .18em; margin-left: 6px; }
#reel .bar { position: relative; align-self: center; width: 90px; height: 1px; margin-left: 10px; background: rgba(240, 231, 216, .18); overflow: hidden; }
#reel .bar i { position: absolute; inset: 0; background: var(--amber); transform-origin: 0 50%; transform: scaleX(0); }
#hint { position: absolute; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0; font: 500 12px/1 var(--sans); letter-spacing: .42em; color: var(--ivory-dim); white-space: nowrap; }
#hint span { animation: breathe 2.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .35; } }

/* narration */
#subs { position: fixed; inset: 0; z-index: 5; pointer-events: none; }
.sub { position: absolute; margin: 0; visibility: hidden; will-change: transform, opacity; font: 500 clamp(19px, 2.05vw, 30px)/1.8 var(--serif); letter-spacing: .1em; color: var(--ivory); text-shadow: 0 2px 24px rgba(0, 0, 0, .85), 0 0 2px rgba(0, 0, 0, .6); max-width: min(17em, 86vw); }
.sub-l { left: 9vw; top: 56%; }
.sub-c { left: 50%; bottom: 16vh; transform: translateX(-50%); text-align: center; width: max-content; }
.sub-r { right: 9vw; top: 56%; text-align: right; }
@media (max-aspect-ratio: 1/1) {
  .sub, .sub-l, .sub-r { left: 7vw; right: 7vw; top: auto; bottom: 15vh; text-align: center; transform: none; width: auto; max-width: none; }
  .sub-c { left: 7vw; right: 7vw; transform: none; }
}

/* credits crawl */
#credits { position: fixed; inset: 0; z-index: 6; overflow: hidden; visibility: hidden; pointer-events: none; -webkit-mask-image: linear-gradient(transparent 6%, #000 22%, #000 78%, transparent 94%); mask-image: linear-gradient(transparent 6%, #000 22%, #000 78%, transparent 94%); }
.roll { position: absolute; left: 0; right: 0; top: 0; will-change: transform; padding: 0 20px; text-align: center; }
.c-head { margin: 0 0 18px; font: 500 12px/1 var(--ui); letter-spacing: .5em; color: var(--ivory-dim); }
.c-title { margin: 0 0 12vh; font: 600 clamp(30px, 4vw, 52px)/1.3 var(--serif); letter-spacing: .12em; }
#credits dl { margin: 0 auto; max-width: 640px; display: grid; gap: 22px; }
#credits dl div { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: baseline; }
#credits dt { text-align: right; font: 400 clamp(13px, 1.1vw, 15px)/1.5 var(--sans); letter-spacing: .16em; color: var(--ivory-dim); }
#credits dd { margin: 0; text-align: left; font: 500 clamp(16px, 1.4vw, 19px)/1.5 var(--serif); letter-spacing: .1em; }
.c-sec { margin: 14vh 0 26px; font: 500 12px/1 var(--ui); letter-spacing: .5em; color: var(--amber); }
.c-thanks { margin: 0; font: 500 clamp(18px, 1.6vw, 22px)/1.8 var(--serif); letter-spacing: .12em; }
.c-note { margin: 12vh auto 0; max-width: 30em; font: 400 13px/1.9 var(--sans); letter-spacing: .08em; color: var(--ivory-dim); }
.c-end { margin: 18vh 0 0; font: 500 clamp(20px, 2vw, 28px)/1.9 var(--serif); letter-spacing: .14em; }

/* final card */
#final { position: fixed; inset: 0; z-index: 7; display: grid; place-items: end center; padding: 0 20px max(9vh, 60px); visibility: hidden; pointer-events: none; }
#final .f-wrap { pointer-events: auto; text-align: center; max-width: 760px; padding: 28px 26px 22px; border-radius: 22px; background: radial-gradient(120% 140% at 50% 120%, rgba(5, 7, 10, .82), rgba(5, 7, 10, .25) 60%, transparent 80%); }
.f-en { margin: 0 0 12px; font: italic 400 clamp(16px, 1.6vw, 22px)/1 var(--en); letter-spacing: .28em; color: var(--amber); }
#final h2 { margin: 0; font: 600 clamp(30px, 4.4vw, 60px)/1.25 var(--serif); letter-spacing: .1em; text-shadow: 0 4px 40px rgba(0, 0, 0, .7); }
.f-sub { margin: 14px 0 24px; font: 500 clamp(14px, 1.2vw, 17px)/1.6 var(--sans); letter-spacing: .14em; color: var(--ivory); text-shadow: 0 2px 16px rgba(0, 0, 0, .8); }
.f-cta { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 22px; border-radius: 999px; border: 1px solid rgba(240, 231, 216, .35); background: rgba(5, 7, 10, .6); font: 500 15px/1 var(--sans); letter-spacing: .08em; text-decoration: none; color: var(--ivory); transition: transform .3s, background .3s, border-color .3s; }
.btn:hover { transform: translateY(-2px); border-color: var(--ivory); }
.btn.gold { background: var(--amber); border-color: var(--amber); color: #1a140c; font-weight: 700; }
.btn.gold:hover { background: #e7c08a; }
.f-links { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; margin-top: 18px; font: 500 13px/1 var(--sans); letter-spacing: .1em; }
.f-links button, .f-links a { color: var(--ivory-dim); text-decoration: none; padding: 10px 4px; }
.f-links button:hover, .f-links a:hover { color: var(--ivory); }
.f-brand { margin: 18px 0 0; font: 500 12px/1.6 var(--sans); letter-spacing: .14em; color: var(--ivory-dim); }
.f-brand b { color: var(--amber); }

/* work modal */
.modal { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .72); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); opacity: 0; visibility: hidden; transition: opacity .4s, visibility 0s .4s; }
.modal.open { opacity: 1; visibility: visible; transition: opacity .4s; }
.m-card { position: relative; width: min(980px, 100%); max-height: 92vh; overflow: auto; border-radius: 18px; background: #0d0f11; border: 1px solid rgba(240, 231, 216, .12); transform: translateY(14px) scale(.98); transition: transform .5s cubic-bezier(.2, .8, .2, 1); }
.modal.open .m-card { transform: none; }
.m-card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; }
.m-body { padding: 22px 26px 26px; display: grid; gap: 8px; justify-items: start; }
.w-kind { margin: 0; font: 500 12px/1 var(--ui); letter-spacing: .3em; color: var(--amber); text-transform: uppercase; }
.w-name { margin: 0; font: 600 26px/1.3 var(--serif); letter-spacing: .08em; }
.w-desc { margin: 0 0 10px; font: 400 15px/1.8 var(--sans); color: var(--ivory-dim); }
.w-close { position: absolute; top: 10px; right: 10px; width: 44px; height: 44px; border-radius: 50%; background: rgba(0, 0, 0, .6); font-size: 24px; line-height: 1; z-index: 2; }

/* ------------------------------------------------ static mode (reduced motion / no WebGL) */
.is-static #static { display: block; }
#static { background: var(--ink); }
#static img { display: block; width: 100%; height: auto; }
.s-hero, .s-ch { position: relative; }
.s-hero .s-t, .s-ch .s-t { padding: 36px 22px 64px; max-width: 760px; margin: 0 auto; }
.s-dark { padding-top: 64px; background: radial-gradient(80% 80% at 50% 30%, #0e2326, var(--ink)); }
.eyebrow { margin: 0 0 10px; font: 500 12px/1 var(--ui); letter-spacing: .4em; color: var(--amber); }
#static h1 { margin: 0; font: 600 clamp(34px, 6vw, 64px)/1.25 var(--serif); letter-spacing: .1em; }
#static h2 { margin: 0 0 14px; font: 600 clamp(24px, 3.4vw, 38px)/1.35 var(--serif); letter-spacing: .08em; }
#static p { font: 400 17px/1.9 var(--serif); letter-spacing: .06em; color: var(--ivory); }
#static .en { font: italic 400 20px/1.4 var(--en); letter-spacing: .2em; color: var(--ivory-dim); }
#static .price strong { font: 300 32px/1 var(--ui); color: var(--amber); }
.s-works, .s-credits { padding: 64px 22px; max-width: 1100px; margin: 0 auto; }
#s-works-list { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 22px; }
#s-works-list a { display: block; text-decoration: none; }
#s-works-list img { border-radius: 10px; aspect-ratio: 390 / 650; object-fit: cover; object-position: top; border: 1px solid rgba(240, 231, 216, .12); }
#s-works-list strong { display: block; margin-top: 10px; font: 600 17px/1.4 var(--serif); }
#s-works-list span { font: 400 13px/1.5 var(--ui); color: var(--ivory-dim); }
.s-foot { padding: 40px 22px 60px; text-align: center; color: var(--ivory-dim); }
.s-foot p { font-size: 14px !important; }

@media (max-width: 640px) {
  .brand { left: 16px; font-size: 16px; }
  .hud-r { right: 6px; }
  .hud-r button { padding: 0 9px; font-size: 12px; }
  #skip { display: none !important; }
  #reel { left: 16px; }
  #reel .bar { width: 54px; }
  #hint { bottom: 64px; }
  #credits dl div { grid-template-columns: 1fr; gap: 2px; }
  #credits dt, #credits dd { text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
#static-note { margin: 0; padding: 12px 18px; text-align: center; font: 500 14px/1.7 var(--sans); background: #15130f; color: var(--ivory-dim); border-bottom: 1px solid rgba(240,231,216,.1); }
#static-note a { color: var(--amber); white-space: nowrap; }
