/* ==========================================================================
   Video.js skin — the ONLY file that styles the player chrome.

   Loaded by video-player.html (after styles.css and video-js.css) and by
   video-embed.html (after video-js.css only, so the embed must be
   self-sufficient — see the "Standalone embed" section at the end).

   Video.js ships its own rules in video-js.css. Everything below either
   restates one of those on the site's tokens or slices the shipped chrome down
   to the controls this site actually uses.
   ========================================================================== */

.video-js {
    font-family: var(--font-base, var(--font-base-default));
    width: 100%;
    height: 100%;
    margin: 0 auto;
    position: relative;
    color: var(--text-dim);
    background-color: var(--bg);
    /* The rounded player box. The radius has to live on the outer box together
       with overflow:hidden, so the video, the poster and the control bar are
       all clipped to it. A radius on the media alone leaves square corners of
       page background showing around it. */
    border-radius: var(--r-md);
    overflow: hidden;
    box-shadow: var(--elev-2);
}

/* The player glow lives on .video-container in styles.css. Do not add a second
   ::before glow here: .video-js has overflow:hidden, which clips an oversized
   pseudo-element at the player edge. */

.video-js .vjs-tech {
    object-fit: contain;
}

/* --- Control bar ---
 * Declared once, here, and its bottom radius follows the player box's own.
 * This skin is the only owner of the chrome: video-js.css loads first and
 * styles.css never touches .vjs-* at all, so nothing below is decided by load
 * order. It *was* declared twice in an earlier era — once here, once in
 * styles.css, which loaded later and therefore won. Removing the losing copy
 * was right; redeclaring the winner with half of its declarations was not, and
 * that is what flattened the bar (it fell back to Video.js's stock #2B333F
 * fill and 3em height). */
.video-js .vjs-control-bar {
    display: flex;
    align-items: center;
    background-color: var(--overlay-scrim);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    height: 48px;
    border-top: 1px solid var(--border-accent);
    border-radius: 0 0 var(--r-md) var(--r-md);
}

/* The empty part of the seek bar. It used to be a raw 10% white, which is the
   same idea as --border (7% white) and is the only neutral hairline in the
   token block; a pink track made the unplayed portion read as progress. */
.video-js .vjs-slider {
    background-color: var(--border);
}

.video-js .vjs-play-progress,
.video-js .vjs-volume-level {
    background-color: var(--accent);
}

.video-js .vjs-load-progress {
    background-color: var(--accent-tint-strong);
}

.video-js .vjs-progress-control {
    flex: 1 1 auto;
    margin: 0 var(--sp-2);
}

.video-js .vjs-progress-control .vjs-progress-holder {
    /* The progress control is a centred flex item as tall as the bar, so the
       track rides the same centre line as the 36px buttons with no offset of
       its own. It used to carry `margin-top: 19px`, which parked it near the
       bottom of the 48px bar and made the timeline the one element out of
       line -- and the timeline is the line the readout below is centred on, so
       the two have to agree. */
    height: 10px;
    border-radius: var(--r-pill);
}

.video-js .vjs-control {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    line-height: 36px;
    font-size: 1.2em;
    color: var(--text);
    border-radius: var(--r-sm);
    /* Not --motion-surface: a control never lifts or moves, it only changes
       colour and fill. */
    transition: background-color var(--dur-base) ease, color var(--dur-base) ease;
}

/* --- Control icons --- */
.video-js .vjs-play-control,
.video-js .vjs-volume-panel,
.video-js .vjs-fullscreen-control,
.video-js .vjs-playback-rate,
.vjs-skip-backward-15,
.vjs-skip-forward-30 {
    color: var(--text);
}

/* One hover treatment for every control in the bar, rather than per-button
   overrides. The earlier version styled six buttons by name, and the partial
   rewrite that followed left the play button on the old pink hover while every
   other control quietly lost it — the inconsistency was structural, not a
   mistake in any single value. */
.video-js .vjs-control:hover,
.video-js .vjs-control:focus {
    color: var(--accent);
    background-color: var(--accent-tint);
}

.video-js .vjs-play-control .vjs-icon-placeholder:before {
    font-size: 1.6em;
}

.video-js .vjs-volume-panel,
.video-js .vjs-fullscreen-control {
    margin-left: var(--sp-1);
    margin-right: var(--sp-1);
}

.video-js .vjs-time-control {
    font-size: var(--fs-base);
    color: var(--text);
    min-width: auto;
}

.video-js .vjs-button > .vjs-icon-placeholder:before {
    font-size: 1.4em;
    line-height: 36px;
}

