/* ------------------------------------------------------------------
   PGK2 / DEL investor deck — IBM Carbon-derived design tokens
   Palette constrained to: blue, cream, bone white, black, grey.
------------------------------------------------------------------ */

:root {
  /* blue */
  --blue-70: #0043ce;
  --blue-60: #0f62fe;
  --blue-40: #78a9ff;
  --blue-20: #d0e2ff;

  /* cream / bone */
  --cream:   #f6f2e8;
  --bone:    #ebe6da;
  --bone-dk: #ddd6c6;

  /* ink */
  --black:   #161616;
  --gray-80: #393939;
  --gray-70: #525252;
  --gray-50: #8d8d8d;
  --gray-30: #c6c6c6;

  /* semantic */
  --bg:        var(--cream);
  --fg:        var(--black);
  --fg-muted:  var(--gray-70);
  --rule:      var(--bone-dk);
  --accent:    var(--blue-60);

  /* Carbon type scale */
  --t-display: clamp(2.6rem, 6.4vw, 5.5rem);
  --t-h1:      clamp(2rem, 4.2vw, 3.4rem);
  --t-h2:      clamp(1.3rem, 2.2vw, 1.9rem);
  --t-body:    clamp(1rem, 1.25vw, 1.2rem);
  --t-label:   0.75rem;

  /* Carbon motion */
  --ease-entrance: cubic-bezier(0, 0, 0.3, 1);
  --ease-standard: cubic-bezier(0.2, 0, 0.38, 0.9);
  --dur: 480ms;

  /* 2x grid */
  --gutter: clamp(1.5rem, 5vw, 6rem);
}

/* dark statement slides invert the semantics only */
.slide[data-tone="ink"] {
  --bg: var(--black);
  --fg: var(--cream);
  --fg-muted: var(--gray-30);
  --rule: var(--gray-80);
  --accent: var(--blue-40);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--black);
  color: var(--fg);
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

/* ---------------------------------------------------------------- deck */

#deck {
  position: relative;
  height: 100vh;
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(1.25rem, 3vh, 2.5rem) var(--gutter) clamp(1.5rem, 4vh, 3rem);
  background: var(--bg);
  color: var(--fg);
  opacity: 0;
  visibility: hidden;
  transition: opacity 320ms var(--ease-standard), visibility 320ms step-end;
}

.slide.is-active {
  opacity: 1;
  visibility: visible;
  transition: opacity 320ms var(--ease-entrance), visibility 0s;
}

/* ------------------------------------------------------- slide chrome */

.slide-head,
.slide-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.slide-head { border-bottom: 1px solid var(--rule); padding-bottom: 0.75rem; }
.slide-foot { border-top: 1px solid var(--rule); padding-top: 0.75rem; }

.eyebrow { color: var(--accent); font-weight: 600; }

.slide-body {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(1rem, 2.5vh, 2rem);
  padding: clamp(1.5rem, 5vh, 4rem) 0;
  max-width: 1400px;
  width: 100%;
}

/* ------------------------------------------------------------ type */

h1 {
  font-size: var(--t-display);
  font-weight: 300;
  line-height: 1.04;
  letter-spacing: -0.02em;
}

h2 {
  font-size: var(--t-h1);
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -0.015em;
  max-width: 24ch;
}

h3 {
  font-size: var(--t-h2);
  font-weight: 400;
  line-height: 1.25;
}

p, li {
  font-size: var(--t-body);
  font-weight: 400;
  line-height: 1.5;
  color: var(--fg-muted);
  max-width: 62ch;
}

strong { color: var(--fg); font-weight: 600; }
em { font-style: normal; color: var(--accent); }

.mono {
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
}

.lede { font-size: clamp(1.1rem, 1.6vw, 1.45rem); max-width: 54ch; }

