/*
 * Story 8.2 — Supplements Section
 * Story 8.2b rework — single-row carousel (fade edges, arrows, position counter).
 *
 * Scoped exclusively to .supplements-section. Every rule prefixed — zero bleed
 * onto video, series, or any other page content.
 *
 * Layout modes (set by PHP based on supplement count):
 *   .supplements-grid--static  (≤5 items): centred static row, no controls.
 *   .supplements-grid--scroll  (>5 items): horizontally scrollable row with
 *       edge fades, arrow buttons, and position counter — progressive
 *       enhancement. JS adds .is-enhanced (reveals arrows + counter) and
 *       .at-start / .at-end (adjusts edge fades and arrow disabled state).
 */

/* ── Section ─────────────────────────────────────────────────────────────── */

.supplements-section {
    background-color: #fff;
    padding-top: 45px;
    padding-bottom: 30px;
}

/* Epic 8b-r2: on single video pages, tighten the gap between the video and
 * the tagline. .video-section carries 80px bottom padding site-wide, so the
 * supplements section pulls itself up instead of altering the shared rule. */
.single-video .supplements-section {
    margin-top: -60px;
    padding-top: 0;
}

@media (max-width: 767px) {
    .single-video .supplements-section {
        margin-top: -30px;
    }
}

/* ── Header: tagline + optional CTA ─────────────────────────────────────── */

.supplements-section .supplements-header {
    text-align: center;
    margin-bottom: 25px; /* Epic 8b-r2: was 35px — tighter per design screenshot */
}

.supplements-section .supplements-tagline {
    font-size: 21px;
    line-height: 1.45;
    color: #1D1C1D;
    font-family: 'gilroy-semibolduploaded_file', 'Poppins', sans-serif;
    font-weight: 600;
    margin: 0 0 20px 0;
}

/* Bright blue accent on the "save 20%" phrase */
.supplements-section .supplements-highlight {
    color: #1A5CE6;
}

/* Story 8.3: $show_cta = false for paying members hides this element via PHP */
.supplements-section .supplements-cta {
    display: inline-block;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 10px 32px;
    border-radius: 7px;
}

/* ── Track: shared flex row ──────────────────────────────────────────────── */

.supplements-section .supplements-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    align-items: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 8px 0;
}

.supplements-section .supplements-track::-webkit-scrollbar {
    display: none;
}

/* ── Static mode (≤5 items): centred, no scroll controls ────────────────── */
/*
 * MAJOR 1 fix: margin-auto pattern instead of justify-content:center.
 * justify-content:center with overflow-x:auto clips start-side cards on
 * viewports narrower than the row (e.g. 375 px phone, 3 cards). Auto
 * margins push the group to the centre when all cards fit; when the row
 * overflows the margins collapse to 0 and horizontal scroll works correctly.
 */
.supplements-section .supplements-grid--static .supplements-track {
    justify-content: flex-start;
}

.supplements-section .supplements-grid--static .supplements-track > .supplements-card:first-child {
    margin-left: auto;
}

.supplements-section .supplements-grid--static .supplements-track > .supplements-card:last-child {
    margin-right: auto;
}

/* Epic 8b-r2: static mode renders larger product shots (matching the original
 * Story 8.2 grid scale) … */
.supplements-section .supplements-grid--static .supplements-card,
.supplements-section .supplements-grid--static .supplements-img {
    width: 200px;
}

/* … and with 2–3 cards the row spans the video's width (71% of the container,
 * same as .video-content) with the cards spread evenly — the screenshot-approved
 * layout. 4–5 cards keep the compact centred row, which stays overflow-safe. */
@media (min-width: 768px) {
    .supplements-section .supplements-grid--static[data-count="2"] .supplements-track,
    .supplements-section .supplements-grid--static[data-count="3"] .supplements-track {
        max-width: 71%;
        margin: 0 auto;
        justify-content: space-evenly;
        padding-left: 16px;
        padding-right: 16px;
    }
    .supplements-section .supplements-grid--static[data-count="2"] .supplements-track > .supplements-card:first-child,
    .supplements-section .supplements-grid--static[data-count="3"] .supplements-track > .supplements-card:first-child {
        margin-left: 0;
    }
    .supplements-section .supplements-grid--static[data-count="2"] .supplements-track > .supplements-card:last-child,
    .supplements-section .supplements-grid--static[data-count="3"] .supplements-track > .supplements-card:last-child {
        margin-right: 0;
    }
}

