/* ------------------------------------------------------------------
   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 flow graph */

.how-h { max-width: 46ch; font-size: clamp(1.4rem, 2.4vw, 2.1rem); }

.flow svg { width: 100%; height: auto; }

.flow-ln {
  stroke: var(--rule);
  stroke-width: 2;
  stroke-dasharray: var(--len, 200);
  stroke-dashoffset: var(--len, 200);
  transition: stroke-dashoffset .55s var(--ease-entrance), stroke .3s;
}
.flow-ln.on { stroke-dashoffset: 0; stroke: var(--accent); }

.flow-nd { cursor: pointer; outline: none; }
.flow-nd circle {
  fill: var(--bg);
  stroke: var(--rule);
  stroke-width: 2;
  transition: stroke .25s var(--ease-standard), transform .25s var(--ease-standard);
  transform-origin: center;
  transform-box: fill-box;
}
.flow-nd .nd-t {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px; fill: var(--fg-muted);
  transition: fill .25s;
}
.flow-nd .nd-l { font-size: 11.5px; 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.1); }
.flow-nd.sel .nd-t, .flow-nd.sel .nd-l { fill: var(--accent); }
.flow-nd:hover circle { stroke: var(--accent); }
.flow-nd:focus-visible circle { stroke: var(--accent); stroke-dasharray: 3 3; }

/* panels */
.panels { position: relative; min-height: 190px; border-top: 1px solid var(--rule); padding-top: 1.1rem; }

.panel {
  position: absolute; inset: 1.1rem 0 0;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(1rem, 3vw, 3rem);
  opacity: 0; visibility: hidden;
  transform: translateY(8px);
  transition: opacity .3s var(--ease-entrance), transform .3s var(--ease-entrance), visibility 0s .3s;
}
.panel.show { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }

.panel-h {
  font-family: "IBM Plex Mono", monospace;
  font-size: .78rem; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent);
}
.panel-b { font-size: .95rem; line-height: 1.5; margin-top: .5rem; max-width: 52ch; }
.panel-c { font-size: .8rem; color: var(--gray-50); margin-top: .6rem; max-width: 52ch; }

.mini svg { width: 100%; height: auto; max-width: 470px; }
.mini-f {
  display: block; margin-top: .3rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: .68rem; letter-spacing: .05em; color: var(--gray-50);
}

.mini .b {
  fill: var(--gray-30);
  transform: scaleY(0); transform-origin: bottom; transform-box: fill-box;
}
.slide[data-tone="ink"] .mini .b { fill: var(--gray-70); }
.mini .b.acc { fill: var(--accent); }
.panel.show .mini .b { animation: grow-y .5s var(--ease-entrance) forwards; }
.panel.show .mini .b:nth-child(2n) { animation-delay: .05s; }

@keyframes grow-y { to { transform: scaleY(1); } }

.mini .xl { font-size: 9.5px; fill: var(--gray-50); font-family: "IBM Plex Mono", monospace; }
.mini .ln { fill: none; stroke-width: 1.6; }
.mini .ln.noise { stroke: var(--gray-50); stroke-dasharray: 4 3; }
.mini .ln.sig   { stroke: var(--accent); }

/* ecfp bit grid for m3 */
.bitgrid {
  display: grid;
  grid-template-columns: repeat(32, 1fr);
  gap: 2px; max-width: 420px;
}
.bitgrid i { aspect-ratio: 1; background: var(--rule); display: block; border-radius: 1px; }
.bitgrid i.on { background: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .flow-ln { stroke-dashoffset: 0; }
  .mini .b { transform: none; animation: none !important; }
}

.flow-tr { stroke: var(--rule); stroke-width: 2; }
