:root {
  --board: #FAF8F3;
  --ink: #2E2D29;
  --cardinal: #8C1515;
  --lagunita: #006CB8;
  --sky: #0098DB;
  --paloverde: #279989;
  --gray: #9A9A9A;
  --ink-50: rgba(46, 45, 41, 0.5);
  --ink-35: rgba(46, 45, 41, 0.35);
  --ink-15: rgba(46, 45, 41, 0.15);
  --serif: "Source Serif 4", "Source Serif Pro", Georgia, serif;
  --sans: "Source Sans 3", "Source Sans Pro", "Helvetica Neue", Arial, sans-serif;
  --enter: cubic-bezier(.2, .7, .2, 1);
  --move: cubic-bezier(.65, 0, .25, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #E9E6DF;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--serif);
}

#viewport {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
}

#stage {
  position: relative;
  width: 1920px;
  height: 1080px;
  background: var(--board);
  transform-origin: 0 0;
  position: absolute;
  left: 0;
  top: 0;
  overflow: hidden;
}

.slide {
  position: absolute;
  inset: 0;
  visibility: hidden;
  pointer-events: none;
}

.slide[data-deck-active] {
  visibility: visible;
  pointer-events: auto;
}

/* ---------- chrome: footer, breadcrumb, question tabs ---------- */

#chrome { position: absolute; inset: 0; pointer-events: none; z-index: 50; }

#footer {
  position: absolute;
  left: 64px;
  right: 64px;
  bottom: 28px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--sans);
  font-size: 22px;
  color: var(--ink-50);
}

#footer .logo { height: 44px; display: flex; align-items: center; gap: 16px; }
#footer .logo img { height: 44px; }
#footer .logo .logo-placeholder {
  font-family: var(--serif);
  font-weight: 600;
  color: var(--cardinal);
  font-size: 26px;
  letter-spacing: 0.02em;
}
#footer .right { display: flex; gap: 28px; align-items: center; }
#footer .num { min-width: 48px; text-align: right; }

#crumbs {
  position: absolute;
  top: 40px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--sans);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-50);
  opacity: 0;
  transition: opacity 500ms var(--enter);
}
#crumbs.on { opacity: 1; }

.lc-past h3, .lc-past p { color: var(--gray); }
.lc-past .icon { opacity: 0.35; }
.lc-current h3, .lc-current p { color: var(--cardinal); }

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

.statement {
  position: absolute;
  left: 200px;
  right: 200px;
  top: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-bottom: 60px;
}
.statement p, .statement h2 { margin: 0; text-wrap: balance; }
.statement .line { font-size: 72px; line-height: 1.18; }
.statement .turn { font-size: 54px; line-height: 1.25; margin-top: 48px; color: var(--ink-50); }
.statement .lead { font-size: 44px; color: var(--ink-50); margin-bottom: 28px; }
.statement .term { font-size: 110px; font-style: italic; color: var(--cardinal); }

.question .line { font-size: 76px; font-style: normal; }
.question .ask {
  font-family: var(--sans);
  font-size: 26px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cardinal);
  margin-bottom: 36px;
}

.header {
  position: absolute;
  left: 140px;
  right: 140px;
  top: 128px;
  font-size: 52px;
  line-height: 1.2;
  text-wrap: balance;
  margin: 0;
  font-weight: 400;
}
.header.center { text-align: center; }

em { font-style: italic; }
.c-cardinal { color: var(--cardinal); }
.c-lagunita { color: var(--lagunita); }
.c-sky { color: var(--sky); }
.c-green { color: var(--paloverde); }
.c-gray { color: var(--gray); }
.c-dim { color: var(--ink-50); }
.sans { font-family: var(--sans); }

.cite {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 92px;
  text-align: center;
  font-family: var(--sans);
  font-size: 22px;
  color: rgba(46, 45, 41, 0.42);
}

.cite a { color: inherit; text-decoration: underline; text-decoration-color: rgba(46, 45, 41, 0.3); text-underline-offset: 3px; pointer-events: auto; }
.cite a:hover { color: var(--lagunita); }

.caption { font-family: var(--sans); font-size: 26px; color: var(--ink-50); }

.stats { position: absolute; font-family: var(--sans); }
.stats dt { font-size: 26px; color: var(--ink-50); margin: 0 0 2px; }
.stats dd { margin: 0 0 30px; font-size: 64px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; color: var(--ink); }
.stats dd .unit { font-size: 38px; font-weight: 400; color: var(--ink-50); margin-left: 6px; }
.stats dd.accent { color: var(--cardinal); }

/* ---------- hand-drawn boxes & panels ---------- */

