/* ============================================================
   OpenCode 后路 deck — base.css
   ① design_system 令牌块（值班供电接力台 · terminal-mono 冷调）
   ② 运行时 stage + deckbar（常量·原样自模板）
   ③ 动效原语（T0）
   ④ 逐页 bespoke layout（本 deck 现场生成）
   ============================================================ */

/* ===== ① 令牌块 ===== */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@300;400;500;600&family=Noto+Sans+SC:wght@300;400;500;700&family=JetBrains+Mono:wght@400;500;700&display=swap');

:root {
  --bg:         oklch(0.165 0.018 250);
  --surface:    oklch(0.205 0.022 250);
  --surface-2:  oklch(0.255 0.024 250);
  --ink:        oklch(0.945 0.008 240);
  --ink-muted:  oklch(0.700 0.022 245);
  --line:       oklch(0.945 0.008 240 / 0.14);
  --accent:     oklch(0.800 0.165 70);
  --accent-2:   oklch(0.620 0.200 28);

  --font-display:     "Space Grotesk", "Noto Sans SC", sans-serif;
  --font-cjk-display: "Noto Sans SC", "Space Grotesk", sans-serif;
  --font-body:        "Inter", "Noto Sans SC", sans-serif;
  --font-mono:        "JetBrains Mono", ui-monospace, monospace;

  --s1: 8px;  --s2: 16px; --s3: 24px; --s4: 32px;
  --s5: 48px; --s6: 64px; --s7: 96px; --s8: 128px; --s9: 192px;

  --radius: 2px;
  --shadow: none;

  --rail-live: var(--accent);
  --rail-trip: var(--accent-2);
  --rail-idle: var(--ink-muted);
  --grid-tick: var(--line);

  --deckbar-h: 56px;
}

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

html, body {
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ===== ② 运行时 stage + deckbar（常量·禁改） ===== */
#viewport {
  position: fixed; left: 0; right: 0; bottom: 0; top: var(--deckbar-h, 56px);
  background: var(--bg);
  overflow: hidden;
}
.stage {
  position: relative;
  width: 100%; height: 100%;
  background: var(--bg);
  overflow: hidden;
}
.slide {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden;
  pointer-events: none;
  overflow: hidden;
  transition: opacity 0.55s ease;
}
.slide.is-active {
  opacity: 1; visibility: visible;
  pointer-events: auto;
}

.deckbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--deckbar-h, 56px);
  display: flex; align-items: center; gap: var(--s4);
  flex-wrap: nowrap; overflow: hidden;
  padding: 0 var(--s5); z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
}
.deckbar .db-brand { font-family: var(--font-cjk-display); font-weight: 600; font-size: 20px; color: var(--ink); letter-spacing: .04em; }
.deckbar .db-brand b { color: var(--accent); }
.deckbar .db-sep { width: 1px; height: 18px; background: var(--line); flex-shrink: 0; }
.deckbar .db-title { font-size: 15px; color: var(--ink-muted); letter-spacing: .12em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; }
.deckbar .db-title b { color: var(--ink); }
.deckbar .db-section { font-size: 13px; color: var(--accent); letter-spacing: .2em; text-transform: uppercase; white-space: nowrap; flex-shrink: 0; }
.deckbar .db-spacer { flex: 1 1 auto; min-width: var(--s3); }
.deckbar .db-brand, .deckbar .db-ctrl { flex-shrink: 0; white-space: nowrap; }
.deckbar .db-ctrl { display: flex; align-items: center; gap: var(--s2); }
.deckbar .counter { color: var(--ink-muted); font-size: 14px; letter-spacing: .18em; min-width: 84px; text-align: center; white-space: nowrap; }
.deckbar .counter b { color: var(--ink); font-weight: 700; }
.deckbar button { appearance: none; cursor: pointer; background: transparent; border: 1px solid var(--line); color: var(--ink); width: 36px; height: 36px; font-size: 16px; line-height: 1; border-radius: var(--radius); transition: border-color .2s, color .2s; flex-shrink: 0; }
.deckbar button:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 1080px) { .deckbar .db-title, .deckbar .db-brand + .db-sep { display: none; } }
@media (max-width: 820px)  { .deckbar .db-section, .deckbar .db-section + .db-sep { display: none; } }

/* ===== ③ 动效原语（T0） ===== */
.reveal { opacity: 0; transform: translateY(22px); }
.slide.is-active .reveal {
  animation: fadeUp 0.85s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: var(--d, 0s);
}
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

.char { display: inline-block; opacity: 0; transform: translateY(0.32em); }
.slide.is-active .char {
  animation: charIn 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
  animation-delay: calc(var(--ci, 0) * 0.085s + 0.15s);
}
@keyframes charIn { to { opacity: 1; transform: translateY(0); } }

