/* =========================================================
   CandleCraft - Browse Classes Infinite Focus-Center Carousel
   Used by home.php, classes.php, book.php via courses_carousel element.
   ========================================================= */

.cc-carousel {
    position: relative;
    width: 100vw;
    max-width: 100vw;
    /* Break out of constrained parent containers (e.g. max-w-7xl) */
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    overflow: visible;
}

/* Soft mask so peeking cards fade into the page edges */
.cc-carousel__mask {
    width: 100%;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
            mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
}

.cc-carousel__track {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    overflow-x: scroll;
    overflow-y: visible;
    /* Native snap + smooth scroll = the smoothest possible motion. */
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    /* Mobile: hand off to the platform's native momentum/touch physics. */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
    /* Slightly tighter side padding so the cards feel like distinct objects */
    padding: 1.5rem clamp(1.5rem, 10vw, 8rem);
    scroll-padding-inline: clamp(1.5rem, 10vw, 8rem);
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.cc-carousel__track::-webkit-scrollbar { display: none; }

/* Möbius warp: forcibly suppress smooth-scroll & snap animation
   for the single frame in which the JS rewrites scrollLeft. */
.cc-carousel__track--no-smooth {
    scroll-behavior: auto !important;
    scroll-snap-type: none !important;
}

.cc-carousel__card {
    flex: 0 0 min(58vw, 700px);
    scroll-snap-align: center;
    /* `normal` (not `always`) lets a fling glide past multiple cards organically */
    scroll-snap-stop: normal;
    /* Inactive: recede behind the active card */
    opacity: 0.55;
    transform: scale(0.85);
    z-index: 10;
    transition:
        opacity 650ms cubic-bezier(0.22, 1, 0.36, 1),
        transform 650ms cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 650ms ease;
    will-change: opacity, transform;
}

.cc-carousel__card.is-active {
    opacity: 1;
    transform: scale(1);
    z-index: 20;
}

/* Split-pane tile (image left, cream content right) */
.cc-carousel__inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: #FDFCFB;
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 8px 24px -12px rgba(40, 25, 18, 0.10);
    border: 1px solid rgba(214, 194, 187, 0.25);
    transition: box-shadow 650ms ease;
}

.cc-carousel__card.is-active .cc-carousel__inner {
    /* Active: soft ambient shadow lifts the card forward */
    box-shadow:
        0 30px 70px -25px rgba(99, 55, 37, 0.28),
        0 12px 28px -14px rgba(40, 25, 18, 0.18);
}

@media (min-width: 768px) {
    .cc-carousel__inner {
        flex-direction: row;
        min-height: 420px;
    }
}

.cc-carousel__image {
    position: relative;
    width: 100%;
    /* 4:5 portrait ratio for an artisanal gallery feel */
    aspect-ratio: 4 / 5;
    overflow: hidden;
    background: #f1ede7;
}

@media (min-width: 768px) {
    .cc-carousel__image {
        width: 48%;
        aspect-ratio: auto;
        height: auto;
    }
}

.cc-carousel__image img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1000ms cubic-bezier(0.22, 1, 0.36, 1);
}

.cc-carousel__card.is-active .cc-carousel__image img {
    transform: scale(1.04);
}

.cc-carousel__image-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: #88726c;
    opacity: 0.6;
}

.cc-carousel__content {
    width: 100%;
    padding: 3rem 2.25rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: #FDFCFB;
    position: relative;
}

@media (min-width: 768px) {
    .cc-carousel__content { width: 52%; padding: 2.5rem 2.5rem; }
}

/* Top-right gold tick (kept subtle) */
.cc-carousel__divider-top {
    position: absolute;
    top: 3.5rem;
    right: 3.75rem;
    width: 2.25rem;
    height: 1px;
    background: #dfc391;
    display: none;
}
@media (min-width: 768px) {
    .cc-carousel__divider-top { display: block; }
}

.cc-carousel__eyebrow {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    color: #944528;
    text-transform: uppercase;
    letter-spacing: 0.32em;
    margin-bottom: 1rem;
}

.cc-carousel__title {
    font-family: 'Playfair Display', serif;
    font-weight: 500;
    font-size: clamp(1.85rem, 2.6vw, 2.35rem);
    line-height: 1.18;
    color: #1c1c18;
    margin-bottom: 1rem;
    letter-spacing: -0.005em;
}

/* Delicate gold rule beneath the title - the masterclass flourish */
.cc-carousel__title-rule {
    width: 40px;
    height: 1px;
    background: #c9a26a;
    margin-bottom: 1.2rem;
    border: 0;
    opacity: 0.85;
}

