/* ---- theo/video (blocks/video/render.php) ---------------------------------
   YouTube is click-to-load: nothing is fetched until view.js inserts the iframe, so the
   poster + play button ARE the player until then. Bunny (Task 10, 23 Sep 2026) is a live
   lazily loaded player UNDER the poster overlay; see the pointer-events rule below.
   R12: every rule here is scoped at TWO-class specificity (`.theo-video .theo-video__*`),
   never a bare single class — the button also carries `.theo-btn` (a Bricks global class
   whose generated inline <style> ties at (0,1,0) and wins by source order on any property
   a bare `.theo-video__play` rule shares with it: position, z-index, transition all flipped
   silently before this fix (measured 23 Sep 2026, R12 incident). `.theo-prose` is NOT the
   scope — `.theo-video` (the figure itself) is, so this stylesheet works outside prose too
   (Bricks element, Task 3). */
.theo-video .theo-video__frame {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  overflow: hidden;
  background: var(--theo-ink-green);
}
.theo-video .theo-video__poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Task 8 fix round 1 (measured 23 Sep 2026, rollout on 13478 rolled back): the poster is a <picture> from
   wp_get_attachment_image, and the <img> inside it carries width="1024" height="576" attributes. Bricks'
   frontend-layer.min.css `img { height: auto; max-width: 100% }` is the only rule that matched it, so in a
   1280x720 frame the image stayed 1024x576 in the top-left corner. Sizing the <picture> alone never sized its
   child. (0,2,1) beats the bare `img` rule; `display: block` removes the inline baseline gap. On the blog
   (15352) the 780px column already scaled the img to fill, so geometry there is unchanged; only its computed
   object-fit changes from fill to cover. */
.theo-video .theo-video__poster img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* The play control is styled HERE, not by `.theo-btn` (finding #5). `.theo-btn` is a Bricks GLOBAL
   CLASS whose generated CSS only ever reaches `.brxe-button`; a bare `<button>` carrying the class
   inherits nothing from it, so this measured 29.7 x 18px with the OS default `rgb(239,239,239)` fill
   and the literal word "Play" on it. `--lp-play` (88px) is this control's size everywhere else on the
   site. `font-size: 0` hides the word while leaving it in the accessibility tree via `aria-label`. */
.theo-video .theo-video__play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--lp-play);
  height: var(--lp-play);
  padding: 0;
  background: var(--theo-green);
  color: var(--theo-white);
  border: 0;
  border-radius: 0;
  font-family: var(--theo-font);
  font-size: 0;
  transition: background-color var(--dur-base) var(--theo-ease);
}
/* The glyph is the LITERAL character, never a CSS hex escape. Measured 22 Sep 2026: a SINGLE backslash
   does not survive the push path — Bricks' customCss loses one level of slashes, so the escape form of
   U+25B6 arrived live as `content: "25B6"` and rendered the four characters 2-5-B-6 inside the button
   (a doubled backslash does survive, as itself). The "⚠" prefix below has always been a literal for
   the same reason. Anything needing a backslash in this file has to be written as the character. */
.theo-video .theo-video__play::after {
  content: "▶";
  font-size: var(--text-xl);
  line-height: 1;
}
.theo-video .theo-video__play:hover { background: var(--theo-ink-green); }
/* Task 8 fix round 1: `.theo-btn` gives every button a skewed white `::before` swipe bar (left:-52.8px, 26x88,
   measured on 15355). The play button has no overflow clipping, so a white sliver showed at its top-left corner.
   The old /lp/ play button (.theo-lp-play) never carried .theo-btn, so hiding the bar here restores that look. */
.theo-video .theo-video__play::before { display: none; }
.theo-video .theo-video__frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.theo-video.is-playing .theo-video__poster,
.theo-video.is-playing .theo-video__play { display: none; }
/* Task 10 (23 Sep 2026): a Bunny figure is a LIVE player (the iframe is first in the frame) with the poster and a
   decorative badge laid over it. Neither may take a pointer event: the visitor's first click has to land on
   Bunny's own play button INSIDE the frame, which is what makes it a real user gesture there (Safari/iOS refuse
   unmuted playback started from a click on our page). view.js adds .is-playing on the player's own play report. */
.theo-video--bunny .theo-video__poster,
.theo-video--bunny .theo-video__play { pointer-events: none; }
/* Task 10: YouTube keeps its poster while the iframe loads underneath (view.js inserts it first and adds
   .is-loading until the iframe's `load`), instead of an empty frame for seconds. The glyph is a LITERAL
   character, per the backslash note above. Both rules only match after a click: RUCSS keeps them through the
   `/theo-video/` safelist pattern in bricks-video.php. */
.theo-video.is-loading .theo-video__play { cursor: progress; }
.theo-video.is-loading .theo-video__play::after { content: "…"; }
/* Task 11 (R27): Bunny uses the same loading state from the moment view.js sets the player src until the player
   document's `load` (then `.is-ready`), so an early click shows "…" on our poster instead of a blank frame. An
   AUTOPLAY figure has no badge; its poster only covers the empty frame until the player is ready, then goes. */
