
:root {
  --dk-top: 0px;
  --dk-vh: calc(100dvh - var(--dk-top));
  --dk-rail: 252px;
  --dk-pad-i: clamp(1.75rem, 4.4vw, 5.5rem);
  --dk-pad-b: clamp(1.75rem, 5vh, 4rem);
  --dk-maxw: 1180px;

  --dk-h:       clamp(2rem,    min(1.35rem + 3.2vw, 0.40rem + 6.6vh), 3.9rem);
  --dk-h-tight: clamp(1.6rem,  min(1.20rem + 1.9vw, 0.38rem + 4.4vh), 2.7rem);
  --dk-h-cover: clamp(2.3rem,  min(1.30rem + 4.2vw, 0.36rem + 8.0vh), 4.6rem);
  --dk-lede:    clamp(1rem,    min(0.96rem + 0.38vw, 0.5rem + 1.15vh), 1.28rem);
  --dk-card:    clamp(1.05rem, min(1.0rem + 0.75vw, 0.35rem + 2.0vh), 1.5rem);
  --dk-micro:   0.6875rem;
  --dk-ease:    cubic-bezier(0.22, 1, 0.36, 1);
}

html.deck, html.deck body { height: 100%; overflow: hidden; }
html.deck { scroll-behavior: auto; --dk-top: var(--fxstrip-h, 0px); }
html.deck [id] { scroll-margin-top: 0; }

.drail {
  position: fixed;
  inset: var(--dk-top) auto 0 0;
  width: var(--dk-rail);
  z-index: 50;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.drail > * { min-width: 0; }
.drail__nav {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  min-width: 0;
}
.drail::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 2px;
  height: var(--dk-progress, 0%);
  background: var(--brand);
  transition: height 0.35s var(--dk-ease);
}
[data-theme$="dark"] .drail::after { background: var(--brand-strong); }

.chapters {
  list-style: none;
  margin: 0;
  padding: calc(var(--u) * 2) calc(var(--u) * 1.5);
  overflow-y: auto;
  scrollbar-width: thin;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.chapters > li + li { margin-top: 2px; }
.chapters a {
  display: grid;
  grid-template-columns: 2ch minmax(0, 1fr);
  gap: calc(var(--u) * 1.5);
  align-items: baseline;
  padding: calc(var(--u) * 1.25) calc(var(--u) * 1.5);
  border-radius: var(--r-sm);
  text-decoration: none;
  color: var(--fg-muted);
  transition: background 0.2s var(--dk-ease), color 0.2s var(--dk-ease);
}
.chapters a:hover { background: var(--surface-muted); color: var(--fg); }
.chapters__n {
  font-family: var(--f-mono);
  font-size: 0.625rem;
  letter-spacing: 0.02em;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}
.chapters__t { font-size: 0.875rem; font-weight: 500; line-height: 1.3; }

.chapters li[data-on] > a { background: var(--surface-muted); color: var(--fg); }
.chapters li[data-on] .chapters__t { font-weight: 700; }
.chapters li[data-on] .chapters__n { color: var(--brand); }
[data-theme$="dark"] .chapters li[data-on] .chapters__n { color: var(--brand-strong); }

.pips {
  --dot: 5px;
  --pill: 18px;
  list-style: none;
  margin: 0;
  padding: 1px 0 calc(var(--u) * 1.25) calc(2ch + var(--u) * 3);
  display: flex;
  align-items: center;
  gap: 5px;
}
.pips li { list-style: none; display: flex; }
.pips button {
  position: relative;
  width: var(--dot);
  height: 14px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  transition: width 0.35s var(--dk-ease);
}
.pips button::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: var(--dot);
  transform: translateY(-50%);
  border-radius: 999px;
  background: var(--line);
  transition: background 0.25s var(--dk-ease);
}
.chapters li[data-on] .pips button:not([data-on])::after { background: var(--fg-subtle); }
.chapters li .pips button:not([data-on]):hover::after { background: var(--fg-muted); }

.pips button[data-on] { width: var(--pill); }
.pips button[data-on]::after { background: var(--brand); }
[data-theme$="dark"] .pips button[data-on]::after { background: var(--brand-strong); }


@media (prefers-reduced-motion: reduce) {
  .pips button, .pips button::after { transition: none; }
}

.drail__foot {
  padding: calc(var(--u) * 2) calc(var(--u) * 2.5) calc(var(--u) * 2.5);
  border-top: 1px solid var(--line);
  display: grid;
  gap: calc(var(--u) * 1.5);
}
.drail__count {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  color: var(--fg-subtle);
  font-variant-numeric: tabular-nums;
}
.drail__count b { color: var(--fg); font-weight: 600; }
.drail__hint {
  font-size: var(--dk-micro);
  color: var(--fg-subtle);
  line-height: 1.5;
}
.drail__hint kbd {
  font-family: var(--f-mono);
  font-size: 0.625rem;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--fg-muted);
}

