/* ==========================================================================
   Agent Orchestration in Production · deck styles
   Stage is a fixed 1920x1080 canvas, scaled to fit the window by deck.js.
   ========================================================================== */

@font-face { font-family: "Open Sauce Sans"; src: url("../fonts/open-sauce-sans-latin-400-normal.woff") format("woff"); font-weight: 400; font-style: normal; font-display: block; }
@font-face { font-family: "Open Sauce Sans"; src: url("../fonts/open-sauce-sans-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: block; }
@font-face { font-family: "Open Sauce Sans"; src: url("../fonts/open-sauce-sans-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: block; }
@font-face { font-family: "Open Sauce Sans"; src: url("../fonts/open-sauce-sans-latin-800-normal.woff2") format("woff2"); font-weight: 800; font-style: normal; font-display: block; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: block; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: block; }

:root {
  --sat: env(safe-area-inset-top, 0px); --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px); --sal: env(safe-area-inset-left, 0px);
  --dark: #222222;
  --light: #d9d9d9;
  --blue: #2f7fe0;
  --blue-hi: #6aa8ff;
  --blue-deep: #17467f;
  --red: #ff5b4f;
  --green: #3fd49b;
  --amber: #f3b84e;
  --ease: cubic-bezier(.22, .8, .2, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --font: "Open Sauce Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --code-bg: #151515;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
html { background: var(--dark); transition: background-color .8s var(--ease); }
html[data-theme="light"] { background: var(--light); }
body { font-family: var(--font); -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
button { font: inherit; color: inherit; }

/* ---------- stage ---------- */
.stage {
  /* fixed, so the 1920px canvas never counts as page overflow (phones would zoom out to fit it) */
  position: fixed; left: 0; top: 0;
  width: 1920px; height: 1080px;
  transform-origin: 0 0;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  transition: background-color .8s var(--ease), color .8s var(--ease);
  --bg: var(--dark); --fg: #ffffff; --fg2: #d9d9d9; --mute: #8d8d8d; --faint: #5a5a5a;
  --line: rgba(255,255,255,.16); --card: rgba(255,255,255,.045); --card-2: rgba(255,255,255,.08); --card-line: rgba(255,255,255,.12);
  --accent: var(--blue-hi);
  --code-ink: #f2f2f2; --code-box: rgba(255,255,255,.06);
}
.stage[data-theme="light"] {
  --bg: var(--light); --fg: #111111; --fg2: #222222; --mute: #5a5a5a; --faint: #8f8f8f;
  --line: rgba(0,0,0,.2); --card: rgba(255,255,255,.42); --card-2: rgba(255,255,255,.62); --card-line: rgba(0,0,0,.1);
  --accent: #1c63c4;
  --code-ink: #1a1a1a; --code-box: rgba(255,255,255,.7);
}

/* blob: the grainy blue shape from the template */
.blob { position: absolute; left: 0; top: 0; width: 1920px; height: 1150px; pointer-events: none; z-index: 0;
  transform: translate(var(--bx, 200px), var(--by, 330px)) scale(var(--bs, 1)) rotate(var(--br, 0deg));
  transform-origin: 50% 50%;
  transition: transform 1.6s var(--ease), opacity 1.2s var(--ease);
  opacity: var(--bo, 1);
}
.blob img { width: 100%; height: 100%; display: block; animation: drift 22s ease-in-out infinite alternate; }
@keyframes drift {
  0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
  50%  { transform: translate(-36px, 18px) scale(1.035) rotate(-1.2deg); }
  100% { transform: translate(28px, -22px) scale(.985) rotate(1deg); }
}

/* chrome (template corner labels) */
.chrome { position: absolute; z-index: 5; font-weight: 700; color: var(--fg); transition: opacity .5s var(--ease), color .8s var(--ease); pointer-events: none; }
.chrome.studio { top: 50px; right: 60px; font-size: 13px; letter-spacing: .01em; }
.chrome.email { bottom: 44px; right: 60px; font-size: 15px; }
.chrome.counter { bottom: 44px; left: 60px; font-size: 15px; font-variant-numeric: tabular-nums; color: var(--mute); display: flex; gap: 18px; align-items: center; }
.chrome .code-hint { font-family: var(--mono); font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--mute); opacity: 0; transition: opacity .4s; }
.stage.has-code .chrome .code-hint { opacity: 1; }
.stage.code-open.has-code .chrome.studio,
.stage.code-open.has-code .chrome.email { opacity: 0; }
.stage.hide-chrome .chrome { opacity: 0; }

.progress { position: absolute; left: 0; bottom: 0; height: 4px; width: 100%; z-index: 6; background: transparent; }
.progress i { display: block; height: 100%; width: 0; background: var(--blue); transition: width .6s var(--ease); }

/* ---------- slides ---------- */
.slides { position: absolute; inset: 0; z-index: 2; transform-origin: 36px 50%; transition: transform .75s var(--ease), border-radius .75s var(--ease), box-shadow .75s; border-radius: 0; }
.stage.code-open.has-code .slides { transform: scale(.535); border-radius: 30px; box-shadow: 0 0 0 2px var(--line); }

.slide { position: absolute; inset: 0; visibility: hidden; opacity: 0; transform: translateY(26px);
  transition: opacity .45s var(--ease), transform .7s var(--ease), visibility 0s linear .7s; }
.slide.past { transform: translateY(-26px); }
.slide.active { visibility: visible; opacity: 1; transform: none; transition: opacity .55s var(--ease) .12s, transform .8s var(--ease) .08s, visibility 0s; }
.slide > .notes, .slide > script.code { display: none; }

.pad { position: absolute; inset: 104px 60px 104px 60px; }

/* fragments */
.frag { opacity: 0; transform: translateY(18px); transition: opacity .55s var(--ease), transform .7s var(--ease); }
.frag.on { opacity: 1; transform: none; }
.frag.fade { transform: none; }

/* ---------- typography ---------- */
.kicker { font-size: 20px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); margin: 0 0 22px; display: flex; gap: 14px; align-items: center; }
.kicker .n { color: var(--mute); }
.title { font-size: 84px; line-height: 1.02; font-weight: 700; letter-spacing: -.018em; margin: 0; }
.title.xl { font-size: 122px; letter-spacing: -.02em; }
.title.lg { font-size: 100px; }
.lead { font-size: 34px; line-height: 1.38; color: var(--fg2); margin: 0; font-weight: 400; max-width: 26ch; }
.lead strong, .body strong { font-weight: 700; color: var(--fg); }
.body { font-size: 30px; line-height: 1.42; color: var(--fg2); }
.body p { margin: 0 0 22px; }
.mute { color: var(--mute); }
.accent { color: var(--accent); }
.mono { font-family: var(--mono); }
.tag { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 16px; font-weight: 700; letter-spacing: .04em; padding: 6px 12px; border-radius: 999px; border: 1.5px solid currentColor; }
.tag.model { color: var(--blue-hi); }
.stage[data-theme="light"] .tag.model { color: #1c63c4; }
.tag.code { color: var(--fg); }

.title-row { position: absolute; left: 60px; top: 96px; right: 60px; }
.below-title { position: absolute; left: 60px; right: 60px; top: 290px; bottom: 100px; }

/* split: text left, visual right */
.split { position: absolute; inset: 96px 60px 100px 60px; display: grid; grid-template-columns: 640px 1fr; column-gap: 70px; }
.split.wide-right { grid-template-columns: 560px 1fr; }
.split .left { display: flex; flex-direction: column; }
.split .left .title { font-size: 76px; }
.split .left .lead { margin-top: 34px; font-size: 31px; max-width: none; }
.split .right { position: relative; }
.points { list-style: none; margin: 40px 0 0; padding: 0; display: grid; gap: 22px; }
.points li { font-size: 28px; line-height: 1.32; color: var(--fg2); padding-left: 34px; position: relative; }
.points li::before { content: ""; position: absolute; left: 0; top: .52em; width: 14px; height: 14px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 5px rgba(47,127,224,.18); }
.points li b { color: var(--fg); font-weight: 700; }

/* ---------- layout: title slide ---------- */
.l-cover .title { position: absolute; left: 60px; top: 70px; }
.l-cover .sub { position: absolute; left: 66px; top: 352px; font-size: 46px; font-weight: 500; color: var(--fg2); letter-spacing: -.005em; }
.l-cover .by { position: absolute; left: 66px; bottom: 150px; font-size: 26px; line-height: 1.5; color: var(--fg2); }
.l-cover .by b { color: var(--fg); font-size: 30px; }
.l-cover .event { position: absolute; left: 66px; bottom: 96px; font-size: 18px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--mute); }

/* ---------- layout: section divider (template slide 3) ---------- */
.l-section .big { position: absolute; left: 108px; top: 150px; width: 640px; font-size: 128px; line-height: 1.0; font-weight: 700; letter-spacing: -.02em; color: var(--fg2); }
.l-section .num { display: block; font-family: var(--mono); font-size: 30px; font-weight: 700; letter-spacing: .1em; color: var(--accent); margin-bottom: 34px; }
.l-section .rule { position: absolute; left: 770px; top: 150px; width: 1.5px; height: 772px; background: var(--fg2); opacity: .55; transform-origin: top; }
.l-section .desc { position: absolute; left: 830px; top: 150px; width: 820px; font-size: 44px; line-height: 1.28; font-weight: 500; color: var(--fg); }
.l-section .desc .mute { font-size: 30px; display: block; margin-top: 34px; font-weight: 400; line-height: 1.45; }

/* ---------- layout: statement ---------- */
.l-statement .q { position: absolute; left: 108px; right: 300px; top: 200px; font-size: 104px; line-height: 1.04; font-weight: 700; letter-spacing: -.022em; }
.l-statement .q .model { color: var(--blue); white-space: nowrap; }
.stage[data-theme="dark"] .l-statement .q .model { color: var(--blue-hi); }
.l-statement .after { position: absolute; left: 112px; top: 760px; font-size: 34px; color: var(--fg2); max-width: 1100px; line-height: 1.4; }

/* ---------- layout: numbered list (template slide 4) ---------- */
.l-numbered .title { position: absolute; left: 60px; top: 70px; }
.numbered { position: absolute; left: 54px; top: 290px; width: 1100px; list-style: none; margin: 0; padding: 0; display: grid; gap: 30px; counter-reset: n; }
.numbered li { display: grid; grid-template-columns: 170px 1fr; align-items: center; min-height: 128px; }
.numbered .no { font-size: 96px; font-weight: 700; color: var(--fg2); letter-spacing: -.02em; line-height: 1; }
.numbered .txt { font-size: 32px; line-height: 1.12; font-weight: 700; text-transform: uppercase; color: var(--fg2); max-width: 900px; }
.numbered .txt small { display: flex; align-items: center; gap: 14px; text-transform: none; font-weight: 400; font-size: 25px; line-height: 1.35; color: var(--mute); margin-top: 12px; letter-spacing: 0; }
.numbered .txt small .tag { font-size: 14px; padding: 4px 10px; }

/* ---------- layout: pillars (template slide 5) ---------- */
.l-pillars .title { position: absolute; left: 60px; right: 60px; top: 92px; text-align: center; font-size: 96px; color: #000; }
.stage[data-theme="dark"] .l-pillars .title { color: var(--fg); }
.l-pillars .hr { position: absolute; left: 108px; right: 108px; top: 248px; height: 1.5px; background: var(--fg2); opacity: .5; }
.pillars { position: absolute; left: 108px; right: 108px; top: 320px; display: grid; gap: 56px; }
.pillars.c3 { grid-template-columns: repeat(3, 1fr); }
.pillars.c4 { grid-template-columns: repeat(4, 1fr); gap: 46px; }
.pillar .ic { width: 64px; height: 64px; margin-bottom: 42px; color: #111; }
.stage[data-theme="dark"] .pillar .ic { color: var(--fg); }
.pillar h3 { font-size: 40px; margin: 0 0 22px; font-weight: 700; color: #000; letter-spacing: -.01em; }
.stage[data-theme="dark"] .pillar h3 { color: var(--fg); }
.pillar p { font-size: 27px; line-height: 1.38; margin: 0; color: #111; }
.stage[data-theme="dark"] .pillar p { color: var(--fg2); }
.pillar .ex { margin-top: 26px; font-family: var(--mono); font-size: 18px; line-height: 1.5; color: #1c63c4; background: rgba(255,255,255,.5); border-radius: 12px; padding: 14px 16px; }
.stage[data-theme="dark"] .pillar .ex { color: var(--blue-hi); background: var(--card); }

/* ---------- layout: thanks (template slide 7) ---------- */
.l-thanks .title { position: absolute; left: 108px; top: 140px; font-size: 120px; color: var(--fg2); }
.l-thanks .links { position: absolute; left: 112px; top: 420px; font-size: 50px; line-height: 1.6; font-weight: 700; color: var(--fg); }
.l-thanks .links span { display: block; }
.l-thanks .more { position: absolute; left: 112px; bottom: 150px; font-size: 24px; color: var(--mute); line-height: 1.6; }
.l-thanks .more b { color: var(--fg2); font-weight: 500; }
.qr { position: absolute; left: 1324px; top: 286px; width: 434px; height: 434px; background: #fff; padding: 28px; border-radius: 4px; }
.qr svg { width: 100%; height: 100%; display: block; }
.qr-cap { position: absolute; left: 1324px; top: 740px; width: 434px; text-align: center; font-family: var(--mono); font-size: 18px; color: var(--fg2); }

/* ---------- code drawer ---------- */
.code-drawer { position: absolute; z-index: 8; top: 26px; right: 26px; bottom: 26px; width: 852px; display: flex; flex-direction: column;
  background: var(--code-bg); color: #d8d8d8; border-radius: 22px; border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 40px 90px rgba(0,0,0,.45), 0 0 0 1px rgba(0,0,0,.2);
  transform: translateX(calc(100% + 60px)); transition: transform .75s var(--ease); overflow: hidden; }
.stage.code-open.has-code .code-drawer { transform: none; }
.code-head { display: flex; align-items: center; gap: 16px; padding: 22px 26px 18px; border-bottom: 1px solid rgba(255,255,255,.07); }
.code-head .dots { display: flex; gap: 8px; }
.code-head .dots i { width: 13px; height: 13px; border-radius: 50%; background: #3a3a3a; display: block; }
.code-head .file { font-family: var(--mono); font-size: 19px; font-weight: 700; color: #f0f0f0; padding: 8px 14px; border-radius: 10px; background: rgba(255,255,255,.06); }
.code-head .lang { font-family: var(--font); font-size: 15px; color: #8a8a8a; }
.code-head .stepinfo { margin-left: auto; font-family: var(--mono); font-size: 15px; color: #8a8a8a; }
.code-body { flex: 1; overflow: auto; padding: 22px 0 40px; font-family: var(--mono); font-size: 18.5px; line-height: 1.62; scrollbar-width: thin; scrollbar-color: #333 transparent; transition: opacity .3s; }
.code-body.swap { opacity: 0; }
.code-line { display: flex; white-space: pre; padding-right: 24px; transition: opacity .35s var(--ease), background-color .35s var(--ease), box-shadow .35s; }
.code-line .ln { flex: 0 0 64px; text-align: right; padding-right: 22px; color: #4a4a4a; user-select: none; }
.code-line .lc { flex: 1; }
.code-body.has-hl .code-line { opacity: .3; }
.code-body.has-hl .code-line.hl { opacity: 1; background: rgba(47,127,224,.15); box-shadow: inset 4px 0 0 var(--blue); }
.code-body.has-hl .code-line.hl .ln { color: #9ab8e6; }
.code-foot { padding: 14px 26px 18px; border-top: 1px solid rgba(255,255,255,.07); font-family: var(--mono); font-size: 14px; color: #777; display: flex; gap: 22px; }
.code-foot kbd { font-family: var(--mono); color: #bbb; border: 1px solid #3a3a3a; border-bottom-width: 2px; border-radius: 6px; padding: 1px 7px; margin-right: 6px; }

/* syntax colors */
.t-kw { color: #6aa8ff; }
.t-str { color: #e8c07a; }
.t-com { color: #6f7781; font-style: italic; }
.t-num { color: #ff8f73; }
.t-dec { color: #5fd4c0; }
.t-fn { color: #ffffff; font-weight: 700; }
.t-call { color: #e6e6e6; }
.t-cls { color: #9cc8ff; }
.t-bi { color: #b6a6ff; }
.t-self { color: #c0c0c0; font-style: italic; }
.t-op { color: #9a9a9a; }

/* ---------- overlays (outside the stage) ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: none; }
.overlay.show { display: block; }
.blackout { background: #000; cursor: none; }

.overview { background: rgba(14,14,14,.94); backdrop-filter: blur(8px); overflow: auto; padding: 48px; color: #eee; font-family: var(--font); }
.overview h2 { margin: 0 0 26px; font-size: 18px; letter-spacing: .16em; text-transform: uppercase; color: #888; font-weight: 700; }
.ov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.ov-card { text-align: left; border: 1px solid #2c2c2c; background: #1a1a1a; border-radius: 14px; padding: 16px 16px 18px; cursor: pointer; min-height: 132px; display: flex; flex-direction: column; gap: 8px; transition: border-color .2s, transform .2s; }
.ov-card:hover, .ov-card.sel { border-color: var(--blue); transform: translateY(-2px); }
.ov-card.cur { background: #13243d; }
.ov-card .n { font-family: var(--mono); font-size: 13px; color: #777; display: flex; justify-content: space-between; }
.ov-card .k { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--blue-hi); font-weight: 700; }
.ov-card .t { font-size: 18px; font-weight: 700; line-height: 1.25; }
.ov-card.light { background: #2a2a2a; }

.help { background: rgba(14,14,14,.9); display: none; place-items: center; color: #eee; }
.help.show { display: grid; }
.help .box { background: #1a1a1a; border: 1px solid #2e2e2e; border-radius: 18px; padding: 30px 36px; min-width: 520px; font-size: 16px; }
.help h3 { margin: 0 0 18px; font-size: 14px; letter-spacing: .16em; text-transform: uppercase; color: #888; }
.help table { border-collapse: collapse; width: 100%; }
.help td { padding: 7px 0; }
.help td:first-child { width: 190px; }
.help kbd { font-family: var(--mono); font-size: 13px; color: #ddd; border: 1px solid #444; border-bottom-width: 2px; border-radius: 6px; padding: 2px 8px; margin-right: 4px; }

/* floating toolbar (auto-hides) */
.toolbar { position: fixed; z-index: 40; left: 50%; bottom: 18px; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  display: flex; gap: 6px; padding: 6px; border-radius: 14px; background: rgba(20,20,20,.86); border: 1px solid rgba(255,255,255,.1); backdrop-filter: blur(10px);
  transition: opacity .3s var(--ease), transform .3s var(--ease); }
.toolbar.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toolbar button { border: 0; background: transparent; color: #ddd; height: 38px; min-width: 40px; padding: 0 12px; border-radius: 10px; cursor: pointer; font-size: 14px; font-family: var(--mono); display: inline-flex; align-items: center; gap: 8px; }
.toolbar button:hover { background: rgba(255,255,255,.1); }
.toolbar button.on { background: rgba(47,127,224,.3); color: #fff; }
.toolbar .sep { width: 1px; background: rgba(255,255,255,.12); margin: 6px 2px; }
.toolbar .pos { font-family: var(--mono); font-size: 13px; color: #999; display: inline-flex; align-items: center; padding: 0 10px; font-variant-numeric: tabular-nums; }

.goto { position: fixed; z-index: 45; right: 24px; top: 20px; font-family: var(--mono); font-size: 28px; color: #fff; background: rgba(20,20,20,.9); border: 1px solid #333; border-radius: 12px; padding: 8px 18px; display: none; }
.goto.show { display: block; }

/* ---------- presenter view ---------- */
body.presenter { background: #0f0f0f; color: #eee; overflow: hidden; }
body.presenter .stage, body.presenter .toolbar { display: none; }
.pv { position: fixed; inset: 0; display: grid; grid-template-columns: 1.55fr 1fr; grid-template-rows: auto 1fr; gap: 18px; padding: 18px; font-family: var(--font); }
.pv-frame { position: relative; background: #000; border-radius: 12px; overflow: hidden; border: 1px solid #2a2a2a; aspect-ratio: 16 / 9; }
.pv-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; pointer-events: none; }
.pv-label { position: absolute; left: 12px; top: 10px; z-index: 2; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #bbb; background: rgba(0,0,0,.6); padding: 4px 8px; border-radius: 6px; font-weight: 700; }
.pv-side { display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.pv-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pv-box { background: #181818; border: 1px solid #2a2a2a; border-radius: 12px; padding: 14px 16px; }
.pv-box .k { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: #888; font-weight: 700; margin-bottom: 6px; }
.pv-box .v { font-family: var(--mono); font-size: 28px; font-variant-numeric: tabular-nums; }
.pv-box .v.small { font-size: 18px; line-height: 1.35; font-family: var(--font); font-weight: 700; }
.pv-box button { background: #262626; border: 1px solid #333; border-radius: 8px; padding: 4px 10px; color: #ddd; cursor: pointer; font-family: var(--mono); font-size: 13px; margin-right: 6px; margin-top: 8px; }
.pv-notes { grid-column: 1 / -1; background: #151515; border: 1px solid #2a2a2a; border-radius: 12px; padding: 22px 28px; overflow: auto; font-size: 25px; line-height: 1.55; color: #e9e9e9; min-height: 0; }
.pv-notes p { margin: 0 0 14px; }
.pv-notes .empty { color: #666; }
.pv-notes .stepnote { color: #9cc8ff; }

/* embed mode (presenter iframes) */
body.embed .toolbar { display: none; }

/* ---------- small screens: keep things usable ---------- */
@media (prefers-reduced-motion: reduce) {
  .blob img { animation: none; }
  .slide, .slide.active, .frag, .slides, .code-drawer, .blob { transition-duration: .01s !important; transition-delay: 0s !important; }
}

/* ==========================================================================
   v2: GSAP + Magic Move layer
   ========================================================================== */

/* GSAP drives the blob; CSS transitions would fight it */
.gsap .blob { transition: none; transform: none; will-change: transform; }

/* headline reveal masks (SplitText) */
.m-line { will-change: transform; }

/* section rail: replaces per-slide eyebrows. Amber = where we are (state). */
.chrome.rail { top: 46px; left: 60px; display: flex; align-items: baseline; gap: 34px; font-size: 15px; font-weight: 500; color: var(--mute); transition: opacity .5s var(--ease), color .8s var(--ease); }
.chrome.rail.off { opacity: 0; }
.chrome.rail .rail-talk { color: var(--fg2); font-weight: 700; }
.chrome.rail ol { list-style: none; display: flex; gap: 26px; margin: 0; padding: 0; }
.chrome.rail li { position: relative; padding-bottom: 7px; transition: color .4s var(--ease); }
.chrome.rail li::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; border-radius: 1px; background: var(--amber); transform: scaleX(0); transform-origin: left; transition: transform .6s cubic-bezier(.7,0,.2,1); }
.chrome.rail li.on { color: var(--fg); }
.chrome.rail li.on::after { transform: scaleX(1); }
.stage.code-open.has-code .chrome.rail { opacity: 0; }

/* travelling dots (Motion.pulse) */
.m-dot-model { fill: #9cc8ff; filter: drop-shadow(0 0 12px rgba(106,168,255,.95)); }
.m-dot-code { fill: #fff; }
.m-dot-bad { fill: var(--red); filter: drop-shadow(0 0 10px rgba(255,91,79,.9)); }
.m-dot-state { fill: var(--amber); filter: drop-shadow(0 0 10px rgba(243,184,78,.9)); }

/* Magic Move code drawer */
.code-drawer.mm .code-body { padding: 0; }
.mm-wrap { position: relative; padding: 22px 24px 48px 0; min-height: 100%; }
.mm-bars { position: absolute; left: 0; right: 0; top: 0; pointer-events: none; }
.mm-bars i { position: absolute; left: 0; right: 0; display: block; background: rgba(47,127,224,.15); box-shadow: inset 4px 0 0 var(--blue); }
.mm-pre { position: relative; margin: 0; padding: 0 0 0 18px; font-family: var(--mono); font-size: 18.5px; line-height: 1.62; color: #d8d8d8; background: transparent !important; tab-size: 4; }
.mm-pre .shiki-magic-move-line-number { display: inline-block; color: #4f4f4f; opacity: 1; min-width: 46px; padding-right: 0; text-align: right; }
/* "where it breaks": the marker names the part of the talk that fixes it */
.numbered.breaks li { grid-template-columns: 230px 1fr; }
.numbered.breaks .no { font-size: 44px; font-weight: 700; color: var(--mute); letter-spacing: -.01em; }

/* ==========================================================================
   Phones and tablets
   ========================================================================== */
html, body { overscroll-behavior: none; }
body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* compact: the stage is small (phone landscape). Code takes the whole stage with larger type. */
.stage.compact .code-drawer { left: 20px; right: 20px; top: 20px; bottom: 20px; width: auto; border-radius: 26px; }
.stage.compact.code-open.has-code .slides { opacity: 0; transform: scale(.94); transition: opacity .4s var(--ease), transform .6s var(--ease); }
.stage.compact .code-head { padding: 26px 34px 22px; }
.stage.compact .code-head .file { font-size: 34px; padding: 10px 18px; }
.stage.compact .code-head .lang, .stage.compact .code-head .stepinfo { font-size: 26px; }
.stage.compact .code-head .dots i { width: 18px; height: 18px; }
.stage.compact .mm-pre, .stage.compact .code-body { font-size: 36px; }
.stage.compact .mm-pre .shiki-magic-move-line-number { min-width: 80px; }
.stage.compact .code-foot { display: none; }
.stage.compact .chrome.counter, .stage.compact .chrome.rail { font-size: 24px; }
.stage.compact .chrome.studio { font-size: 20px; }
.stage.compact .chrome.email { font-size: 22px; }

/* touch toolbar: bigger targets */
.toolbar.touch { bottom: max(12px, env(safe-area-inset-bottom)); }
.toolbar.touch button { height: 46px; min-width: 50px; font-size: 16px; }

/* rotate prompt */
.rotate { background: #1b1b1b; color: #f2f2f2; display: none; place-items: center; text-align: center; padding: 32px; font-family: var(--font); }
.rotate.show { display: grid; }
.rot-box { max-width: 320px; display: grid; justify-items: center; gap: 6px; }
.rot-phone { width: 76px; height: 76px; color: #6aa8ff; margin-bottom: 18px; animation: rot-turn 2.6s cubic-bezier(.65,0,.35,1) infinite; }
@keyframes rot-turn { 0%, 25% { transform: rotate(0deg); } 50%, 80% { transform: rotate(-90deg); } 100% { transform: rotate(0deg); } }
.rot-en { margin: 0; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.rot-tr { margin: 0; font-size: 20px; color: #bdbdbd; }
.rot-why { margin: 14px 0 0; font-size: 15px; color: #8a8a8a; }
.rot-go { margin-top: 22px; font: 600 15px var(--font); color: #ddd; background: transparent; border: 1.5px solid #444; border-radius: 999px; padding: 10px 18px; }
@media (prefers-reduced-motion: reduce) { .rot-phone { animation: none; transform: rotate(-90deg); } }
.toolbar .pos { white-space: nowrap; }
.toolbar.touch { max-width: calc(100vw - 24px); }
.toolbar.touch button { white-space: nowrap; padding: 0 10px; }

/* ==========================================================================
   Story mode: phones in portrait. One scrolling page, sticky graphics,
   steps driven by scroll. Everything here is scoped under html.story.
   ========================================================================== */
/* the page (viewport) scrolls, never body: a scrolling body would break position: sticky */
html.story { height: auto; overflow-y: auto; overflow-x: hidden; }
html.story body { height: auto; overflow: visible; }
html.story { background: var(--dark); scroll-behavior: auto; }
html.story body { touch-action: auto; }
html.story .stage { position: static; width: auto; height: auto; transform: none !important; overflow: visible; background: none; color: var(--fg); transition: none; }
html.story .blob, html.story .chrome.studio, html.story .chrome.email, html.story .chrome.counter, html.story .progress, html.story .toolbar, html.story .goto, html.story .rotate { display: none !important; }
html.story .slides { position: static; transform: none !important; border-radius: 0; box-shadow: none; }

/* each slide is a section with its own theme and its own blob */
html.story .slide { position: relative; inset: auto; visibility: visible; opacity: 1; transform: none; transition: none;
  padding: 92px 22px 64px; background: var(--bg); color: var(--fg); overflow: clip; }
html.story .slide[data-theme="light"] {
  --bg: var(--light); --fg: #111111; --fg2: #222222; --mute: #5a5a5a; --faint: #8f8f8f;
  --line: rgba(0,0,0,.2); --card: rgba(255,255,255,.42); --card-2: rgba(255,255,255,.62); --card-line: rgba(0,0,0,.1);
  --accent: #1c63c4; --code-ink: #1a1a1a; --code-box: rgba(255,255,255,.7);
}
html.story .slide::before { content: ""; position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background: url("../img/blob.webp") no-repeat; background-size: calc(var(--bsz, 100%) * 1.9) auto;
  background-position: var(--bpx, 10%) var(--bpy, 30%); opacity: var(--bop, 1); }
html.story .slide > * { position: relative; z-index: 1; }
html.story .slide + .slide { border-top: 1px solid rgba(255,255,255,.04); }

/* reset the 1920px absolute layouts into flow */
html.story .split, html.story .title-row, html.story .below-title, html.story .pad,
html.story .l-cover .title, html.story .l-cover .sub, html.story .l-cover .by, html.story .l-cover .event,
html.story .l-section .big, html.story .l-section .rule, html.story .l-section .desc,
html.story .l-statement .q, html.story .l-statement .after,
html.story .l-numbered .title, html.story .numbered,
html.story .l-pillars .title, html.story .l-pillars .hr, html.story .pillars,
html.story .l-thanks .title, html.story .l-thanks .links, html.story .l-thanks .more, html.story .qr, html.story .qr-cap {
  position: relative; inset: auto; left: auto; right: auto; top: auto; bottom: auto; width: auto; height: auto;
}
html.story .split { display: block; }

/* type, set for a 390px-wide screen */
html.story .title { font-size: clamp(32px, 9.2vw, 46px); line-height: 1.04; }
html.story .title.xl { font-size: clamp(38px, 11vw, 54px); }
html.story .title.lg { font-size: clamp(34px, 10vw, 48px); }
html.story .split .left .title { font-size: clamp(32px, 9.2vw, 46px); }
html.story .lead, html.story .split .left .lead, html.story .title-row .lead.side { font-size: 18px; line-height: 1.5; max-width: 60ch; margin-top: 16px; color: var(--fg2); }
html.story .points { margin-top: 22px; gap: 12px; }
html.story .points li { font-size: 17px; padding-left: 26px; }
html.story .points li::before { width: 10px; height: 10px; top: .5em; box-shadow: 0 0 0 4px rgba(47,127,224,.18); }
html.story .legend { margin-top: 18px; }
html.story .legend .tag { font-size: 14px; padding: 6px 12px; }
html.story .stack { margin-top: 22px; gap: 8px; }
html.story .stack span { font-size: 13px; padding: 6px 10px; }
html.story .pillar-legend { margin-top: 18px; }
html.story .pl { font-size: 14px; }

html.story .l-cover { min-height: 92svh; display: flex; flex-direction: column; justify-content: flex-end; padding-top: 72px; }
html.story .l-cover .title { order: 0; }
html.story .l-cover .sub { font-size: 22px; margin-top: 14px; }
html.story .l-cover .by { font-size: 16px; margin-top: 48px; }
html.story .l-cover .by b { font-size: 18px; }
html.story .l-cover .event { font-size: 12px; margin-top: 12px; }
html.story .l-cover::before { background-position: 30% 92%; background-size: 260% auto; }

html.story .l-section .big { font-size: clamp(48px, 15vw, 72px); width: auto; }
html.story .l-section .num { font-size: 18px; margin-bottom: 14px; }
html.story .l-section .rule { width: 56px; height: 2px; margin: 26px 0; }
html.story .l-section .desc { font-size: 21px; line-height: 1.38; width: auto; }
html.story .l-section .desc .mute { font-size: 17px; margin-top: 18px; }
html.story .bio { gap: 16px; }
html.story .bio li { font-size: 19px; }
html.story .bio li.old { font-size: 16px; }

html.story .l-statement .q { font-size: clamp(32px, 9.4vw, 44px); line-height: 1.08; }
html.story .l-statement .after { font-size: 18px; margin-top: 26px; }

html.story .numbered { margin-top: 26px; gap: 22px; width: auto; }
html.story .numbered li { grid-template-columns: 64px 1fr; min-height: 0; align-items: start; }
html.story .numbered .no { font-size: 34px; }
html.story .numbered .txt { font-size: 17px; max-width: none; }
html.story .numbered .txt small { font-size: 15px; flex-wrap: wrap; gap: 8px; }
html.story .numbered.breaks li { grid-template-columns: 1fr; gap: 4px; }
html.story .numbered.breaks .no { font-size: 15px; color: var(--accent); }
html.story .lessons .numbered .txt { font-size: 18px; }

html.story .l-pillars .title { font-size: clamp(32px, 9.2vw, 44px); text-align: left; }
html.story .l-pillars .hr { margin: 22px 0; }
html.story .pillars.c3, html.story .pillars.c4 { grid-template-columns: 1fr; gap: 30px; }
html.story .pillar .ic { width: 40px; height: 40px; margin-bottom: 12px; }
html.story .pillar h3 { font-size: 22px; margin-bottom: 8px; }
html.story .pillar p { font-size: 16px; }
html.story .pillar .ex { font-size: 13px; margin-top: 12px; }

html.story .l-thanks .title { font-size: clamp(42px, 13vw, 60px); }
html.story .l-thanks .links { font-size: 20px; margin-top: 26px; }
html.story .l-thanks .more { font-size: 15px; margin-top: 26px; }
html.story .l-thanks [data-widget] { position: relative; inset: auto; margin-top: 34px; }
html.story .qr { width: 210px; height: 210px; padding: 14px; }
html.story .qr-cap { width: 210px; font-size: 13px; margin-top: 8px; text-align: left; }

/* sticky frames: the widget's own 1920-stage canvas, scaled to the screen width */
html.story .story-frame { position: sticky; top: 48px; z-index: 2; display: block; width: calc(100% + 44px); margin: 28px -22px 0; overflow: hidden; background: var(--bg); }
html.story .story-frame > [data-widget] { position: absolute; left: 0; top: 0; right: auto; bottom: auto; transform-origin: 0 0; }
html.story .story-spacer { pointer-events: none; }
.story-dots { position: absolute; left: 22px; bottom: 10px; display: flex; gap: 6px; z-index: 3; }
.story-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); transition: background .3s; }
.story-dots i.on { background: var(--amber); }

/* header: the rail becomes a fixed top bar */
html.story .chrome.rail { position: fixed; top: 0; left: 0; right: 0; height: 48px; padding: 0 22px; display: flex; align-items: center; gap: 16px;
  font-size: 13px; background: rgba(26,26,26,.86); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); z-index: 30; color: #8d8d8d; border-bottom: 1px solid rgba(255,255,255,.06); }
html.story .chrome.rail.off { opacity: 0; pointer-events: none; }
html.story .chrome.rail .rail-talk { color: #e6e6e6; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
html.story .chrome.rail ol { gap: 14px; margin-left: auto; }
html.story .chrome.rail li { padding-bottom: 4px; }
html.story .chrome.rail li.on { color: #fff; }
@media (max-width: 380px) { html.story .chrome.rail .rail-talk { display: none; } html.story .chrome.rail ol { margin-left: 0; } }

/* code as a bottom sheet */
html.story .code-drawer { position: fixed; left: 0; right: 0; bottom: 0; top: auto; width: auto; height: 62svh; border-radius: 20px 20px 0 0; z-index: 40;
  transform: translateY(105%); box-shadow: 0 -20px 60px rgba(0,0,0,.5); }
html.story .stage.code-open.has-code .code-drawer { transform: none; }
html.story .code-head { padding: 14px 18px 12px; gap: 10px; }
html.story .code-head .file { font-size: 14px; padding: 6px 10px; }
html.story .code-head .lang, html.story .code-head .stepinfo { font-size: 12px; }
html.story .code-head .dots { display: none; }
html.story .code-foot { display: none; }
html.story .mm-wrap { padding: 14px 14px 80px 0; }
html.story .mm-pre, html.story .code-body { font-size: 12.5px; }
html.story .mm-pre { padding-left: 8px; }
html.story .mm-pre .shiki-magic-move-line-number { min-width: 26px; }
.story-code-btn { display: none; }
html.story.story-has-code .story-code-btn { display: inline-flex; position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 45;
  align-items: center; gap: 6px; font: 600 15px var(--mono); color: #111; background: #f4f4f4; border: 0; border-radius: 999px; padding: 12px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35); }
