/* =============================================================
   CBC Service Slider — Frontend Styles
   ============================================================= */

/* ── Wrapper ────────────────────────────────────────────────── */
.cbcss-wrapper {
    position: relative;
    width: 100%;
    /* Clip sideways only: the scaled cards and their shadows still need to
       breathe vertically, but nothing should ever push the page wide enough
       to produce a horizontal scrollbar. `clip` (unlike `hidden`) does not
       turn the other axis into a scroll container. */
    overflow-x: clip;
    padding: 30px 0 50px;
}

/* Fallback for browsers without overflow: clip support. */
@supports not (overflow-x: clip) {
    .cbcss-wrapper { overflow-x: hidden; }
}

/* ── Slick overrides ────────────────────────────────────────── */
.cbcss-slider .slick-list {
    overflow: hidden;
    /* Only force the vertical breathing room. Left/right padding is how Slick
       implements centerMode's peek (centerPadding), so it must stay Slick's. */
    padding-top: 20px !important;
    padding-bottom: 20px !important;
}

.cbcss-slider .slick-track {
    display: flex;
    align-items: center;
}

/* ── Individual slide ───────────────────────────────────────── */
.cbcss-slide {
    outline: none;
    /* The scale + translate that keeps a constant gap between cards is
       applied per-slide by service-slider.js. CSS only owns the dimming
       and the transition timing. */
    transform-origin: center center;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                opacity  0.4s ease;
    opacity: 0.6;
    will-change: transform, opacity;
}

.cbcss-slider .cbcss-slide.slick-center {
    opacity: 1;
    z-index: 2;
}

/* Suppress the transition for the first paint so cards don't animate in. */
.cbcss-slider.cbcss-no-anim .cbcss-slide {
    transition: none !important;
}

/* ── Slide card ─────────────────────────────────────────────── */
/* Normalise <a> card so it looks identical to <div> card */
a.cbcss-slide__card {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.cbcss-slide__card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    /* A transformed child (the centre card's image zoom) can bleed past a
       rounded, overflow-hidden parent in WebKit. The mask forces the browser
       to clip on the rounded shape, and isolation keeps the stacking context
       self-contained so the corners stay clean. */
    -webkit-mask-image: -webkit-radial-gradient(#ffffff, #000000);
    isolation: isolate;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transition: box-shadow 0.4s ease;
}

.cbcss-slide.slick-center .cbcss-slide__card {
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.22);
}

/* ── Image wrap ─────────────────────────────────────────────── */
.cbcss-slide__image-wrap {
    position: relative;
    /* Height derives from width → the card keeps the same aspect ratio at
       every screen size. Per-device value comes from the widget control. */
    aspect-ratio: 3 / 4;
    height: auto;
    overflow: hidden;
    /* Follow the card's rounding rather than carrying a separate value that
       could disagree with it and show as a clipped corner. */
    border-radius: inherit;
}

.cbcss-slide__image-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}

.cbcss-slide.slick-center .cbcss-slide__image-wrap img {
    transform: scale(1.04);
}

/* ── Overlay (solid or gradient — set via inline style) ─────── */
.cbcss-slide__overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    transition: opacity 0.4s ease;
}

.cbcss-slide:not(.slick-center) .cbcss-slide__overlay {
    opacity: 1.25;
}

/* ── Text content box ───────────────────────────────────────── */
.cbcss-slide__content {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 20px;
    background-color: #ffffff;
    transition: background-color 0.3s ease;
}

.cbcss-slide__title {
    margin: 0 0 8px;
    font-size: 1.15rem;
    font-weight: 700;
    color: #1a1a2e;
    line-height: 1.3;
}

.cbcss-slide__descriptor {
    margin: 0;
    font-size: 0.9rem;
    color: #555577;
    line-height: 1.6;
}

/* ── Slide icon ─────────────────────────────────────────────── */
.cbcss-slide__icon {
    display: block;
    margin-top: 12px;
    font-size: 32px;
    color: #1a73e8;
    line-height: 1;
}

.cbcss-slide__icon svg {
    width: 1em;
    height: 1em;
    fill: currentColor;
    display: inline-block;
    vertical-align: middle;
}