.stage-deck {
  position: relative;
  margin-left: var(--dk-rail);
  height: var(--dk-vh);
  overflow-x: hidden;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
}
.stage-deck::-webkit-scrollbar { display: none; }
@media (prefers-reduced-motion: reduce) { .stage-deck { scroll-behavior: auto; } }

.slide {
  position: relative;
  min-height: var(--dk-vh);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: grid;
  align-content: center;
  padding: var(--dk-pad-b) var(--dk-pad-i);
  overflow: hidden;
}
.slide__in { width: 100%; max-width: var(--dk-maxw); margin-inline: auto; }

html.js .slide__in > * {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.5s var(--dk-ease), transform 0.5s var(--dk-ease);
}
html.js .slide.is-live .slide__in > * { opacity: 1; transform: none; }
html.js .slide.is-live .slide__in > :nth-child(2) { transition-delay: 60ms; }
html.js .slide.is-live .slide__in > :nth-child(3) { transition-delay: 120ms; }
html.js .slide.is-live .slide__in > :nth-child(4) { transition-delay: 180ms; }
@media (prefers-reduced-motion: reduce) {
  html.js .slide__in > * { opacity: 1; transform: none; transition: none; }
}

.dk-eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--f-mono);
  font-size: var(--dk-micro);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-subtle);
  margin: 0 0 calc(var(--u) * 2.5);
}
.dk-eyebrow::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--brand);
  flex: 0 0 6px;
}
[data-theme$="dark"] .dk-eyebrow::before { background: var(--brand-strong); }

.dk-h {
  font-size: var(--dk-h);
  font-weight: 600;
  line-height: 1.04;
  letter-spacing: -0.028em;
  margin: 0;
  max-width: 26ch;
  text-wrap: balance;
}
.dk-h--tight { font-size: var(--dk-h-tight); max-width: 34ch; }
.dk-h--cover { font-size: var(--dk-h-cover); letter-spacing: -0.036em; max-width: 22ch; }
.dk-h .hl { color: var(--brand); }
[data-theme$="dark"] .dk-h .hl { color: var(--brand-strong); }

.dk-lede {
  font-size: var(--dk-lede);
  line-height: 1.5;
  color: var(--fg-muted);
  max-width: 62ch;
  margin: calc(var(--u) * 2.5) 0 0;
  text-wrap: pretty;
}
.dk-rule { height: 1px; background: var(--line); border: 0; margin: calc(var(--u) * 3.5) 0 0; }

.ev {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--f-mono);
  font-size: var(--dk-micro);
  font-weight: 500;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: var(--r-sm);
  white-space: nowrap;
}
.ev--fact { background: var(--positive-bg); color: var(--positive); }
.ev--demo { background: transparent; color: var(--fg-subtle); border: 1px solid var(--line); }
.ev--open { background: transparent; color: var(--fg-subtle); border: 1px dashed var(--line); }

.dk-cards { display: grid; gap: clamp(12px, 1.6vw, 20px); margin-top: calc(var(--u) * 4); }
.dk-cards--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dk-cards--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dk-cards--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 1040px) { .dk-cards--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 860px)  { .dk-cards--2, .dk-cards--3 { grid-template-columns: 1fr; } }

.dk-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: clamp(14px, 1.7vw, 24px);
}
.dk-card__n {
  font-family: var(--f-mono);
  font-size: var(--dk-micro);
  letter-spacing: 0.1em;
  color: var(--fg-subtle);
  margin: 0 0 8px;
}
.dk-card__t {
  font-size: var(--dk-card);
  font-weight: 600;
  line-height: 1.18;
  letter-spacing: -0.016em;
  margin: 0;
  text-wrap: balance;
}
.dk-card__d {
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--fg-muted);
  margin: 10px 0 0;
  text-wrap: pretty;
}
.dk-card--accent { border-top: 2px solid var(--brand); }
[data-theme$="dark"] .dk-card--accent { border-top-color: var(--brand-strong); }

