/* presentation.css — the /presentation slide deck.
   Loads after fonts.css and site.css and consumes their tokens
   (--color-bg, --color-surface, --color-header-bg, --color-text,
   --color-text-muted, --color-text-faint, --color-accent, --border,
   --page-x, --header-h, --ease-out-expo, --font-display, --font-ui,
   --font-editorial, --font-mono). It declares no new hue and no new
   design token — everything here is deck-specific layout, type scale,
   controls and print rules. */

/* ── 1. Deck scroll foundation ──
   The document itself is the scroll container: html carries the snap
   type, each .slide is a snap child. This is deliberate — a nested
   scrolling <div> would need its own focus/tabindex handling before
   arrow keys or Page Down would reach it. Letting the page scroll means
   ArrowUp/ArrowDown/Space/PageUp/PageDown already work the moment the
   page loads, with zero JavaScript. The script below only upgrades this
   into slide-aware semantics (counter, progress, hash, click-to-advance,
   fullscreen). */
html {
  scroll-snap-type: y mandatory;
}

.deck {
  /* Semantic wrapper only — see the html rule above for why the actual
     scrolling happens on the document, not on this element. */
  position: relative;
}

.slide {
  position: relative;
  min-height: calc(100dvh - var(--header-h));
  display: flex;
  overflow: hidden;
  border-top: 1px solid var(--border);
  scroll-snap-align: start;
  scroll-snap-stop: always;
  /* Matches the .section convention in site.css: the sticky header sits
     on top of the snap point unless the snap target itself reserves the
     header's height. */
  scroll-margin-top: var(--header-h);
}

/* ── 2. Shared slide furniture ── */
.slide-media {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.slide-scrim {
  display: none;
  pointer-events: none;
}

.slide-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(10px, 1.4vw, 16px);
  padding: clamp(28px, 5vw, 72px) var(--page-x);
  max-height: 100%;
  overflow-y: auto;
}

.slide-title {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 0.96;
  font-size: clamp(2.5rem, 8vw, 7rem);
  text-shadow: 0 2px 30px rgba(0, 0, 0, 0.4);
}

.slide-title-sub {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1;
  font-size: clamp(1.8rem, 5.5vw, 4.5rem);
  color: var(--color-accent);
}

.slide-dek {
  font-family: var(--font-editorial);
  font-style: italic;
  font-size: clamp(1.05rem, 2.1vw, 1.7rem);
  line-height: 1.4;
  max-width: 32ch;
}

.slide-body {
  font-family: var(--font-ui);
  font-size: clamp(0.95rem, 1.4vw, 1.15rem);
  line-height: 1.6;
  max-width: 46ch;
  color: var(--color-text);
}
.slide-body strong { font-weight: 600; }
.slide-body em { font-family: var(--font-editorial); font-style: italic; }

.slide-list {
  font-family: var(--font-ui);
  font-size: clamp(0.95rem, 1.4vw, 1.1rem);
  line-height: 1.55;
  max-width: 46ch;
  padding-left: 1.2em;
}
.slide-list li + li { margin-top: 0.5em; }
.slide-list--numbered { list-style: decimal; }

.slide-mono-list {
  list-style: none;
  font-family: var(--font-mono);
  font-size: clamp(0.85rem, 1.2vw, 1rem);
  line-height: 1.7;
  max-width: 46ch;
}
.slide-mono-list li + li { margin-top: 0.4em; }
.slide-mono-list em { font-family: var(--font-editorial); font-style: italic; }

.slide-mono {
  font-family: var(--font-mono);
  font-size: clamp(0.85rem, 1.2vw, 1.05rem);
  line-height: 1.6;
  max-width: 46ch;
}

.slide-groups {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(14px, 2vw, 22px);
}

.slide-group-title {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-text-muted);
  margin-bottom: 6px;
}

/* ── 3. Layout variant: full ──
   Full-bleed background image with a two-axis scrim (echoing
   .splash-scrim in site.css) and the copy anchored bottom-left. */
.slide--full {
  display: block;
}

.slide--full .slide-media {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.slide--full .slide-scrim {
  display: block;
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    linear-gradient(90deg,
      rgba(0, 0, 0, 0.55) 0%,
      rgba(0, 0, 0, 0.28) 35%,
      rgba(0, 0, 0, 0.12) 60%,
      rgba(0, 0, 0, 0.45) 100%),
    linear-gradient(180deg,
      rgba(0, 0, 0, 0.30) 0%,
      rgba(0, 0, 0, 0.00) 30%,
      rgba(13, 11, 9, 0.90) 100%);
}

.slide--full .slide-content {
  position: absolute;
  z-index: 2;
  bottom: 0;
  left: 0;
  justify-content: flex-end;
  max-width: min(92vw, 34ch);
}

/* ── 4. Layout variant: split ──
   Two columns at desktop widths: copy on the left, the graphic filling
   the right column with object-fit:cover. Collapses to a single column
   under 900px, where the graphic becomes a scrimmed full-bleed
   background sitting behind the copy — the same idiom as .slide--full. */
.slide--split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: stretch;
}

