:root { --chrome: #f3f3f3; --ink: #222; --btn: #fff; --line: #ccc; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --chrome: #1d1f22; --ink: #ddd; --btn: #2a2d31; --line: #444; }
}
:root[data-theme="dark"] { --chrome: #1d1f22; --ink: #ddd; --btn: #2a2d31; --line: #444; }

/* Slide fonts. The decks use Avenir Next LT Pro (licensed, cannot be served).
 * Apple devices have the same design as system Avenir / Avenir Next; other
 * devices get Albert Sans. Letter-spacing values are calibrated with
 * textfit.py so word widths match PowerPoint's (median ratio ~1.00). */
:root {
  --f-l: 'Avenir Next LT Pro Light', Avenir, 'Albert Sans', sans-serif;
  --f-n: 'Avenir Next LT Pro', 'Avenir Next', 'Albert Sans', sans-serif;
  --ls-l: .013em; --ls-lb: 0em; --ls-n: 0em; --ls-b: 0em;
}
html.alt-font {
  --f-l: 'Albert Sans', sans-serif;
  --f-n: 'Albert Sans', sans-serif;
  --ls-l: 0em; --ls-lb: -.010em; --ls-n: -.010em; --ls-b: .025em;
}
.f-l  { font-family: var(--f-l); font-weight: 300; letter-spacing: var(--ls-l); }
.f-lb { font-family: var(--f-l); font-weight: 500; letter-spacing: var(--ls-lb); }
.f-n  { font-family: var(--f-n); font-weight: 400; letter-spacing: var(--ls-n); }
.f-b  { font-family: var(--f-n); font-weight: 700; letter-spacing: var(--ls-b); }

html, body { margin: 0; height: 100%; background: var(--chrome); color: var(--ink);
  font-family: 'Albert Sans', system-ui, sans-serif; }
.deck { display: flex; flex-direction: column; align-items: center; min-height: 100%; }
.wrap { position: relative; width: 100%; overflow: hidden; }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }

.slide { position: absolute; inset: 0; overflow: hidden; display: none;
  box-shadow: 0 1px 6px rgba(0,0,0,.25); color: #000;
  /* macOS browsers thicken text by default; this matches PowerPoint's stroke
     weight much more closely (ink vs. its PDF: +33% -> +10% text, +35% -> +16%
     maths). Widths are unchanged, so locked line breaks are unaffected. */
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
.slide.on { display: block; }
.slide .notes { display: none; }

.sh { position: absolute; box-sizing: border-box; }
.sh > svg.g { position: absolute; left: 0; top: 0; overflow: visible; }
.sh > img.fill { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sh.pic > .crop { position: absolute; inset: 0; overflow: hidden; }
.sh.pic img { position: absolute; max-width: none; }
.sh.pic video { position: absolute; inset: 0; width: 100%; height: 100%; background: #000; }
.sh.grp { pointer-events: none; }
.sh.grp > * { pointer-events: auto; }

.tx { position: absolute; inset: 0; display: flex; flex-direction: column; box-sizing: border-box;
  overflow: visible; overflow-wrap: break-word; }
.tx p { margin: 0; }
/* a paragraph carries its first run's face only for its strut (line metrics);
   spacing and weight stay on the runs */
.tx p[class] { letter-spacing: 0; font-weight: 400; }
.tx .bu { display: inline-block; text-indent: 0; }
.tx .tab { display: inline-block; width: 1em; }
.tx a { color: inherit; }
.tx .m { white-space: nowrap; }
.tx .m .katex { font-size: 1.06em; line-height: 1; }  /* matches Cambria Math widths within ~1%; the
   paragraph's line height governs, as in PowerPoint (KaTeX's own 1.2 at 1.06em added ~3 px a line) */
.tx .m.d { display: block; text-align: center; }

/* IguanaTex equations: KaTeX on top, the original picture kept as fallback */
.sh.pic.has-itex img { visibility: hidden; }
.itex { position: absolute; left: 0; top: 0; transform-origin: 0 0; white-space: nowrap; color: #000; }
.itex .katex-display { margin: 0; }

.tbl { border-collapse: collapse; width: 100%; height: 100%; table-layout: fixed; isolation: isolate; }
.tbl td { position: relative; padding: 0; vertical-align: top; border: 0 none; }
/* the text box floats in its cell (rows are sized by deck.js, PowerPoint's way) */
.tbl td .tx { position: absolute; inset: 0; }
/* border lines straddle the cell edges, as PowerPoint draws them */
.tbl td i.bd { position: absolute; z-index: 1; pointer-events: none; }

.hid { visibility: hidden; }

.bar { display: flex; gap: 8px; align-items: center; padding: 10px 0; user-select: none; }
.bar button { background: var(--btn); color: var(--ink); border: 1px solid var(--line); border-radius: 6px;
  min-width: 36px; height: 32px; font-size: 18px; cursor: pointer; }
.bar button.on { outline: 2px solid #4a7bd0; }
.bar a.back { color: var(--ink); font-size: 14px; text-decoration: none; margin-right: 10px; }
.bar a.back:hover { text-decoration: underline; }
#count { min-width: 90px; text-align: center; font-variant-numeric: tabular-nums; }

.deck:fullscreen { background: #000; justify-content: center; }
.deck:fullscreen .bar { position: fixed; bottom: 6px; opacity: 0; transition: opacity .3s; }
.deck:fullscreen .bar:hover { opacity: 1; }
.deck:fullscreen .slide { box-shadow: none; }

/* review detours (deck.js): the question shape opens the review slides */
.rv-btn { cursor: pointer; }
.rv-btn::after { content: "\203A"; position: absolute; right: 12px; top: 50%; transform: translateY(-52%);
  font: 600 30px/1 system-ui, sans-serif; color: #fff; pointer-events: none; }
.rv-btn:hover { filter: brightness(1.08); }
.rv-btn:focus-visible { outline: 3px solid #2F528F; outline-offset: 2px; }
.bar .rvback { display: none; }
.deck.in-review .bar .rvback { display: inline-block; background: #ED7D31; color: #fff; border-color: #C55A11; padding: 0 12px; font-size: 14px; white-space: nowrap; }
.bar a.back, #count { white-space: nowrap; }
.deck.in-review #count { color: #C55A11; font-weight: 600; }