/* ── Custom arrows — Slick injects these, positions like native ─ */
.cbcss-arrow {
    /* Reset Slick's own button styles */
    position: absolute;
    top: 50%;
    box-shadow: none !important;
    transform: translateY(-50%);
    z-index: 10;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 56px;
    height: 56px;
    padding: 0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background-color: rgba(0, 0, 0, 0);
    color: #ffffff;
    line-height: 1;
    transition: color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

/* No shadow of any kind, in any state. box-shadow alone isn't enough — themes
   commonly apply a drop-shadow filter or text-shadow to button hover, which a
   box-shadow reset won't touch. */
.cbcss-arrow,
.cbcss-arrow:hover,
.cbcss-arrow:focus,
.cbcss-arrow:focus-visible,
.cbcss-arrow:active,
.cbcss-slider .slick-arrow:hover,
.cbcss-slider .slick-arrow:focus {
    box-shadow: none !important;
    -webkit-box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    -webkit-filter: none !important;
}

.cbcss-arrow:hover {
    transform: translateY(-50%) scale(1.1);
}

.cbcss-arrow:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.7);
    outline-offset: 2px;
}

/* Icon inside the button — an SVG sized by width; height follows the SVG's
   own proportions. Elementor may render it bare, wrapped in a <span>, or as
   an <img> for an uploaded SVG file, so all three are handled. */
.cbcss-arrow i,
.cbcss-arrow svg,
.cbcss-arrow img {
    display: block;
    pointer-events: none;
    line-height: 1;
}

/* If Elementor wraps the icon, collapse the wrapper so the sizing lands on
   the SVG itself rather than being constrained by the span. */
.cbcss-arrow span {
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    max-width: 100%;
    max-height: 100%;
}

.cbcss-arrow svg {
    width: 30px;
    height: auto;
    /* Safety net: an SVG with no viewBox has no intrinsic ratio, so `auto`
       height can collapse or balloon. Never let it exceed the button. */
    max-width: 100%;
    max-height: 100%;
    fill: currentColor;
    flex-shrink: 0;
}

.cbcss-arrow img {
    width: 30px;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    flex-shrink: 0;
}

.cbcss-arrow i {
    font-size: 30px;
}

/* Slick places prev/next using its own left/right values — match them */
.cbcss-arrow--prev { left: 25px; }
.cbcss-arrow--next { right: 25px; }

/* ── Dots ───────────────────────────────────────────────────── */
.cbcss-slider .slick-dots {
    bottom: -35px;
}

.cbcss-slider .slick-dots li button:before {
    font-size: 10px;
    color: #ccc;
    opacity: 1;
    transition: color 0.2s ease, transform 0.2s ease;
}

.cbcss-slider .slick-dots li.slick-active button:before {
    color: #1a73e8;
    transform: scale(1.4);
}

/* ── Editor preview (no slick) ──────────────────────────────── */
.cbcss-editor-preview {
    display: flex !important;
    gap: 16px;
    overflow-x: auto;
    padding: 20px 0;
}

.cbcss-editor-preview .cbcss-slide {
    flex: 0 0 260px;
    transform: scale(1);
    opacity: 1;
}

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

/* Tablet (≤1024px) keeps the tiered centre scaling; only the slide count and
   peek change, and those are driven from the widget controls via JS. */

/* Mobile (≤767px): cards swipe through the centre, previous/next peek in at
   the edges, and every card is the same size — the centre one is simply
   brighter. Slick owns the layout here, so any leftover inline transform from
   a wider viewport is neutralised. */
@media (max-width: 767px) {
    .cbcss-wrapper {
        padding: 16px 0 44px;
    }

    /* Scale on mobile is CSS-driven from the Mobile Slide Scale controls, so
       it's a pure scale with no chained translation — the thing that caused
       cards to overflow the wrapper. Both default to 1 (no scaling), and any
       inline transform left over from a wider viewport is overridden. */
    .cbcss-slider .slick-slide {
        transform: scale(var(--cbcss-m-side, 1)) !important;
    }

    .cbcss-slider .slick-slide.slick-center {
        transform: scale(var(--cbcss-m-center, 1)) !important;
    }

    .cbcss-slide.slick-center .cbcss-slide__image-wrap img,
    .cbcss-slide .cbcss-slide__image-wrap img {
        transform: none !important;
    }

    /* Opacity is driven by the Active/Inactive Slide Opacity controls, which
       have their own mobile values — nothing hardcoded here. */

    /* Breathing room between the peeking cards. */
    .cbcss-slide__card {
        margin: 0 6px;
    }

    .cbcss-slider .slick-list {
        padding-top: 10px !important;
        padding-bottom: 10px !important;
    }
}