.rough-layer { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.rough-layer path { fill: none; stroke-linecap: round; stroke-linejoin: round; }

.panel {
  position: absolute;
  padding: 36px 40px;
}
.panel h3 { margin: 0 0 18px; font-size: 40px; font-weight: 600; }
.panel p, .panel li { font-size: 30px; line-height: 1.35; margin: 0 0 10px; }
.panel ul { margin: 0; padding-left: 28px; }
.panel.muted { color: var(--ink-50); }

.card {
  position: absolute;
  padding: 26px 28px;
  text-align: center;
}
.card .icon { height: 74px; margin-bottom: 12px; }
.card h3 { margin: 0 0 8px; font-size: 40px; font-weight: 600; }
.card p { margin: 0; font-size: 27px; font-style: italic; color: var(--ink-50); line-height: 1.3; }
.card p + p { margin-top: 18px; }
.wrap-balance p { text-wrap: balance; }
.card a { color: var(--lagunita); text-decoration: underline; text-decoration-color: rgba(0, 108, 184, 0.35); text-underline-offset: 4px; }
.card p.link-main { font-size: 36px; font-style: normal; font-weight: 600; }
.reveal-box { text-align: left; cursor: pointer; }
.reveal-box h3 { font-size: 34px; }
.reveal-box .front p { font-size: 26px; }
.reveal-box .back { display: none; }
.reveal-box .back p { font-style: normal; color: var(--ink); font-size: 26px; }
.reveal-box.revealed { cursor: default; }
.reveal-box.revealed .front { display: none; }
.reveal-box.revealed .back { display: block; }

.big-number {
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

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

.fig { position: absolute; }
.fig svg, .fig canvas { position: absolute; left: 0; top: 0; overflow: visible; }

.placeholder {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--sans);
  color: var(--ink-50);
  font-size: 26px;
  padding: 30px;
}
.placeholder b { color: var(--ink); font-size: 30px; display: block; margin-bottom: 10px; }
.placeholder video, .placeholder img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }

.pending {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--sans);
  font-size: 26px;
  color: var(--cardinal);
}

/* ---------- controls ---------- */

.slider {
  position: absolute;
  height: 60px;
  cursor: pointer;
  touch-action: none;
}
.slider .track { position: absolute; left: 0; right: 0; top: 29px; height: 2px; background: var(--ink-35); }
.slider .fill { position: absolute; left: 0; top: 28px; height: 4px; background: var(--lagunita); }
.slider .thumb {
  position: absolute;
  top: 14px;
  width: 32px;
  height: 32px;
  margin-left: -16px;
  border-radius: 50%;
  border: 3px solid var(--lagunita);
  background: var(--board);
}
.slider .label {
  position: absolute;
  top: -36px;
  font-family: var(--sans);
  font-size: 26px;
  color: var(--ink);
  transform: translateX(-50%);
  white-space: nowrap;
}

/* ---------- notes overlay ---------- */

#notes {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 38vh;
  overflow: auto;
  background: rgba(30, 30, 28, 0.94);
  color: #f2f0ea;
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.45;
  padding: 16px 28px;
  display: none;
  z-index: 100;
}
#notes.on { display: block; }
#notes h4 { margin: 0 0 6px; font-size: 14px; letter-spacing: 0.1em; text-transform: uppercase; color: #c9b9a8; }
.slide aside.notes { display: none; }

@media print {
  html, body { overflow: visible; background: white; }
  #viewport { position: static; display: block; }
  #stage { transform: none !important; position: relative; overflow: visible; height: auto; }
  .slide { position: relative; visibility: visible; width: 1920px; height: 1080px; page-break-after: always; }
}
.stats.compact dd { font-size: 56px; margin-bottom: 20px; }
.stats.compact dd .unit { font-size: 34px; }

/* ---------- worked-example table ---------- */
.wx-row {
  position: absolute;
  left: 180px;
  width: 1560px;
  display: grid;
  grid-template-columns: 560px 400px 300px 300px;
  align-items: baseline;
  font-size: 32px;
}
.wx-row .f { font-style: italic; color: var(--ink-50); }
.wx-row .v { font-family: var(--sans); font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.wx-row.head { font-family: var(--sans); font-size: 24px; color: var(--ink-50); }
.wx-row.head .v { font-weight: 400; }
.wx-row.result .v { color: var(--paloverde); }
.wx-row.late, .wx-row.late .v { color: var(--gray); }

.katex { font-size: 1.05em; }
.wx-row .f .katex { color: rgba(46, 45, 41, 0.72); }
.wx-row > span:first-child { font-family: var(--sans); }

/* ---------- numbered method steps ---------- */
.pc-steps { position: absolute; }
.pc-step { margin-bottom: 22px; }
.pc-step h4 { margin: 0 0 4px; font-family: var(--sans); font-size: 29px; font-weight: 600; }
.pc-step p { margin: 0; font-family: var(--sans); font-size: 24px; line-height: 1.32; color: var(--ink-50); }
.pc-step p .katex { color: var(--ink); }
.pc-step.result h4 { font-size: 36px; }
.pc-step p.eq { margin-top: 4px; text-align: center; }

/* ---------- brahe slide: modules and code ---------- */
.mod-grid { position: absolute; left: 160px; right: 160px; top: 260px; font-family: var(--sans); }
.mod { display: grid; grid-template-columns: 270px 1fr; align-items: baseline; margin-bottom: 18px; }
.mod h4 { margin: 0; font-size: 30px; font-weight: 600; }
.mod p { margin: 0; font-size: 26px; line-height: 1.4; color: var(--ink-50); font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.mod.coming h4, .mod.coming p { color: var(--gray); font-style: italic; }
.code-full { position: absolute; left: 160px; right: 160px; top: 240px; padding: 26px 34px; }
.code-full pre { margin: 0; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 26px; line-height: 1.4; color: var(--ink); white-space: pre; }
.code-full .kw { color: var(--cardinal); font-weight: 600; }
.code-full .fn { color: var(--lagunita); }
.code-full .st { color: var(--paloverde); }
.code-full .nu { color: #C26A00; }
.code-full .cm { color: var(--gray); font-style: italic; }
.code-full.half { right: auto; left: 100px; width: 1000px; padding: 22px 28px; }
.code-full.half pre { font-size: 20px; }