.theo-video--autoplay.is-ready .theo-video__poster { display: none; }
.theo-video .theo-video__consent {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  z-index: 3;
  margin: 0;
  padding: var(--space-2xs) var(--space-xs);
  background: var(--theo-charcoal);
  color: var(--theo-white);
  font-size: var(--text-sm);
  text-align: center;
}
.theo-video .theo-video__consent a { color: var(--theo-white); }
.theo-video .theo-video__consent[hidden] { display: none; }

/* dark tone — today's /lp/ look (spec §4.5); explicit class or any .theo-on-dark ancestor. Both forms
   stay at two-class-or-more specificity per R12 (`.theo-video--dark` is on the SAME figure as `.theo-video`,
   so `.theo-video--dark .theo-video__frame` is already (0,2,0); the ancestor form adds `.theo-video` itself
   so it does not regress below that floor either). */
.theo-video--dark .theo-video__frame, .theo-on-dark .theo-video .theo-video__frame {
	border: var(--border-hair) solid var(--theo-grey-text); background: var(--theo-charcoal);
}
.theo-video--dark .theo-video__poster, .theo-on-dark .theo-video .theo-video__poster { filter: saturate(.7) brightness(.8); }
.theo-video--dark .theo-video__play, .theo-on-dark .theo-video .theo-video__play { color: var(--theo-black); }
.theo-video--dark .theo-video__play:hover, .theo-video--dark .theo-video__play:focus-visible,
.theo-on-dark .theo-video .theo-video__play:hover, .theo-on-dark .theo-video .theo-video__play:focus-visible { background: var(--theo-white); }
.theo-video--light .theo-video__frame { border: 0; }

/* builder-only label (bricks-video-element.php) — never printed on the live page. Note: --text-s does not
   exist in design-system/variables.json (checked 23 Sep 2026); nearest existing token is --text-sm, already
   used above for .theo-video__consent — used here instead, no new token added.
   R12: scoped at .brxe-theo-video (the element's own root, printed by Bricks — verified live) rather than a
   bare .theo-video__builder, so this holds the same two-class-or-more specificity floor as the rest of the
   file (fix round 1: the first cut of this file used a bare single-class selector here — wrong per R12). */
.brxe-theo-video .theo-video__builder { margin: var(--space-2xs) 0 0; font-size: var(--text-sm); color: var(--theo-grey-text); }
.brxe-theo-video .theo-video__builder.is-error { color: var(--theo-black); background: var(--theo-yellow); padding: var(--space-2xs); }
/* Task 10: in the BUILDER canvas the Bunny player is live too, and a cross-origin iframe swallows the click Bricks
   needs to select the element. The builder label only exists in the builder (render() prints it nowhere else), so
   `:has(.theo-video__builder)` scopes this to the canvas; the live page keeps a clickable player. */
.brxe-theo-video:has(.theo-video__builder) .theo-video__frame iframe { pointer-events: none; }

/* Fix round 1: the element root Bricks prints (.brxe-theo-video) and the figure inside it (.theo-video) had
   no width rule anywhere in this file — video.css only ever sized .theo-video__frame at width:100%, which
   resolves against ITS parent (.theo-video)'s box. Inside Bricks' default section (display:flex;
   align-items:center) an element with no explicit width shrink-wraps, so the figure — and therefore the
   frame — collapsed to 0x0 on any page that doesn't carry a builder-generated per-instance _width (every
   raw/scripted page write; measured live on scratch page 15353, fix round 1). A bare class selector here is
   deliberately LOW specificity (0,1,0 for the root, 0,2,0 for the figure line) so a real builder-set
   ID-scoped _width (Bricks emits those as `#brxe-<id>{width:...}`, specificity (1,0,0)) still wins over it —
   this is a floor, not an override. Does not touch the blog block: `.theo-prose .theo-video` there already
   gets its width from the post content column, and neither of these new selectors is scoped to `.theo-prose`
   or shares a selector with anything the blog reads, so blog/.theo-video__frame sizing is unaffected. */
.brxe-theo-video { width: 100%; }
/* margin: 0 (Task 8 fix round 1): <figure> keeps the browser's default `margin: 1em 40px` outside prose, which
   shifted the frame 40px right and overflowed it on /lp/ (measured on 13478). Scoped to the element, so the blog's
   .theo-prose figure margin is untouched. */
.brxe-theo-video .theo-video { width: 100%; margin: 0; }

/* theovideosec (Task 4, design/theovideosec.json) section padding — ported from the /lp/-only
   `.theo-lp-video { padding: var(--space-2xl) 0; }` (css/lp-v2.css) so the component carries its own
   padding on ANY page, not only inside the .theo-lp-v2 region. R12: two-class form
   (`.brxe-section.theo-video-section`) — Bricks prints `.brxe-section` on every section root
   (design-system/css/THEO-LP-CSS.css uses the same pattern for `.theo-hero-split` etc.), and a bare
   single-class `.theo-video-section` rule would tie with it on source order. */