@media (max-width: 767px) {
    .supplements-section .supplements-grid--static .supplements-card,
    .supplements-section .supplements-grid--static .supplements-img {
        width: 140px;
    }
}

/* ── Scroll mode (>5 items): arrows + track + counter via flex-wrap ──────── */

.supplements-section .supplements-grid--scroll {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.supplements-section .supplements-grid--scroll .supplements-track {
    flex: 1;
    min-width: 0; /* critical: allows flex child to shrink below content size */
    order: 2;
    scroll-snap-type: x mandatory;
    /* Edge fades via CSS mask — both active by default until JS classifies state */
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0px,
        #000 70px,
        #000 calc(100% - 70px),
        transparent 100%
    );
    mask-image: linear-gradient(
        to right,
        transparent 0px,
        #000 70px,
        #000 calc(100% - 70px),
        transparent 100%
    );
}

/* JS adds .at-start when scrolled fully left — hide left fade */
.supplements-section .supplements-grid--scroll.at-start .supplements-track {
    -webkit-mask-image: linear-gradient(
        to right,
        #000 calc(100% - 70px),
        transparent 100%
    );
    mask-image: linear-gradient(
        to right,
        #000 calc(100% - 70px),
        transparent 100%
    );
}

/* JS adds .at-end when scrolled fully right — hide right fade */
.supplements-section .supplements-grid--scroll.at-end .supplements-track {
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0px,
        #000 70px
    );
    mask-image: linear-gradient(
        to right,
        transparent 0px,
        #000 70px
    );
}

/* Both ends simultaneously (small content that doesn't actually scroll) */
.supplements-section .supplements-grid--scroll.at-start.at-end .supplements-track {
    -webkit-mask-image: none;
    mask-image: none;
}

/* ── Cards ───────────────────────────────────────────────────────────────── */

.supplements-section .supplements-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 0 0 auto;
    width: 148px;
    scroll-snap-align: start;
    text-decoration: none;
    text-align: center;
}

.supplements-section .supplements-img {
    width: 148px;
    max-width: 100%;
    display: block;
    border-radius: 4px;
    transition: opacity 0.2s ease;
}

.supplements-section .supplements-card:hover .supplements-img {
    opacity: 0.82;
}

/* Optional title — small centred text below image; absent = no layout shift */
.supplements-section .supplements-card-title {
    font-size: 13px;
    line-height: 1.4;
    color: #5D4060;
    font-family: 'gilroy-mediumuploaded_file', 'Poppins', sans-serif;
    margin: 8px 0 0 0;
    text-align: center;
}

/* ── Arrow buttons ───────────────────────────────────────────────────────── */
/*
 * Default: display:none — progressive enhancement.
 * JS adds .is-enhanced to the grid to reveal them.
 */

.supplements-section .supplements-arrow {
    display: none;
    flex-shrink: 0;
    align-self: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid #3F0E40;
    background: #fff;
    color: #3F0E40;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease, color 0.2s ease;
    -webkit-user-select: none;
    user-select: none;
}

.supplements-section .supplements-grid--scroll.is-enhanced .supplements-arrow {
    display: flex;
}

.supplements-section .supplements-arrow:hover {
    background: #FFFAF5;
}

.supplements-section .supplements-arrow--prev {
    order: 1;
    margin-right: 12px;
}

.supplements-section .supplements-arrow--next {
    order: 3;
    margin-left: 12px;
}

/* Disabled state — dimmed, non-interactive */
.supplements-section .supplements-arrow[aria-disabled="true"] {
    opacity: 0.35;
    cursor: default;
    pointer-events: none;
}

/* ── Position counter ────────────────────────────────────────────────────── */
/*
 * Default: display:none — progressive enhancement.
 * JS adds .is-enhanced to the grid to reveal it.
 */