.s-blur { opacity: 0; filter: blur(14px); }
.slide.is-active .s-blur { animation: sBlur 0.9s cubic-bezier(0.2,0.7,0.2,1) forwards; animation-delay: var(--d,0s); }
@keyframes sBlur { to { opacity: 1; filter: blur(0); } }

.s-wipe { clip-path: inset(0 100% 0 0); }
.slide.is-active .s-wipe { animation: sWipe 0.8s cubic-bezier(0.7,0,0.2,1) forwards; animation-delay: var(--d,0s); }
@keyframes sWipe { to { clip-path: inset(0 0 0 0); } }

.s-clip { clip-path: inset(0 0 100% 0); }
.slide.is-active .s-clip { animation: sClip 0.85s cubic-bezier(0.2,0.7,0.2,1) forwards; animation-delay: var(--d,0s); }
@keyframes sClip { to { clip-path: inset(0 0 0 0); } }

.s-line { display: block; overflow: hidden; }
.s-line > span { display: inline-block; transform: translateY(110%); }
.slide.is-active .s-line > span { animation: sLine 0.8s cubic-bezier(0.2,0.7,0.2,1) forwards; animation-delay: var(--d,0s); }
@keyframes sLine { to { transform: translateY(0); } }

.s-shiny { background: linear-gradient(100deg, var(--ink) 40%, var(--accent) 50%, var(--ink) 60%); background-size: 220% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent; background-position: 220% 0; }
.slide.is-active .s-shiny { animation: sShiny 1.4s cubic-bezier(0.4,0,0.2,1) forwards; animation-delay: var(--d,.3s); }
@keyframes sShiny { to { background-position: -20% 0; } }

/* 告警脉冲（值班台母题信号语言）*/
@keyframes alertPulse { 0%,100% { opacity: .35; } 50% { opacity: 1; } }

/* 氛围原语 */
.amb-scrim { position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: radial-gradient(120% 120% at 50% 50%, transparent 30%, color-mix(in oklch, var(--bg) 62%, transparent) 100%),
              linear-gradient(color-mix(in oklch, var(--bg) 34%, transparent), color-mix(in oklch, var(--bg) 34%, transparent)); }
.amb-canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; z-index: 0; pointer-events: none; opacity: .72; }
.amb-css { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.deck-ambient { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.deck-ambient .amb-css { opacity: .5; }
.stage > .slide { z-index: 1; }
.slide[data-ambient] { isolation: isolate; }
.slide[data-ambient] > *:not(.amb-scrim):not(.amb-canvas):not(.amb-css) { position: relative; z-index: 2; }

@media (prefers-reduced-motion: reduce) {
  .slide.is-active .reveal, .slide.is-active .char,
  .slide.is-active .s-blur, .slide.is-active .s-wipe, .slide.is-active .s-clip,
  .slide.is-active .s-line > span, .s-shiny { animation: none; }
  .reveal, .s-blur { opacity: 1; transform: none; filter: none; }
  .char   { opacity: 1; transform: none; }
  .s-wipe, .s-clip { clip-path: none; }
  .s-line > span { transform: none; }
  .s-shiny { background-position: 0 0; }
}

/* ============================================================
   ④ 逐页 bespoke layout
   通用：每页留白靠栏沟/行距；字号 vw clamp + vh 上限双钳防短屏溢出。
   ============================================================ */

.eyebrow { font-family: var(--font-mono); font-size: clamp(11px, .8vw, 13px); letter-spacing: .28em;
  text-transform: uppercase; color: var(--accent); display: inline-flex; align-items: center; gap: var(--s2); }
.eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--accent); display: inline-block; }

/* 通用 schematic SVG 舞台样式（token 取色，禁写死）*/
.rail { fill: none; stroke-width: 2.5; stroke-linecap: round; }
.rail-base { stroke: var(--line); }
.rail-live { stroke: var(--rail-live); }
.rail-trip { stroke: var(--rail-trip); }
.rail-idle { stroke: var(--rail-idle); }
.node { stroke-width: 2; }
.cap { font-family: var(--font-mono); fill: var(--ink-muted); font-size: 13px; letter-spacing: .04em; }
.cap-strong { fill: var(--ink); }
.glyph { fill: var(--ink); font-family: var(--font-cjk-display); font-weight: 600; }
.scene-cap { font-family: var(--font-mono); color: var(--ink-muted); font-size: clamp(12px, 1vw, 15px);
  letter-spacing: .06em; min-height: 1.5em; }
.scene-cap b { color: var(--accent); font-weight: 700; }