.brxe-section.theo-video-section { padding: var(--space-2xl) 0; }
/* Task 8 fix round 1: side padding for the component's container. On /lp/ the old raw section got it from
   `.theo-lp-v2 > .brxe-container.theo-container { padding-inline: var(--space-s) }` (css/lp-v2.css:13), which
   needs a .theo-lp-v2 ancestor that theovideosec never has, so the first rollout rendered the header at x=0.
   Same value here without the ancestor dependency, so the component matches the v2 sections on any page
   (parity measured against the old section: 14.67px at 1280, 12.83px at 375). max-width already comes from
   the global .theo-container. */
.theo-video-section > .brxe-container { padding-inline: var(--space-s); }

/* Fix round 1 (controller ruling R15, 23 Sep 2026). Concern flagged in the Task 4 report: `vsesub`
   carries `theo-lp-sub`, but that class is coloured ONLY in css/lp-v2.css, and BOTH of its rules are
   scoped under a `.theo-lp-v2` ancestor:
     .theo-lp-v2 .theo-lp-sub { font-size: var(--text-lead); color: var(--theo-black); }
     .theo-lp-v2.theo-on-dark .theo-lp-sub { color: var(--theo-white); }
   theovideosec's root carries `.theo-on-dark`, never `.theo-lp-v2`, so a filled-in Lede got no colour
   override on ANY page, including under /lp/ itself (theovideosec is not the v2 layout body). Checked
   lp-v2.css:11-12 for every property those two rules set before mirroring: `font-size` is already
   supplied by `theolead` (design-system/classes.json, same `--text-lead` value) and the base rule's
   `color: var(--theo-black)` is the LIGHT-section default, which this component never needs (its root
   is always `.theo-on-dark`, no light variant exists yet) — so `color` on dark is the ONLY property the
   dark section needs mirrored here, not `font-size` (redundant with theolead) and not a light-mode rule
   (out of scope, nothing calls for it). R12: two-class form. */
.theo-video-section .theo-lp-sub { color: var(--theo-white); }

/* ---- Popup mode (display=popup, 12 Nov 2026; video-render.php, view.js) -------------------------------------
   A button opens the Bunny film in a native <dialog>. The trigger copies `.theo-btn`'s token usage (green fill and
   border, white 900-weight uppercase text, padding --space-2xs / --space-m, square corners); a bare <button> does
   not inherit it (see the play-button note above), so it is written out. No outline button, per the brand rules.
   Backdrop: the design system has no overlay token (its modal rules use a literal rgba, which this file must not),
   so it is a color-mix of --theo-black: the one deliberate exception to "no new tokens", no hex, no rgba.
   R12: two-class selectors throughout. */
.theo-video-popup .theo-video-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xs) var(--space-m);
  background: var(--theo-green);
  color: var(--theo-white);
  border: var(--border-hair) solid var(--theo-green);
  border-radius: 0;
  font-family: var(--theo-font);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: var(--track-caps);
  line-height: var(--lh-tight);
  cursor: pointer;
  transition: background-color var(--dur-base) var(--theo-ease), border-color var(--dur-base) var(--theo-ease);
}
.theo-video-popup .theo-video-open:hover,
.theo-video-popup .theo-video-open:focus-visible { background: var(--theo-ink-green); border-color: var(--theo-ink-green); }
.theo-video-popup .theo-video-dialog {
  box-sizing: border-box;
  width: min(100vw - 2 * var(--space-s), 1200px, calc((100vh - 2 * var(--space-s)) * 16 / 9));   /* never taller than the viewport */
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--theo-black);
  color: var(--theo-white);
  overflow: visible;
}
.theo-video-popup .theo-video-dialog::backdrop { background: color-mix(in srgb, var(--theo-black) 88%, transparent); }
.theo-video-popup .theo-video-dialog .theo-video { width: 100%; margin: 0; }
.theo-video-popup .theo-video-dialog .theo-video__frame { border: 0; background: var(--theo-black); }
/* the close button sits on the frame's top-right corner, always visible */
.theo-video-popup .theo-video-dialog__close {
  position: absolute;
  top: var(--space-2xs);
  right: var(--space-2xs);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--theo-btn-h);
  height: var(--theo-btn-h);
  padding: 0;
  background: var(--theo-green);
  color: var(--theo-white);
  border: 0;
  border-radius: 0;
  font-family: var(--theo-font);
  font-size: var(--text-xl);
  line-height: 1;
  cursor: pointer;
}
.theo-video-popup .theo-video-dialog__close:hover,
.theo-video-popup .theo-video-dialog__close:focus-visible { background: var(--theo-white); color: var(--theo-black); }
