/* ============================================================================
   Openfilm 视频幻灯片 · 视觉系统
   ----------------------------------------------------------------------------
   本文件只包含「规则」，不含任何颜色字面量。
   全部颜色 / 字体令牌都定义在 index.html 的 :root（框架指定的 theme token slot）里，
   这里是它们唯一的使用方。改配色 → 改 index.html 的 :root，不要改本文件。

   命名约定
     .slide-body  每页的内容盒（已避让页脚 folio 与四周留白），默认 36px 垂直节奏
     .t-*         字阶（type scale）
     .sb-*        页面级布局工具
     .anim .d1–d6 入场动效与错峰延迟
     .deck-*      舞台之外的播放器控件（进度条 / 控制条 / 帮助 / 提示）
   ========================================================================== */

/* ── 舞台与页面 ─────────────────────────────────────────────────────────── */

.deck-stage { font-family: var(--font-body); }

.slide { color: var(--fg); }

/* 每页内容盒：左右 120、上 124、下 132 → 内容区 1680 × 824。
   全片统一的 36px 垂直节奏，靠 gap 得到，页面里不再写行内间距。 */
.slide-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 36px;
  min-height: 0;
  padding: 124px 120px 132px;
}

.sb-mid { justify-content: center; }
.sb-end { justify-content: flex-end; }

/* 通用列布局与间距工具 */
.col { display: flex; flex-direction: column; }
.gap-12 { gap: 12px; }
.gap-20 { gap: 20px; }
.gap-28 { gap: 28px; }
.gap-36 { gap: 36px; }
.gap-44 { gap: 44px; }
.gap-56 { gap: 56px; }
.gap-72 { gap: 72px; }

.sb-2col   { display: grid; grid-template-columns: 1080px 1fr; gap: 72px; align-items: start; }
.sb-spread { display: grid; grid-template-columns: 452px 1fr; gap: 72px; align-items: center; }
.sb-spread-r { display: grid; grid-template-columns: 1000px 1fr; gap: 80px; align-items: center; }
.sb-2x2    { display: grid; grid-template-columns: 1fr 1fr; gap: 40px 72px; }

/* ── 字阶 ───────────────────────────────────────────────────────────────── */

.t-display {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.008em;
  margin: 0;
  text-wrap: balance;
}

.t-cover   { font-size: 116px; line-height: 1.06; letter-spacing: -0.02em; }
.t-xl      { font-size: 124px; line-height: 1.08; letter-spacing: -0.02em; }
.t-final   { font-size: 92px;  line-height: 1.1;  letter-spacing: -0.02em; }
.t-section { font-size: 84px;  line-height: 1.12; }
.t-h2      { font-size: 58px;  line-height: 1.16; max-width: 1040px; }
.t-h3      { font-size: 44px;  line-height: 1.24; }

.t-lead {
  font-size: 33px;
  line-height: 1.62;
  color: var(--muted);
  margin: 0;
  max-width: 44ch;
  text-wrap: pretty;
}

.t-body {
  font-size: 28px;
  line-height: 1.78;
  margin: 0;
  max-width: 46ch;
  text-wrap: pretty;
}

.t-caption {
  font-size: 24px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0;
  text-wrap: pretty;
}

.t-credit {
  font-family: var(--font-mono);
  font-size: 19px;
  line-height: 1.5;
  letter-spacing: 0.02em;
  color: var(--muted);
  margin: 0;
}

.t-note {
  font-family: var(--font-mono);
  font-size: 21px;
  line-height: 1.65;
  color: var(--muted);
  margin: 0;
  text-wrap: pretty;
}

/* 眉标：全片唯一的强调色用法，同时也是本片的导航系统 */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.4;
  letter-spacing: 0.16em;
  color: var(--accent);
  margin: 0;
}

/* 大号章节数字 */
.t-num {
  font-family: var(--font-mono);
  font-size: 200px;
  font-weight: 400;
  line-height: 0.86;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  margin: 0;
}

/* 引用页的主体大字：宽度按字号配好，让长句在第 18 字左右自然断行，
   避免出现「末行只剩一两个字」的孤字 */
.pull {
  font-family: var(--font-display);
  font-size: 72px;
  font-weight: 600;
  line-height: 1.42;
  letter-spacing: -0.01em;
  max-width: 1340px;
  margin: 0;
  text-wrap: pretty;
}

/* ── 分隔线 ─────────────────────────────────────────────────────────────── */

/* 发丝线用 border 而非 background 绘制：导出/打印时即使「背景图形」被关掉，
   border 依然会输出，线不会整片消失。 */