/* —— 01 cover · 黄金比例居中 hero —— */
.slide.cover { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.cover-glow { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%);
  width: min(60vw, 720px); height: min(60vw, 720px);
  background: radial-gradient(circle, color-mix(in oklch, var(--accent) 16%, transparent), transparent 62%);
  filter: blur(8px); pointer-events: none; z-index: 0; }
.cover-in { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: center; width: min(1100px, 92vw); gap: clamp(var(--s2), 2.2vh, var(--s4)); }
.cover-kicker { font-family: var(--font-mono); font-size: clamp(12px, 1vw, 15px); letter-spacing: .32em; text-transform: uppercase; color: var(--accent); }
.cover-title { font-family: var(--font-cjk-display); font-weight: 700; line-height: 1.02; letter-spacing: -.01em;
  font-size: min(clamp(48px, 9vw, 132px), 26vh); color: var(--ink); }
.cover-title b { color: var(--accent); }
.cover-sub { font-size: min(clamp(16px, 2vw, 26px), 4vh); color: var(--ink-muted); max-width: 40ch; line-height: 1.5; }
.cover-sub .nb { white-space: nowrap; }
.cover-rule { width: min(360px, 50vw); height: 1px; background: linear-gradient(90deg, transparent, var(--accent), transparent); }
.cover-foot { position: absolute; left: 50%; bottom: clamp(var(--s4), 6vh, var(--s6)); transform: translateX(-50%);
  display: flex; gap: 0; font-family: var(--font-mono); font-size: clamp(11px, .95vw, 14px); color: var(--ink-muted); white-space: nowrap; }
.cover-foot span { padding: 0 var(--s3); }
.cover-foot span + span { border-left: 1px solid var(--line); }
.cover-foot b { color: var(--accent); margin-right: var(--s1); }
.cover-mini { position: absolute; right: clamp(var(--s5), 6vw, var(--s8)); top: 50%; transform: translateY(-50%); width: clamp(120px, 14vw, 200px); height: auto; z-index: 1; opacity: .9; }
@media (max-width: 980px) { .cover-mini { display: none; } }

/* —— 02 contrast · 双区告警对照 —— */
.slide.cards2 { display: grid; grid-template-rows: auto 1fr auto; gap: clamp(var(--s2), 2vh, var(--s4));
  padding: clamp(var(--s4), 5vh, var(--s7)) clamp(var(--s5), 6vw, var(--s8)); }
.c2-head { display: flex; flex-direction: column; gap: var(--s2); }
.c2-title { font-family: var(--font-cjk-display); font-weight: 700; font-size: min(clamp(28px, 4vw, 52px), 9vh); color: var(--ink); line-height: 1.1; }
.c2-sub { font-size: clamp(14px, 1.4vw, 19px); color: var(--ink-muted); }
.c2-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(var(--s3), 2.4vw, var(--s5)); min-height: 0; }
.c2-panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  display: grid; grid-template-rows: auto 1fr auto; gap: var(--s2); padding: clamp(var(--s3), 2.4vh, var(--s4)); min-height: 0; }
.c2-tag { font-family: var(--font-mono); font-size: clamp(12px, 1vw, 15px); letter-spacing: .2em; text-transform: uppercase; }
.c2-panel.verify .c2-tag { color: var(--accent); }
.c2-panel.ban .c2-tag { color: var(--rail-trip); }
.c2-svg { width: 100%; height: 100%; min-height: 0; flex: 1 1 auto; }
.c2-desc { font-size: clamp(13px, 1.2vw, 17px); color: var(--ink); line-height: 1.5; }
.c2-desc b { color: var(--ink); }
.c2-foot { font-family: var(--font-mono); font-size: clamp(13px, 1.2vw, 17px); color: var(--ink-muted); text-align: center; letter-spacing: .04em; }
.c2-foot b { color: var(--accent); }

/* —— 03 relay (hero) · 三轨供电接力板 —— */
.slide.relay { display: grid; grid-template-rows: auto 1fr auto; gap: clamp(var(--s2), 2vh, var(--s3));
  padding: clamp(var(--s3), 3.5vh, var(--s5)) clamp(var(--s5), 6vw, var(--s8)) clamp(var(--s3), 3vh, var(--s5)); }
