/* Narrated deck runtime: a 1920×1080 stage scaled to the window, one <section> per slide.
   Themes (theme.css) set the variables below and may restyle any layout. */
@font-face { font-family: "Deck Sans"; src: url("fonts/Inter-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: block; }
@font-face { font-family: "Deck Serif"; src: url("fonts/InstrumentSerif-Regular.woff2") format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "Deck Serif"; src: url("fonts/InstrumentSerif-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: block; }
@font-face { font-family: "Deck Grotesk"; src: url("fonts/SpaceGrotesk-Variable.woff2") format("woff2"); font-weight: 300 700; font-display: block; }
@font-face { font-family: "Deck Mono"; src: url("fonts/JetBrainsMono-Variable.woff2") format("woff2"); font-weight: 100 800; font-display: block; }

:root {
  --bg: #f6f3ec;
  --surface: #ffffff;
  --ink: #18160f;
  --muted: #6d685c;
  --line: #ddd7ca;
  --accent: #e5532d;
  --accent-ink: #ffffff;
  --accent-2: #2f6fdb;
  --ok: #2f8f4e;
  --bad: #c73a2b;
  --cjk: "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", "Noto Sans SC", "Microsoft YaHei";
  --cjk-serif: "Songti SC", "Noto Serif CJK SC", "Noto Serif SC", "SimSun";
  --font-display: "Deck Serif", var(--cjk-serif), Georgia, serif;
  --font-body: "Deck Sans", var(--cjk), system-ui, sans-serif;
  --font-mono: "Deck Mono", ui-monospace, monospace;
  --radius: 22px;
  --pad: 120px;
  --chart-colors: #e5532d, #2f6fdb, #e3a21a, #2f8f4e, #8a5cd6, #6d685c;
  --outer: #0d0d0c;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--outer); overflow: hidden; font-family: var(--font-body); color: var(--ink); -webkit-font-smoothing: antialiased; }

/* Stage */
.deck { position: fixed; inset: 0; overflow: hidden; }
.deck-stage { position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px; transform-origin: center center; transform: translate(-50%, -50%) scale(var(--scale, 1)); }
html.deck-video .deck-stage { left: 0; top: 0; transform: none; }
.deck > section, .deck-stage > section {
  position: absolute; inset: 0; width: 1920px; height: 1080px; overflow: hidden;
  background: var(--bg); color: var(--ink); padding: var(--pad);
  display: flex; flex-direction: column; justify-content: center; gap: 36px;
  opacity: 0; visibility: hidden; transition: opacity 0.45s ease, transform 0.45s ease, visibility 0s linear 0.45s;
  transform: translateX(28px);
}
.deck-stage > section.past { transform: translateX(-28px); }
.deck-stage > section.current { opacity: 1; visibility: visible; transform: none; transition: opacity 0.45s ease, transform 0.45s ease, visibility 0s; }
section aside.notes { display: none; }

/* Type */
section h1, section h2 { font-family: var(--font-display); font-weight: 400; line-height: 1.04; letter-spacing: -0.01em; text-wrap: balance; }
section h1 { font-size: 140px; }
section h2 { font-size: 96px; }
section h3 { font-size: 44px; font-weight: 600; line-height: 1.2; }
section p, section li { font-size: 44px; line-height: 1.42; }
section .kicker { font-family: var(--font-mono); font-size: 28px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); }
section .sub { font-size: 50px; line-height: 1.4; color: var(--muted); max-width: 1400px; text-wrap: pretty; }
section .muted { color: var(--muted); }
section em { font-style: normal; color: var(--accent); }
section .source { position: absolute; left: var(--pad); bottom: 48px; font-size: 24px; color: var(--muted); }
section .page-tag { position: absolute; right: var(--pad); bottom: 52px; font-family: var(--font-mono); font-size: 20px; color: var(--muted); }
:lang(zh) section h1 { font-size: 132px; line-height: 1.15; letter-spacing: 0; }
:lang(zh) section h2 { font-size: 88px; line-height: 1.2; letter-spacing: 0; }
:lang(zh) section p, :lang(zh) section li { font-size: 44px; line-height: 1.55; }
:lang(zh) section .sub { font-size: 48px; }

/* Fragments: revealed one at a time */
.step { opacity: 0; transform: translateY(18px); transition: opacity 0.4s ease, transform 0.4s ease; }
.step.shown { opacity: 1; transform: none; }

/* Layouts */
section[data-layout="cover"] { justify-content: flex-end; padding-bottom: 150px; }
section[data-layout="cover"] h1 { max-width: 1550px; }
section[data-layout="bullets"] ul, section[data-layout="bullets"] ol { list-style: none; display: grid; gap: 26px; max-width: 1500px; }
section[data-layout="bullets"] li { position: relative; padding-left: 64px; }
section[data-layout="bullets"] li::before { content: ""; position: absolute; left: 0; top: 0.6em; width: 34px; height: 4px; background: var(--accent); }
section[data-layout="bullets"] ol { counter-reset: n; }
section[data-layout="bullets"] ol li::before { counter-increment: n; content: counter(n, decimal-leading-zero); width: auto; height: auto; top: 0.2em; background: none; font-family: var(--font-mono); font-size: 26px; color: var(--accent); }

section[data-layout="stats"] .stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 40px; }
.stat { border-top: 3px solid var(--ink); padding-top: 28px; }
.stat b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 168px; line-height: 1; color: var(--accent); letter-spacing: -0.02em; }
.stat span { display: block; margin-top: 18px; font-size: 38px; line-height: 1.35; color: var(--muted); }

section[data-layout="chart"] { justify-content: flex-start; padding-top: 100px; padding-bottom: 120px; gap: 24px; }
.chart { position: relative; flex: 1; min-height: 0; width: 100%; }
.chart-filter { display: flex; gap: 12px; flex-wrap: wrap; }
.chart-filter button { font: 600 24px/1 var(--font-body); padding: 14px 24px; border-radius: 999px; border: 2px solid var(--line); background: transparent; color: var(--muted); cursor: pointer; }
.chart-filter button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

section[data-layout="compare"] .cols { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
section[data-layout="compare"] .col { background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius); padding: 48px; }
section[data-layout="compare"] .col:last-child { border-color: var(--accent); }
section[data-layout="compare"] .col h3 { margin-bottom: 20px; }
section[data-layout="compare"] .col li { font-size: 38px; list-style: none; padding: 10px 0; border-top: 1px solid var(--line); }

section[data-layout="quote"] blockquote { font-family: var(--font-display); font-size: 96px; line-height: 1.12; max-width: 1600px; text-wrap: balance; }
section[data-layout="quote"] blockquote::before { content: "“"; display: block; color: var(--accent); font-size: 1.4em; line-height: 0.6; }
section[data-layout="quote"] cite { font-style: normal; font-size: 32px; color: var(--muted); }
:lang(zh) section[data-layout="quote"] blockquote { font-size: 76px; line-height: 1.35; }

section[data-layout="image"] { flex-direction: row; align-items: center; gap: 80px; }
section[data-layout="image"] .text { flex: 1; display: flex; flex-direction: column; gap: 28px; }
section[data-layout="image"] figure { flex: 1.15; align-self: stretch; border-radius: var(--radius); overflow: hidden; background: var(--surface); }
section[data-layout="image"] img { width: 100%; height: 100%; object-fit: cover; display: block; }

section[data-layout="end"] { align-items: flex-start; }
section[data-layout="end"] .quiz-score { font-family: var(--font-mono); font-size: 28px; color: var(--muted); }

/* Quiz */
.quiz { display: grid; gap: 28px; max-width: 1500px; }
.quiz .q { font-family: var(--font-display); font-size: 68px; line-height: 1.12; }
:lang(zh) .quiz .q { font-size: 60px; line-height: 1.3; }
.quiz ol { list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 20px; counter-reset: opt; }
.quiz li { counter-increment: opt; display: flex; align-items: center; gap: 24px; font-size: 40px; padding: 26px 32px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--surface); cursor: pointer; transition: border-color 0.2s, background 0.2s; }
.quiz li::before { content: counter(opt, upper-alpha); flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 2px solid var(--line); font: 600 24px/1 var(--font-mono); color: var(--muted); }
.quiz li:hover { border-color: var(--ink); }
.quiz li.picked { border-color: var(--ink); }
.quiz li.right { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.quiz li.right::before { content: "✓"; border-color: var(--ok); background: var(--ok); color: #fff; }
.quiz li.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 10%, var(--surface)); }
.quiz li.wrong::before { content: "✕"; border-color: var(--bad); background: var(--bad); color: #fff; }
.quiz .check { justify-self: start; font: 600 26px/1 var(--font-body); padding: 18px 30px; border-radius: 999px; border: 0; background: var(--ink); color: var(--bg); cursor: pointer; }
.quiz .explain { font-size: 34px; color: var(--muted); opacity: 0; transition: opacity 0.3s; }
.quiz.answered .explain { opacity: 1; }
.quiz.answered li { pointer-events: none; }

/* Drag to match */
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 28px 80px; max-width: 1600px; }
.match .items, .match .targets { display: grid; gap: 20px; align-content: start; }
.match .item { font-size: 38px; padding: 22px 30px; border-radius: var(--radius); background: var(--ink); color: var(--bg); cursor: grab; touch-action: none; user-select: none; transition: transform 0.2s, opacity 0.2s; }
.match .item.dragging { cursor: grabbing; transform: scale(1.04); box-shadow: 0 20px 40px rgb(0 0 0 / 0.2); z-index: 5; position: relative; }
.match .item.selected { outline: 4px solid var(--accent); }
.match .item.placed { opacity: 0.25; pointer-events: none; }
.match .target { min-height: 104px; display: flex; flex-direction: column; justify-content: center; gap: 8px; font-size: 34px; padding: 18px 30px; border-radius: var(--radius); border: 2px dashed var(--line); color: var(--muted); }
.match .target.over { border-color: var(--accent); }
.match .target.done { border-style: solid; border-color: var(--ok); color: var(--ink); background: color-mix(in srgb, var(--ok) 10%, var(--surface)); }
.match .target .answer { font-weight: 600; color: var(--ok); }
.match .target.nope { animation: nope 0.35s; }
@keyframes nope { 25% { transform: translateX(-10px); } 75% { transform: translateX(10px); } }

/* Chrome: controls, progress, notes */
.deck-progress { position: fixed; left: 0; bottom: 0; height: 4px; background: var(--accent); transition: width 0.3s ease; z-index: 20; }
.deck-controls { position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 6px; border-radius: 999px; background: rgb(20 20 18 / 0.82); color: #f1eee7; font: 500 13px/1 system-ui, sans-serif; z-index: 20; opacity: 0; transition: opacity 0.25s; backdrop-filter: blur(8px); }
body.show-ui .deck-controls, .deck-controls:hover, .deck-controls:focus-within { opacity: 1; }
.deck-controls button { border: 0; background: transparent; color: inherit; font: inherit; min-width: 36px; height: 32px; padding: 0 10px; border-radius: 999px; cursor: pointer; }
.deck-controls button:hover { background: rgb(255 255 255 / 0.12); }
.deck-controls .count { padding: 0 8px; font-variant-numeric: tabular-nums; opacity: 0.8; }
.deck-notes { position: fixed; left: 16px; right: 16px; bottom: 64px; max-height: 32vh; overflow: auto; padding: 18px 22px; border-radius: 14px; background: rgb(20 20 18 / 0.9); color: #f1eee7; font: 400 17px/1.6 system-ui, var(--cjk), sans-serif; z-index: 19; display: none; }
body.notes-open .deck-notes { display: block; }

@media (prefers-reduced-motion: reduce) {
  .deck-stage > section, .step { transition: none; transform: none; }
}

/* Video export: every slide is driven by the timeline instead of classes. */
html.deck-video *, html.deck-video *::before, html.deck-video *::after { transition: none !important; animation: none !important; }
html.deck-video .deck-stage > section { transform: none; }
html.deck-video .deck-controls, html.deck-video .deck-progress, html.deck-video .deck-notes { display: none; }

/* Drag to sort */
ol.sort { list-style: none; display: grid; gap: 16px; max-width: 1300px; counter-reset: rank; }
ol.sort li { counter-increment: rank; display: flex; align-items: center; gap: 24px; font-size: 38px; padding: 20px 28px; border-radius: var(--radius); background: var(--surface); border: 2px solid var(--line); cursor: grab; touch-action: none; user-select: none; }
ol.sort li::before { content: counter(rank); flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--ink); color: var(--bg); font: 600 22px/1 var(--font-mono); }
ol.sort li.dragging { cursor: grabbing; box-shadow: 0 20px 40px rgb(0 0 0 / 0.18); position: relative; z-index: 5; }
ol.sort li.right { border-color: var(--ok); }
ol.sort li.wrong { border-color: var(--bad); }
.sort-check { justify-self: start; align-self: flex-start; font: 600 26px/1 var(--font-body); padding: 18px 30px; border-radius: 999px; border: 0; background: var(--ink); color: var(--bg); cursor: pointer; }
