/**
 * Scroll Collapse Banner with Cards Widget
 *
 * Mechanic (matches reference HTML exactly):
 * - .scbc-hero-container is 100vh tall, contains the banner
 * - .scbc-hero-media-wrapper is position:sticky top:0, height:100vh
 *   so the image stays pinned while the container scrolls
 * - GSAP animates scaleY (height collapse via clip-path) on the
 *   sticky wrapper — collapses the image from bottom to top
 * - .scbc-cards-section has min-height:250vh with its own sticky
 *   container, white background slides over the collapsing hero
 * - Cards and header animate in as the section scrolls into view
 * - Cards stay visible permanently (no reverse on scroll)
 */

/* ── Widget ──────────────────────────────────────────────────── */
.scbc-widget {
    position: relative;
    width: 100%;
}

/* Full-bleed for Elementor columns and flex/container layouts */
.elementor-column .scbc-widget,
.elementor-container .scbc-widget,
.e-con .scbc-widget,
.e-con-inner .scbc-widget {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    position: relative;
    left: auto;
}

.elementor-widget-scroll_collapse_banner_cards {
    width: 100% !important;
    max-width: 100% !important;
    overflow: visible !important;
}

/* ── Hero Container ──────────────────────────────────────────── */
/* Acts as the scroll track for the sticky hero wrapper */
.scbc-hero-container {
    position: relative;
    width: 100%;
    height: 100vh;
}

/* ── Hero Media Wrapper ──────────────────────────────────────── */
/*
 * Sticky so it stays at the top while .scbc-hero-container scrolls.
 * GSAP will animate clip-path to collapse it from bottom to top.
 * transform-origin: top center ensures clipping pulls from the bottom.
 */
.scbc-hero-media-wrapper {
    position: sticky;
    top: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;          /* clips the image during collapse */
    transform-origin: top center;
    will-change: clip-path;
    z-index: 1;
}

.scbc-hero-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
}

video.scbc-hero-media {
    object-fit: cover;
    object-position: center center;
}

.scbc-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.2) 0%,
        rgba(0,0,0,0.05) 50%,
        rgba(0,0,0,0.3) 100%
    );
    pointer-events: none;
    z-index: 1;
}

/* ── Hero Content ────────────────────────────────────────────── */
.scbc-hero-content {
    position: absolute;
    top: 50%;
    left: 0;
    width: 100%;
    transform: translateY(-50%);
    z-index: 2;
    color: white;
    padding: 0 5%;
    will-change: opacity;
}

.scbc-hero-content.scbc-align-left   { text-align: left; }
.scbc-hero-content.scbc-align-center { text-align: center; }
.scbc-hero-content.scbc-align-right  { text-align: right; }

.scbc-hero-title {
    font-size: clamp(40px, 8vw, 80px);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 20px;
    text-shadow: 0 2px 20px rgba(0,0,0,0.3);
}

