/* Slide engine: fixed 1440x900 canvas scaled to fit the window */
html, body.deck { height: 100%; overflow: hidden; }
body.deck { background: #e9eaee; }

.stage {
  position: fixed; left: 50%; top: 50%;
  width: 1440px; height: 900px;
  transform-origin: 0 0;
}
.slide {
  position: absolute; inset: 0;
  overflow: hidden;
  padding: 88px 96px 72px;
  opacity: 0; visibility: hidden;
  transition: opacity .45s var(--ease), visibility 0s linear .45s, transform .55s var(--ease);
  transform: translateX(24px);
}
.slide.past { transform: translateX(-24px); }
.slide.active { opacity: 1; visibility: visible; transform: none; transition: opacity .45s var(--ease), visibility 0s, transform .55s var(--ease); z-index: 2; }

/* paper surface */
.slide { background-color: var(--paper); background-image: linear-gradient(to bottom, var(--rule) 1px, transparent 1px); background-size: 100% 30px; }
.slide.plain { background-image: none; }
.slide.dark { background: #0d0f16; color: #e8eaf0; }
.slide.dark h1, .slide.dark h2, .slide.dark h3 { color: #fff; }

/* chrome */
.chrome { position: absolute; z-index: 5; pointer-events: none; font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.chrome.tl { left: 96px; top: 36px; }
.chrome.tr { right: 96px; top: 36px; text-align: right; }
.chrome.br { right: 96px; bottom: 30px; }
.chrome.bl { left: 96px; bottom: 30px; }
.chrome b { color: var(--ink-2); font-weight: 500; }
.progress { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--blue); z-index: 6; transition: width .5s var(--ease); }

/* typography on slides */
.slide h1 { font-size: 92px; letter-spacing: -0.045em; }
.slide h2 { font-size: 56px; letter-spacing: -0.04em; margin-bottom: 18px; }
.slide h3 { font-size: 26px; letter-spacing: -0.025em; }
.slide .kicker { font-family: var(--f-mono); font-size: 13px; letter-spacing: .1em; text-transform: uppercase; color: var(--blue); margin-bottom: 18px; display: block; }
.slide .lede { font-size: 24px; line-height: 1.45; color: var(--ink-3); max-width: 900px; }
.slide p { font-size: 20px; line-height: 1.5; color: var(--ink-2); margin: 0 0 14px; }
.slide ul.plain { list-style: none; padding: 0; margin: 0; }
.slide ul.plain li { font-size: 20px; line-height: 1.45; color: var(--ink-2); padding: 10px 0 10px 28px; position: relative; border-top: 1px solid var(--line); }
.slide ul.plain li::before { content: ""; position: absolute; left: 2px; top: 20px; width: 10px; height: 10px; border: 1.5px solid var(--blue); }
.slide small, .slide .src { font-family: var(--f-mono); font-size: 11px; color: var(--muted); letter-spacing: .02em; }
.src a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }

.cols { display: grid; gap: 40px; }
.cols.c2 { grid-template-columns: 1fr 1fr; }
.cols.c3 { grid-template-columns: repeat(3, 1fr); }
.cols.c4 { grid-template-columns: repeat(4, 1fr); }
.cols.c37 { grid-template-columns: 3fr 7fr; }
.cols.c46 { grid-template-columns: 4fr 6fr; }
.cols.c55 { grid-template-columns: 5fr 5fr; }
.cols.c64 { grid-template-columns: 6fr 4fr; }

/* entry animations: children with .rise animate when slide becomes active */
.slide .rise { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); transition-delay: calc(var(--i, 0) * 80ms + 120ms); }
.slide.active .rise { opacity: 1; transform: none; }

/* step builds */
[data-step] { transition: opacity .45s var(--ease), transform .45s var(--ease), filter .45s; }
[data-step]:not(.shown) { opacity: 0; transform: translateY(10px); pointer-events: none; }
[data-step].dim-after.shown.dimmed { opacity: .35; }

/* scrollable deep slides */
.scroller { overflow-y: auto; overscroll-behavior: contain; }
.scroller::-webkit-scrollbar { width: 8px; }
.scroller::-webkit-scrollbar-thumb { background: var(--line-2); }

/* images */
.shot { display: block; max-width: 100%; border: 1px solid var(--line); background: #fff; cursor: zoom-in; }
figure { margin: 0; }
figcaption { font-family: var(--f-mono); font-size: 11px; color: var(--muted); margin-top: 8px; letter-spacing: .02em; }
figcaption a { color: var(--muted); text-decoration: underline; }

/* lightbox */
.lightbox { position: fixed; inset: 0; background: rgba(12,13,18,.86); z-index: 100; display: none; align-items: center; justify-content: center; cursor: zoom-out; padding: 3vh 3vw; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 100%; max-height: 100%; background: #fff; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.lightbox .cap { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #c9ccd6; font-family: var(--f-mono); font-size: 12px; }

/* notes drawer */
.notes { display: none; }
.notes-drawer { position: fixed; left: 0; right: 0; bottom: 0; max-height: 34vh; overflow: auto; background: #12141c; color: #e6e8ef; font-family: var(--f-body); font-size: 17px; line-height: 1.5; padding: 18px 28px 22px; z-index: 50; transform: translateY(100%); transition: transform .3s var(--ease); border-top: 3px solid var(--blue); }
.notes-drawer.open { transform: none; }
.notes-drawer .label { color: #8d93a6; display: block; margin-bottom: 6px; }
.notes-drawer ul { margin: 6px 0; padding-left: 20px; }

/* overview */
body.overview .stage { position: absolute; left: 0; top: 0; transform: none !important; width: 100%; height: auto; }
body.overview { overflow-y: auto; }
body.overview .slide { opacity: 1; visibility: visible; width: 1440px; height: 900px; cursor: pointer; transition: none; box-shadow: 0 0 0 1px var(--line-2); transform-origin: 0 0; }
body.overview .slide.active { box-shadow: 0 0 0 6px var(--blue); }
body.overview .slide [data-step] { opacity: 1; transform: none; }
body.overview .slide .rise { opacity: 1; transform: none; transition: none; }
body.overview .slide * { pointer-events: none; }
body.overview .notes-drawer, body.overview .hud { display: none; }

/* small on-screen controls */
.hud { position: fixed; right: 14px; bottom: 12px; z-index: 55; display: flex; gap: 6px; opacity: 0; transition: opacity .3s; }
body:hover .hud { opacity: 1; }
.hud button { font-family: var(--f-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); background: rgba(255,255,255,.85); border: 1px solid var(--line-2); padding: 6px 9px; cursor: pointer; }
.hud button:hover { color: var(--blue); border-color: var(--blue); }
.help { position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); background: #fff; border: 1px solid var(--line-2); padding: 22px 28px; z-index: 60; display: none; font-size: 15px; box-shadow: 0 20px 50px rgba(0,0,0,.12); }
.help.open { display: block; }
.help kbd { font-family: var(--f-mono); font-size: 12px; border: 1px solid var(--line-2); padding: 1px 6px; background: var(--paper); }
.help td { padding: 4px 14px 4px 0; }

/* Pareto chart */
.pareto { position: relative; }
.pc-bar { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 8px; }
.pc-filters { display: flex; gap: 6px; }
.pc-filters button { font-family: var(--f-mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; padding: 7px 11px; border: 1px solid var(--line-2); background: #fff; color: var(--ink-3); cursor: pointer; }
.pc-filters button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.pc-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-family: var(--f-mono); font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.pc-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.pc-legend i.hollow { border: 1.5px solid var(--ink-3); background: #fff; }
.pc-plot { position: relative; background: #fff; border: 1px solid var(--line); }
.pc-plot svg { display: block; width: 100%; height: auto; cursor: grab; }
.pc-axis text { font-family: var(--f-mono); font-size: 11px; fill: var(--muted); }
.pc-axis line { stroke: #eef0f3; }
.pc-axis path { stroke: var(--line-2); }
.pc-title { font-family: var(--f-mono); font-size: 11px; fill: var(--ink-3); letter-spacing: .06em; text-transform: uppercase; }
.pc-front { fill: none; stroke: var(--blue); stroke-width: 2.5; }
.pc-dot { cursor: pointer; transition: opacity .3s; }
.pc-dot .core { stroke-width: 2; }
.pc-dot:not(.front):not(.near) .core { opacity: .55; }
.pc-dot.off { opacity: .07; pointer-events: none; }
.pc-lab { font-family: var(--f-body); font-size: 13px; font-weight: 600; fill: var(--ink-2); paint-order: stroke; stroke: #fff; stroke-width: 4px; pointer-events: none; }
.pc-tip { position: absolute; width: 300px; background: #fff; border: 1px solid var(--line-2); box-shadow: 0 16px 40px -16px rgba(20,25,60,.3); padding: 12px 14px; font-size: 13px; opacity: 0; transition: opacity .15s; pointer-events: none; z-index: 3; }
.pc-tip.on { opacity: 1; }
.pc-tip b { font-family: var(--f-head); font-weight: 600; font-size: 15px; display: block; }
.pc-fam { font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; }
.pc-kv { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding: 5px 0; margin-top: 6px; }
.pc-kv em { color: var(--muted); font-style: normal; font-size: 11px; }
.pc-raw { font-family: var(--f-mono); font-size: 11px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 4px; }
.pc-raw div { display: flex; justify-content: space-between; padding: 1px 0; }
.pc-basis { font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 5px; margin-top: 4px; line-height: 1.4; }
.pc-reset { position: absolute; right: 10px; top: 10px; font-family: var(--f-mono); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; background: #fff; border: 1px solid var(--line-2); padding: 5px 8px; cursor: pointer; color: var(--ink-3); }
.pc-multi { font-family: var(--f-mono); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; cursor: pointer; }
.pc-multi input { accent-color: var(--blue); }
.pc-off { font-family: var(--f-mono); font-size: 10.5px; color: var(--muted); margin-top: 6px; }
.pc-hint { margin-left: auto; color: var(--muted); }
.pc-dot .ring { fill: none; stroke: none; stroke-width: 1.5; }
.pc-dot.near .ring { stroke: var(--blue); stroke-dasharray: 3 3; }
.pc-dot:focus { outline: none; }
.pc-dot:focus .ring { stroke: var(--ink); stroke-dasharray: none; stroke-width: 2; }
.pc-dot.near .core { opacity: .85; }
.pc-legend i.near { border: 1.5px dashed var(--blue); background: #fff; }
.pc-missing, .viz-missing { border: 1px dashed var(--line-2); background: #fff; padding: 40px; font-size: 16px; color: var(--ink-3); text-align: center; }
.pc-tip em { color: var(--muted); font-style: normal; }

.notes-drawer { padding-right: 420px; }
.notes-close { float: right; margin: -4px -400px 0 0; font-family: var(--f-mono); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: #e6e8ef; background: transparent; border: 1px solid #4a4f63; padding: 6px 10px; cursor: pointer; }
.notes-close:hover { border-color: #fff; }
body:has(.notes-drawer.open) .hud { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
  .tv-scan, .typing .cursor { display: none; }
}
