/**
 * K4 Video Carousel – Styles
 *
 * Self-contained CSS for the YouTube video carousel.
 * All classes prefixed with k4vc- to avoid conflicts.
 *
 * Mobile-first: base styles target small screens (one video per view,
 * swipe to scroll); min-width media queries scale up to a multi-card
 * row with arrow navigation on larger screens.
 *
 * @package  k4-video-carousel
 * @author   Steve Austen
 * @company  The PCGP
 * @version  1.0.1
 */

/* ═══════════════════════════════════════════
   Section wrapper – dark background to match
   the differentiators / reviews sections.
   ═══════════════════════════════════════════ */
.k4vc-section {
    background: #1a1a1a;
    padding: 56px 0;
    /* Local custom properties keep the brand colour in one place */
    --k4vc-gold: #f3af2e;
}

.k4vc-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ── Header ── */
.k4vc-header {
    text-align: center;
    margin-bottom: 34px;
}

.k4vc-heading {
    font-family: "Poppins", sans-serif;
    font-size: 26px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 12px;
    position: relative;
    padding-bottom: 16px;
}

/* Gold underline rule beneath the heading */
.k4vc-heading::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 52px;
    height: 3px;
    border-radius: 2px;
    background: var(--k4vc-gold);
}

.k4vc-intro {
    font-family: "Poppins", sans-serif;
    font-size: 15px;
    line-height: 1.6;
    color: #bdbdbd;
    margin: 0 auto;
    max-width: 640px;
}

/* ═══════════════════════════════════════════
   Carousel
   Base (mobile): native horizontal scroll with
   snap. One video fills most of the width, with
   a sliver of the next peeking to hint swipe.
   ═══════════════════════════════════════════ */
.k4vc-carousel-wrap {
    position: relative;
}

.k4vc-carousel {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch; /* momentum scroll on iOS */
    scrollbar-width: none;             /* hide scrollbar (Firefox)  */
    -ms-overflow-style: none;          /* hide scrollbar (IE/Edge)  */
    /* Breathing room so card shadows/focus rings aren't clipped */
    padding-bottom: 6px;
    scroll-padding-left: 0;
    /* Centre the cards when there are too few to fill the row. The "safe"
       keyword falls back to start-alignment once the cards overflow, which
       avoids the known bug where centred overflow becomes unreachable by
       scrolling. So: few videos centre, many videos left-align and scroll. */
    justify-content: safe center;
}

.k4vc-carousel::-webkit-scrollbar {
    display: none; /* hide scrollbar (Chrome/Safari) */
}

/* ── Card ── */
.k4vc-card {
    flex: 0 0 86%;          /* one card per view, slight peek of the next */
    scroll-snap-align: start;
}

/* The whole card is a button so it's keyboard-operable */
.k4vc-card-btn {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font-family: "Poppins", sans-serif;
    -webkit-appearance: none;
    appearance: none;
}

/* ── Thumbnail ── */
.k4vc-thumb {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4);
}

.k4vc-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease, opacity 0.3s ease;
}

/* Subtle darkening overlay so the play button always reads clearly */
.k4vc-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.35));
    transition: background 0.3s ease;
}

/* ── Play button overlay ── */
.k4vc-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 64px;
    height: 45px;
    z-index: 2;
    transition: transform 0.25s ease;
}

.k4vc-play svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Red YouTube-style chrome by default; turns gold on interaction */
.k4vc-play-bg {
    fill: #212121;
    fill-opacity: 0.85;
    transition: fill 0.25s ease, fill-opacity 0.25s ease;
}

.k4vc-play-arrow {
    fill: #fff;
}

/* ── Card title ── */
.k4vc-card-title {
    display: block;
    margin-top: 14px;
    font-size: 15px;
    font-weight: 600;
    line-height: 1.4;
    color: #ececec;
}

/* ═══════════════════════════════════════════
   Hover / focus states (pointer devices)
   ═══════════════════════════════════════════ */
.k4vc-card-btn:hover .k4vc-thumb img,
.k4vc-card-btn:focus-visible .k4vc-thumb img {
    transform: scale(1.05);
}

.k4vc-card-btn:hover .k4vc-thumb::after,
.k4vc-card-btn:focus-visible .k4vc-thumb::after {
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.05), rgba(0, 0, 0, 0.2));
}

