/* Core deck chrome: stage, toolbar, progress, overview, shortcut sheet, print rules.
   Each deck's own stylesheet sets the palette, the type and the motion on top of this. */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--backdrop, #111);
  color: var(--type, #fff);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  display: grid;
  place-items: center;
  overflow: hidden;
}
body.modal { overflow: hidden; }

/* ---------- stage ---------- */
.wrap { width: 100%; height: 100%; display: grid; place-items: center; padding: 16px; }
#stage {
  position: relative;
  width: min(100%, calc((100vh - 96px) * 16 / 9));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--bg);
  border-radius: var(--stage-radius, 4px);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
  container-type: inline-size;
  cursor: default;
}
.slide {
  position: absolute;
  inset: 0;
  padding: var(--pad, 6.2cqw);
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 0;
}
.slide.live { display: flex; }
.slide:focus, .slide:focus-visible { outline: none; }  /* focus is moved by script, not by the user */
.slide.leaving { display: flex; }

/* The stagger: every [data-anim] child waits its turn. Decks override the transform. */
.slide [data-anim] {
  opacity: 0;
  transition: opacity .42s ease, transform .52s cubic-bezier(.2, .8, .2, 1), clip-path .52s cubic-bezier(.2, .8, .2, 1);
  transition-delay: calc(var(--i, 0) * 70ms);
}
/* The resting state has to beat every per-deck direction rule, and those are written against #stage[data-dir],
   which carries an id. !important keeps the arrival state simple: decks only ever describe where things come from. */
#stage .slide.in [data-anim] { opacity: 1 !important; transform: none !important; clip-path: inset(0) !important; }
[data-draw] { transition: stroke-dashoffset .62s ease-out; }
[data-bar] { width: 0; transition: width .4s cubic-bezier(.2, .8, .2, 1); transition-delay: calc(var(--i, 0) * 70ms + 240ms); }
#stage .slide.in [data-bar] { width: var(--to); }

