/* ===== STREAM OVERLAY (#107) =====
   The display as OBS browser source (?session=…&overlay=1): init.js sets
   `display-overlay` on <html> from the URL, before Alpine starts. The page is
   transparent (OBS lays it over the video), only the blocks of the layout
   show; gear and session name are left out in the markup, the connection dot
   only shows while the connection is not up.
   Why on <html> and from init.js: the boot screen comes before Alpine, and a
   reload in OBS must not flash a dark full screen over the stream.
   Without the class nothing here applies, so the hall display is unchanged. */

html.display-overlay,
html.display-overlay body,
html.display-overlay.booting .boot-screen,
html.display-overlay .display-full,
html.display-overlay .display-full.display-contrast {
    background: transparent;
}
html.display-overlay .boot-loading { visibility: hidden; }

html.display-overlay .display-full::before,
html.display-overlay .display-full::after {
    display: none;
}

/* "Waiting…" is a hint for the hall, not for the stream. */
html.display-overlay .display-status { display: none; }

/* Readable on any camera picture: a translucent dark panel behind every
   text block (timer, reasons, verdict, lifter and attempt; the lights stay
   free) and pure white, bolder texts. The panel grows outward with a
   box-shadow spread instead of padding, so no block changes its size and the
   lights never move (see layout.css, "Lights never move"). */
html.display-overlay .display-timer-big,
html.display-overlay .display-orb-reason,
html.display-overlay .verdict-stamp,
html.display-overlay .vportal-corner,
html.display-overlay .display-pause {
    background-color: var(--overlay-panel-bg);
    border-radius: 0.15em;
}
/* The timer's box reaches into the lights by its negative bottom margin
   (empty descender space): clip the panel there. */
html.display-overlay .display-timer-big {
    padding: 0 0.08em;
    clip-path: inset(0 0 0.15em 0 round 0.15em);
}
html.display-overlay .display-orb-reason { box-shadow: 0 0 0 0.12em var(--overlay-panel-bg); }
html.display-overlay .vportal-corner {
    box-shadow: 0 0 0 calc(clamp(6px, 1vmin, 16px) * var(--display-zoom, 1)) var(--overlay-panel-bg);
}
/* Room around the pause text; the widest line ("Next: …") would touch the
   panel's edge otherwise. In pause units (components.css), so the panel grows
   with the pause zoom and stays on screen with it. */
html.display-overlay .display-pause {
    box-shadow: 0 0 0 var(--pause-unit) var(--overlay-panel-bg);
    padding: calc(1.5 * var(--pause-unit)) calc(2 * var(--pause-unit));
}
/* The editor fades a hidden or sample block's children (display-layout.css);
   the corners carry the panel on the block itself, so fade it here too, or a
   hidden corner would look as if it still showed in the stream. */
html.display-overlay .display-layout-editing .vportal-corner:is(.layout-hidden, .layout-sample) {
    background-color: var(--overlay-panel-bg-faded);
    box-shadow: 0 0 0 calc(clamp(6px, 1vmin, 16px) * var(--display-zoom, 1)) var(--overlay-panel-bg-faded);
}
html.display-overlay .display-layout-editing .display-pause.layout-hidden {
    background-color: var(--overlay-panel-bg-faded);
    box-shadow: 0 0 0 var(--pause-unit) var(--overlay-panel-bg-faded);
}
html.display-overlay .display-timer-big:not(.expired),
html.display-overlay .display-orb-reason,
html.display-overlay .vportal-corner,
html.display-overlay .vportal-corner-name,
html.display-overlay .vportal-corner-meta,
html.display-overlay .vportal-corner-disc,
html.display-overlay .vportal-corner-weight,
html.display-overlay .display-pause-title,
html.display-overlay .display-pause-time,
html.display-overlay .display-pause-next {
    color: var(--overlay-text);
}
html.display-overlay .display-orb-reason,
html.display-overlay .vportal-corner-meta,
html.display-overlay .vportal-corner-disc {
    font-weight: 700;
}

/* While editing: a dark checkerboard, so the white texts stay visible when the
   overlay is edited in a normal browser (white page) and it is clear that this
   is not what the stream shows. */
html.display-overlay .display-full.display-layout-editing {
    background: repeating-conic-gradient(var(--overlay-checker-a) 0 25%, var(--overlay-checker-b) 0 50%) 0 0 / 32px 32px;
}

.overlay-notice {
    position: absolute;
    left: 50%;
    bottom: clamp(16px, 4vmin, 64px);
    transform: translateX(-50%);
    padding: clamp(6px, 1vmin, 14px) clamp(12px, 2vmin, 28px);
    background: var(--overlay-notice-bg);
    color: var(--overlay-notice-text);
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    font-size: clamp(14px, 2.2vmin, 36px);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* The settings panel's notes (layout from the URL, invalid layout code). */
.display-settings-note {
    margin-top: 10px;
    font-size: 12px;
    letter-spacing: .06em;
    color: var(--panel-text);
}
.display-settings-note--error { color: var(--overlay-error-text); }
html.display-overlay .display-settings-layout-btn + .display-settings-layout-btn { margin-top: 10px; }

/* ===== LIGHTS ONLY AFTER THE DECISION (#216) =====
   Classic lights (with cards and reasons) and the verdict, in the overlay
   only (screens/displayStreamLights.js sets the classes): invisible without a
   result shown in the stream, then the lights come on one after another,
   card and reason follow, the verdict last (all within 1 s). When the chosen
   duration is over they fade out; the next lift hides them at once (no fade
   of emptied lights). The parts keep their place while invisible, so nothing
   moves when they come. */
html.display-overlay .stream-lights-hide .display-orb-wrap,
html.display-overlay .stream-lights-hide .verdict-stamp {
    opacity: 0;
}
html.display-overlay .stream-lights-hide.stream-lights-fade .display-orb-wrap,
html.display-overlay .stream-lights-hide.stream-lights-fade .verdict-stamp {
    transition: opacity 0.45s ease-in;
}
/* Opacity only, no scale: the lights never move (layout.css). */
html.display-overlay .stream-lights-on .display-orb {
    animation: bvdk-fade 0.3s ease-out backwards;
}
html.display-overlay .stream-lights-on .display-orb-card,
html.display-overlay .stream-lights-on .display-orb-reason {
    animation: bvdk-fade 0.25s ease-out backwards;
}
html.display-overlay .stream-lights-on .display-orb-wrap:nth-child(2) .display-orb { animation-delay: 0.12s; }
html.display-overlay .stream-lights-on .display-orb-wrap:nth-child(3) .display-orb { animation-delay: 0.24s; }
html.display-overlay .stream-lights-on .display-orb-card,
html.display-overlay .stream-lights-on .display-orb-reason { animation-delay: 0.45s; }
html.display-overlay .stream-lights-on .verdict-stamp {
    animation: bvdk-fade 0.25s ease-out 0.6s backwards;
}
/* "Reduce motion": only a short fade, the same for all parts. */
@media (prefers-reduced-motion: reduce) {
    html.display-overlay .stream-lights-on .display-orb-wrap,
    html.display-overlay .stream-lights-on .verdict-stamp {
        animation: bvdk-fade 0.2s linear backwards;
    }
    html.display-overlay .stream-lights-on :is(.display-orb, .display-orb-card, .display-orb-reason) { animation: none; }
    html.display-overlay .stream-lights-hide.stream-lights-fade .display-orb-wrap,
    html.display-overlay .stream-lights-hide.stream-lights-fade .verdict-stamp {
        transition-duration: 0.2s;
    }
}
