/* Stacked Cards Block Styles */
.wp-block-group-is-layout-constrained > :where(.stacked-cards-block)  {
    max-width: 100% !important;
}

.stacked-cards-block {
    position: relative;
    width: 100%;
    padding: 4.5rem 0 0 0;
    margin-bottom: -4rem; /* Negative to pull up the block that appears underneath the stacked cards block */
}

.stacked-cards__container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    /* padding: 0 1.5rem; */
}

.stacked-cards__title {
    text-align: center;
    margin-bottom: 4rem;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 600;
    color: var(--wp--preset--color--contrast);
}

/* Wrapper - simple flex container */
.stacked-cards__wrapper {
    margin: 0 auto;
    width: fit-content;
    display: flex;
    flex-direction: column;
}

/* Card - uses CSS variable for dynamic sticky positioning */
.stacked-cards__card {
    margin: 0 auto 20px auto;
    padding: 2rem;
    border-radius: 1.5rem;
    background: var(--card-bg-color, #FFFFFF);
    color: var(--card-text-color, var(--wp--preset--color--heading));
    /* box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15); */
    border: none;
    flex: none;
    position: sticky;
    /* Dynamic top position based on card index */
    top: calc(var(--card-index, 0) * 2rem + 4rem);
    max-width: 1200px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0;
    align-items: center;
    width: 100%;
}

/* All card colors are now controlled via ACF fields */

/* Image section */
.stacked-cards__image {
    width: auto;
    height: 100%;
    overflow: hidden;
}

/* Desktop image - shown on larger screens */
.stacked-cards__image--desktop {
    margin: 0px 20px 0px 0;
    display: block;
    padding: 18px 0px;
}

/* Mobile image - hidden by default */
.stacked-cards__image--mobile {
    display: none;
}

.stacked-cards__image img {
    width: 350px;
    height: 100%;
    object-fit: cover;
    display: block;
    border-radius: 1.5rem;
    /* box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); */
}

/* Content section */
.stacked-cards__content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-right: 2rem;
}

.stacked-cards__card-title {
    font-size: 2.625rem; /* 42px */
    font-weight: 400;
    color: inherit;
    margin: 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.stacked-cards__introduction {
    font-family: var(--wp--preset--font-family--body);
    font-size: 1.125rem; /* 18px */
    line-height: 1.6;
    color: inherit;
    opacity: 0.85;
    margin-bottom: 0.5rem;
}

/* Bullets section */
.stacked-cards__bullets {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin: 0.5rem 0;
}

.stacked-cards__bullet {
    position: relative;
    padding-left: 2.5rem;
}

.stacked-cards__bullet::before {
    content: "";
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M22.247 10.6183L12.0106 20.8546L7.23505 16.0791L8.50784 14.8064L12.0106 18.3091L20.9742 9.34546L22.247 10.6183Z' fill='white'/%3E%3C/svg%3E");
    position: absolute;
    left: 0;
    top: -3px;
    width: 1.5rem;
    height: 1.5rem;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: normal;
    opacity: 1;
}

.stacked-cards__wrapper .stacked-cards__card:nth-child(2) .stacked-cards__bullet::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='29' height='29' viewBox='0 0 29 29' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M22.247 10.6183L12.0106 20.8546L7.23505 16.0791L8.50784 14.8064L12.0106 18.3091L20.9742 9.34546L22.247 10.6183Z' fill='%231C2C88'/%3E%3C/svg%3E%0A");
}

