/* Presentation mode: one slide per screen, with controls.
   Scroll view (the original stacked layout) is body without .present. */
:root { --bar: 56px; --deck-ink: #0B2234; --deck-sky: #7FB6D9; --deck-paper: #F5F7F9; }

/* Original export froze the entrance animations; let them play in presentation mode only. */
body:not(.present) .rise, body:not(.present) .fade { animation: none !important; opacity: 1 !important; }
@media (prefers-reduced-motion: reduce) { .rise, .fade { animation: none !important; opacity: 1 !important; } }

body.present { overflow: hidden; height: 100vh; height: 100dvh; background: #06111A; overscroll-behavior: none; }
body.present main {
  max-width: none; padding: 0; gap: 0; margin: 0;
  height: calc(100vh - var(--bar)); height: calc(100dvh - var(--bar));
  display: flex; align-items: center; justify-content: center;
  touch-action: pan-y pinch-zoom; user-select: none; -webkit-user-select: none;
}
body.present .frame {
  display: none; flex: none; box-shadow: 0 12px 48px rgba(0, 0, 0, .5);
  width: min(100vw, calc((100vh - var(--bar)) * 16 / 9));
  width: min(100vw, calc((100dvh - var(--bar)) * 16 / 9));
}
body.present .frame.active { display: block; }
body.present.fs { --bar: 0px; }

/* Control bar */
.deckbar { display: none; }
body.present .deckbar {
  display: flex; align-items: center; gap: 12px;
  position: fixed; left: 0; right: 0; bottom: 0; height: 56px; padding: 0 16px;
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--deck-ink); color: var(--deck-paper);
  font: 600 15px/1 'Hanken Grotesk', Arial, sans-serif; z-index: 10;
  transition: opacity .3s ease;
}
body.present.fs .deckbar { background: rgba(11, 34, 52, .88); backdrop-filter: blur(6px); }
body.present.fs.idle .deckbar { opacity: 0; pointer-events: none; }
body.present.fs.idle { cursor: none; }
.deckbar .progress { position: absolute; left: 0; top: 0; height: 3px; background: var(--deck-sky); transition: width .3s ease; }
.deckbar .title { flex: 1; min-width: 0; color: var(--deck-sky); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .3px; }
.deckbar .center { display: flex; align-items: center; gap: 6px; }
.deckbar .right { flex: 1; display: flex; justify-content: flex-end; gap: 6px; }
.deckbar .count { min-width: 72px; text-align: center; font-variant-numeric: tabular-nums; }
.deckbar button, .present-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; min-width: 40px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: inherit; font: inherit; cursor: pointer;
}
.deckbar button:hover { background: rgba(127, 182, 217, .16); }
.deckbar button:disabled { opacity: .3; cursor: default; background: transparent; }
.deckbar button:focus-visible, .present-btn:focus-visible { outline: 2px solid var(--deck-sky); outline-offset: 2px; }
.deckbar svg, .present-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* "Present" button shown in scroll view */
.present-btn {
  position: fixed; top: 16px; right: 16px; z-index: 10; height: 44px; padding: 0 16px;
  background: var(--deck-ink); color: var(--deck-paper); box-shadow: 0 4px 16px rgba(11, 34, 52, .3);
  font: 600 15px/1 'Hanken Grotesk', Arial, sans-serif;
}
.present-btn:hover { background: #123E5C; }
body.present .present-btn { display: none; }

/* Contents page rows jump to their slide */
.toc-row[data-go] { cursor: pointer; }
.toc-row[data-go]:hover p:first-child { text-decoration: underline; text-underline-offset: 4px; }

/* Rotate hint on phones held upright */
.rotate-hint {
  display: none; position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 11;
  max-width: calc(100vw - 32px); padding: 10px 14px; border-radius: 8px;
  background: rgba(11, 34, 52, .92); color: var(--deck-paper);
  font: 500 14px/1.35 'Hanken Grotesk', Arial, sans-serif; text-align: center;
}
@media (orientation: portrait) and (max-width: 767px) {
  body.present.touch:not(.hint-dismissed) .rotate-hint { display: block; }
}

/* Small screens */
@media (max-width: 640px) {
  .deckbar .title, .deckbar .label { display: none; }
  body.present .deckbar { padding: 0 8px; gap: 4px; }
}
@media (max-height: 500px) and (orientation: landscape) {
  :root { --bar: 44px; }
  body.present .deckbar { height: 44px; }
  .deckbar button { height: 36px; }
}