.dk-figs { display: flex; flex-wrap: wrap; gap: clamp(24px, 4vw, 68px); margin-top: calc(var(--u) * 4); }
.dk-fig { min-width: 0; }
.dk-fig__v {
  display: block;
  font-size: clamp(1.85rem, min(1.2rem + 2.6vw, 0.4rem + 5.4vh), 3.1rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}
.dk-fig__k {
  display: block;
  margin-top: 9px;
  font-size: 0.8125rem;
  color: var(--fg-muted);
  line-height: 1.35;
  max-width: 24ch;
}
.dk-fig--win .dk-fig__v { color: var(--positive); }

.slide--cover { color: #fff; }
.slide--cover .dk-bg { position: absolute; inset: 0; z-index: 0; }
.slide--cover .dk-bg img { width: 100%; height: 100%; object-fit: cover; }
.slide--cover .dk-bg::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(105deg, rgba(var(--scrim), 0.94) 0%, rgba(var(--scrim), 0.80) 46%,
                    rgba(var(--scrim), 0.42) 100%),
    linear-gradient(180deg, rgba(var(--scrim), 0.5) 0%, rgba(var(--scrim), 0.1) 34%);
}
.slide--cover .slide__in { position: relative; z-index: 1; }
.slide--cover .dk-eyebrow { color: rgba(255, 255, 255, 0.74); }
.slide--cover .dk-eyebrow::before { background: #fff; }
.slide--cover .dk-lede { color: rgba(255, 255, 255, 0.9); }
.slide--cover .dk-h .hl { color: #fff; opacity: 0.62; }
@media (max-width: 860px) {
  .slide--cover .dk-bg::after {
    background: linear-gradient(180deg, rgba(var(--scrim), 0.9) 0%, rgba(var(--scrim), 0.66) 100%);
  }
}

.dk-cover-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin-top: calc(var(--u) * 4);
  padding-top: calc(var(--u) * 3);
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  font-family: var(--f-mono);
  font-size: var(--dk-micro);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
}

.slide--center { background: var(--brand); color: var(--brand-fg); }
[data-theme$="dark"] .slide--center { background: var(--surface-muted); color: var(--fg); }
.slide--center .slide__in { max-width: 880px; }
.slide--center .dk-eyebrow { color: currentColor; opacity: 0.68; }
.slide--center .dk-eyebrow::before { background: currentColor; }
.slide--center .dk-lede { color: currentColor; opacity: 0.84; max-width: 46ch; }
.slide--center .dk-h { max-width: none; }

.frame {
  margin-top: calc(var(--u) * 3);
  border: 1px solid var(--line);
  border-top: 2px solid var(--brand);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}
[data-theme$="dark"] .frame { border-top-color: var(--brand-strong); }
.frame__bar {
  display: flex;
  align-items: center;
  gap: calc(var(--u) * 1.5);
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}
.frame__k {
  font-family: var(--f-mono);
  font-size: var(--dk-micro);
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.frame__bar .ev { margin-left: auto; }
.frame__well { background: var(--surface-muted); padding: clamp(10px, 1.3vw, 18px); }
.frame__well img { width: 100%; display: block; border-radius: var(--r-sm); border: 1px solid var(--line); }
.frame__note {
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  font-size: 0.8125rem;
  color: var(--fg-muted);
  line-height: 1.5;
}

.slide--gate .slide__in { max-width: 900px; }
.dk-gate {
  margin-top: calc(var(--u) * 3);
  border-left: 3px solid var(--positive);
  padding-left: clamp(18px, 2.4vw, 34px);
}
.dk-gate__v {
  display: block;
  font-size: clamp(2.1rem, min(1.3rem + 3.4vw, 0.4rem + 6.6vh), 3.6rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.036em;
  color: var(--positive);
  font-variant-numeric: tabular-nums;
}
.dk-gate__k {
  display: block;
  margin-top: 12px;
  font-size: var(--dk-lede);
  color: var(--fg-muted);
  max-width: 52ch;
  line-height: 1.5;
  text-wrap: pretty;
}

.dk-source {
  margin: calc(var(--u) * 3.5) 0 0;
  font-family: var(--f-mono);
  font-size: 0.625rem;
  letter-spacing: 0.05em;
  color: var(--fg-subtle);
  text-transform: uppercase;
}

.deck-tools {
  position: fixed;
  top: calc(var(--dk-top) + var(--u) * 2);
  right: calc(var(--u) * 2.5);
  z-index: 60;
  display: flex;
  gap: 8px;
}
.deck-tools button, .deck-tools a {
  font-family: var(--f-mono);
  font-size: var(--dk-micro);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  color: var(--fg-muted);
  cursor: pointer;
  text-decoration: none;
}
.deck-tools button:hover, .deck-tools a:hover { color: var(--fg); border-color: var(--fg-subtle); }

@media (max-width: 900px) {
  .drail {
    inset: var(--dk-top) 0 auto 0;
    width: 100%;
    height: auto;
    grid-template-rows: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .drail::after { top: auto; bottom: 0; right: auto; left: 0; width: var(--dk-progress, 0%); height: 2px; transition: width 0.35s var(--dk-ease); }
  .drail__nav, .drail__act, .drail__foot { display: none; }
  .stage-deck { margin-left: 0; }
  .slide { padding-top: calc(var(--dk-pad-b) + 54px); }
  .deck-tools { top: auto; bottom: calc(var(--u) * 2); }
}

@media print {
  html.deck, html.deck body { height: auto; overflow: visible; }
  .drail, .deck-tools { display: none !important; }
  .stage-deck { margin-left: 0; height: auto; overflow: visible; }
  .slide { min-height: auto; break-after: page; padding: 24px 0; }
  .slide__in > * { opacity: 1 !important; transform: none !important; }
  .slide--center, .slide--cover { color: black; background: #fff; }
  .slide--cover .dk-bg { display: none; }
}