.k4vc-card-btn:hover .k4vc-play,
.k4vc-card-btn:focus-visible .k4vc-play {
    transform: translate(-50%, -50%) scale(1.08);
}

.k4vc-card-btn:hover .k4vc-play-bg,
.k4vc-card-btn:focus-visible .k4vc-play-bg {
    fill: var(--k4vc-gold);
    fill-opacity: 1;
}

.k4vc-card-btn:hover .k4vc-play-arrow,
.k4vc-card-btn:focus-visible .k4vc-play-arrow {
    fill: #231f20;
}

.k4vc-card-btn:hover .k4vc-card-title,
.k4vc-card-btn:focus-visible .k4vc-card-title {
    color: #fff;
}

/* Clear keyboard focus indicator on the thumbnail */
.k4vc-card-btn:focus-visible .k4vc-thumb {
    outline: 3px solid var(--k4vc-gold);
    outline-offset: 3px;
}

.k4vc-card-btn:focus-visible {
    outline: none;
}

/* ═══════════════════════════════════════════
   Navigation arrows – hidden on mobile (swipe),
   shown from the tablet breakpoint upward.
   ═══════════════════════════════════════════ */
.k4vc-nav {
    display: none;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease, color 0.25s ease, opacity 0.25s ease;
}

.k4vc-nav span {
    /* Optical centring of the chevron glyph */
    margin-top: -4px;
}

.k4vc-nav:hover {
    background: var(--k4vc-gold);
    color: #231f20;
}

/* Disabled state when the track can't scroll further in that direction */
.k4vc-nav[disabled] {
    opacity: 0;
    pointer-events: none;
}

/* ═══════════════════════════════════════════
   Modal – dark, full-screen overlay with a
   16:9 responsive iframe.
   ═══════════════════════════════════════════ */
.k4vc-modal {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

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

.k4vc-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    /* Fade handled via the body open class below */
    opacity: 0;
    transition: opacity 0.25s ease;
}

.k4vc-modal-panel {
    position: relative;
    width: 100%;
    max-width: 960px;
    /* Slide + fade in */
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Active state toggled by JS once the element is shown */
.k4vc-modal.is-open .k4vc-modal-backdrop {
    opacity: 1;
}

.k4vc-modal.is-open .k4vc-modal-panel {
    opacity: 1;
    transform: translateY(0);
}

/* 16:9 responsive video frame */
.k4vc-modal-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7);
}

.k4vc-modal-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.k4vc-modal-title {
    margin: 16px 0 0;
    text-align: center;
    font-family: "Poppins", sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #fff;
}

/* Close button – top-right, outside the frame on larger screens */
.k4vc-modal-close {
    position: absolute;
    top: -46px;
    right: 0;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background 0.25s ease, color 0.25s ease;
}

.k4vc-modal-close:hover,
.k4vc-modal-close:focus-visible {
    background: var(--k4vc-gold, #f3af2e);
    color: #231f20;
    outline: none;
}

/* Prevent background scroll while the modal is open */
body.k4vc-modal-open {
    overflow: hidden;
}

/* ═══════════════════════════════════════════
   Tablet and up (≥768px) – multi-card row,
   arrows visible, no peek needed.
   ═══════════════════════════════════════════ */
@media (min-width: 768px) {
    .k4vc-section {
        padding: 70px 0;
    }

    .k4vc-heading {
        font-size: 32px;
    }

    /* Make room for the arrows either side of the track */
    .k4vc-carousel-wrap {
        padding: 0 8px;
    }

    /* Two cards per view on tablet */
    .k4vc-card {
        flex-basis: calc((100% - 16px) / 2);
    }

    .k4vc-nav {
        display: flex;
    }

    .k4vc-prev {
        left: -10px;
    }

    .k4vc-next {
        right: -10px;
    }

    /* Close button moves inside the corner of the panel on big screens */
    .k4vc-modal-close {
        top: -48px;
    }
}

/* ═══════════════════════════════════════════
   Desktop (≥1100px) – three cards per view.
   ═══════════════════════════════════════════ */
@media (min-width: 1100px) {
    .k4vc-card {
        flex-basis: calc((100% - 32px) / 3);
    }
}

/* ═══════════════════════════════════════════
   Reduced motion – disable transform/opacity
   animation for users who prefer less motion.
   ═══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .k4vc-thumb img,
    .k4vc-play,
    .k4vc-modal-backdrop,
    .k4vc-modal-panel,
    .k4vc-carousel {
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
