/* ===== STREAM OVERLAY: BVDK VIEW OF THE LIGHTS (#215) =====
   The overlay's default lights view (screens/displayBvdk.js): a box in the
   look of the BVDK broadcast graphics — head "REFEREES" with the discipline,
   three square lights, one row per invalid vote (judge marker, card colour,
   reason) — in the narrow Barlow Condensed (fonts.css). It sits in the
   layout's "Lights" block instead of the round orbs (.display-lights--bvdk),
   so it is moved, scaled and hidden like them. Only the overlay sets that
   class, so the hall display is unchanged.

   Sizes are in --bvdk-u (1vmin, scaled by the block's zoom). The box is
   wide enough for the longest reasons in two lines (German "Hantelkontakt
   mit Hantelständern", "Arme nicht gestreckt bei Abschluss"); a reason never
   gets cut off, it would take a third line. */

.display-lights--bvdk {
    --bvdk-u: calc(clamp(4px, 1vmin, 22px) * var(--display-zoom, 1));
    display: block;
}
.display-lights--bvdk > .display-orb-wrap { display: none; }

/* Default flow layout (no saved layout): bottom right, above the BVDK lifter
   bar, outside the flow of timer and verdict. Also while editing, so the
   editor measures it there (layoutFromRects) and nothing jumps. */
.display-full:not(.display-layout-custom) .display-lights.display-lights--bvdk {
    position: absolute;
    right: var(--bvdk-default-right);
    bottom: var(--bvdk-default-bottom);
}

/* Slot of the box's largest size (three rows of two lines); the box sits at
   its bottom, so with fewer rows it grows upwards from a fixed bottom edge —
   the edge that sits on top of the broadcast graphics. The block (and its
   frame in the editor) is the slot. */
.bvdk-slot {
    width: calc(36 * var(--bvdk-u));
    height: calc(34 * var(--bvdk-u));
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.bvdk-box {
    font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif;
    font-weight: 700;
    color: var(--bvdk-text);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    filter: drop-shadow(0 calc(0.4 * var(--bvdk-u)) calc(1.2 * var(--bvdk-u)) var(--bvdk-shadow));
}

.bvdk-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--bvdk-u);
    padding: calc(1.1 * var(--bvdk-u)) calc(1.3 * var(--bvdk-u)) var(--bvdk-u);
    background: linear-gradient(90deg, var(--bvdk-blue) 0%, var(--bvdk-blue) 35%, var(--bvdk-red) 100%);
    line-height: 1;
    animation: bvdk-wipe-x 0.42s cubic-bezier(.16, .84, .24, 1) both;
}
.bvdk-head-title { font-size: calc(2.6 * var(--bvdk-u)); }
.bvdk-head-discipline { font-size: calc(1.7 * var(--bvdk-u)); }

.bvdk-body {
    display: grid;
    gap: calc(0.65 * var(--bvdk-u));
    padding: calc(0.9 * var(--bvdk-u));
    background: var(--bvdk-body-bg);
    animation: bvdk-wipe-y 0.38s cubic-bezier(.16, .84, .24, 1) 0.16s both;
}

.bvdk-lights {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: calc(0.8 * var(--bvdk-u));
}
.bvdk-light {
    height: calc(4.2 * var(--bvdk-u));
    border: calc(0.3 * var(--bvdk-u)) solid var(--bvdk-line);
    background: var(--bvdk-light-white);
    animation: bvdk-pop 0.32s cubic-bezier(.16, .84, .24, 1) both;
    animation-delay: calc(0.3s + var(--i, 0) * 0.07s);
}
.bvdk-light.red { background: var(--bvdk-light-red); }

.bvdk-row {
    display: flex;
    align-items: center;
    gap: calc(0.8 * var(--bvdk-u));
    padding: calc(0.8 * var(--bvdk-u)) calc(0.9 * var(--bvdk-u));
    background: var(--bvdk-row-bg);
    border: calc(0.15 * var(--bvdk-u)) solid var(--bvdk-row-line);
    font-size: calc(2.1 * var(--bvdk-u));
    line-height: 1.15;
    animation: bvdk-slide-in 0.36s cubic-bezier(.16, .84, .24, 1) both;
    animation-delay: calc(0.46s + var(--i, 0) * 0.08s);
}
/* Which judge: three small squares, the judge's one lit (left, centre, right). */
.bvdk-pos { display: flex; gap: calc(0.3 * var(--bvdk-u)); flex: none; }
.bvdk-pos i { display: block; width: calc(0.9 * var(--bvdk-u)); height: calc(0.9 * var(--bvdk-u)); background: var(--bvdk-marker-off); }
.bvdk-pos i.on { background: var(--bvdk-line); }
.bvdk-card {
    flex: none;
    width: calc(1.3 * var(--bvdk-u));
    height: calc(1.85 * var(--bvdk-u));
    border-radius: calc(0.15 * var(--bvdk-u));
    box-shadow: 0 0 0 calc(0.18 * var(--bvdk-u)) var(--bvdk-line);
}
.bvdk-card.red { background: var(--vote-red); }
.bvdk-card.blue { background: var(--vote-blue); }
.bvdk-card.yellow { background: var(--vote-yellow); }
/* Breaks only between words or at a soft hyphen of the locales. */
.bvdk-reason { min-width: 0; overflow-wrap: break-word; hyphens: manual; }

/* Next lift, or the overlay's duration is over (#216): the box fades out
   with the result it showed (bvdkView() in displayBvdk.js); Alpine's
   x-transition keeps it on screen for the fade, the same 0.45 s as the
   Classic lights (display-overlay.css).
   Why the wait is fine: it only delays the look of a result that is gone
   already; the next result shows the box again at once. */
.bvdk-leave { transition: opacity 0.45s ease-in; }
.bvdk-leave-start { opacity: 1; }
.bvdk-leave-end { opacity: 0; }
/* The editor's sample goes at once when the editor closes: outside the
   editor it would not be faded and look like a real decision. Invisible
   from the leave's first frame (Alpine adds .bvdk-leave at once); an
   animation cannot override visibility. */
.bvdk-box.layout-sample.bvdk-leave { visibility: hidden; transition: none; }

/* "Reduce motion": only a short fade, no wipes or staggered parts. */
@media (prefers-reduced-motion: reduce) {
    /* backwards, not both: a fill after the fade-in would pin opacity at 1
       and block the fade-out. */
    .bvdk-box { animation: bvdk-fade 0.2s linear backwards; }
    .bvdk-head, .bvdk-body, .bvdk-light, .bvdk-row { animation: none; }
    .bvdk-leave { transition-duration: 0.2s; }
}

/* Hidden "Lights" block: no box outside the editor, faded inside it. */
.display-layout-custom:not(.display-layout-editing) .layout-hidden-lights .bvdk-box { display: none; }
.display-layout-editing .layout-hidden-lights .bvdk-box { opacity: 0.3; }