.hair     { border: 0; border-top: 1px solid var(--border); height: 0; margin: 0; }
.hair-ink { border: 0; border-top: 1px solid var(--fg);     height: 0; margin: 0; }
.v-rule   { border: 0; border-left: 1px solid var(--ink-line); width: 0; min-height: 180px; align-self: stretch; }

/* ── 封面 ───────────────────────────────────────────────────────────────── */

.cover-lead { max-width: 40ch; }

.cover-foot {
  display: grid;
  grid-template-columns: 1fr 560px;
  gap: 72px;
  align-items: start;
}

.brief { display: flex; flex-direction: column; gap: 16px; }

.brief-label {
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin: 0;
}

.brief-list { display: flex; flex-direction: column; gap: 14px; margin: 0; padding: 0; list-style: none; }

.brief-list li {
  display: flex;
  gap: 14px;
  align-items: baseline;
  font-size: 26px;
  line-height: 1.4;
}

.brief-list .n {
  font-family: var(--font-mono);
  font-size: 19px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.meta-stack { display: flex; flex-direction: column; gap: 14px; margin: 0; }

.meta-stack > div { display: grid; grid-template-columns: 116px 1fr; gap: 20px; align-items: baseline; }

.meta-stack dt {
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.meta-stack dd {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 20px;
  line-height: 1.5;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

/* ── 章节卡（深色页）─────────────────────────────────────────────────────
   深色底由 --fg 直接充当，文字用 --bg，属于同一配色的明暗互换，不引入新色相；
   强调色在深底上换成提亮版 --accent-lit，保证 ≥4.5:1。 */

.s-section {
  background: var(--ink);
  color: var(--ink-fg);
}

.s-section .eyebrow     { color: var(--ink-muted); }
.s-section .t-lead      { color: var(--ink-muted); }
.s-section .t-num       { color: var(--accent-lit); }
.s-section .t-credit    { color: var(--ink-muted); }
.s-section .hair        { border-top-color: var(--ink-line); }
.s-section .slide-folio { color: var(--ink-muted); }
.s-section .slide-folio .folio-page { color: var(--ink-fg); }

.chapter-grid {
  display: grid;
  grid-template-columns: 300px 1px 1fr;
  gap: 64px;
  align-items: center;
}

.chapter-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 44px;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--ink-line);
}

.chapter-tags span {
  font-family: var(--font-mono);
  font-size: 22px;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}

/* ── 规格表（<dl>，无盒子边框）──────────────────────────────────────────── */

.spec { margin: 0; display: flex; flex-direction: column; }

.spec > div {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: baseline;
  padding: 22px 0;
  border-top: 1px solid var(--border);
}

.spec dt {
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.spec dd { margin: 0; font-size: 28px; line-height: 1.5; }

/* ── 对照页 ─────────────────────────────────────────────────────────────── */

.compare { display: grid; grid-template-columns: 1fr 1fr; }

.compare-col { padding-inline: 64px; }
.compare-col:first-child { padding-left: 0; border-right: 1px solid var(--border); }
.compare-col:last-child  { padding-right: 0; }

.compare-kicker {
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0;
}

.compare-title {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

.compare-quote {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 500;
  line-height: 1.5;
  margin: 0;
  text-wrap: pretty;
}

.compare-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; }

.compare-list li {
  font-size: 27px;
  line-height: 1.5;
  padding: 16px 0;
  border-top: 1px solid var(--border);
}

/* ── 事实行（编号列表）─────────────────────────────────────────────────── */

.facts { display: flex; flex-direction: column; margin: 0; padding: 0; list-style: none; }

.facts li {
  display: grid;
  grid-template-columns: 96px 300px 1fr;
  gap: 40px;
  align-items: baseline;
  padding: 26px 0;
  border-top: 1px solid var(--border);
}

.facts .f-num {
  font-family: var(--font-mono);
  font-size: 30px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.facts .f-name { font-family: var(--font-display); font-size: 36px; font-weight: 600; line-height: 1.2; }
.facts .f-desc { font-size: 28px; line-height: 1.5; color: var(--muted); }

/* ── 结论 / 价值条目 ───────────────────────────────────────────────────── */

.concl { border-top: 1px solid var(--border); padding-top: 22px; }

.concl .c-name { font-family: var(--font-display); font-size: 38px; font-weight: 600; margin: 0 0 10px; }
.concl .c-desc { font-size: 26px; line-height: 1.6; color: var(--muted); margin: 0; text-wrap: pretty; }

.value-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 56px; }

.value-item { border-top: 1px solid var(--border); padding-top: 22px; }

.value-item .v-label {
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.14em;
  color: var(--muted);
  margin: 0 0 14px;
}

.value-item .v-name { font-family: var(--font-display); font-size: 38px; font-weight: 600; margin: 0 0 12px; }
.value-item .v-desc { font-size: 26px; line-height: 1.6; color: var(--muted); margin: 0; text-wrap: pretty; }

.closing-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px 40px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}

.closing-foot a {
  color: var(--accent-dark);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklch, var(--accent-dark) 40%, transparent);
  transition: border-color 160ms ease, color 160ms ease;
}

