/**
 * Influencer (UGC) video carousel — "Real Growers, Real Results".
 *
 * Edge-to-edge marquee of vertical creator clips. The scroll is a pure CSS
 * animation over two identical tracks; influencer-videos.js only adds lazy
 * loading, in-view playback and the full-screen player.
 */

:root {
    --bs-ugc-bg: #163317;
    /* Matches the theme's .container side gutter. */
    --bs-ugc-gutter: 15px;
    --bs-ugc-gap: 20px;
}

.bs-ugc {
    /* Full bleed without risking horizontal scroll: --bs-vw is the viewport
       width *minus* the scrollbar, set by the JS (100vw includes it). The 100%
       fallback simply leaves the block in flow if the JS never runs. */
    position: relative;
    z-index: 1;
    box-sizing: border-box;
    flex: 0 0 auto;
    width: var(--bs-vw, 100%);
    max-width: var(--bs-vw, 100%);
    margin-left: calc(50% - (var(--bs-vw, 100%) / 2));
    margin-right: calc(50% - (var(--bs-vw, 100%) / 2));
    /* Same vertical rhythm as .bs-product-faq-accordion, which like the other
       full-width product sections keeps its padding at every breakpoint. */
    padding: 4rem 0 5rem;
    overflow: hidden;
    background: var(--bs-ugc-bg);
    color: #fff;
}

.bs-ugc__head {
    /* 36px is the theme's heading-to-content gap (faq h2, logo carousel band). */
    padding: 0 var(--bs-ugc-gutter) 36px;
    text-align: center;
}