/* ---------- chrome ---------- */
.chrome {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 18px;
  font: 500 12px/1 var(--sans);
  color: var(--chrome-ink, rgba(255, 255, 255, .72));
  background: var(--chrome-bg, rgba(10, 10, 12, .72));
  backdrop-filter: blur(8px);
  z-index: 40;
}
.chrome .sp { flex: 1; }
.chrome button, .chrome a {
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chrome button:hover, .chrome a:hover { background: rgba(255, 255, 255, .1); }
.chrome button:disabled { opacity: .55; cursor: progress; }
.chrome :focus-visible, .ov-cell:focus-visible { outline: 2px solid var(--focus, #7ad); outline-offset: 2px; }
#counter { font-variant-numeric: tabular-nums; letter-spacing: .06em; }
#bar-track { position: fixed; left: 0; right: 0; bottom: 64px; height: 2px; background: rgba(255, 255, 255, .14); z-index: 40; }
#bar { height: 100%; background: var(--accent, #fff); transform-origin: 0 50%; transform: scaleX(0); transition: transform .45s cubic-bezier(.2, .8, .2, 1); }

/* ---------- editing affordance ---------- */
[contenteditable]:hover { box-shadow: inset 0 -1px 0 var(--edit-hint, rgba(255, 255, 255, .34)); }
[contenteditable]:focus { outline: none; box-shadow: inset 0 -2px 0 var(--accent, #fff); }

/* ---------- overlays ---------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(6, 6, 8, .9);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 40px 24px 90px;
  color: #fff;
}
.sheet[hidden] { display: none; }   /* display:grid above would otherwise beat the hidden attribute */
.sheet-in { width: min(1100px, 100%); max-height: 100%; overflow: auto; }
.sheet h2 { margin: 0 0 20px; font-size: 15px; letter-spacing: .22em; text-transform: uppercase; font-weight: 600; }
.ov-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.ov-cell {
  text-align: left;
  min-height: 92px;
  padding: 14px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 6px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  display: grid;
  gap: 8px;
  align-content: start;
}
.ov-cell:hover { background: rgba(255, 255, 255, .13); }
.ov-cell[aria-current="true"] { border-color: var(--accent, #fff); }
.ov-n { font: 600 11px/1 var(--mono); letter-spacing: .2em; opacity: .7; }
.ov-t { font-size: 15px; line-height: 1.35; }
.keys { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 28px; font-size: 14px; }
.keys div { display: flex; gap: 12px; align-items: baseline; }
.keys kbd {
  font: 600 11px/1.6 var(--mono);
  padding: 3px 7px;
  border: 1px solid rgba(255, 255, 255, .3);
  border-radius: 4px;
  white-space: nowrap;
}
.sheet-x { position: absolute; top: 18px; right: 18px; }

/* ---------- toast ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 86px;
  transform: translate(-50%, 12px);
  padding: 11px 18px;
  border-radius: 999px;
  background: #15161a;
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 70;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .slide [data-anim], [data-draw], [data-bar], #bar, .mask, .plate img { transition: none !important; animation: none !important; }
  .slide [data-anim] { opacity: 1 !important; transform: none !important; clip-path: inset(0) !important; }
  .slide.in [data-bar], .slide [data-bar] { width: var(--to) !important; }
}

/* ---------- print: one 16:9 page per slide ---------- */
@media print {
  @page { size: 1280px 720px; margin: 0; }
  html, body { height: auto; overflow: visible; background: #fff; display: block; }
  .wrap { padding: 0; display: block; }
  .chrome, #bar-track, .sheet, #toast, .sr { display: none !important; }
  #stage {
    width: 1280px;
    height: auto;
    aspect-ratio: auto;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    container-type: normal;
  }
  .slide {
    position: relative !important;
    inset: auto !important;
    display: flex !important;
    width: 1280px;
    height: 720px;
    break-after: page;
    page-break-after: always;
    overflow: hidden;   /* a decorative layer that bleeds outside the slide must not spill onto a page of its own */
    transform: none !important;
    opacity: 1 !important;
    padding: 72px;
  }
  .slide:last-child { break-after: auto; page-break-after: auto; }
  .slide [data-anim] { opacity: 1 !important; transform: none !important; clip-path: inset(0) !important; transition: none !important; }
  .slide [data-bar] { width: var(--to) !important; }
  [data-draw] { stroke-dashoffset: 0 !important; }
  .mask { display: none !important; }
  * { print-color-adjust: exact !important; -webkit-print-color-adjust: exact !important; }
}


:root {
  --bg: #FBFAF7; --backdrop: #2A2A28; --ink: #101214; --rule: #DCD8CF;
  --good: #2F7D5A; --watch: #B8821F; --miss: #A93B30;
  --type: var(--ink); --muted: #6A675F; --accent: var(--ink); --focus: var(--good);
  --sans: "Figtree", -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --chrome-bg: rgba(16, 18, 20, .9); --chrome-ink: rgba(251, 250, 247, .8);
  --edit-hint: rgba(16, 18, 20, .3); --pad: 4.4cqw; --stage-radius: 0;
}
#stage { color: var(--ink); }
.slide { justify-content: flex-start; padding-top: 4.6cqw; }  /* a review page is dense: start at the top */
.grid-ov {
  position: absolute; inset: 0 4.4cqw; pointer-events: none; z-index: 9; opacity: 0;
  background: repeating-linear-gradient(90deg, rgba(169, 59, 48, .09) 0 calc((100% - 11 * 1.9cqw) / 12), transparent 0 calc((100% - 11 * 1.9cqw) / 12 + 1.9cqw));
}
body.show-grid .grid-ov { opacity: 1; }
.slide > * { position: relative; z-index: 1; }
.rh { display: flex; justify-content: space-between; font: 600 clamp(8px, .72cqw, 11px)/1 var(--mono); letter-spacing: .2em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--rule); padding-bottom: 1cqw; margin-bottom: 2.6cqw; }
h1 { font: 600 clamp(24px, 3.4cqw, 58px)/1.08 var(--sans); letter-spacing: -.028em; margin: 0; }
h2 { font: 600 clamp(17px, 2.3cqw, 40px)/1.12 var(--sans); letter-spacing: -.02em; margin: 0 0 2cqw; }
.verdict { font-size: clamp(12px, 1.5cqw, 24px); line-height: 1.5; color: var(--muted); max-width: 52ch; margin: 2cqw 0 0; }
.note { font: 400 clamp(8px, .76cqw, 11px)/1.5 var(--mono); color: var(--muted); margin: 1.8cqw 0 0; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.9cqw; }
.mcard { border-top: 2px solid var(--ink); padding-top: 1.4cqw; }
.mcard .k { font: 600 clamp(8px, .72cqw, 11px)/1.3 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.mcard .v { font: 400 clamp(22px, 3.4cqw, 60px)/1 var(--mono); font-variant-numeric: tabular-nums; margin: 1cqw 0 .6cqw; }
.mcard .d { font: 600 clamp(9px, .92cqw, 14px)/1 var(--mono); }
.mcard .d.good { color: var(--good); } .mcard .d.watch { color: var(--watch); } .mcard .d.miss { color: var(--miss); }
.track { height: .7cqw; background: var(--rule); margin-top: 1.2cqw; }
.track span { display: block; height: 100%; background: var(--ink); }
.track span.good { background: var(--good); } .track span.watch { background: var(--watch); } .track span.miss { background: var(--miss); }

table { width: 100%; border-collapse: collapse; font: 400 clamp(8px, .95cqw, 15px)/1.5 var(--mono); }
th { text-align: left; font-weight: 600; font-size: .8em; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); padding: 0 1.4cqw .8cqw 0; border-bottom: 1px solid var(--ink); }
td { padding: .7cqw 1.4cqw .7cqw 0; border-bottom: 1px solid var(--rule); font-variant-numeric: tabular-nums; }
th:not(:first-child), td:not(:first-child) { text-align: right; }
tbody tr:nth-child(5n) td { background: rgba(220, 216, 207, .3); }
tr.total td { border-top: 1.5px solid var(--ink); border-bottom: none; font-weight: 600; }
.good { color: var(--good); } .watch { color: var(--watch); } .miss { color: var(--miss); }

.chart { width: 100%; height: 30cqw; overflow: visible; }
.chart text { font: 600 9px/1 var(--mono); fill: #6A675F; letter-spacing: .1em; }
.chart .gl { stroke: #DCD8CF; stroke-width: 1; }
.chart .tg { stroke: #A93B30; stroke-width: 1.4; stroke-dasharray: 6 5; }
.funnel { display: grid; gap: 1.2cqw; margin-top: 1cqw; }
.fstage { display: grid; grid-template-columns: 12cqw 1fr 7cqw; gap: 1.6cqw; align-items: center; font: 400 clamp(9px, 1cqw, 15px)/1.4 var(--mono); }
.fbar { height: 2.6cqw; background: var(--ink); }
.fstage:nth-child(2) .fbar { background: #2b3136; } .fstage:nth-child(3) .fbar { background: #3f464c; }
.fstage:nth-child(4) .fbar { background: #545c63; } .fstage:nth-child(5) .fbar { background: #6b747c; }
.rows3 { display: grid; gap: 1.4cqw; margin-top: 1cqw; }
.rows3 > div { display: grid; grid-template-columns: 1fr 10cqw 14cqw; gap: 1.9cqw; align-items: baseline; padding-top: 1.2cqw; border-top: 1px solid var(--rule); }
.rows3 .t { font-size: clamp(11px, 1.3cqw, 21px); }
.rows3 .n { font: 400 clamp(11px, 1.3cqw, 21px)/1 var(--mono); font-variant-numeric: tabular-nums; }
.rows3 .o { font: 600 clamp(8px, .76cqw, 11px)/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.heat { display: grid; grid-template-columns: 9cqw repeat(6, 1fr); gap: 2px; margin-top: 1.6cqw; font: 400 clamp(7px, .82cqw, 12px)/1 var(--mono); }
.heat .hl { display: grid; place-items: center; color: var(--muted); font-weight: 600; letter-spacing: .1em; }
.heat .c { aspect-ratio: 2.3 / 1; display: grid; place-items: center; color: #fff; }
.risk { display: grid; grid-template-columns: 8cqw repeat(3, 1fr); grid-template-rows: auto repeat(3, 1fr); gap: 2px; margin-top: 1.6cqw; font: 600 clamp(7px, .8cqw, 12px)/1.3 var(--mono); }
.risk .lab { display: grid; place-items: center; color: var(--muted); letter-spacing: .12em; text-transform: uppercase; }
.risk .cell { background: #EFEDE8; min-height: 8cqw; padding: 1cqw; display: grid; align-content: start; gap: .5cqw; font-weight: 400; }
.risk .cell.hot { background: rgba(169, 59, 48, .14); }
.risk .cell b { font: 600 clamp(7px, .76cqw, 11px)/1 var(--mono); letter-spacing: .12em; color: var(--miss); }
.commit { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.9cqw; margin-top: 1.6cqw; }
.commit > div { border-top: 2px solid var(--good); padding-top: 1.4cqw; }
.commit .h { font-size: clamp(11px, 1.3cqw, 21px); margin: 0 0 1cqw; }
.commit .m { font: 400 clamp(9px, 1cqw, 15px)/1.6 var(--mono); color: var(--muted); margin: 0; }

/* ---- motion: column snap ---- */
.slide [data-anim] { transform: translateX(7.6cqw); transition: opacity .2s linear, transform .36s steps(3, end); transition-delay: calc(var(--i, 0) * 60ms + 60ms); }
#stage[data-dir="back"] .slide [data-anim] { transform: translateX(-7.6cqw); }
.slide.leaving { animation: snapOut .24s steps(3, end) forwards; }
#stage[data-dir="back"] .slide.leaving { animation: snapOutB .24s steps(3, end) forwards; }
@keyframes snapOut { to { transform: translateX(-7.6cqw); opacity: 0; } }
@keyframes snapOutB { to { transform: translateX(7.6cqw); opacity: 0; } }
.track span, .fbar { width: 0; transition: width .4s cubic-bezier(.2, .8, .2, 1); transition-delay: calc(var(--i, 0) * 60ms + 420ms); }
.slide.in .track span, .slide.in .fbar { width: var(--to); }
@media (prefers-reduced-motion: reduce) { .slide.leaving { animation: none; } .track span, .fbar { width: var(--to) !important; } }
