/* ==========================================================================
 * Content Pile Cards
 *
 * Stacking cards with scroll-driven sticky positioning.
 * Each card sticks at a progressively lower offset, creating a "staircase"
 * pile effect where the tagline of each previous card remains visible.
 *
 * Key CSS variables:
 * --pile-offset: Space between stacked cards (default: 72px, matches tagline height)
 * --card-index:  0-based index set inline on each card element
 * --total-cards: Total number of cards, set inline on the stack container
 * ========================================================================== */


/* --------------------------------------------------------------------------
 * Section container
 * -------------------------------------------------------------------------- */

.wb-content-pile-cards {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 80px;
    width: 100%;
    position: relative;
}


/* --------------------------------------------------------------------------
 * Header — sticky to keep it always visible
 * -------------------------------------------------------------------------- */

/* Spacing via global: [class*="__tagline"] mb 8x, [class*="__title"] mb 12x, .button-group mt 16x */
.wb-content-pile-cards__header {
    position: static;
    /* top is set dynamically via JavaScript to respect widget padding-top */
    top: var(--widget-padding-top, 0px);
    z-index: 10000; /* Very high z-index to always stay above cards (cards max z-index is ~100) */
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 768px;
    width: 100%;
    text-align: center;
    /* Background inherits from widget wrapper, but ensure it has a fallback */
    background-color: inherit;
}

.wb-content-pile-cards__header-text {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.wb-content-pile-cards__title {
    margin-block-start: 0;
    margin-inline: 0;
    /* margin-bottom via wb-global-styles.css (--spacing-12x) */
}

.wb-content-pile-cards__description {
    margin: 0;
}

.wb-content-pile-cards__buttons {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: center;
}


/* --------------------------------------------------------------------------
 * Cards stack — the magic happens here with position: sticky
 * -------------------------------------------------------------------------- */

.wb-content-pile-cards__stack {
    --pile-offset: 120px; /* Increased spacing between cards for "appearing from below" effect */

    position: relative;
    width: 100%;
}


/* --------------------------------------------------------------------------
 * Individual card — sticky positioning for pile effect
 *
 * Each card:
 * 1. Sticks at top = card-index * pile-offset
 * 2. Has z-index = card-index + 1 so later cards appear on top
 * 3. The tagline of each card (72px tall) remains visible above the next card
 * -------------------------------------------------------------------------- */

.wb-content-pile-cards__card {
    position: sticky;
    /* top is set dynamically via JavaScript based on header height */
    top: var(--header-height, 0px);
    z-index: calc(var(--card-index) + 1); /* Cards stack with increasing z-index */

    display: flex;
    flex-direction: row;
    height: 640px;
    border-radius: var(--radius-small);
    overflow: hidden;
    width: 100%;
    margin-bottom: var(--spacing-150x); /* Additional spacing between cards for visual separation */
}


/* --------------------------------------------------------------------------
 * Card content (left side)
 * -------------------------------------------------------------------------- */

/* Spacing via margins (no gap) — card-title mb 12x, .button-group mt 16x */
.wb-content-pile-cards__card-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1 0 0;
    min-width: 0;
    min-height: 0;
    height: 100%;
    padding: var(--section-padding-padding-section-small);
    position: relative;
    width: 50%;
}

/* Tagline — positioned at the very top of the card.
 * When the next card covers this one, the tagline area (72px) stays visible. */
.wb-content-pile-cards__card-tagline {
    position: absolute;
    top: 0;
    left: var(--section-padding-padding-section-small, 3rem);
    right: var(--section-padding-padding-section-small, 3rem);
    padding: var(--spacing-12x, 1.5rem) 0;
    font-size: var(--e-global-typography-fc27a18-font-size, 1rem);
    font-weight: var(--e-global-typography-fc27a18-font-weight, 600);
    line-height: var(--e-global-typography-fc27a18-line-height, 1.5);
}

/* Spacing via global: __card-title mb 12x, .button-group mt 16x */
.wb-content-pile-cards__card-body {
    display: flex;
    flex-direction: column;
}

.wb-content-pile-cards__card-title {
    margin-block-start: 0;
    margin-inline: 0;
    /* margin-bottom via wb-global-styles.css (--spacing-12x) */
    font-size: var(--e-global-typography-a3c159c-font-size, 2.5rem);
    font-weight: 400;
    line-height: var(--e-global-typography-a3c159c-line-height, 1.2);
    letter-spacing: -0.4px;
}

.wb-content-pile-cards__card-description {
    margin: 0;
    font-size: var(--e-global-typography-3ddb51d-font-size, 1rem);
    font-weight: var(--e-global-typography-3ddb51d-font-weight, 400);
    line-height: var(--e-global-typography-3ddb51d-line-height, 1.5);
}

.wb-content-pile-cards__card-buttons {
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}


/* --------------------------------------------------------------------------
 * Card media (right side — image)
 * -------------------------------------------------------------------------- */

.wb-content-pile-cards__card-media {
    flex: 1 0 0;
    min-width: 0;
    min-height: 0;
    height: 100%;
    position: relative;
    overflow: hidden;
    width: 50%;
}

.wb-content-pile-cards__card-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}


/* --------------------------------------------------------------------------
 * Responsive — Tablet (max-width: 1024px)
 * -------------------------------------------------------------------------- */

@media (max-width: 1024px) {
    .wb-content-pile-cards {
        gap: 48px;
    }

    .wb-content-pile-cards__card-content {
        padding: 32px;
    }

    .wb-content-pile-cards__card-tagline {
        left: var(--section-padding-padding-section-small, 2rem);
        right: var(--section-padding-padding-section-small, 2rem);
    }

    .wb-content-pile-cards__card-title {
        font-size: var(--e-global-typography-21ead8b-font-size, 2rem);
        line-height: var(--e-global-typography-21ead8b-line-height, 1.3);
    }
    .wb-content-pile-cards__card{
        height: 450px;
    }
    .wb-content-pile-cards__card-media img {
        object-fit: contain;
    }
}


/* --------------------------------------------------------------------------
 * Responsive — Mobile (max-width: 767px)
 *
 * Cards switch to vertical layout: text on top, image below.
 * The pile effect remains active with sticky positioning.
 * -------------------------------------------------------------------------- */

@media (max-width: 767px) {
    .wb-content-pile-cards__stack {
        --pile-offset: 60px; /* Increased spacing between cards for "appearing from below" effect */
    }
    .wb-content-pile-cards {
        gap: 32px;
    }

    .wb-content-pile-cards__card {
        flex-direction: column;
        height: auto;
    }

    .wb-content-pile-cards__card-content {
        padding: 24px;
        min-height: auto;
        width: 100%;
    }

    .wb-content-pile-cards__card-tagline {
        position: initial;
        padding-top: 0;
    }

    .wb-content-pile-cards__card-title {
        font-size: var(--e-global-typography-e84df36-font-size, 1.5rem);
        line-height: var(--e-global-typography-e84df36-line-height, 1.4);
    }

    .wb-content-pile-cards__card-description {
        font-size: var(--e-global-typography-a22beb5-font-size, 0.875rem);
        line-height: var(--e-global-typography-a22beb5-line-height, 1.5);
    }

    .wb-content-pile-cards__card-media {
        flex: none;
        height: 280px;
        width: 100%;
    }
    .wb-content-pile-cards__header, .wb-content-pile-cards__header.header-sticky-disabled {
        position: static;
    }
    .wb-content-pile-cards__card-media img {
        object-fit: cover;
    }

}