.single-product .woocommerce-tabs .panel .bs-ugc__title,
.bs-ugc .bs-ugc__title {
    /* 2.5rem/1.2 matches the strain, experience and faq section headings. */
    margin: 0 0 0.7rem;
    color: #fff;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.bs-ugc .bs-ugc__subtitle {
    /* Mirrors the comparison section's secondary heading: 18px, 1.4, secondary. */
    margin: 0;
    color: var(--rbb-general-secondary-color, #f3bd66);
    font-size: 1.125rem;
    font-weight: 500;
    letter-spacing: 0.5px;
    line-height: 1.4;
}

/* Marquee ------------------------------------------------------------------ */

.bs-ugc__marquee {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Fade the clips out at both edges so tiles enter and leave softly. */
.bs-ugc__marquee::before,
.bs-ugc__marquee::after {
    content: "";
    position: absolute;
    top: 0;
    z-index: 2;
    width: 8vw;
    max-width: 120px;
    height: 100%;
    pointer-events: none;
}

.bs-ugc__marquee::before {
    left: 0;
    background: linear-gradient(90deg, var(--bs-ugc-bg) 0%, rgba(22, 51, 23, 0) 100%);
}

.bs-ugc__marquee::after {
    right: 0;
    background: linear-gradient(270deg, var(--bs-ugc-bg) 0%, rgba(22, 51, 23, 0) 100%);
}

.bs-ugc__viewport {
    display: flex;
    width: max-content;
    will-change: transform;
    animation: bs-ugc-scroll var(--bs-ugc-duration, 60s) linear infinite;
}

/* Paused while the section is off screen so it costs nothing when unseen. */
.bs-ugc.is-idle .bs-ugc__viewport,
.bs-ugc.is-frozen .bs-ugc__viewport,
.bs-ugc--pause-on-hover:hover .bs-ugc__viewport,
.bs-ugc--pause-on-hover:focus-within .bs-ugc__viewport {
    animation-play-state: paused;
}

@keyframes bs-ugc-scroll {
    from { transform: translate3d(0, 0, 0); }
    to   { transform: translate3d(-50%, 0, 0); }
}

.bs-ugc__track {
    display: flex;
    flex-shrink: 0;
    gap: var(--bs-ugc-gap);
    margin: 0;
    padding: 0 0 0 var(--bs-ugc-gap);
    list-style: none;
}

.bs-ugc__item {
    flex: 0 0 auto;
    margin: 0;
    padding: 0;
    list-style: none;
}

/* Tile -------------------------------------------------------------------- */

.bs-ugc__card {
    position: relative;
    display: block;
    /* 9:16 vertical clips. */
    width: calc(var(--bs-ugc-card-height, 460px) * 0.5625);
    height: var(--bs-ugc-card-height, 460px);
    margin: 0;
    padding: 0;
    overflow: hidden;
    background: #0d1f0e;
    border: 0;
    border-radius: 18px;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.bs-ugc__card:hover,
.bs-ugc__card:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}

.bs-ugc__card:focus-visible {
    outline: 2px solid var(--rbb-general-secondary-color, #f3bd66);
    outline-offset: 3px;
}

.bs-ugc__video {
    display: block;
    width: 100%;
    height: 100%;
    margin: 0;
    object-fit: cover;
    background: #0d1f0e;
    pointer-events: none;
}

.bs-ugc__scrim {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 45%;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.65) 100%);
    pointer-events: none;
}

.bs-ugc__play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    color: #163317;
    background: rgba(255, 255, 255, 0.92);
    border-radius: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.bs-ugc__play svg {
    width: 26px;
    height: 26px;
    margin-left: 2px;
}

.bs-ugc__card:hover .bs-ugc__play,
.bs-ugc__card:focus-visible .bs-ugc__play {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.bs-ugc__handle {
    position: absolute;
    right: 12px;
    bottom: 12px;
    left: 12px;
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
    text-align: left;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    pointer-events: none;
}

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

/* Full-screen player ------------------------------------------------------ */

.bs-ugc-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(6, 16, 7, 0.92);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.bs-ugc-modal[hidden] {
    display: none;
}

.bs-ugc-modal.is-open {
    opacity: 1;
}

.bs-ugc-modal__dialog {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: min(100%, calc((100vh - 130px) * 0.5625));
    max-width: 420px;
}

.bs-ugc-modal__video {
    display: block;
    width: 100%;
    max-height: calc(100vh - 130px);
    aspect-ratio: 9 / 16;
    background: #000;
    border-radius: 16px;
    object-fit: contain;
}

.bs-ugc-modal__meta {
    display: flex;
    align-items: center;
    gap: 16px;
    color: #fff;
    font-size: 0.95rem;
}

.bs-ugc-modal__handle {
    font-weight: 600;
}

.bs-ugc-modal .bs-ugc-modal__link,
.bs-ugc-modal .bs-ugc-modal__link:hover {
    color: var(--rbb-general-secondary-color, #f3bd66);
    text-decoration: underline;
}

/* Pinned to the viewport, not the dialog: the dialog is nearly as tall as the
   screen, so a button above it would be squeezed against the top edge. */
.bs-ugc-modal__close {
    position: fixed;
    top: 16px;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    color: #fff;
    background: rgba(255, 255, 255, 0.14);
    border: 0;
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.bs-ugc-modal__close:hover,
.bs-ugc-modal__close:focus-visible {
    background: rgba(255, 255, 255, 0.28);
}

body.bs-ugc-modal-open {
    overflow: hidden;
}

/* Product pages ----------------------------------------------------------- */

/* The comparison block below starts on white, so no gap is needed between them. */
.bs-ugc--product {
    margin-bottom: 0;
}

/* Responsive -------------------------------------------------------------- */

/* Tablet: the theme holds section headings at 2.5rem down to 768px, so only the
   tiles shrink here. 1023px avoids overlapping the theme's min-width:1024px. */
@media (max-width: 1023px) {
    .bs-ugc__card {
        width: calc(min(var(--bs-ugc-card-height, 460px), 400px) * 0.5625);
        height: min(var(--bs-ugc-card-height, 460px), 400px);
    }
}

/* Mobile: 767px is the theme's breakpoint. Type drops to the same 30px/14px
   pairing the comparison section uses below this block. */
@media (max-width: 767px) {
    :root {
        --bs-ugc-gap: var(--bs-ugc-gutter);
    }

    .single-product .woocommerce-tabs .panel .bs-ugc__title,
    .bs-ugc .bs-ugc__title {
        font-size: 30px;
        line-height: 1.1;
    }

    .bs-ugc .bs-ugc__subtitle {
        font-size: 14px;
    }

    .bs-ugc__card {
        width: calc(min(var(--bs-ugc-card-height, 460px), 330px) * 0.5625);
        height: min(var(--bs-ugc-card-height, 460px), 330px);
        border-radius: 14px;
    }

    .bs-ugc__marquee::before,
    .bs-ugc__marquee::after {
        width: 6vw;
        max-width: 40px;
    }
}

/* On touch screens there is no hover, so the play affordance stays visible. */
@media (hover: none) {
    .bs-ugc__play {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
        width: 46px;
        height: 46px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .bs-ugc__viewport {
        animation: none;
    }

    /* Without the animation the tiles must be reachable by hand. */
    .bs-ugc__marquee {
        overflow-x: auto;
        scrollbar-width: thin;
    }

    /* The fades are absolute children of what is now a scroll container, so
       they would drift with the content. */
    .bs-ugc__marquee::before,
    .bs-ugc__marquee::after {
        display: none;
    }

    .bs-ugc__card {
        transition: none;
    }

    .bs-ugc__card:hover,
    .bs-ugc__card:focus-visible {
        transform: none;
    }
}
