/* Viewer shell */
:root {
  --page: #0c0c0b;
  --chrome: rgba(24, 24, 22, 0.78);
  --chrome-ink: #f4f3ef;
  --chrome-dim: #a3a39e;
  --accent: #3f74d6;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--page); }
body { overflow: hidden; -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; }

#deck { position: fixed; inset: 0; overflow: hidden; touch-action: pan-y pinch-zoom; }
#stage { position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; transform-origin: 0 0; }
.frame { position: absolute; inset: 0; display: none; }
.frame.on { display: block; }
.frame.top { z-index: 2; }

/* Slide canvas: the Slides format's defaults (format.md) */
.slide {
  position: absolute; left: 0; top: 0; width: 1920px; height: 1080px; overflow: hidden;
  display: flex; flex-direction: column;
  font-size: 32px; line-height: 1.4; font-weight: 400;
  overflow-wrap: break-word; text-rendering: optimizeLegibility;
}
.slide div { display: flex; flex-direction: column; }
.slide h1 { font-size: 96px; font-weight: 600; line-height: 1.1; }
.slide h2 { font-size: 64px; font-weight: 600; line-height: 1.15; }
.slide h3 { font-size: 44px; font-weight: 600; line-height: 1.2; }
.slide ul { list-style: disc outside; padding-left: 1.2em; }
.slide ol { list-style: decimal outside; padding-left: 1.4em; }
.slide img { display: block; object-fit: cover; }
.slide a { color: inherit; }
.slide .xi, .slide .xs { display: block; flex-shrink: 0; overflow: visible; }
.slide .embed { display: block; background: transparent; pointer-events: none; color-scheme: normal; }
.slide .tbl table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.slide .tbl th, .slide .tbl td { padding: 0.35em 0.6em; text-align: left; vertical-align: middle; font-weight: inherit; }
.slide .tbl tr + tr > * { border-top: 1px solid var(--rule); }
.slide .tbl th + th, .slide .tbl td + td { border-left: 1px solid var(--rule); }
.slide .bh { visibility: hidden; }

/* Click-to-play clips */
.slide .vid { cursor: pointer; }
.slide .vid img, .slide .vid video { position: absolute; inset: 0; width: 100%; height: 100%; }
.slide .vid video { background: #000; }
/* Same badge as the Slides player: a small dark disc in the clip's bottom-left corner */
.slide .vid .play {
  position: absolute; left: 18px; bottom: 18px; width: 48px; height: 48px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: rgba(40, 40, 38, 0.72); color: #fff;
  transition: transform .2s ease, background .2s ease;
}
.slide .vid .play svg { width: 22px; height: 22px; margin-left: 3px; }
.slide .vid:hover .play { transform: scale(1.08); background: rgba(63, 116, 214, 0.95); }
.slide .vid:focus-visible { outline: 4px solid var(--accent); outline-offset: 4px; }
.slide .vid.playing .play, .slide .vid.playing img { display: none; }

/* Controls */
#ui {
  position: fixed; right: max(10px, env(safe-area-inset-right)); bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 10; display: flex; align-items: center; gap: 0; padding: 3px;
  border-radius: 999px; background: var(--chrome); color: var(--chrome-ink);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  font: 500 12px/1 'Manrope', system-ui, sans-serif; font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  transition: opacity .3s ease, transform .3s ease;
}
#ui.idle { opacity: 0; transform: translateY(8px); pointer-events: none; }
#ui button {
  width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent; color: inherit;
  display: grid; place-items: center; cursor: pointer;
}
#ui button:hover { background: rgba(244, 243, 239, 0.12); }
#ui button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#ui button:disabled { opacity: .35; cursor: default; background: transparent; }
#ui svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#ui-count { min-width: 56px; text-align: center; color: var(--chrome-dim); letter-spacing: .02em; }
#progress { position: fixed; left: 0; right: 0; bottom: 0; height: 3px; z-index: 9; background: rgba(244, 243, 239, 0.08); }
#progress div { height: 100%; width: 0; background: var(--accent); transition: width .35s ease; }

/* Phone held upright: slides stack and scroll, each one full width */
body.scroll { overflow: auto; }
body.scroll #deck { position: static; overflow: visible; padding: max(12px, env(safe-area-inset-top)) 0 max(16px, env(safe-area-inset-bottom)); }
body.scroll #stage { position: static; width: auto; height: auto; transform: none !important; display: flex; flex-direction: column; gap: 10px; }
body.scroll .frame { position: relative; display: block; inset: auto; width: 100vw; height: calc(100vw * 9 / 16); overflow: hidden; }
body.scroll .frame .slide { transform-origin: 0 0; transform: scale(var(--s)); }
body.scroll #ui, body.scroll #progress { display: none; }
body.scroll #hint {
  display: block; margin: 4px 16px 12px; color: var(--chrome-dim); text-align: center;
  font: 500 13px/1.4 'Manrope', system-ui, sans-serif;
}
#hint { display: none; }

@media (prefers-reduced-motion: reduce) {
  #progress div, #ui { transition: none; }
}