.supplements-section .supplements-counter {
    display: none;
    order: 4;
    flex-basis: 100%; /* wraps to its own line in the flex-wrap grid */
    margin: 14px 0 0 0;
    text-align: center;
    font-size: 15px;
    line-height: 1;
}

.supplements-section .supplements-grid--scroll.is-enhanced .supplements-counter {
    display: block;
}

.supplements-section .supplements-counter-current {
    font-family: 'gilroy-bolduploaded_file', 'Poppins', sans-serif;
    font-weight: 700;
    color: #3F0E40;
}

.supplements-section .supplements-counter-sep,
.supplements-section .supplements-counter-total {
    font-family: 'gilroy-mediumuploaded_file', 'Poppins', sans-serif;
    color: #5D4060;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 767px) {
    .supplements-section .supplements-tagline {
        font-size: 18px;
    }

    .supplements-section .supplements-card {
        width: 120px;
    }

    .supplements-section .supplements-img {
        width: 120px;
    }

    /* Narrower fades on mobile */
    .supplements-section .supplements-grid--scroll .supplements-track {
        -webkit-mask-image: linear-gradient(
            to right,
            transparent 0px,
            #000 48px,
            #000 calc(100% - 48px),
            transparent 100%
        );
        mask-image: linear-gradient(
            to right,
            transparent 0px,
            #000 48px,
            #000 calc(100% - 48px),
            transparent 100%
        );
    }

    .supplements-section .supplements-grid--scroll.at-start .supplements-track {
        -webkit-mask-image: linear-gradient(
            to right,
            #000 calc(100% - 48px),
            transparent 100%
        );
        mask-image: linear-gradient(
            to right,
            #000 calc(100% - 48px),
            transparent 100%
        );
    }

    .supplements-section .supplements-grid--scroll.at-end .supplements-track {
        -webkit-mask-image: linear-gradient(
            to right,
            transparent 0px,
            #000 48px
        );
        mask-image: linear-gradient(
            to right,
            transparent 0px,
            #000 48px
        );
    }

    .supplements-section .supplements-arrow {
        width: 30px;
        height: 30px;
        font-size: 20px;
    }

    .supplements-section .supplements-arrow--prev {
        margin-right: 8px;
    }

    .supplements-section .supplements-arrow--next {
        margin-left: 8px;
    }
}

@media (max-width: 480px) {
    .supplements-section .supplements-tagline {
        font-size: 16px;
    }
}

/* ══════════════════════════════════════════════════════════════════════════
 * Epic 8b — "Related Content You Will Enjoy" carousel (single video pages)
 *
 * Scoped exclusively to .related-content-section. Continuous leftward
 * auto-scroll (JS, supplements.js) with edge fades on both sides via CSS
 * mask. Locked cards carry a dimmed overlay + lock icon and route to signup.
 * Without JS the track is still a normal touch/trackpad scroll row.
 * ══════════════════════════════════════════════════════════════════════════ */

.related-content-section {
    background-color: #fff;
    padding-top: 10px;
    padding-bottom: 30px;
}

.related-content-section .related-carousel {
    position: relative;
}

.related-content-section .related-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 20px;
    align-items: flex-start;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 8px 0;
    /* Edge fades on both sides — the marquee loops, so both stay on */
    -webkit-mask-image: linear-gradient(
        to right,
        transparent 0px,
        #000 70px,
        #000 calc(100% - 70px),
        transparent 100%
    );
    mask-image: linear-gradient(
        to right,
        transparent 0px,
        #000 70px,
        #000 calc(100% - 70px),
        transparent 100%
    );
}

.related-content-section .related-track::-webkit-scrollbar {
    display: none;
}

.related-content-section .related-card {
    flex: 0 0 auto;
    width: 260px;
    text-decoration: none;
    display: block;
}

.related-content-section .related-card-media {
    position: relative;
    display: block;
    border-radius: 10px;
    overflow: hidden;
}

.related-content-section .related-card-media img {
    display: block;
    width: 100%;
    height: 150px;
    object-fit: cover;
}

