/* -------------------------------------------------------------------------
   Bassar Production — video grid + in-page video lightbox.

   Everything the Elementor controls drive is a custom property on .bp-vgrid,
   so the widget's selectors only ever set variables and never fight the rules
   below. Both theme states are covered: the tokens fall back to the parent
   theme's --color-* ramp and only hardcode a value when that ramp is missing.
   ---------------------------------------------------------------------- */

.elementor-widget-bp_video_grid {
    position: relative;
    z-index: 1;
}

.bp-vgrid {
    --bp-vgrid-columns: 3;
    --bp-vgrid-column-gap: 16px;
    --bp-vgrid-row-gap: 40px;
    --bp-vgrid-ratio: 16 / 9;
    --bp-vgrid-radius: 14px;
    --bp-vgrid-thumb-bg: var(--color-contrast-lower, rgba(127, 127, 127, 0.16));
    --bp-vgrid-title-color: var(--color-contrast-higher, #101114);
    --bp-vgrid-meta-color: var(--color-contrast-medium, #7b7f88);

    display: grid;
    grid-template-columns: repeat(var(--bp-vgrid-columns), minmax(0, 1fr));
    column-gap: var(--bp-vgrid-column-gap);
    row-gap: var(--bp-vgrid-row-gap);
    margin: 0;
    /* Cards otherwise sit flush against the viewport edge; this matches the
       gutter the rest of the page keeps. */
    padding: 0 clamp(16px, 3vw, 32px);
    list-style: none;
}

/* -------------------------------------------------------------------------
   Shorts shelf.

   Vertical videos get their own row rather than being forced into the wide
   grid, where a 9:16 card would stretch every row it lands in. It carries its
   own class — not a modifier on .bp-vgrid — so the wide grid's Elementor
   selectors (columns, gap, ratio, radius) cannot reach in and flatten it.
   ---------------------------------------------------------------------- */

/* The vertical row is part of the same block of work as the wide cards, not a
   separate shelf: it carries no heading and no extra separation — just the
   grid's own row gap, so the two read as one section. */
.bp-vshelf-wrap {
    display: flex;
    flex-direction: column;
}

.bp-vgrid + .bp-vshelf-wrap {
    margin-top: var(--bp-vgrid-row-gap, 40px);
}

.bp-vshelf {
    --bp-vshelf-columns: 5;

    display: grid;
    grid-template-columns: repeat(var(--bp-vshelf-columns), minmax(0, 1fr));
    column-gap: 16px;
    row-gap: 32px;
    margin: 0;
    padding: 0 clamp(16px, 3vw, 32px);
    list-style: none;
}

/* The shelf's own card geometry: taller frame, tighter radius, no ratio
   inherited from the wide grid. */
.bp-vshelf .bp-vgrid__thumb {
    aspect-ratio: 9 / 16;
    border-radius: 12px;
}

.bp-vshelf .bp-vgrid__trigger {
    border-radius: 12px;
}

.bp-vshelf .bp-vgrid__title {
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.35;
}

.bp-vshelf .bp-vgrid__meta {
    font-size: 0.75rem;
}

.bp-vshelf .bp-vgrid__play {
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
}

@media only screen and (max-width: 767px) {
    .bp-vshelf {
        column-gap: 10px;
        row-gap: 24px;
    }
}

/* Editor-only notice when the widget has nothing to show. */
.bp-vgrid__empty {
    margin: 0;
    padding: 24px;
    border: 1px dashed var(--color-contrast-low, rgba(127, 127, 127, 0.35));
    border-radius: 12px;
    color: var(--color-contrast-medium, #7b7f88);
    text-align: center;
}

/* -------------------------------------------------------------------------
   Card
   ---------------------------------------------------------------------- */

.bp-vshelf {
    --bp-vgrid-radius: 12px;
    --bp-vgrid-thumb-bg: var(--color-contrast-lower, rgba(127, 127, 127, 0.16));
    --bp-vgrid-title-color: var(--color-contrast-higher, #101114);
    --bp-vgrid-meta-color: var(--color-contrast-medium, #7b7f88);
}

.bp-vgrid__item {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-width: 0;
}

.bp-vgrid__thumb {
    position: relative;
    aspect-ratio: var(--bp-vgrid-ratio);
    overflow: hidden;
    border-radius: var(--bp-vgrid-radius);
    background: var(--bp-vgrid-thumb-bg);
    /* No translateZ here on purpose. It was promoting every card to its own
       compositing layer — a hundred-odd of them across a page — which on
       mobile exhausts the compositor and paints cards over the sections below.
       overflow:hidden with a radius clips the zoomed poster on its own. */
}

.bp-vgrid__poster,
.bp-vgrid__preview {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bp-vgrid__poster {
    transition: transform 0.6s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.bp-vgrid__poster--empty {
    background: linear-gradient(135deg,
        var(--bp-vgrid-thumb-bg),
        rgba(var(--bp-accent-rgb, 253, 67, 2), 0.18));
}

/* The preview sits on top of the poster and is faded in once it is playing —
   the `is-playing` class is added by the script only after play() resolves, so
   a clip that fails to start never shows a black frame. */
.bp-vgrid__preview {
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}

.bp-vgrid__item.is-previewing .bp-vgrid__preview {
    opacity: 1;
}

/* Cards without a hover clip get the poster zoom instead. */
.bp-vgrid__item:not(.has-preview):hover .bp-vgrid__poster,
.bp-vgrid__item:not(.has-preview):focus-within .bp-vgrid__poster {
    transform: scale(1.06);
}

/* -------------------------------------------------------------------------
   Play chip + duration badge
   ---------------------------------------------------------------------- */

.bp-vgrid__play {
    position: absolute;
    left: 50%;
    top: 50%;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin: -28px 0 0 -28px;
    border-radius: 50%;
    background: rgba(12, 12, 14, 0.55);
    color: #fff;
    backdrop-filter: blur(6px);
    opacity: 0;
    transform: scale(0.82);
    transition: opacity 0.28s ease, transform 0.28s ease, background-color 0.28s ease;
    pointer-events: none;
}

.bp-vgrid__play svg {
    /* Optical centring — the triangle reads left-heavy when perfectly centred. */
    margin-left: 2px;
}

.bp-vgrid__item:hover .bp-vgrid__play,
.bp-vgrid__item:focus-within .bp-vgrid__play {
    opacity: 1;
    transform: scale(1);
    background: rgba(var(--bp-accent-rgb, 253, 67, 2), 0.92);
}

.bp-vgrid__badge {
    position: absolute;
    right: 8px;
    bottom: 8px;
    padding: 3px 6px;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.78);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: 0.01em;
    transition: opacity 0.25s ease;
}

.bp-vgrid__item.is-previewing .bp-vgrid__badge {
    opacity: 0;
}

/* -------------------------------------------------------------------------
   Title block
   ---------------------------------------------------------------------- */

.bp-vgrid__info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-right: 4px;
}

.bp-vgrid__title {
    margin: 0;
    color: var(--bp-vgrid-title-color);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.35;
    /* Two lines then ellipsis, so uneven titles do not shift the rows. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.22s ease;
}

.bp-vgrid__item:hover .bp-vgrid__title,
.bp-vgrid__item:focus-within .bp-vgrid__title {
    color: var(--color-primary, #fd4302);
}

.bp-vgrid__meta {
    margin: 0;
    color: var(--bp-vgrid-meta-color);
    font-size: 0.8125rem;
    line-height: 1.4;
}

/* -------------------------------------------------------------------------
   Trigger — one focusable element covering the whole card.
   ---------------------------------------------------------------------- */

.bp-vgrid__trigger {
    position: absolute;
    inset: 0;
    z-index: 2;
    padding: 0;
    border: 0;
    border-radius: var(--bp-vgrid-radius);
    background: none;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.bp-vgrid__trigger:focus {
    outline: none;
}

.bp-vgrid__trigger:focus-visible {
    outline: 2px solid var(--color-primary, #fd4302);
    outline-offset: 4px;
}

/* -------------------------------------------------------------------------
   Lightbox
   ---------------------------------------------------------------------- */

.bp-vlb {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: grid;
    place-items: center;
    padding: clamp(16px, 4vw, 56px);
    opacity: 0;
    transition: opacity 0.28s ease;
}

.bp-vlb[hidden] {
    display: none;
}

.bp-vlb.is-open {
    opacity: 1;
}

.bp-vlb__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 6, 8, 0.92);
    backdrop-filter: blur(10px);
    cursor: pointer;
}

.bp-vlb__dialog {
    position: relative;
    width: min(1280px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transform: scale(0.965);
    transition: transform 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.bp-vlb.is-open .bp-vlb__dialog {
    transform: scale(1);
}

.bp-vlb__stage {
    position: relative;
    aspect-ratio: 16 / 9;
    max-height: calc(100vh - 190px);
    overflow: hidden;
    border-radius: 12px;
    background: #000;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
}

.bp-vlb__stage iframe,
.bp-vlb__stage video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.bp-vlb__title {
    margin: 0;
    color: #fff;
    font-size: 1.0625rem;
    font-weight: 600;
    line-height: 1.4;
    text-align: center;
}

.bp-vlb__title:empty {
    display: none;
}

.bp-vlb__close {
    position: absolute;
    top: -52px;
    right: 0;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    transition: background-color 0.22s ease, transform 0.22s ease;
}

.bp-vlb__close:hover,
.bp-vlb__close:focus-visible {
    background: rgba(var(--bp-accent-rgb, 253, 67, 2), 0.95);
    transform: rotate(90deg);
}

.bp-vlb__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* On short or narrow screens the close button has no room above the stage. */
@media only screen and (max-width: 767px), (max-height: 620px) {
    .bp-vlb__close {
        top: 8px;
        right: 8px;
        background: rgba(0, 0, 0, 0.6);
        z-index: 2;
    }

    .bp-vlb__stage {
        max-height: calc(100vh - 120px);
    }
}

/* Body lock while the lightbox is open — a belt-and-braces companion to
   locoScroll.stop(), which the script calls when the theme's smooth scroll
   is running. */
body.bp-vlb-open {
    overflow: hidden;
}

/* -------------------------------------------------------------------------
   Motion / input preferences
   ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .bp-vgrid__poster,
    .bp-vgrid__preview,
    .bp-vgrid__play,
    .bp-vgrid__title,
    .bp-vlb,
    .bp-vlb__dialog,
    .bp-vlb__close {
        transition: none;
    }

    .bp-vgrid__item:not(.has-preview):hover .bp-vgrid__poster {
        transform: none;
    }
}

/* Touch: no hover state to speak of, so the play chip is always visible. */
@media (hover: none) {
    .bp-vgrid__play {
        opacity: 1;
        transform: scale(1);
    }
}

.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
