/* ===== THE POUR — 一杯酒的解構 ===== */
:root {
  --ink: #EEF0FF;          /* 由 JS 隨場景明暗切換 */
  --gold: #FFB547;
  --pink: #FF4D8D;
  --purple: #7B5CFF;
  --line: rgba(128, 128, 160, 0.28);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #05060d;
  color: var(--ink);
  font-family: 'Space Grotesk', 'Noto Sans TC', -apple-system, sans-serif;
  line-height: 1.75;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---------- 載入畫面 ---------- */
.loader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: #05060d;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader-ring { position: absolute; width: min(58vmin, 340px); height: min(58vmin, 340px); }
.loader-ring circle { fill: none; stroke-width: 1; transform: rotate(-90deg); transform-origin: center; }
.ring-track { stroke: rgba(255, 255, 255, 0.09); }
.ring-fill {
  stroke: #FFB547; stroke-linecap: round;
  transition: stroke-dashoffset 0.5s cubic-bezier(0.22, 1, 0.36, 1);
  filter: drop-shadow(0 0 10px rgba(255, 181, 71, 0.5));
}
.loader-center { text-align: center; color: #EEF0FF; }
.loader-label { font-size: 13px; letter-spacing: 4px; text-transform: uppercase; color: #8E95BF; }
.loader-pct { margin-top: 10px; font-family: 'Orbitron', sans-serif; font-size: 34px; font-weight: 700; }

/* ---------- 圖層 ---------- */
/* 底色：JS 逐格改變，明暗場景之間平滑過渡 */
.bg-layer {
  position: fixed; inset: 0; z-index: 0;
  background-color: #05060d;
}

/* 巨型字體：壓在 3D 畫布之下，所以酒杯會自然遮住文字 */
.type-layer {
  position: fixed; inset: 0; z-index: 1;
  pointer-events: none;
  display: flex; flex-direction: column; justify-content: center;
  --type-shift: 0px;
}
.type-row {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  letter-spacing: -0.04em;
  white-space: nowrap;
  color: var(--ink);
  opacity: 0.085;
  line-height: 0.86;
  transform: translateX(var(--type-shift));
  transition: color 0.4s linear;
}
.tr-1 { font-size: clamp(90px, 21vw, 300px); }
.tr-2 { font-size: clamp(52px, 11vw, 158px); align-self: flex-end; transform: translateX(calc(var(--type-shift) * -0.55)); }
.tr-3 { font-size: clamp(70px, 16vw, 230px); opacity: 0.06; transform: translateX(calc(var(--type-shift) * 0.35)); }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 2; display: block; }

/* 零件標籤：位置由 JS 每格投影計算 */
.label-layer {
  position: fixed; inset: 0; z-index: 3;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.part-label {
  position: absolute; top: 0; left: 0;
  display: flex; align-items: center; gap: 10px;
  transform: translate3d(-100px, -100px, 0);
  will-change: transform;
}
.pl-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 4px rgba(255, 181, 71, 0.16), 0 0 12px rgba(255, 181, 71, 0.8);
  flex-shrink: 0;
}
.pl-text {
  display: flex; flex-direction: column; line-height: 1.35;
  padding-left: 44px; margin-left: -38px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
  font-size: 11px; letter-spacing: 1.4px;
  color: color-mix(in srgb, var(--ink) 62%, transparent);
}
.pl-text b {
  font-size: 14px; font-weight: 700; letter-spacing: 2px;
  color: var(--ink);
}

/* 暗角：只在深色場景需要，明亮場景由 JS 把它淡出，否則會把攝影棚壓成灰的 */
.scrim {
  position: fixed; inset: 0; z-index: 4; pointer-events: none;
  background:
    radial-gradient(ellipse 62% 52% at 50% 46%, rgba(5, 6, 13, 0) 0%, rgba(5, 6, 13, 0.5) 100%);
  opacity: 1;
}

/* ---------- 頂部列 / 進度軌 ---------- */
.sc-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 34px;
  font-size: 12px; letter-spacing: 2.5px; text-transform: uppercase;
  color: color-mix(in srgb, var(--ink) 60%, transparent);
  opacity: 0; transition: opacity 1s ease 0.3s, color 0.4s linear;
}
body.ready .sc-top { opacity: 1; }
.sc-back { color: inherit; text-decoration: none; transition: opacity 0.3s; }
.sc-back:hover { opacity: 0.6; }
.sc-mark { font-family: 'Orbitron', sans-serif; font-weight: 700; letter-spacing: 6px; color: var(--ink); }

.rail {
  position: fixed; right: 34px; top: 50%; transform: translateY(-50%);
  width: 1px; height: 190px; background: var(--line); z-index: 20;
  opacity: 0; transition: opacity 1s ease 0.5s;
}
body.ready .rail { opacity: 1; }
.rail-fill {
  width: 100%; height: 100%; transform-origin: top; transform: scaleY(0);
  background: linear-gradient(180deg, var(--gold), var(--pink), var(--purple));
  box-shadow: 0 0 12px rgba(255, 77, 141, 0.6);
}

/* ---------- 章節 ---------- */
.scroller { position: relative; z-index: 10; }
.act {
  min-height: 100vh;
  display: flex; align-items: center;
  padding: 0 clamp(24px, 7vw, 120px);
  pointer-events: none;
  position: relative;
}
.act-inner {
  max-width: 460px;
  opacity: 0; transform: translateY(30px);
  transition: opacity 1.1s cubic-bezier(0.22, 1, 0.36, 1),
              transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.act.in .act-inner { opacity: 1; transform: none; }
.act-inner.left { margin-right: auto; }
.act-inner.right { margin-left: auto; }
.act-inner.center { margin: 0 auto; text-align: center; max-width: 760px; }
.act-inner.cols {
  max-width: 380px; margin-right: auto;
  display: flex; flex-direction: column; gap: 34px;
}
.act-inner a { pointer-events: auto; }

.eyebrow {
  display: inline-block; padding: 7px 16px;
  border: 1px solid var(--line); border-radius: 100px;
  font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase;
  color: color-mix(in srgb, var(--ink) 62%, transparent);
  margin-bottom: 30px;
}

.title {
  font-family: 'Orbitron', 'Noto Sans TC', sans-serif;
  font-weight: 900; font-size: clamp(40px, 7.4vw, 96px);
  line-height: 1.04; letter-spacing: -2px; margin-bottom: 26px;
  text-shadow: 0 6px 44px var(--halo, rgba(5, 6, 13, 0.7));
}
.t-line { display: block; }
.grad {
  background: linear-gradient(120deg, var(--gold), var(--pink) 52%, var(--purple));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.lede {
  font-size: clamp(15px, 1.4vw, 19px); font-weight: 300;
  color: color-mix(in srgb, var(--ink) 72%, transparent);
}

.num {
  font-family: 'Orbitron', sans-serif;
  font-size: 11px; letter-spacing: 4px; color: var(--gold);
  margin-bottom: 14px;
}
.act h2 {
  font-family: 'Orbitron', 'Noto Sans TC', sans-serif;
  font-size: clamp(28px, 4vw, 52px); font-weight: 700;
  letter-spacing: -1px; line-height: 1.16; margin-bottom: 18px;
  text-shadow: 0 4px 30px var(--halo, rgba(5, 6, 13, 0.55));
}
.act p {
  font-size: clamp(14px, 1.1vw, 16px); font-weight: 300;
  color: color-mix(in srgb, var(--ink) 70%, transparent);
}

.col-title {
  font-size: 12px; letter-spacing: 2.5px; text-transform: uppercase;
  color: color-mix(in srgb, var(--ink) 55%, transparent);
  margin-bottom: 10px;
}

.spec-grid {
  display: flex; gap: 34px; margin-top: 28px;
  border-top: 1px solid var(--line); padding-top: 18px;
}
.spec { display: flex; flex-direction: column; }
.spec span {
  font-size: 10px; letter-spacing: 2px; text-transform: uppercase;
  color: color-mix(in srgb, var(--ink) 50%, transparent);
}
.spec b {
  font-family: 'Orbitron', sans-serif; font-size: 17px; font-weight: 700;
  margin-top: 4px; color: var(--ink);
}

/* 巨大數字，壓在版面右下 */
.big-figure {
  position: absolute; right: clamp(20px, 5vw, 90px); bottom: 8vh;
  font-family: 'Orbitron', sans-serif; font-weight: 700;
  font-size: clamp(90px, 15vw, 210px); line-height: 1;
  color: var(--ink); opacity: 0.9;
  letter-spacing: -4px;
  pointer-events: none;
}
.big-figure span { font-size: 0.42em; vertical-align: super; opacity: 0.6; }

.scroll-cue {
  margin-top: 52px; display: inline-flex; flex-direction: column; align-items: center; gap: 12px;
  font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: color-mix(in srgb, var(--ink) 55%, transparent);
}
.scroll-cue i {
  width: 1px; height: 54px;
  background: linear-gradient(180deg, var(--gold), transparent);
  animation: cueDrop 2.4s ease-in-out infinite;
}
@keyframes cueDrop {
  0%, 100% { transform: scaleY(0.35); transform-origin: top; opacity: 0.4; }
  50% { transform: scaleY(1); transform-origin: top; opacity: 1; }
}

.end-title { font-size: clamp(32px, 5.4vw, 72px); }
.end-cta { margin-top: 38px; display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.sc-btn {
  padding: 15px 30px; border: 1px solid var(--line); border-radius: 100px;
  color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: border-color 0.3s, transform 0.3s;
}
.sc-btn:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--ink) 45%, transparent); }
.sc-btn.primary {
  background: linear-gradient(120deg, var(--gold), var(--pink), var(--purple));
  border-color: transparent; color: #0a0b1a; font-weight: 700;
  box-shadow: 0 10px 32px rgba(255, 77, 141, 0.32);
}

.fallback {
  position: fixed; inset: 0; display: grid; place-items: center;
  background: #05060d; color: #8E95BF; z-index: 200;
}

/* ---------- 手機 ---------- */
@media (max-width: 820px) {
  .sc-top { padding: 18px 20px; font-size: 10px; letter-spacing: 1.6px; }
  .sc-meta { display: none; }
  .rail { right: 16px; height: 130px; }
  .act { padding: 0 24px; }
  .act-inner,
  .act-inner.left,
  .act-inner.right,
  .act-inner.cols,
  .act-inner.center { max-width: none; margin: 0; }
  .act-inner.cols { gap: 24px; }
  .big-figure { font-size: 26vw; bottom: 4vh; opacity: 0.55; }
  .end-cta { flex-direction: column; }
  .sc-btn { text-align: center; }
  .pl-text { font-size: 10px; }
  .pl-text b { font-size: 12px; }
}

.end-sub {
  margin-top: 18px;
  font-size: clamp(14px, 1.15vw, 16px);
  color: color-mix(in srgb, var(--ink) 62%, transparent);
}