/* --- Timeline readout ---
 * Video.js ships the time as chips: an accent fill, a radius, a shadow, and a
 * float 3.4em clear of the bar. There are two of them -- the playhead's, inside
 * .vjs-play-progress, and the pointer's, inside .vjs-mouse-display -- and stock
 * draws both at once the moment the timeline is hovered, on top of the scrubber
 * preview.
 *
 * This skin draws plain numerals ON the timeline instead, centred on the track.
 * The progress control is as tall as the bar, so `top: 50%` of it is the same
 * centre line the track rides at any control-bar height; nothing here restates
 * the geometry that centres the bar. The chip's fill, radius and shadow are
 * undone, and legibility over moving video comes from a halo instead -- the
 * accent fill is what made the readout read as a deprecated badge.
 */
.video-js .vjs-time-tooltip,
.video-js .vjs-progress-tooltip {
    position: absolute;
    /* Centred on the point it describes -- the pointer's x for the hover copy,
       the end of the played fill for the playhead's. Stock's `float: right` plus
       its scripted `right` offset is undone here: that offset is clamped against
       the player box from document coordinates, so the chip drifts a digit or
       two away from the point it is counting. `--readout-nudge` is the one part
       of this that CSS cannot know -- how close the point is to either end of
       the timeline -- and static/timeline-readout.js supplies it. */
    /* `!important` because Video.js writes `right` inline on every update, and
       an inline offset left in place would pin this box to both edges of the
       played fill and stretch it across the timeline. */
    top: 50%;
    left: 0 !important;
    right: auto !important;
    float: none;
    line-height: 1;
    /* The box is only as tall as its numerals, so it can never reach past the
       bar's own edges and clip. */
    transform: translate(calc(-50% + var(--readout-nudge, 0px)), -50%);
    background: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0 var(--sp-1, 6px);
    color: var(--text);
    font-family: var(--font-base, var(--font-base-default));
    /* Stock's 0.6em-on-hover is undone in the rule below. */
    font-size: var(--fs-base, 0.9rem);
    /* A clock that shifts whenever a digit changes reads as a glitch. */
    font-variant-numeric: tabular-nums;
    letter-spacing: 0;
    /* White numerals cross both the grey track and the accent fill, so they are
       outlined rather than filled. Like the rest of this skin, the token is
       named without a literal fallback: on the embed, which loads no token
       block, the declaration is simply dropped and the numerals go bare. */
    text-shadow: 0 1px 2px var(--overlay-scrim), 0 0 4px var(--overlay-scrim);
    white-space: nowrap;
}

/* The two readouts hang in boxes of different shapes, and each is anchored at
   the point it counts. The pointer's sits in .vjs-mouse-display, a 1px marker
   parked on the cursor, so its containing block's left edge is the cursor. The
   playhead's sits in .vjs-play-progress, the played fill, which starts at the
   beginning of the timeline and ends at the playhead -- so the point it counts
   is that box's right edge, not its left. */
.video-js .vjs-play-progress .vjs-time-tooltip {
    left: 100% !important;
}

/* Stock shrinks the readout to 0.6em while the timeline is hovered. Restated
   with the same four classes, which is enough: this file loads after
   video-js.css. */
.video-js .vjs-progress-control:hover .vjs-time-tooltip,
.video-js .vjs-progress-control:hover .vjs-progress-holder:focus .vjs-time-tooltip {
    font-size: var(--fs-base, 0.9rem);
}

/* The playhead readout. Stock only shows it while the timeline is hovered; it
   is the only running clock the timeline itself carries, so it stays up. The
   six classes outrank stock's `:focus` display:none (four) at every sibling
   state. */
.video-js.vjs-has-started .vjs-progress-control .vjs-progress-holder .vjs-play-progress .vjs-time-tooltip {
    display: block;
    visibility: visible;
}

/* Two readouts, one line. While the pointer is away from the playhead both are
   legible side by side, which is the point of drawing them at all. When they
   would collide -- the viewer is scrubbing around where playback already is --
   the pointer's copy is the one being steered and keeps the line; the
   playhead's steps back rather than printing two timecodes as one smear. The
   script (static/timeline-readout.js) sets this class; nothing here decides
   where the pointer is. */
.video-js.vjs-readout-collision .vjs-progress-control .vjs-progress-holder .vjs-play-progress .vjs-time-tooltip {
    opacity: 0;
}

/* The stock playhead dot is the accent fill with a hole punched in it, and it
   sat directly under the timecode the readout now holds. Two digits over a
   filled circle cannot be read, so the dot stands down on the seek bar (the
   volume level keeps its own). */
.video-js .vjs-play-progress:before,
.video-js .vjs-play-progress .vjs-svg-icon {
    display: none;
}

/* --- Inline controls ---
 * A control that carries its slider inside it needs a width of its own. Nothing
 * gave the mute panel one, so with the inline slider (still used by the
 * standalone embed — see "Standalone embed" at the end) the 36px box was too
 * narrow to hold both the icon and the track, and the track ran out under the
 * fullscreen button. The vertical popup is exempt: it parks its slider above.
 */