.closing-foot a:hover { color: var(--fg); border-bottom-color: var(--fg); }
.closing-foot a:focus-visible { outline: 2px solid currentColor; outline-offset: 4px; }

/* ── 图片 ───────────────────────────────────────────────────────────────── */

.figure { margin: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 22px; }

.fig-end   { justify-self: end; }
.fig-start { justify-self: start; }

/* 内容图：宽高均为 auto，只用 max-* 单向约束 —— 不锁双轴、不裁切、保持原比例 */
.photo {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 620px;
  object-fit: contain;
}

.photo-lg { max-height: 700px; }
.photo-sm { max-height: 520px; }

/* 白底商品图放在 --surface 底板上，避免在纸色背景上出现突兀白块 */
.figure-plate {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.figure-cap { display: flex; flex-direction: column; align-items: stretch; gap: 12px; margin: 0; }

/* ── 页脚 folio：章节 + 页码 ───────────────────────────────────────────── */

.slide-folio {
  position: absolute;
  left: 120px;
  right: 120px;
  bottom: 52px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 32px;
  font-family: var(--font-mono);
  font-size: 20px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.slide-folio .folio-page { color: var(--fg); font-variant-numeric: tabular-nums; letter-spacing: 0.06em; }
.slide-folio .folio-sep  { color: var(--border); }

/* ── 入场动效 ────────────────────────────────────────────────────────────
   .anim 只在当前页挂载动画，翻回该页时动画自然重放。
   起始状态写在 keyframes 里，因此 reduces-motion 下取消动画
   不会把元素留在透明状态。 */

@keyframes ofRise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
@keyframes ofFade { from { opacity: 0; } to { opacity: 1; } }

.slide.active .anim      { animation: ofRise 560ms cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.slide.active .anim-fade { animation: ofFade 720ms ease both; }

.slide.active .d1 { animation-delay: 40ms; }
.slide.active .d2 { animation-delay: 120ms; }
.slide.active .d3 { animation-delay: 200ms; }
.slide.active .d4 { animation-delay: 280ms; }
.slide.active .d5 { animation-delay: 360ms; }
.slide.active .d6 { animation-delay: 440ms; }

/* ── 旁白笔记（排练用，不参与录屏与打印）──────────────────────────────── */

.slide-note { display: none; }

.deck-stage.notes-on .slide.active .slide-note {
  display: block;
  position: absolute;
  left: 120px;
  right: 120px;
  bottom: 108px;
  padding: 30px 36px 32px;
  border-radius: 14px;
  border: 1px solid var(--accent);
  background: color-mix(in oklch, var(--fg) 95%, transparent);
  color: var(--bg);
  box-shadow: 0 24px 60px color-mix(in oklch, var(--fg) 34%, transparent);
}

.note-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid color-mix(in oklch, var(--bg) 24%, transparent);
}

.note-tag,
.note-time { font-family: var(--font-mono); font-size: 19px; letter-spacing: 0.14em; }

.note-tag  { color: var(--accent-lit); }
.note-time { color: color-mix(in oklch, var(--bg) 72%, transparent); }

.slide-note p { margin: 0; font-size: 27px; line-height: 1.7; color: var(--bg); text-wrap: pretty; }

/* ── 播放器控件（位于缩放舞台之外，按真实屏幕像素渲染）────────────────── */

.deck-progress {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  z-index: 1200;
  background: color-mix(in oklch, var(--fg) 12%, transparent);
}

.deck-rail-fill {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 420ms cubic-bezier(0.4, 0, 0.2, 1);
}

.deck-tools {
  position: fixed;
  top: 0;
  right: 22px;
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  height: 46px;
  border-radius: 0 0 12px 12px;
  background: color-mix(in oklch, var(--fg) 92%, transparent);
  color: var(--bg);
  font-family: var(--font-body);
  font-size: 14px;
  transition: opacity 200ms ease, transform 200ms ease;
}

.deck-tools button {
  min-width: 44px;
  height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: background 150ms ease;
}

.deck-tools button:hover { background: color-mix(in oklch, var(--bg) 20%, transparent); }
.deck-tools button[aria-pressed="true"] { background: color-mix(in oklch, var(--bg) 26%, transparent); }
.deck-tools button:focus-visible { outline: 2px solid currentColor; outline-offset: -4px; }

.deck-tools .deck-count {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
  padding: 0 12px;
  color: color-mix(in oklch, var(--bg) 78%, transparent);
}

.deck-tools .deck-sep {
  width: 1px;
  height: 22px;
  margin: 0 6px;
  background: color-mix(in oklch, var(--bg) 22%, transparent);
}

body.ui-idle .deck-tools { opacity: 0; pointer-events: none; transform: translateY(-8px); }
body.ui-hidden .deck-tools,
body.ui-hidden .deck-progress { display: none; }

/* ── 帮助浮层 ──────────────────────────────────────────────────────────── */

.deck-help {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: none;
  place-items: center;
  background: color-mix(in oklch, var(--fg) 74%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

body.help-on .deck-help { display: grid; }

.help-card {
  width: min(760px, calc(100vw - 48px));
  max-height: calc(100vh - 64px);
  overflow: auto;
  padding: 40px 44px 36px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  box-shadow: 0 32px 80px color-mix(in oklch, var(--fg) 40%, transparent);
}

.help-card h2 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  margin: 0 0 26px;
}

.help-keys { margin: 0; display: flex; flex-direction: column; }

.help-keys > div {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 24px;
  align-items: baseline;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}

.help-keys dt {
  font-family: var(--font-mono);
  font-size: 17px;
  letter-spacing: 0.06em;
  color: var(--accent-dark);
}

.help-keys dd { margin: 0; font-size: 19px; line-height: 1.6; color: var(--muted); }

.help-foot {
  margin: 26px 0 0;
  font-family: var(--font-mono);
  font-size: 16px;
  line-height: 1.7;
  color: var(--muted);
}

/* ── 轻提示 ────────────────────────────────────────────────────────────── */

.deck-toast {
  position: fixed;
  left: 50%;
  bottom: 64px;
  transform: translate(-50%, 12px);
  z-index: 1400;
  padding: 14px 24px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--fg) 94%, transparent);
  color: var(--bg);
  font-size: 16px;
  line-height: 1.4;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}

.deck-toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ── 小屏兜底：舞台本身等比缩放，控件只做收窄以免遮挡内容 ─────────────── */

@media (max-width: 900px) {
  .deck-tools { font-size: 13px; right: 10px; }
  .deck-tools button { padding: 0 10px; }
}

/* ── 无障碍：尊重系统「减弱动效」 ─────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .slide.active .anim,
  .slide.active .anim-fade { animation: none !important; }

  .deck-rail-fill,
  .deck-tools,
  .deck-toast { transition: none !important; }
}

/* ── 静态导出模式（给不读 @media print 的转换器）─────────────────────────
   有些「HTML → PPT / 长图」工具不套用打印媒体，于是只认得第 1 页：
   其余页面被框架的 .slide:not(.active){display:none!important} 藏起来，
   导出结果就是一堆空白页。
   给 <html> 手动加上 data-export 属性即可让全部页面在屏幕媒体下同时可见、
   纵向排列、无动效、无控件。打开方式见 README「导出」一节。 */

html[data-export],
html[data-export] body { height: auto; overflow: visible; background: var(--bg); }
html[data-export] .deck-shell { position: static; overflow: visible; }
html[data-export] .deck-stage {
  width: 1920px;
  height: auto;
  transform: none !important;
  box-shadow: none;
}
html[data-export] .slide {
  display: flex !important;
  position: relative !important;
  inset: auto !important;
  width: 1920px;
  height: 1080px;
}
html[data-export] .slide .anim,
html[data-export] .slide .anim-fade { animation: none !important; }
html[data-export] .slide * { transition: none !important; }
html[data-export] .deck-progress,
html[data-export] .deck-tools,
html[data-export] .deck-help,
html[data-export] .deck-toast,
html[data-export] .deck-counter,
html[data-export] .deck-hint,
html[data-export] .slide-note { display: none !important; }

/* ── 打印 / 导出 PDF、PPTX、长图：只留幻灯片本体 ─────────────────────────
   导出工具按打印媒体渲染，而且是一次性快照。入场动效用的是
   animation-fill-mode: both——元素在延迟期间处于 opacity: 0，
   一旦快照早于动画结束，页面正文就会整片消失（眉标、标题、导语、列表都没了）。
   所以打印媒体下一律关停动效，元素停在自然状态，永远是可见的。 */

@media print {
  .slide .anim,
  .slide .anim-fade { animation: none !important; }
  .slide * { transition: none !important; }

  .slide-note { display: none !important; }
  .deck-progress,
  .deck-tools,
  .deck-help,
  .deck-toast { display: none !important; }

  /* 强制输出品牌底色与发丝线，不依赖打印对话框里的「背景图形」开关。
     少了这一条，三张深色章节卡会变成米色字印在白纸上，等于整页空白。 */
  html, body, .deck-stage, .slide, .s-section, .figure-plate {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}