.stacked-cards__bullet-heading {
    font-size: 1.3125rem; /* 21px */
    font-weight: 500;
    color: inherit;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

.stacked-cards__bullet-description {
    font-size: 0.8125rem; /* 13px */
    font-weight: 500;
    line-height: 1.6;
    color: inherit;
    opacity: 0.85;
    margin: 0;
}

/* CTA Button */
.stacked-cards__cta {
    margin-top: 2rem;
}

.stacked-cards__button {
    display: inline-block;
    padding: 0.875rem 2.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    background: var(--wp--preset--color--primary);
    color: var(--wp--preset--color--base);
}

.stacked-cards__button:hover {
    background: var(--wp--preset--color--secondary);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(14, 111, 255, 0.3);
}

/* White button variant - increased specificity */
.stacked-cards__button.stacked-cards__button--white,
.wp-block-button__link.stacked-cards__button--white {
    background: var(--wp--preset--color--base) !important;
    color: var(--wp--preset--color--secondary) !important;
    border: 2px solid var(--wp--preset--color--base);
}

.stacked-cards__button.stacked-cards__button--white:hover,
.wp-block-button__link.stacked-cards__button--white:hover {
    background: var(--wp--preset--color--base-2) !important;
    color: var(--wp--preset--color--secondary) !important;
    border-color: var(--wp--preset--color--base-2);
    box-shadow: 0 6px 20px rgba(255, 255, 255, 0.3);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .stacked-cards__wrapper {
        width: 100%;
    }

    .stacked-cards__card {
        grid-template-columns: 1fr;
        text-align: center;
        padding: 2.5rem 1.5rem;
        width: 100%;
        position: relative;
        margin-bottom: 0px;
    }
    
    /* Hide desktop image, show mobile image for tablets too */
    .stacked-cards__image--desktop {
        display: none;
    }
    
    .stacked-cards__image--mobile {
        display: block;
        margin: 0 auto 1.5rem;
    }
    
    /* Center content for tablets */
    .stacked-cards__content {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
        padding-right: 0;
    }
    
    .stacked-cards__card-title {
        margin-bottom: 1.5rem;
    }

    .stacked-cards__introduction,
    .stacked-cards__bullets {
        max-width: 820px;
        padding: 0 1.5rem;
    }
    
    .stacked-cards__introduction {
        text-align: left;
    }
    
    .stacked-cards__bullets {
        text-align: left;
        margin: 0 auto;
        width: 100%;
    }
    
    .stacked-cards__cta {
        display: flex;
        justify-content: center;
    }
    
    .stacked-cards__image img {
        width: 100%;
        max-width: 500px;
    }

    .stacked-cards-block {
        margin-bottom: 2.5rem;
        padding-top: 0px;
    }
}

@media (max-width: 768px) {
    .stacked-cards__wrapper {
        padding-bottom: 1.5rem;
    }

    .stacked-cards__card {
        margin-bottom: 0.5rem;
        /* Adjust stacking offset for mobile */
        top: calc(var(--card-index, 0) * 1.5rem + 1.5rem);
        text-align: center;
        padding: 2.5rem 1.5rem;
    }
    
    /* Hide desktop image, show mobile image */
    .stacked-cards__image--desktop {
        display: none;
    }
    
    .stacked-cards__image--mobile {
        display: block;
        margin: 0 auto 1.5rem;
    }
    
    /* Center content for mobile */
    .stacked-cards__content {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    
    .stacked-cards__card-title {
        font-size: 2rem; /* Scale down on mobile */
        margin-bottom: 1.5rem;
    }

    .stacked-cards__introduction,
    .stacked-cards__bullets {
        padding: 0;
    }
    
    .stacked-cards__introduction {
        font-size: 1rem; /* Scale down on mobile */
        max-width: 500px;
    }
    
    .stacked-cards__bullets {
        text-align: left;
        max-width: 500px;
        margin: 0 auto;
    }
    
    .stacked-cards__bullet-heading {
        font-size: 1.125rem; /* Scale down on mobile */
    }
    
    .stacked-cards__bullet-description {
        font-size: 0.8125rem; /* Keep 13px on mobile */
    }
    
    .stacked-cards__cta {
        display: flex;
        justify-content: center;
    }
    
    .stacked-cards__image img {
        width: 100%;
        max-width: 420px;
    }

    .stacked-cards-block {
        padding-top: 1rem;
    }
}

/* Preview mode adjustments */
.editor-styles-wrapper .stacked-cards-block {
    margin-bottom: 10rem;
}

.editor-styles-wrapper .stacked-cards__card {
    position: relative;
    margin-bottom: 2rem;
}