.slide--split .slide-content {
  order: 1;
}

.slide--split .slide-media {
  order: 2;
}

@media (max-width: 900px) {
  .slide--split {
    display: block;
  }

  .slide--split .slide-media {
    position: absolute;
    inset: 0;
    z-index: 0;
  }

  .slide--split .slide-scrim {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
      linear-gradient(180deg,
        rgba(13, 11, 9, 0.55) 0%,
        rgba(13, 11, 9, 0.55) 30%,
        rgba(13, 11, 9, 0.95) 100%);
  }

  .slide--split .slide-content {
    position: relative;
    z-index: 2;
    min-height: 100%;
  }
}

/* ── 5. Layout variant: strip ──
   Copy on top, a row of small graphic frames beneath it, reusing the
   .filmstrip / .film-cell / .film-caption idiom already defined in
   site.css so the deck doesn't reinvent a fourth image treatment. */
.slide--strip {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: clamp(20px, 3vw, 32px);
  padding: clamp(28px, 5vw, 64px) var(--page-x);
  width: 100%;
}

.slide-filmstrip {
  margin: 0;
  max-width: 100%;
}

/* ── 6. Controls ── */
.deck-controls {
  position: fixed;
  right: var(--page-x);
  bottom: clamp(1.25rem, 3.5vw, 2.5rem);
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 10px;
  background: rgba(13, 11, 9, 0.72);
  border: 1px solid var(--border);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.deck-btn {
  appearance: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--color-text);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: border-color 200ms ease, color 200ms ease;
}
.deck-btn:hover,
.deck-btn:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent);
}
.deck-btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.deck-counter {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--color-text-muted);
  min-width: 3.4em;
  text-align: center;
}
.deck-counter-current { color: var(--color-accent); }

/* ── 7. Progress bar ── */
.deck-progress {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 150;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.deck-progress-fill {
  height: 100%;
  width: 0%;
  background: var(--color-accent);
  transition: width 260ms var(--ease-out-expo);
}

/* ── 8. Mobile scale-down ──
   Same discipline as site.css's 480px breakpoint: type shrinks before
   anything clips or overflows the viewport. */
@media (max-width: 640px) {
  .slide-title { font-size: clamp(2.1rem, 13vw, 3.4rem); }
  .slide-title-sub { font-size: clamp(1.4rem, 9vw, 2.4rem); }
  .slide-content { padding: clamp(24px, 6vw, 40px) var(--page-x); }
  .slide--full .slide-content { max-width: 94vw; }
}

/* ── 9. Motion safety ──
   The deck's own smooth-scroll is driven by the script (scrollIntoView),
   which already checks prefers-reduced-motion before choosing smooth vs.
   auto; this rule covers the native CSS scroll-snap path so a
   no-JS/reduced-motion visitor gets an instant snap instead of an
   animated one. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .deck-progress-fill { transition: none; }
}

/* ── 10. Print — PDF export as a demo-day backup ──
   Each slide becomes its own page at its natural (auto) height; the
   on-screen controls and progress bar are hidden; scrim gradients are
   dropped in favor of a flat readable background since projector-style
   full-bleed scrims don't reproduce reliably on paper. */
@media print {
  .site-header,
  .skip-link,
  .deck-controls,
  .deck-progress {
    display: none !important;
  }

  html {
    scroll-snap-type: none;
  }

  html, body, .deck {
    height: auto;
    overflow: visible;
  }

  .slide {
    display: block;
    min-height: auto;
    height: auto;
    page-break-after: always;
    break-after: page;
    scroll-snap-align: none;
  }
  .slide:last-child {
    page-break-after: auto;
    break-after: auto;
  }

  .slide--full .slide-media,
  .slide--split .slide-media {
    position: static;
    width: 100%;
    height: auto;
    max-height: 55vh;
    object-fit: cover;
  }

  .slide--full .slide-content,
  .slide--split .slide-content {
    position: static;
    max-width: none;
    padding: 24px;
  }

  .slide--full .slide-scrim,
  .slide--split .slide-scrim {
    display: none;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
