/* Structure, presenter mode, print. Era looks live in eras.css. */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }

html {
  font-size: clamp(18px, 1.4vw, 24px);
  line-height: 1.3;
  -webkit-text-size-adjust: 100%;
}
body { min-height: 100vh; overflow-x: hidden; }
img, svg { display: block; max-width: 100%; }
ol, ul { padding: 0; list-style: none; }
a { color: inherit; overflow-wrap: anywhere; }
table { border-collapse: collapse; }
.nowrap, [data-num] { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

section {
  position: relative;
  min-height: 100vh;
  padding: 6vh 6vw;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.7em;
  overflow: hidden;
}

/* Presenter mode: one scene fills the screen; body text >= 28px at 1280px wide. */
html:has(body.presenter) { font-size: clamp(28px, 2.2vw, 46px); overflow: hidden; }
.presenter section { height: 100vh; min-height: 0; }
@media screen {
  .presenter section:not(.active):not(.fx) { display: none !important; }
}

/* Beats: hidden until reached in presenter mode. visibility keeps the layout still. */
/* Without GSAP (offline) beats fall back to a plain CSS reveal. With GSAP, scenes.js owns them. */
html:not(.gsap) [data-beat] { transition: opacity 0.35s; }
html:not(.gsap) .presenter [data-beat]:not(.is-shown) { visibility: hidden; opacity: 0; }

/* Era transitions keep the outgoing scene (and its clones) on screen, stacked. */
.presenter section.fx { position: fixed; inset: 0; z-index: 3; }

#counter {
  position: fixed; right: 1.1rem; bottom: 0.8rem; z-index: 5;
  font: 600 20px/1 system-ui, sans-serif;
  font-variant-numeric: tabular-nums;
  color: var(--muted, #555);
  background: var(--bg, #fff);
  padding: 4px 8px;
  border-radius: 4px;
  opacity: 0.85;
}
#blackout { position: fixed; inset: 0; background: #000; z-index: 20; }
#blackout[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Print: one landscape page per scene, every beat at its end state. */
/* 16:9 slide page = 1280x720 CSS px, the same stage as presenter mode */
@page { size: 13.333in 7.5in; margin: 0; }
@media print {
  html, html:has(body.presenter) { font-size: 28px; overflow: visible; }
  body { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  section, .presenter section {
    display: flex; height: 100vh; min-height: 0;
    break-after: page; break-inside: avoid;
  }
  [data-beat], .presenter [data-beat]:not(.is-shown) { visibility: visible !important; opacity: 1 !important; }
  #counter, #blackout { display: none !important; }
  /* backstop if a print event was missed: never print scroll-mode pinning */
  .pin-spacer { height: auto !important; padding: 0 !important; }
  section { position: relative !important; inset: auto !important; transform: none !important; translate: none !important; }
}
