/* ==========================================================================
   STAGE MODE — Orel Hershiser Chevrolet Training Academy
   (Tony's ruling, 2026-10-29; shared rollout built 2026-10-29 from the
   STAGE-ROLLOUT-DESIGN note, generalized from the Trailering decks/solo
   blocks that shipped v31–v38.)

   OPT-IN ONLY: every rule below is scoped to `body.stage`. A class page opts
   in by linking this file and putting class="stage" on <body>. Pages without
   the marker (homepage, reference tools, hubs, manager pages) are untouched
   by this file.

   What stage mode is:
   - Chrome off: the site header and footer never render on a class screen.
   - The class is a pinned stage: <main> fills the viewport (100vh / 100dvh),
     full width, no max-width cap, and never scrolls itself.
   - The in-main page title <h1> and the .progressline / meta paragraphs are
     hidden — on the Trailering surfaces they pushed every screen down and
     forced a scroll on every Next (deck root cause #1).
   - Only the ACTIVE screen scrolls, inside the stage (long-form exception:
     final-test screens and long text screens scroll internally; no scroll
     position ever reveals chrome).
   - The player nav bar (Back / counter / Next) stays pinned under the
     scrolling screen — it is the last <p> in <main>, held as a fixed-height
     flex row under the scroll region, so it can never cover content the way
     the old fixed-bar layout could (the M3 problem). Because the bar sits
     OUTSIDE the scroll region in these player families, no bottom-padding
     compensation is needed and none is carried here.
   - Media is sized from the viewport HEIGHT, not the container width:
     YouTube .vid boxes use aspect-ratio + a height-derived width cap
     (deck root cause #2 — the inline padding-top:56.25% hack resolves
     against container width), photos take a 58vh height cap.
   - Exit: one round ✕ (.stagex), fixed top-right, back to the class's
     home page. Same geometry as the decks' #dx / the solo class's #sx.
   ========================================================================== */

body.stage{overflow:hidden}

/* --- Chrome off ---------------------------------------------------------- */
body.stage header.top,
body.stage footer{display:none!important}

/* --- The pinned stage ----------------------------------------------------- */
body.stage main{
  max-width:none;width:100%;margin:0;
  padding:14px 18px 12px;
  height:100vh;height:100dvh;
  overflow:hidden;
  display:flex;flex-direction:column;
}

/* --- In-main title + meta lines off (they pushed every screen down) ------- */
body.stage main>h1,
body.stage main>.progressline{display:none}
/* Any other direct-child meta paragraph of <main> (level / lesson-outline
   lines) hides too; the player nav bar — always the LAST <p> in <main> —
   is excepted and stays. */
body.stage main>p:not(:last-child){display:none}

/* --- The active screen is the only scroll region -------------------------- */
body.stage .screen{margin:8px 0 10px}
body.stage .screen.active{
  flex:1 1 auto;min-height:0;
  overflow-y:auto;overflow-x:auto;
  -webkit-overflow-scrolling:touch;
}

/* --- Player nav bar: pinned under the scroll region, never an overlay ----- */
body.stage main>p:last-child{flex:0 0 auto;margin:8px 0 0}

/* --- Media fit: sized from viewport height -------------------------------- */
body.stage .screen .vid{
  padding-top:0!important;aspect-ratio:16/9;height:auto;
  max-width:min(1080px,calc((100dvh - 300px)*16/9));
  margin:12px auto;
}
body.stage .screen figure.photobeat img{
  max-height:58vh;width:auto;max-width:100%;margin:0 auto;
}

/* --- Exit ✕ (matches the decks' #dx / solo class's #sx) -------------------- */
body.stage .stagex{
  position:fixed;top:12px;right:14px;z-index:90;
  width:48px;height:48px;border-radius:50%;
  background:#fff;color:#0E4180;border:2px solid #0E4180;
  font-size:21px;font-weight:800;line-height:1;
  display:flex;align-items:center;justify-content:center;
  text-decoration:none;
  box-shadow:0 8px 20px rgba(14,65,128,.25);
}

/* --- FIRST VIDEO LARGE + the iframe fill it always needed (Tony, 2026-11-02)
   Root cause of "the first video is too small — I have to click into it to
   make it full screen": the shared CSS sized the .vid BOX (aspect-ratio +
   the height-derived width cap above) but NO rule anywhere sized the IFRAME
   inside the box on stage class pages — the player rendered at the browser
   default 300x150 inside the box, and only the player's own fullscreen
   button made it large. (The homepage, the Trailering solo class and the
   decks never had the bug: their iframes carry the fill inline.)
   Two repairs:
   (a) Every stage .vid iframe now fills its box. This touches all screens
       because no sizing rule can work without it; box sizes are unchanged.
   (b) The FIRST video screen of each class (its <section> carries .kickvid)
       becomes a flex column: the video takes every pixel left after the
       screen title and debrief — the largest true 16:9 that fits the stage
       with NO scrolling at any viewport height, phone included. Surrounding
       spacing is trimmed on those screens so the video wins the space.
       The 160px min-height floor means the video is never crushed on a
       short/narrow viewport: there the debrief takes the screen's own
       internal scroll (the stage's long-form exception) and the video
       stays large. Later screens keep the capped sizing above. */
body.stage .screen .vid{position:relative}
body.stage .screen .vid iframe{
  position:absolute;inset:0;width:100%;height:100%;border:0;
}
body.stage .screen.kickvid.active{display:flex;flex-direction:column}
body.stage .screen.kickvid .vid{
  flex:1 1 auto;min-height:160px;align-self:center;
  max-width:100%;margin:8px auto;
}
body.stage .screen.kickvid h2{margin-bottom:0}
body.stage .screen.kickvid p{margin:.4em 0}

/* --- Print: give the stage back its full height ---------------------------- */
@media print{
  body.stage main{height:auto;overflow:visible;display:block}
  body.stage .screen.active{overflow:visible}
  body.stage .stagex{display:none}
}

/* --- .vidwrap PARITY (v50, 2026-11-02) ------------------------------------
   Eight class files (Classes 2A, 2B, 3A, 3B, 4, 5, 6, 9) were built with a
   different video wrapper, <div class="vidwrap">, that no stylesheet ever
   defined — every sizing rule in this file targets .vid only, so in those
   classes the iframe fill and the kickvid enlargement above never engaged
   and the players rendered at the browser default ~300x150 (live-measured
   ~300x135 on Class 4 Screen 1, production v48). The rules below give
   .vidwrap the IDENTICAL treatment .vid receives — same height-capped box,
   same iframe fill, same kickvid flex enlargement — so both wrapper
   families render the same. No existing rule is changed; .vid screens
   are unaffected. */
body.stage .screen .vidwrap{
  padding-top:0!important;aspect-ratio:16/9;height:auto;
  max-width:min(1080px,calc((100dvh - 300px)*16/9));
  margin:12px auto;position:relative;
}
body.stage .screen .vidwrap iframe{
  position:absolute;inset:0;width:100%;height:100%;border:0;
}
body.stage .screen.kickvid .vidwrap{
  flex:1 1 auto;min-height:160px;align-self:center;
  max-width:100%;margin:8px auto;
}