.scbc-hero-cta {
    display: inline-block;
    padding: 12px 24px;
    border: 2px solid white;
    border-radius: 30px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
}
.scbc-hero-cta:hover { background: white; color: #333; }

/* ── Cards Section ───────────────────────────────────────────── */
/*
 * min-height: 250vh gives enough scroll room for staggered cards.
 * position:relative + z-index:10 means it layers above the hero.
 * Background is set here — default white so it covers the hero
 * as this section scrolls up over it.
 */
.scbc-cards-section {
    position: relative;
    z-index: 10;
    min-height: 250vh;
    background: var(--scbc-bg, #ffffff);
}

/* ── Cards Container ─────────────────────────────────────────── */
/*
 * Sticky: pins to top of viewport as user scrolls through
 * the 250vh cards section. Cards and header animate in here.
 */
.scbc-cards-container {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    overflow: hidden;
    box-sizing: border-box;
}

/* ── Section Header ──────────────────────────────────────────── */
.scbc-section-header {
    text-align: center;
    margin-bottom: 30px;
    opacity: 0;
    transform: translateY(20px);
    flex-shrink: 0;
}

.scbc-section-title {
    font-size: 32px;
    color: #333;
    font-weight: 500;
    margin-bottom: 10px;
}

.scbc-section-subtitle {
    font-size: 16px;
    color: #666;
}

/* ── Cards Wrapper ───────────────────────────────────────────── */
.scbc-cards-wrapper {
    display: flex;
    gap: 20px;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    max-width: 1200px;
    flex-shrink: 0;
}

/* Desktop grid widths */
.scbc-cards-wrapper[data-cards-per-row="1"] .scbc-card { width: 100%;                  max-width: 400px; }
.scbc-cards-wrapper[data-cards-per-row="2"] .scbc-card { width: calc(50% - 10px);      max-width: 560px; }
.scbc-cards-wrapper[data-cards-per-row="3"] .scbc-card { width: calc(33.333% - 14px);  max-width: 380px; }
.scbc-cards-wrapper[data-cards-per-row="4"] .scbc-card { width: calc(25% - 15px);      max-width: 280px; }

/* ── Individual Card ─────────────────────────────────────────── */
.scbc-card {
    position: relative;
    height: 420px;
    border-radius: 20px;
    overflow: hidden;
    opacity: 0;
    transform: translateY(50px) scale(0.95);
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    flex-shrink: 0;
}

.scbc-card-media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    display: block;
}

.scbc-card-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 30px;
    color: white;
    background: linear-gradient(
        to top,
        var(--card-overlay-color, #6366f1) 0%,
        var(--card-overlay-color, #6366f1) 40%,
        transparent 100%
    );
    z-index: 1;
}

.scbc-card-title {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 8px;
}

.scbc-card-subtitle {
    font-size: 13px;
    line-height: 1.5;
    opacity: 0.9;
    margin-bottom: 15px;
}

.scbc-card-link {
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: gap 0.3s ease;
}
.scbc-card-link:hover { gap: 10px; }

/* ── Navigation Dots ─────────────────────────────────────────── */
.scbc-carousel-dots {
    display: none;
    justify-content: center;
    gap: 10px;
    margin-top: 20px;
    flex-shrink: 0;
}

.scbc-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #ddd;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    padding: 0;
}
.scbc-dot.active { background: #6366f1; transform: scale(1.2); }

/* ── Tablet ──────────────────────────────────────────────────── */
@media (max-width: 1024px) {
    .scbc-cards-wrapper[data-cards-per-row="4"] .scbc-card {
        width: calc(33.333% - 14px);
    }
}

/* ── Mobile ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .scbc-hero-title    { font-size: clamp(32px, 10vw, 60px); }
    .scbc-section-title { font-size: 24px; }
    .scbc-card          { height: 340px; }

    .scbc-cards-container {
        justify-content: flex-start;
        padding-top: 30px;
    }

    .scbc-cards-wrapper {
        overflow-x: auto;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
        gap: 15px;
        justify-content: flex-start;
        align-items: flex-start;
        padding-bottom: 10px;
        width: 100%;
    }
    .scbc-cards-wrapper::-webkit-scrollbar { display: none; }
    .scbc-card { scroll-snap-align: start; }

    .scbc-cards-wrapper.scbc-show-1 .scbc-card { width: 85vw; min-width: 85vw; }
    .scbc-cards-wrapper.scbc-show-2 .scbc-card { width: 45vw; min-width: 45vw; }
    .scbc-cards-wrapper.scbc-show-3 .scbc-card { width: 30vw; min-width: 30vw; }

    .scbc-carousel-dots { display: flex; }
}

/* ── Elementor Editor Preview ────────────────────────────────── */
.elementor-editor-active .scbc-hero-media-wrapper {
    position: relative;
    height: 60vh;
}
.elementor-editor-active .scbc-cards-section {
    min-height: auto;
}
.elementor-editor-active .scbc-cards-container {
    position: relative;
    height: auto;
    min-height: 500px;
}
.elementor-editor-active .scbc-section-header,
.elementor-editor-active .scbc-card {
    opacity: 1 !important;
    transform: none !important;
}