.video-js .vjs-volume-panel.vjs-volume-panel-horizontal {
    width: auto;
}

/* --- Volume popup ---
 * On the player page the slider opens UPWARD out of the mute button instead of
 * widening the panel to its right. Inline, the panel grew from 48px to 156px
 * the moment the cursor entered it, which slid the mute button left out from
 * under the pointer; the panel then closed, the pointer was over the button
 * again, and the two states flickered until the mouse left. A popup that opens
 * on the Y axis leaves every control in the bar at exactly the width it had, so
 * there is nothing to re-enter and nothing to flicker.
 *
 * The panel itself is the containing block, so the popup is centred on the mute
 * button rather than on the control bar. Video.js's stock popup uses
 * `bottom: 8em` and a borrowed dark fill; both are overridden, because the
 * button's box and the popup's distance belong to this skin.
 */
.video-js .vjs-volume-panel.vjs-volume-panel-vertical {
    /* The panel never grows: it is the 36px control box and nothing more. */
    width: 36px;
    min-width: 36px;
    flex: none;
    position: relative;
}

.video-js .vjs-volume-panel .vjs-volume-control.vjs-volume-vertical {
    position: absolute;
    /* Hammered out of the flow in the closed state too, so the bar can never
       reflow around it (stock parks it off-screen at left: -3000em instead). */
    left: 50%;
    bottom: calc(100% + var(--sp-1));
    transform: translateX(-50%);
    width: 36px;
    height: 132px;
    margin: 0;
    padding: var(--sp-1) 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--overlay-scrim);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border-accent);
    border-radius: var(--r-sm);
    box-shadow: var(--elev-2);
    /* Hidden, but never `display: none` or `visibility: hidden`: Video.js maps
       a click on the slider onto a volume from its measured box, and a box that
       is not rendered has no measurement. Opacity plus pointer-events hides it
       while keeping the geometry intact. */
    opacity: 0;
    pointer-events: none;
    transition: var(--motion-reveal);
}

/* The open state has to be restated, and not merely by matching stock: stock
   opens with `.vjs-volume-panel.vjs-hover .vjs-mute-control ~
   .vjs-volume-control.vjs-volume-vertical`, which is six classes deep. A rule
   of four classes is not "later wins" — it loses, and `left: -3.5em` sent the
   popup 50px to the left of where it belonged while `bottom` and the fill
   stayed put, which is what made the popup look half-styled. So this selector
   carries the same sibling combinator and the same six classes.
 *
 * `transition` is restated here on purpose: stock's open rule sets
 * `transition: left 0s` at a weight that would otherwise outrank the closed
 * state's recipe, and the fade would snap. */
.video-js .vjs-volume-panel.vjs-hover .vjs-mute-control ~ .vjs-volume-control.vjs-volume-vertical,
.video-js .vjs-volume-panel:focus .vjs-mute-control ~ .vjs-volume-control.vjs-volume-vertical,
.video-js .vjs-volume-panel .vjs-mute-control ~ .vjs-volume-control.vjs-volume-vertical.vjs-slider-active {
    /* Stock returns the popup to the flow when it opens; the whole point here
       is that it never leaves its own box. */
    position: absolute;
    left: 50%;
    height: 132px;
    opacity: 1;
    pointer-events: auto;
    transition: var(--motion-reveal);
}

.video-js .vjs-volume-vertical .vjs-volume-bar.vjs-slider-vertical {
    width: 6px;
    height: 108px;
    margin: 0 auto;
    border-radius: var(--r-pill);
}

.video-js .vjs-volume-vertical .vjs-volume-level {
    border-radius: var(--r-pill);
}

/* The scrub-style tooltip would hang off the popup's edge; the popup is narrow
   and the level is legible on its own, so it is not shown. */
.video-js .vjs-volume-vertical .vjs-volume-tooltip,
.video-js .vjs-volume-vertical .vjs-mouse-display {
    display: none;
}

/* --- Skip controls ---
 * Two adjacent buttons, and the only ones whose label is not drawn into the
 * glyph: Video.js ships replay-5/10/30 and forward-5/10/30, each with its
 * numeral baked in, and nothing for 15. Its plain replay ring is a filled
 * cable and the hole inside it is barely wider than a full stop, so a numeral
 * cannot sit in it. Both buttons therefore draw the same thin ring as inline
 * SVG (the idiom the rest of the site uses for icons) and keep the number as a
 * real text node on top of it; the forward arrow is the backward one mirrored.
 *
 * This also means neither button depends on the icon font, which is what the
 * placeholder span was silently falling back to before. */
