/* Deck engine. Three ways to show the same slides:
   - STAGE: a computer screen in landscape, with JavaScript. One 1920 x 1080 slide at a time, scaled to fit.
   - FLUID: phones, portrait screens and small windows, or no JavaScript. One page that scrolls down.
   - PRINT: one 1920 x 1080 page per slide. tools/build-pdf.cjs makes the PDF this way.
   The two screen queries below are exact opposites. js/deck.js and css/slides.css use the same ones. */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--paper); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  font-feature-settings: 'cv11', 'ss01';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, p, ol, ul, dl, dd, figure { margin: 0; padding: 0; }
ol, ul { list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; border-radius: 4px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; z-index: 40; left: 12px; top: -80px;
  padding: 12px 16px; border-radius: 8px;
  background: var(--paper); color: var(--ink); font-weight: 600;
}
.skip-link:focus { top: 12px; }

.slide { position: relative; isolation: isolate; overflow: clip; background: var(--paper); color: var(--ink); }
.slide--night { background: var(--night); color: var(--on-night); }
.slide--mist { background: var(--mist); }

/* Controls: hidden until deck.js runs, never printed. */
[data-chrome][hidden] { display: none !important; }
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.deck-edge {
  position: fixed; z-index: 20; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 52px; height: 52px; padding: 0;
  border: 1px solid var(--chrome-line); border-radius: 50%;
  background: var(--chrome-bg); color: var(--chrome-fg);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  cursor: pointer; opacity: 0.55;
  transition: opacity 200ms ease, background-color 150ms ease;
}
.deck-edge--prev { left: calc(16px + env(safe-area-inset-left)); }
.deck-edge--next { right: calc(16px + env(safe-area-inset-right)); }
.deck-edge:hover, .deck-edge:focus-visible { opacity: 1; }
.deck-edge:disabled { visibility: hidden; }