/* Epic 8b-r2: unlocked cards show a centred play badge (titles removed) */
.related-content-section .related-card-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: url("../img/play-btn.png") no-repeat center / contain;
    z-index: 1;
    pointer-events: none;
}

/* Locked card: dim the thumbnail and centre the lock badge over it */
.related-content-section .related-card--locked .related-card-media:after {
    content: "";
    position: absolute;
    inset: 0;
    background: rgba(29, 28, 29, 0.55);
}

.related-content-section .related-card--locked .related-card-lock {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 44px;
    height: 44px;
    background: url("../img/lock-icon.png") no-repeat center / contain;
    z-index: 1;
}

@media (max-width: 767px) {
    .related-content-section .related-card {
        width: 200px;
    }
    .related-content-section .related-card-media img {
        height: 116px;
    }
    .related-content-section .related-track {
        -webkit-mask-image: linear-gradient(
            to right,
            transparent 0px,
            #000 48px,
            #000 calc(100% - 48px),
            transparent 100%
        );
        mask-image: linear-gradient(
            to right,
            transparent 0px,
            #000 48px,
            #000 calc(100% - 48px),
            transparent 100%
        );
    }
}

/* ══════════════════════════════════════════════════════════════════════════
 * Epic 8b-r10 — teaser countdown banner (between video title and player).
 * Shown only to viewers who don't own the content while a teaser window is
 * open. Sits inside the video's width; kept tight so the existing gap
 * between title and player absorbs it.
 * ══════════════════════════════════════════════════════════════════════════ */

/* 2026-09-09 redesign: gold block, purple copy, red days-only countdown. */
.video-section .teaser-banner {
    max-width: 65%;
    /* 2026-09-09: single-video h2 margin is zeroed below and every follower
       carries its own 20px top margin, so no negative compensation needed. */
    margin: 20px auto 0;
    text-align: center;
    background: #F1EBD9;
    border-radius: 12px;
    padding: 16px 24px;
}

.video-section .teaser-banner-line {
    font-size: 17px;
    line-height: 1.6;
    color: #3F0E40;
    font-weight: 500;
    margin: 0;
}

.video-section .teaser-banner-line strong {
    color: #3F0E40;
    font-weight: 700;
}

.video-section .teaser-banner .teaser-countdown {
    color: #E5251A;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 767px) {
    .video-section .teaser-banner {
        max-width: 100%;
    }
    .video-section .teaser-banner-line {
        font-size: 15px;
    }
}

/* 2026-09-09: single video page vertical rhythm — 20px between the title and
   whatever follows (teaser banner, transcript/MP3 buttons, or the player).
   The h2's global 75px margin is zeroed here; each follower brings its own
   20px top margin, and adjacent block margins collapse to keep gaps at 20px.
   Scoped to .single-video so series/archive pages keep their spacing. */
.single-video .video-title h2 {
    margin-bottom: 0;
}
.single-video .video-title .btn-wapper {
    margin-top: 20px;
}
.single-video .video-content {
    margin-top: 20px;
}

/* ── "20% OFF" badge on every supplement card (Option A, 2026-09-10) ─────── */

.supplements-section .supplements-card {
    position: relative;
}

.supplements-section .supplements-card::before {
    content: '20% OFF';
    position: absolute;
    top: -10px;
    left: -10px;
    z-index: 2;
    background: #E8D7AC;
    color: #3F0E40;
    font-family: 'gilroy-bolduploaded_file', 'Poppins', sans-serif;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.04em;
    padding: 4px 12px;
    border-radius: 5px;
    box-shadow: 0 5px 14px rgba(63, 14, 64, 0.45);
    white-space: nowrap;
}

/* The static track is still a scroll container (overflow:auto) — let the
   overhanging badge escape, and pad the grid so it clears the CTA above. */
.supplements-section .supplements-grid--static .supplements-track {
    overflow: visible;
}
.supplements-section .supplements-grid--static {
    padding-top: 18px;
    padding-bottom: 6px;
}

/* Scroll mode (6+ items) keeps its clipping (fade mask + arrows), so the
   badge tucks just inside the image corner instead of overhanging. */
.supplements-section .supplements-grid--scroll .supplements-card::before {
    top: 6px;
    left: 6px;
}