.vjs-skip-backward-15,
.vjs-skip-forward-30 {
    position: relative;
}

.vjs-skip-ring {
    display: block;
    width: 28px;
    height: 28px;
    margin: 0 auto;
}

/* The forward control is the same ring and arrow mirrored, so the two read as
   one pair without a second path. */
.video-js .vjs-skip-forward-30 .vjs-skip-arrow {
    transform: scaleX(-1);
    transform-origin: 12px 12px;
}

.vjs-skip-seconds {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    /* Inside the ring, clear of the arrow's tail. */
    padding-top: 1px;
    font-size: 0.7em;
    font-weight: 600;
    letter-spacing: 0;
    color: inherit;
    pointer-events: none;
}

/* --- Scrubber (seek) previews ---
 * A still frame that follows the pointer over the progress bar, positioned by
 * static/scrubber-preview.js from Stash's sprite sheet. It lives INSIDE the seek
 * bar element, whose stock rule is `position: relative`, so `bottom: 100%` is
 * measured from the top of the bar and needs no absolute offsets of our own.
 *
 * Every value carries a literal fallback because the embed loads only
 * video-js.css and this file -- the token block lives in styles.css, which the
 * embed never fetches. `var(--token, fallback)` degrades to the fallback on the
 * embed and picks up the real tokens on the player page.
 *
 * The preview must clear the stock time tooltip and the whole control bar, so it
 * takes the highest z-index in the player. It never intercepts pointers: the
 * seek bar underneath owns all seeking.
 */
.video-js .vjs-scrubber-preview {
    position: absolute;
    bottom: calc(100% + var(--sp-2, 10px));
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    pointer-events: none;
    background: var(--overlay-scrim, rgba(7, 6, 11, 0.9));
    border: 1px solid var(--border-accent, rgba(255, 42, 109, 0.24));
    border-radius: var(--r-sm, 6px);
    box-shadow: var(--elev-2, 0 8px 24px rgba(0, 0, 0, 0.5));
    /* The reveal recipe from the token block, with the durations restated so
       the embed animates identically without them. */
    transition: var(--motion-reveal, opacity 200ms ease, transform 200ms ease);
}

/* `hidden` is authoritative: the script toggles this attribute rather than a
   class, and the display:flex above would otherwise win over the UA default. */
.video-js .vjs-scrubber-preview[hidden] {
    display: none;
}

.video-js .vjs-scrubber-preview__frame {
    display: block;
    /* The sprite sheet is scaled and offset here by the script; the box itself
       is exactly one cue rectangle, so nothing else can bleed in. */
    background-repeat: no-repeat;
    background-color: transparent;
    pointer-events: none;
}

/* --- Hidden chrome ---
 * This site ships no caption tracks, audio tracks or chapters, so the buttons
 * that would open an empty menu are removed rather than shown as dead ends. */
.video-js .vjs-text-track-display,
.video-js .vjs-captions-button,
.video-js .vjs-subtitles-button,
.video-js .vjs-audio-button,
.video-js .vjs-chapters-button,
.video-js .vjs-descriptions-button {
    display: none !important;
}

/* --- Playback error banner --- */
.playback-error {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    align-items: center;
    max-width: 80vw;
    margin: 1rem auto;
    padding: 0.75rem 1rem;
    color: var(--text);
    background: var(--accent-tint-strong);
    border: 1px solid var(--accent);
    border-radius: var(--r-sm);
}

.playback-error[hidden] {
    display: none !important;
}

.playback-error a {
    color: var(--text);
    font-weight: 600;
}

/* The player box dimensions are computed in JS (see video-player.html) to fit
   the viewport at the video's native aspect ratio, so no per-orientation
   overrides are needed here. */

/* ==========================================================================
   Standalone embed (static/video-embed.html)

   The embed loads ONLY video-js.css and this file — not styles.css — so it
   cannot inherit the site's document-level reset and must carry its own. Every
   rule here is keyed off .embed-body / .embed-stage, which exist only on the
   embed, so the player page (which shares this stylesheet) is untouched.

   The letterbox stays literal black: a video matte is not a theme surface, and
   the embed has no access to the token block anyway.
   ========================================================================== */

body.embed-body {
    margin: 0;
    height: 100%;
    background: #000;
    overflow: hidden;
}

.embed-stage {
    position: fixed;
    inset: 0;
}

/* The embed is edge-to-edge inside an iframe, so the rounded box is squared
   off there on purpose — this is the one place the skin undoes itself. */
.embed-stage .video-js {
    width: 100% !important;
    height: 100% !important;
    border-radius: 0;
    box-shadow: none;
}

.embed-stage .video-js .vjs-tech {
    object-fit: contain;
}

.embed-stage .video-js .vjs-control-bar {
    border-radius: 0;
}
