/* ============================================================
 * Lux Watches — Premium 3D Coverflow Carousel
 *
 * Shared between the homepage hero carousel and (formerly) the
 * brand-family page. Driven by static/js/cdl-carousel.js which
 * implements iOS-spec spring physics (Apple WWDC18 model).
 *
 * Slide markup options:
 *   A) Single image card (brand-family style — cutout PNG):
 *      <a class="swiper-slide cdl-carousel-slide">
 *        <div class="cdl-carousel-slide-img"><img src="..."></div>
 *        <div class="cdl-carousel-slide-name">Name</div>
 *      </a>
 *
 *   B) Cinematic blur card (homepage style — keep background):
 *      <a class="swiper-slide cdl-carousel-slide cdl-carousel-slide--blur">
 *        <img class="cdl-carousel-slide-bg" src="...">   ← blurred bg
 *        <img class="cdl-carousel-slide-fg" src="...">   ← sharp w/ radial mask
 *      </a>
 * ============================================================ */

/* ===== Container ===== */
.cdl-carousel-wrap {
    max-width: 100%;
    margin: 0 auto;
    padding: 0;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse 520px 340px at 50% 46%,
                        rgba(212,175,55,0.10), transparent 70%),
        radial-gradient(ellipse 90% 50% at 50% 100%,
                        rgba(212,175,55,0.04), transparent 80%);
}
.cdl-carousel {
    position: relative;
    padding: 12px 0 28px;
    perspective: 1100px;
}
.cdl-carousel .swiper-wrapper {
    /* Layout (position, display, height) set inline by cdl-carousel.js. */
}
.cdl-carousel .swiper-slide {
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    transform-style: preserve-3d;
    will-change: transform, opacity;
    transition: none !important;
}

/* ===== Slide outer ===== */
.cdl-carousel-slide {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
}

/* ===== Variant A: single image (no card frame, drop-shadow on watch) ===== */
.cdl-carousel-slide-img {
    flex: 1;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cdl-carousel-slide-img img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    /* Coverflow blur on side cards — only the active slide stays sharp.
       Blur sits inside the same filter chain as the drop-shadow so the
       shadow keeps grounding the watch even while the body softens. */
    filter:
        drop-shadow(0 14px 20px rgba(0,0,0,0.45))
        blur(3.5px);
    transition: filter 0.45s ease-out;
}
.cdl-carousel .swiper-slide-active .cdl-carousel-slide-img img {
    filter:
        drop-shadow(0 45px 65px rgba(0,0,0,0.7))
        drop-shadow(0 0 95px rgba(212,175,55,0.20))
        blur(0);
}
/* Adjacent (prev/next) slides: lighter blur — they are visually nearest
   to the active card so a heavy filter looks like a layout mistake. */