.relay-head { display: flex; align-items: baseline; gap: var(--s4); flex-wrap: wrap; }
.relay-title { font-family: var(--font-cjk-display); font-weight: 700; font-size: min(clamp(26px, 3.6vw, 46px), 8vh); color: var(--ink); }
.relay-title b { color: var(--accent); }
.relay-sub { font-size: clamp(13px, 1.3vw, 18px); color: var(--ink-muted); }
.relay-stagewrap { display: grid; grid-template-columns: minmax(0,1fr) clamp(180px, 22vw, 320px); gap: clamp(var(--s3), 2.5vw, var(--s5)); min-height: 0; }
.relay-svg { width: 100%; height: 100%; min-height: 0; flex: 1 1 auto; }
.relay-legend { display: flex; flex-direction: column; justify-content: center; gap: clamp(var(--s2), 1.8vh, var(--s3)); min-height: 0; }
.relay-legend .rl { border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(var(--s2), 1.6vh, var(--s3)); background: var(--surface); }
.relay-legend .rl b { display: block; font-family: var(--font-cjk-display); font-size: clamp(15px, 1.5vw, 20px); color: var(--ink); margin-bottom: 4px; }
.relay-legend .rl span { font-size: clamp(12px, 1.1vw, 15px); color: var(--ink-muted); line-height: 1.45; }
.relay-legend .rl .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: var(--s1); vertical-align: middle; }
.relay-legend .rl.r-main .dot { background: var(--rail-idle); }
.relay-legend .rl.r-sec .dot { background: var(--rail-idle); }
.relay-legend .rl.r-fire .dot { background: var(--rail-live); }
.relay-cap { font-family: var(--font-mono); }

/* —— 04 process · 任务分流路由 —— */
.slide.routing { display: grid; grid-template-columns: clamp(260px, 32%, 440px) 1fr; gap: clamp(var(--s4), 4vw, var(--s7));
  padding: clamp(var(--s4), 5vh, var(--s7)) clamp(var(--s5), 6vw, var(--s8)); align-items: center; }
.rt-left { display: flex; flex-direction: column; gap: clamp(var(--s2), 2vh, var(--s3)); }
.rt-title { font-family: var(--font-cjk-display); font-weight: 700; font-size: min(clamp(26px, 3.4vw, 46px), 9vh); color: var(--ink); line-height: 1.12; }
.rt-title b { color: var(--accent); }
.rt-sub { font-size: clamp(13px, 1.3vw, 18px); color: var(--ink-muted); line-height: 1.5; }
.rt-points { list-style: none; display: flex; flex-direction: column; gap: var(--s2); margin-top: var(--s2); }
.rt-points li { display: grid; grid-template-columns: auto 1fr; gap: var(--s2); align-items: baseline; font-size: clamp(13px, 1.15vw, 16px); color: var(--ink); }
.rt-points li i { font-family: var(--font-mono); color: var(--accent); font-style: normal; font-size: .85em; }
.rt-right { position: relative; min-height: 0; height: 100%; display: flex; flex-direction: column; }
.rt-svg { width: 100%; height: 100%; min-height: 0; flex: 1 1 auto; }

/* —— 05 closing · 5 件事模块 + CTA —— */
.slide.outro { display: grid; grid-template-rows: auto 1fr auto; gap: clamp(var(--s2), 2.2vh, var(--s4));
  padding: clamp(var(--s4), 5vh, var(--s7)) clamp(var(--s5), 6vw, var(--s8)); }
.outro-head { display: flex; flex-direction: column; gap: var(--s2); }
.outro-title { font-family: var(--font-cjk-display); font-weight: 700; font-size: min(clamp(28px, 4vw, 52px), 9vh); color: var(--ink); }
.outro-title b { color: var(--accent); }
.outro-sub { font-size: clamp(14px, 1.4vw, 19px); color: var(--ink-muted); }
.outro-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: clamp(var(--s2), 1.6vw, var(--s3)); min-height: 0; align-self: center; width: 100%; }
.outro-cell { border: 1px solid var(--line); border-top: 2px solid var(--accent); border-radius: var(--radius); background: var(--surface);
  padding: clamp(var(--s3), 3vh, var(--s5)) clamp(var(--s2), 1.4vw, var(--s3)); display: flex; flex-direction: column; gap: clamp(var(--s2), 2vh, var(--s4));
  min-height: clamp(180px, 30vh, 300px); justify-content: flex-start; }
.outro-cell .on { font-family: var(--font-mono); font-size: clamp(26px, 3vw, 44px); color: var(--accent); font-weight: 700; line-height: 1; }
.outro-cell p { font-size: clamp(13px, 1.15vw, 17px); color: var(--ink); line-height: 1.5; margin-top: auto; }
.outro-cta { display: flex; align-items: center; justify-content: space-between; gap: var(--s4);
  border-top: 1px solid var(--line); padding-top: clamp(var(--s2), 2vh, var(--s4)); flex-wrap: wrap; }
.outro-cta .cta-line { font-family: var(--font-cjk-display); font-weight: 600; font-size: clamp(16px, 1.8vw, 24px); }
.outro-cta .cta-tags { font-family: var(--font-mono); font-size: clamp(12px, 1vw, 15px); color: var(--ink-muted); }
.outro-cta .cta-tags b { color: var(--accent); }
@media (max-width: 1080px) { .outro-grid { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; } }