.deck-bar {
  position: fixed; z-index: 20;
  right: calc(16px + env(safe-area-inset-right)); bottom: calc(16px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 2px; padding: 0 3px 0 16px;
  border: 1px solid var(--chrome-line); border-radius: 999px;
  background: var(--chrome-bg); color: var(--chrome-fg);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  font: 500 0.875rem/1 var(--sans); font-variant-numeric: tabular-nums;
  transition: opacity 250ms ease;
}
.deck-count { min-width: 4.4ch; text-align: center; white-space: nowrap; }
.deck-count span { opacity: 0.6; }
.deck-btn {
  display: grid; place-items: center; min-width: 44px; min-height: 44px; padding: 0;
  border: 0; border-radius: 999px; background: transparent; color: inherit; cursor: pointer;
}
.deck-btn:hover { background: var(--chrome-hover); }

.deck-menu {
  position: absolute; right: 0; bottom: calc(100% + 10px);
  width: 22rem; max-height: min(70vh, 34rem); overflow: auto; padding: 6px;
  border: 1px solid var(--rule); border-radius: 14px;
  background: var(--paper); color: var(--ink);
  box-shadow: 0 18px 48px rgb(8 26 43 / 0.22), 0 2px 6px rgb(8 26 43 / 0.08);
}
.deck-menu[hidden] { display: none; }
.deck-menu ol { counter-reset: none; }
.deck-menu a, .deck-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 8px 12px;
  border: 0; border-radius: 9px; background: transparent; color: inherit;
  font: 500 0.9375rem/1.25 var(--sans); text-align: left; text-decoration: none; cursor: pointer;
}
.deck-menu a:hover, .deck-menu button:hover, .deck-menu a:focus-visible, .deck-menu button:focus-visible { background: var(--mist); }
.deck-menu a[aria-current='true'] { background: var(--mist); }
.deck-menu .num { width: 1.6em; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.deck-menu hr { margin: 6px 4px; border: 0; border-top: 1px solid var(--rule); }
.deck-menu kbd { margin-left: auto; color: var(--ink-2); font: 500 0.8125rem/1 var(--sans); }

.deck-progress {
  position: fixed; z-index: 20; left: 0; right: 0; top: 0; height: 3px; pointer-events: none;
}
.deck-progress i { display: block; height: 100%; background: var(--cyan); transform-origin: 0 50%; transform: scaleX(0); }

.deck-end {
  display: flex; flex-direction: column; align-items: flex-start; gap: 14px;
  padding: 40px max(20px, env(safe-area-inset-left)) calc(56px + env(safe-area-inset-bottom));
  background: var(--night); color: var(--on-night-2); font-size: 0.9375rem;
}

.download {
  display: inline-flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 22px;
  border: 1px solid currentColor; border-radius: 999px;
  color: inherit; font: 600 1rem/1 var(--sans); text-decoration: none;
  transition: background-color 150ms ease, color 150ms ease;
}
.download .icon { width: 20px; height: 20px; }

:root {
  --chrome-bg: rgb(255 255 255 / 0.8);
  --chrome-fg: var(--ink);
  --chrome-line: rgb(11 26 40 / 0.14);
  --chrome-hover: rgb(11 26 40 / 0.07);
}

/* ---------- FLUID: one page that scrolls ---------- */
@media screen and (max-width: 899.98px), screen and (max-height: 499.98px), screen and (orientation: portrait) {
  .stage-only { display: none !important; }
  .deck-edge, .deck-bar { display: none !important; }
}
html:not(.js) .stage-only { display: none !important; }
html:not(.js) .deck-progress { display: none; }

/* ---------- STAGE geometry: screen in landscape, and print ---------- */
@media print, screen and (min-width: 900px) and (min-height: 500px) and (orientation: landscape) {
  html.js .slide { width: 1920px; height: 1080px; }
  html.js .fluid-only { display: none !important; }
}

/* ---------- STAGE behaviour ---------- */
@media screen and (min-width: 900px) and (min-height: 500px) and (orientation: landscape) {
  html.js, html.js body { height: 100%; overflow: hidden; background: #040d17; }
  html.js .deck { position: fixed; inset: 0; overflow: hidden; touch-action: pan-y pinch-zoom; }
  html.js .slide {
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%) scale(var(--deck-scale, 0.5));
    opacity: 0; visibility: hidden;
    transition: opacity 260ms ease, visibility 0s linear 260ms;
  }
  html.js .slide.is-active { opacity: 1; visibility: visible; transition: opacity 260ms ease, visibility 0s; }
  html.js:not(.deck-ready) .slide { transition: none; }
  html.js .deck-progress, html.js .deck-end { display: none; }

  /* The controls fade after the mouse rests, so a shared screen shows only the slide. */
  html.js.chrome-idle .deck-edge { opacity: 0.16; }
  html.js.chrome-idle .deck-bar { opacity: 0; }
  html.js.chrome-idle.is-fullscreen .deck-edge { opacity: 0; }
  html.js .deck-bar:hover, html.js .deck-bar:focus-within { opacity: 1; }
  html.js .deck-edge:focus-visible { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  html.js .slide, html.js .slide.is-active { transition: none !important; }
}

/* ---------- PRINT: one slide per page ---------- */
@media print {
  @page { size: 1920px 1080px; margin: 0; }
  html, body { height: auto; overflow: visible; background: var(--paper); }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  [data-chrome], .deck-end, .skip-link { display: none !important; }
  .deck { position: static; }
  .slide {
    position: relative !important; left: auto !important; top: auto !important; transform: none !important;
    opacity: 1 !important; visibility: visible !important; transition: none !important;
    width: 1920px; height: 1080px;
    break-after: page; page-break-after: always; break-inside: avoid;
  }
  .slide:last-of-type { break-after: auto; page-break-after: auto; }
  html:not(.js) .stage-only { display: revert !important; }
  html:not(.js) .fluid-only { display: none !important; }
}