/* ------------------------------------------------------------ figures */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.stat {
  background: var(--bg);
  padding: clamp(1rem, 2vw, 1.75rem);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.stat-value {
  font-family: "IBM Plex Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.9rem, 3.4vw, 3rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.stat-value.accent { color: var(--accent); }

.stat-label {
  font-size: var(--t-label);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.stat-note { font-size: 0.8rem; color: var(--gray-50); max-width: none; }

/* a single bar used for the read-count distribution */
.bars { display: flex; flex-direction: column; gap: 0.6rem; }

.bar-row {
  display: grid;
  grid-template-columns: 7ch 1fr 11ch;
  align-items: center;
  gap: 1rem;
}

.bar-track {
  height: 1.6rem;
  background: var(--bone);
  position: relative;
  overflow: hidden;
}

.slide[data-tone="ink"] .bar-track { background: var(--gray-80); }

.bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w);
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

.bar-row.is-muted .bar-fill { background: var(--gray-50); }

.bar-key,
.bar-val { font-family: "IBM Plex Mono", monospace; font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.bar-key { color: var(--fg-muted); }
.bar-val { color: var(--fg); text-align: right; }

/* ------------------------------------------------------------ anim */

[data-anim] {
  opacity: 0;
  transform: translateY(16px);
}

.slide.is-active [data-anim] {
  animation: rise var(--dur) var(--ease-entrance) forwards;
  animation-delay: calc(var(--i, 0) * 90ms);
}

.slide.is-active .bar-fill {
  animation: grow 720ms var(--ease-entrance) forwards;
  animation-delay: calc(240ms + var(--i, 0) * 110ms);
}

@keyframes rise {
  to { opacity: 1; transform: none; }
}

@keyframes grow {
  to { transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  [data-anim] { opacity: 1; transform: none; animation: none !important; }
  .bar-fill { transform: scaleX(1); animation: none !important; }
}

/* ------------------------------------------------------------ nav */

#progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: var(--blue-60);
  width: 0;
  transition: width 320ms var(--ease-standard);
  z-index: 10;
}

/* the slide number lives in each slide's own footer, so nothing is fixed
   over the footer rule */
.counter { font-family: "IBM Plex Mono", monospace; font-variant-numeric: tabular-nums; }

.hint {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1rem;
  font-size: var(--t-label);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-50);
}

.hint::before {
  content: "";
  width: 2rem;
  height: 1px;
  background: var(--gray-50);
}

/* ------------------------------------------------- diagrams & new blocks */

.fig svg { width: 100%; height: auto; max-width: 1000px; display: block; }

.dia circle,
.dia rect,
.dia path:not([fill]),
.dia line { fill: none; stroke: var(--fg); stroke-width: 1.5; }

.dia .bc { fill: var(--accent); stroke: none; opacity: .9; }
.dia { color: var(--fg); }

.dia .cap {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px; letter-spacing: .09em;
  fill: var(--fg-muted); stroke: none;
}
.dia .cap.accent { fill: var(--accent); }
.dia .n { font-size: 12px; fill: var(--fg-muted); stroke: none; }
.dia .op {
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px; letter-spacing: .06em; fill: var(--gray-50); stroke: none;
}
.dia .big {
  font-family: "IBM Plex Mono", monospace;
  font-size: 44px; font-weight: 300; fill: var(--accent); stroke: none;
}

/* six-cell grid for the noise taxonomy */
.grid4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.cell {
  background: var(--bg);
  padding: clamp(.85rem, 1.5vw, 1.25rem);
  display: flex; flex-direction: column; gap: .4rem;
}

.cell-h {
  font-size: .95rem; font-weight: 600; color: var(--fg);
}

.cell-b { font-size: .82rem; line-height: 1.45; color: var(--fg-muted); }

/* lineage timeline */
.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}

.tl-step {
  background: var(--bg);
  padding: clamp(1rem, 2vw, 1.6rem);
  display: flex; flex-direction: column; gap: .55rem;
}

.tl-y {
  font-family: "IBM Plex Mono", monospace;
  font-size: 1.6rem; font-weight: 300; color: var(--accent);
  line-height: 1;
}

.tl-h { font-size: 1rem; font-weight: 600; color: var(--fg); }
.tl-b { font-size: .83rem; line-height: 1.5; color: var(--fg-muted); }

.tl-b i { font-style: italic; color: inherit; }

/* lineage media band — one fixed-height row so a portrait and a wordmark align */
.tl-fig {
  height: 94px;
  display: flex;
  align-items: center;
  margin: .1rem 0 .2rem;
}

.tl-fig img.portrait {
  height: 100%;
  width: auto;
  filter: grayscale(1) contrast(1.06);
}

.slide[data-tone="ink"] .tl-fig img.portrait { filter: grayscale(1) contrast(1.06) invert(0); }

.tl-fig img.mark {
  max-height: 30px;
  max-width: 155px;
  width: auto;
  filter: brightness(0);
  opacity: .86;
}

.slide[data-tone="ink"] .tl-fig img.mark { filter: brightness(0) invert(1); }

/* ================================================ how-it-works (rebuilt) */

.how-body { justify-content: flex-start; gap: clamp(.8rem, 1.8vh, 1.4rem); padding-top: clamp(1rem, 3vh, 2rem); }

.how-top { display: flex; align-items: baseline; gap: 1.2rem; flex-wrap: wrap; }
.how-h { font-size: clamp(1.5rem, 2.6vw, 2.3rem); max-width: none; }
.how-sub {
  font-family: "IBM Plex Mono", monospace;
  font-size: .8rem; letter-spacing: .05em; color: var(--accent);
  transition: opacity .25s var(--ease-standard);
}

/* ---- flow graph */
.flow svg { width: 100%; height: auto; }
.flow-tr { stroke: var(--rule); stroke-width: 2; }
.flow-ln {
  stroke: var(--accent); stroke-width: 2;
  stroke-dasharray: var(--len, 140); stroke-dashoffset: var(--len, 140);
  transition: stroke-dashoffset .5s var(--ease-entrance);
}
.flow-ln.on { stroke-dashoffset: 0; }

.flow-nd { cursor: pointer; outline: none; }
.flow-nd circle {
  fill: var(--bg); stroke: var(--rule); stroke-width: 2;
  transition: stroke .25s, transform .25s var(--ease-standard);
  transform-origin: center; transform-box: fill-box;
}
.flow-nd .nd-t { font-family: "IBM Plex Mono", monospace; font-size: 12px; fill: var(--gray-50); transition: fill .25s; }
.flow-nd .nd-l { font-size: 11px; fill: var(--gray-50); transition: fill .25s; }
.flow-nd.on circle { stroke: var(--accent); }
.flow-nd.on .nd-t { fill: var(--fg); }
.flow-nd.on .nd-l { fill: var(--fg-muted); }
.flow-nd.sel circle { stroke: var(--accent); stroke-width: 3; transform: scale(1.12); }
.flow-nd.sel .nd-t, .flow-nd.sel .nd-l { fill: var(--accent); }
.flow-nd:hover circle, .flow-nd:focus-visible circle { stroke: var(--accent); }

/* ---- stage area */
.stages { position: relative; flex: 1; min-height: clamp(280px, 38vh, 340px); }
.stage {
  position: absolute; inset: 0;
  opacity: 0; visibility: hidden;
  transition: opacity .28s var(--ease-entrance), visibility 0s .28s;
}
.stage.show { opacity: 1; visibility: visible; transition-delay: 0s; }
.stage svg { width: 100%; height: 100%; }

/* axes */
.ax { stroke: var(--fg-muted); stroke-width: 1.2; }
.gl { stroke: var(--rule); stroke-width: 1; }
.yl, .xl { font-family: "IBM Plex Mono", monospace; font-size: 10px; fill: var(--gray-50); }
.axt { font-size: 11px; fill: var(--fg-muted); letter-spacing: .04em; }

/* vertical bars */
.bar {
  fill: var(--gray-30);
  transform: scaleY(0); transform-origin: bottom; transform-box: fill-box;
}
.slide[data-tone="ink"] .bar { fill: var(--gray-70); }
.bar.pos  { fill: var(--accent); }
.bar.quar { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-dasharray: 3 2; }
.stage.show .bar { animation: gy .5s var(--ease-entrance) forwards; animation-delay: calc(var(--i) * 45ms); }
@keyframes gy { to { transform: scaleY(1); } }

/* fitted curves */
.cv { fill: none; stroke-width: 2; stroke-dasharray: 1400; stroke-dashoffset: 1400; }
.cv.noise { stroke: var(--gray-50); stroke-dasharray: 1400; }
.cv.sig   { stroke: var(--accent); }
.stage.show .cv { animation: draw .9s var(--ease-entrance) forwards; animation-delay: var(--d, 1s); }
@keyframes draw { to { stroke-dashoffset: 0; } }
.stage.show .cv.noise { animation-name: draw-dash; }
@keyframes draw-dash { to { stroke-dashoffset: 0; stroke-dasharray: 5 4; } }

/* threshold marker */
.thr { stroke: var(--fg); stroke-width: 1.4; stroke-dasharray: 4 3; opacity: 0; }
.thrl { font-family: "IBM Plex Mono", monospace; font-size: 12px; fill: var(--fg); opacity: 0; }
.stage.show .thr, .stage.show .thrl { animation: fin .4s var(--ease-entrance) forwards; animation-delay: var(--d, 1.9s); }
@keyframes fin { to { opacity: 1; } }

.brace { fill: none; stroke: var(--accent); stroke-width: 1.4; opacity: 0; }
.stage.show .brace { animation: fin .4s var(--ease-entrance) forwards; animation-delay: var(--d, 1s); }

/* horizontal bars */
.hb {
  fill: var(--gray-30); transform: scaleX(0);
  transform-origin: left; transform-box: fill-box;
}
.slide[data-tone="ink"] .hb { fill: var(--gray-70); }
.hb.win { fill: var(--accent); }
.hb.rej { fill: none; stroke: var(--gray-50); stroke-width: 1.4; stroke-dasharray: 3 2; }
.hb.floor { fill: var(--gray-50); }
.stage.show .hb { animation: gx .55s var(--ease-entrance) forwards; animation-delay: calc(var(--i) * 70ms); }
@keyframes gx { to { transform: scaleX(1); } }

.hl { font-family: "IBM Plex Mono", monospace; font-size: 11px; fill: var(--fg-muted); }
.hw { font-family: "IBM Plex Mono", monospace; font-size: 9px; fill: var(--gray-50); }
.hv {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; fill: var(--fg);
  opacity: 0;
}
.stage.show .hv { animation: fin .3s ease forwards; animation-delay: calc(.5s + var(--i) * 70ms); }

/* bit field */
.bit { fill: var(--rule); opacity: 0; }
.bit.on { fill: var(--accent); }
.stage.show .bit { animation: fin .25s ease forwards; animation-delay: calc(var(--i) * 18ms); }

/* annotation column */
.a-h {
  font-family: "IBM Plex Mono", monospace; font-size: 11px; letter-spacing: .1em;
  fill: var(--accent);
}
.a-b { font-size: 12.5px; fill: var(--fg-muted); }
.a-k { font-size: 12.5px; fill: var(--fg); font-weight: 600; }
.a-n { font-family: "IBM Plex Mono", monospace; font-size: 11px; fill: var(--gray-50); }
.a-h, .a-b, .a-k, .a-n { opacity: 0; }
.stage.show .a-h, .stage.show .a-b, .stage.show .a-k, .stage.show .a-n {
  animation: fin .35s var(--ease-entrance) forwards;
  animation-delay: calc(.45s + var(--i) * 55ms);
}
.sw-g { fill: var(--gray-30); } .sw-q { fill: var(--accent); } .sw-b { fill: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .flow-ln { stroke-dashoffset: 0; }
  .bar, .hb { transform: none; animation: none !important; }
  .cv { stroke-dashoffset: 0; animation: none !important; }
  .thr, .thrl, .brace, .hv, .bit, .a-h, .a-b, .a-k, .a-n { opacity: 1; animation: none !important; }
}