.cc-carousel__copy {
    font-family: 'Noto Serif', serif;
    font-size: 15px;
    line-height: 1.5;
    color: #6b6660;
    margin-bottom: 1.3rem;
    max-width: 32ch;
}

.cc-carousel__price {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: #6b6660;
    text-transform: uppercase;
    margin-bottom: 1.2rem;
}

.cc-carousel__cta {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.95rem 2.25rem;
    background: #331104;
    color: #ffffff;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    border-radius: 9999px;
    box-shadow: 0 10px 24px -8px rgba(51, 17, 4, 0.45);
    transition: transform 250ms ease, box-shadow 250ms ease, background 250ms ease;
    text-decoration: none;
}
.cc-carousel__cta:hover {
    background: #944528;
    transform: translateY(-2px);
    box-shadow: 0 16px 32px -10px rgba(99, 55, 37, 0.55);
    color: #ffffff;
}

/* Floating navigation arrows - lighter, pinned to viewport edges */
.cc-carousel__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px; height: 44px;
    border-radius: 9999px;
    background: rgba(255, 255, 255, 0.92);
    color: #944528;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px -4px rgba(126, 78, 58, 0.18);
    z-index: 40;
    cursor: pointer;
    transition: background 250ms ease, color 250ms ease, transform 250ms ease, box-shadow 250ms ease;
    border: 1px solid rgba(214, 194, 187, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.cc-carousel__arrow .material-symbols-outlined {
    font-size: 22px;
}
.cc-carousel__arrow:hover {
    background: #944528;
    color: #ffffff;
    transform: translateY(-50%) scale(1.06);
    box-shadow: 0 8px 20px -6px rgba(126, 78, 58, 0.32);
}
.cc-carousel__arrow--prev { left: clamp(0.75rem, 2.5vw, 1.75rem); }
.cc-carousel__arrow--next { right: clamp(0.75rem, 2.5vw, 1.75rem); }

@media (max-width: 640px) {
    .cc-carousel__arrow { width: 38px; height: 38px; }
    .cc-carousel__arrow .material-symbols-outlined { font-size: 20px; }
}

/* Dash-style progress indicators */
.cc-carousel__dots {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.25rem;
}
.cc-carousel__dot {
    width: 32px;
    height: 2px;
    border-radius: 9999px;
    background: #dbc1b9;
    opacity: 0.7;
    transition: background 350ms ease, opacity 350ms ease, width 350ms ease, height 350ms ease;
    cursor: pointer;
    border: 0;
    padding: 0;
}
.cc-carousel__dot.is-active {
    background: #944528;
    opacity: 1;
    width: 56px;
    height: 3px;
}

/* Empty state */
.cc-carousel__empty {
    text-align: center;
    padding: 4rem 2rem;
    color: #55433d;
    font-family: 'Noto Serif', serif;
}

/* View Full Catalogue CTA - sits below the dash indicators */
.cc-carousel__view-all {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

.cc-carousel__view-all-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.7rem 1.75rem;
    background: #944528;
    color: #ffffff;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    border-radius: 9999px;
    box-shadow: 0 6px 16px -6px rgba(99, 55, 37, 0.35);
    transition: transform 250ms ease, box-shadow 250ms ease, background 250ms ease;
    text-decoration: none;
}

.cc-carousel__view-all-btn:hover {
    background: #7a3920;
    transform: translateY(-1px);
    box-shadow: 0 10px 22px -8px rgba(99, 55, 37, 0.45);
    color: #ffffff;
}

/* =========================================================
   Mobile refinement (max-width 767px)
   - 85vw card width with peeking neighbours
   - Image-on-top vertical split (already default; tightened ratio)
   - Touch-first physics, hidden arrows, full-width CTA pill
   ========================================================= */
@media (max-width: 767px) {
    /* Loosen the mask so peeked neighbours read clearly at the edges */
    .cc-carousel__mask {
        -webkit-mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
                mask-image: linear-gradient(to right, transparent 0%, black 4%, black 96%, transparent 100%);
    }

    .cc-carousel__track {
        gap: 1rem;
        /* 11vw of padding on each side guarantees that 11% of the previous
           and next cards remain visible at the screen edges at all times. */
        padding: 1.5rem 11vw;
        scroll-padding-inline: 11vw;
        /* Mandatory snapping - the track MUST land on a card every time */
        scroll-snap-type: x mandatory !important;
        /* Disable native momentum: the snap points become the only stops,
           so a high-velocity flick can no longer glide past several cards. */
        -webkit-overflow-scrolling: auto;
        /* Block accidental browser back/forward gestures */
        overscroll-behavior-x: contain;
        /* Slightly damped easing for the JS-driven scrollTo() arrows/dashes */
        scroll-behavior: smooth;
    }

    .cc-carousel__card {
        /* Active card sits at exactly 78vw. With 11vw padding on each side
           of the track, that leaves 11% of the previous and 11% of the
           next card visible on the screen edges at all times. */
        flex: 0 0 70vw;
        scroll-snap-align: center;
        /* Strict friction: force the browser to stop at every card so the
           user cannot accidentally fling past the now-very-visible cards. */
        scroll-snap-stop: always;
        /* Aggressive 3D focus: inactive cards drop to 0.88 scale and 0.4
           opacity so they read as background layers, while the active
           card pops as the hero. */
        transform: scale(0.9);
        opacity: 0.45;
    }
    .cc-carousel__card.is-active {
        transform: scale(1);
        opacity: 1;
    }

    /* Deep, soft layer shadow on every card so the peeked overlaps look
       like physical layers stacked above the background. */
    .cc-carousel__inner {
        box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
    }
    .cc-carousel__card.is-active .cc-carousel__inner {
        box-shadow:
            0 28px 45px -10px rgba(0, 0, 0, 0.28),
            0 12px 22px -10px rgba(40, 25, 18, 0.22);
    }

    /* One-shot 1.5s "wobble" tease on first load: nudge the carousel
           horizontally to make it unmistakably clear that this section
           can slide. Universal mobile pattern. */
    .cc-carousel__track.cc-carousel__track--peek-tease {
        animation: cc-peek-tease 1500ms cubic-bezier(0.22, 1, 0.36, 1) 1;
    }
    @keyframes cc-peek-tease {
        0%   { transform: translateX(0); }
        40%  { transform: translateX(-20px); }
        70%  { transform: translateX(8px); }
        100% { transform: translateX(0); }
    }
    @media (prefers-reduced-motion: reduce) {
        .cc-carousel__track.cc-carousel__track--peek-tease { animation: none; }
    }

    /* Vertical split: image on top, content below */
    .cc-carousel__inner {
        flex-direction: column;
        min-height: auto;
    }
    .cc-carousel__image {
        width: 100%;
        /* Banner crop ~45% of the card height */
        aspect-ratio: 16 / 11;
        height: auto;
    }
    .cc-carousel__content {
        width: 100%;
        padding: 1.25rem 1.1rem 1.4rem;
    }

    /* Typography: scaled down so headers don't wrap onto 3 lines */
    .cc-carousel__eyebrow {
        margin-bottom: 0.85rem;
        font-size: 10px;
        letter-spacing: 0.28em;
    }
    .cc-carousel__title {
        font-size: 1.2rem;
        line-height: 1.28;
        margin-bottom: 0.6rem;
    }
    .cc-carousel__title-rule { margin-bottom: 0.9rem; }
    .cc-carousel__copy {
        font-size: 13px;
        line-height: 1.55;
        margin-bottom: 1rem;
        max-width: 100%;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }
    .cc-carousel__price {
        margin-bottom: 0.85rem;
        font-size: 10px;
    }

    /* Full-width pill CTA - thumb-friendly tap target */
    .cc-carousel__cta {
        align-self: stretch;
        justify-content: center;
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 10px;
        letter-spacing: 0.16em;
    }

    /* Touch is the primary interaction - hide the floating arrows */
    .cc-carousel__arrow { display: none !important; }

    /* Pulled 20px closer to the card so the progress dashes feel
       directly tied to the active slide. High-contrast charcoal active
       and light-cream inactive for unmistakable navigation feedback. */
    .cc-carousel__dots {
        margin-top: 0.5rem;
        gap: 0.5rem;
    }
    .cc-carousel__dot {
        width: 24px;
        height: 3px;
        background: #f3e9e3;
        opacity: 1;
    }
    .cc-carousel__dot.is-active {
        width: 40px;
        height: 4px;
        background: #1c1c18;
        opacity: 1;
    }

    .cc-carousel__view-all { margin-top: 1.5rem; padding: 0 1.25rem; }
    .cc-carousel__view-all-btn {
        width: 100%;
        max-width: 22rem;
        padding: 0.85rem 1.5rem;
    }
}