.cdl-carousel .swiper-slide-prev .cdl-carousel-slide-img img,
.cdl-carousel .swiper-slide-next .cdl-carousel-slide-img img {
    filter:
        drop-shadow(0 14px 20px rgba(0,0,0,0.45))
        blur(2px);
}
.cdl-carousel-slide.no-cutout .cdl-carousel-slide-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    mask-image: radial-gradient(ellipse 78% 70% at 50% 48%, #000 38%, transparent 95%);
    -webkit-mask-image: radial-gradient(ellipse 78% 70% at 50% 48%, #000 38%, transparent 95%);
}
.cdl-carousel .swiper-slide-active .cdl-carousel-slide.no-cutout .cdl-carousel-slide-img img {
    mask-image: radial-gradient(ellipse 88% 82% at 50% 48%, #000 50%, transparent 100%);
    -webkit-mask-image: radial-gradient(ellipse 88% 82% at 50% 48%, #000 50%, transparent 100%);
}

/* ===== Variant B: Cinematic background blur (subject isolation) =====
 * Layered approach (no need to remove background of source photo):
 *  - .cdl-carousel-slide-bg : SAME photo, blurred + scaled up to hide
 *    blur edges. Acts as the soft "out-of-focus" backdrop.
 *  - .cdl-carousel-slide-fg : SAME photo, SHARP, with a radial mask that
 *    keeps the centre crisp and fades to transparent toward edges.
 *  Net effect: fake shallow-DoF — the watch in the centre pops out 3D
 *  while the surrounding scene softly defocuses. Source images stay
 *  intact, no segmentation needed. */
.cdl-carousel-slide--blur {
    position: relative;
    overflow: hidden;
    border-radius: 18px;
    box-shadow:
        0 28px 60px rgba(0,0,0,0.55),
        0 0 0 1px rgba(212,175,55,0.10) inset;
    background: #0a0a0a;
}
.cdl-carousel-slide--blur::after {
    /* Vignette + golden inner glow on active */
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(ellipse 60% 50% at 50% 50%, transparent 55%, rgba(0,0,0,0.45) 100%),
        radial-gradient(ellipse 60% 50% at 50% 50%, rgba(212,175,55,0.05) 0%, transparent 60%);
    z-index: 3;
    transition: opacity 0.45s ease-out;
    opacity: 0.85;
}
.cdl-carousel .swiper-slide-active .cdl-carousel-slide--blur::after {
    /* Active card: extra gold glow */
    background:
        radial-gradient(ellipse 60% 50% at 50% 50%, transparent 50%, rgba(0,0,0,0.35) 100%),
        radial-gradient(ellipse 65% 55% at 50% 50%, rgba(212,175,55,0.14) 0%, transparent 65%);
    opacity: 1;
}
.cdl-carousel-slide-bg,
.cdl-carousel-slide-fg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.cdl-carousel-slide-bg {
    /* Out-of-focus layer. Scaled 1.15× so blur ring doesn't show edge. */
    filter: blur(14px) saturate(0.88) brightness(0.78);
    transform: scale(1.15);
    z-index: 0;
}
.cdl-carousel-slide-fg {
    /* In-focus layer with radial mask — sharp centre, transparent edges.
       Default state (used on side cards) softens with a body blur so only
       the active slide reveals true sharpness. */
    z-index: 2;
    filter: blur(4px);
    transition: filter 0.45s ease-out;
    -webkit-mask-image: radial-gradient(ellipse 58% 52% at 50% 50%,
        rgba(0,0,0,1) 28%,
        rgba(0,0,0,0.85) 48%,
        rgba(0,0,0,0) 96%);
    mask-image: radial-gradient(ellipse 58% 52% at 50% 50%,
        rgba(0,0,0,1) 28%,
        rgba(0,0,0,0.85) 48%,
        rgba(0,0,0,0) 96%);
}
/* Adjacent cards: only half the body blur of farther-out cards. */
.cdl-carousel .swiper-slide-prev .cdl-carousel-slide-fg,
.cdl-carousel .swiper-slide-next .cdl-carousel-slide-fg {
    filter: blur(2px);
}
/* Active blur-card: relax the mask slightly so the focal area opens up a
   touch, and increase fg saturation — gives a subtle "lens opens" feel.
   Body blur lifts to zero so the active card reads as the in-focus subject. */
.cdl-carousel .swiper-slide-active .cdl-carousel-slide-fg {
    filter: blur(0);
    -webkit-mask-image: radial-gradient(ellipse 64% 58% at 50% 50%,
        rgba(0,0,0,1) 32%,
        rgba(0,0,0,0.9) 52%,
        rgba(0,0,0,0) 98%);
    mask-image: radial-gradient(ellipse 64% 58% at 50% 50%,
        rgba(0,0,0,1) 32%,
        rgba(0,0,0,0.9) 52%,
        rgba(0,0,0,0) 98%);
}

/* ===== Optional slide name (under or absolutely-positioned) ===== */
.cdl-carousel-slide-name {
    padding: 1.4rem 0.8rem 0;
    font-family: 'Playfair Display', serif;
    font-size: 1.35rem;
    font-weight: 500;
    text-align: center;
    color: rgba(255,255,255,0.5);
    letter-spacing: 0.6px;
    transition: color 0.95s cubic-bezier(0.22, 1, 0.36, 1);
}
.cdl-carousel .swiper-slide-active .cdl-carousel-slide-name {
    color: var(--gold, #D4AF37);
}

/* ===== Navigation arrows ===== */
.cdl-carousel-prev,
.cdl-carousel-next {
    position: absolute;
    top: 50%;
    margin-top: -23px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background: rgba(0,0,0,0.5);
    border: 1px solid rgba(212,175,55,0.42);
    color: var(--gold, #D4AF37);
    backdrop-filter: blur(10px);
    transition: background 0.3s, color 0.3s, transform 0.2s, box-shadow 0.3s;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    line-height: 1;
    font-family: serif;
    user-select: none;
}
.cdl-carousel-prev { left: 18px; }
.cdl-carousel-next { right: 18px; }
.cdl-carousel-prev:hover,
.cdl-carousel-next:hover {
    background: var(--gold, #D4AF37);
    color: #000;
    transform: scale(1.06);
    box-shadow: 0 10px 24px rgba(212,175,55,0.30);
}

/* ===== Pagination ===== */
.cdl-carousel-pagination {
    position: absolute;
    bottom: 14px;
    left: 0;
    right: 0;
    text-align: center;
    z-index: 10;
    pointer-events: auto;
}
.cdl-carousel-pagination-bullet {
    display: inline-block;
    background: rgba(212,175,55,0.35);
    width: 6px;
    height: 6px;
    border-radius: 999px;
    margin: 0 4px;
    cursor: pointer;
    transition: width 0.35s cubic-bezier(0.22,1,0.36,1), background 0.35s;
    vertical-align: middle;
}
.cdl-carousel-pagination-bullet-active {
    background: var(--gold, #D4AF37);
    width: 26px;
}

/* ===== Mobile chrome tweaks ===== */
@media (max-width: 768px) {
    .cdl-carousel-slide-name { font-size: 0.9rem; padding: 0.85rem 0.4rem 0; }
    .cdl-carousel { padding: 8px 0 18px; perspective: 900px; }
    .cdl-carousel-prev,
    .cdl-carousel-next { width: 34px; height: 34px; margin-top: -17px; font-size: 17px; }
    .cdl-carousel-prev { left: 8px; }
    .cdl-carousel-next { right: 8px; }
    .cdl-carousel-wrap {
        background:
            radial-gradient(ellipse 280px 200px at 50% 44%,
                            rgba(212,175,55,0.14), transparent 70%),
            radial-gradient(ellipse 90% 50% at 50% 100%,
                            rgba(212,175,55,0.04), transparent 80%);
    }
    /* Lighter blur on mobile — keeps the coverflow depth cue without
       hammering integrated GPUs. Active slide stays fully sharp. */
    .cdl-carousel-slide-img img {
        filter: blur(2px);
        transition: filter 0.35s ease-out;
    }
    .cdl-carousel .swiper-slide-prev .cdl-carousel-slide-img img,
    .cdl-carousel .swiper-slide-next .cdl-carousel-slide-img img {
        filter: blur(1.2px);
    }
    .cdl-carousel .swiper-slide-active .cdl-carousel-slide-img img {
        filter: drop-shadow(0 18px 28px rgba(0,0,0,0.55)) blur(0);
        transition: filter 0.3s ease-out;
    }
    .cdl-carousel-slide.no-cutout .cdl-carousel-slide-img img {
        mask-image: none;
        -webkit-mask-image: none;
    }
    .cdl-carousel-prev,
    .cdl-carousel-next {
        backdrop-filter: none;
        background: rgba(0,0,0,0.75);
    }
    .cdl-carousel-slide-bg { filter: blur(10px) saturate(0.85) brightness(0.78); }
    /* Variant B fg layer on mobile: lighter side-card blur for the same
       GPU-budget reason as variant A above. */
    .cdl-carousel-slide-fg { filter: blur(2.5px); }
    .cdl-carousel .swiper-slide-prev .cdl-carousel-slide-fg,
    .cdl-carousel .swiper-slide-next .cdl-carousel-slide-fg { filter: blur(1.5px); }
    .cdl-carousel .swiper-slide-active .cdl-carousel-slide-fg { filter: blur(0); }
}
@media (max-width: 480px) {
    .cdl-carousel-slide-name { font-size: 0.85rem; padding: 0.7rem 0.3rem 0; }
    .cdl-carousel { padding: 4px 0 12px; perspective: 800px; }
}

/* === Carousel slide link + caption overlay ===
   Each linked slide wraps its imagery in an <a class="cdl-carousel-slide-link">
   that fills the slide area; click anywhere on the slide jumps to /watch/<id>.
   Caption is a bottom-anchored two-line label that surfaces brand + model,
   with a dark gradient pad so gold text stays legible over any photo. */
.cdl-carousel-slide-link {
    position: absolute;
    inset: 0;
    display: block;
    text-decoration: none;
    color: inherit;
    z-index: 4;          /* above the bg/fg <img>s */
    cursor: pointer;
}
.cdl-carousel-slide-link:focus-visible {
    outline: 2px solid rgba(212,175,55,0.7);
    outline-offset: -4px;
}
.cdl-carousel-slide-caption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    z-index: 5;          /* above the link wrapper's background */
    padding: 0.9rem 0.8rem 0.7rem;
    text-align: center;
    pointer-events: none; /* clicks pass through to the link */
    background: linear-gradient(
        to top,
        rgba(0,0,0,0.78) 0%,
        rgba(0,0,0,0.55) 55%,
        rgba(0,0,0,0) 100%);
    color: #f3e7ba;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity .35s ease, transform .35s ease;
}
.cdl-carousel-slide-caption-brand {
    font-family: 'Playfair Display', 'Cormorant Garamond', serif;
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--gold, #D4AF37);
    text-shadow: 0 1px 3px rgba(0,0,0,0.65);
    line-height: 1.15;
    margin-bottom: 2px;
}
.cdl-carousel-slide-caption-model {
    font-family: 'Playfair Display', 'Cormorant Garamond', serif;
    font-weight: 500;
    font-size: 0.78rem;
    color: var(--gold, #D4AF37);
    line-height: 1.25;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-shadow: 0 1px 3px rgba(0,0,0,0.65);
    letter-spacing: 0.4px;
    text-transform: none;
    opacity: 0.92;
}
/* Caption appears only on the active centred slide */
.cdl-carousel .swiper-slide-active .cdl-carousel-slide-caption {
    opacity: 1;
    transform: translateY(0);
}
/* Subtle gold glow on hover for linked active slide */
.cdl-carousel-slide--linked.swiper-slide-active:hover .cdl-carousel-slide-caption-brand {
    text-shadow: 0 0 14px rgba(212,175,55,0.45), 0 1px 3px rgba(0,0,0,0.65);
}

@media (max-width: 640px) {
    .cdl-carousel-slide-caption {
        padding: 0.7rem 0.6rem 0.55rem;
    }
    .cdl-carousel-slide-caption-brand { font-size: 0.92rem; letter-spacing: 1.2px; }
    .cdl-carousel-slide-caption-model { font-size: 0.7rem; }
}
