/* ==========================================================================
   Stacked Overlapping Cards Section Styles (Exact Sticky Overlap & Release)
   ========================================================================== */

.stacked-cards-section {
    position: relative;
    max-width: 1240px;
    margin: 0 auto;
    padding: 40px 20px;
    display: block;
}

.stacked-cards__container {
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Card General Base Styling */
.stacked-cards__card {
    width: 100%;
    border-radius: 28px;
    background-color: var(--card-bg, #3b82f6);
    color: var(--card-color, #ffffff);
    overflow: hidden;
}

/* --------------------------------------------------------------------------
   Block A (Card 1 - Blue): Sticky at top: 25px when reached
   -------------------------------------------------------------------------- */
.stacked-cards__card:first-child {
    position: sticky;
    top: -220px;
    z-index: 1;
    width: 90%;
    margin-left: auto;
    margin-right: auto;
}

/* --------------------------------------------------------------------------
   Block B (Card 2 - Red): Starts 140vh below off-screen.
   When scrolling past Block A's button, Block B slides UP over Block A and locks at top: 180px.
   When Block B locks, section finishes and releases sticky state!
   -------------------------------------------------------------------------- */
.stacked-cards__card:nth-child(2) {
    position: sticky;
    top: 180px;
    z-index: 2;
    margin-top: 140vh;
}

/* Subsequent Cards if present */
.stacked-cards__card:nth-child(3) {
    position: sticky;
    top: 280px;
    z-index: 3;
    margin-top: 150vh;
}

.stacked-cards__card-inner {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
    gap: 36px;
    padding: 44px 44px;
    min-height: 480px;
}

.stacked-cards__card-inner--reverse {
    grid-template-columns: 0.9fr 1.1fr;
}

.stacked-cards__card-inner--reverse .stacked-cards__content {
    order: 2;
}

.stacked-cards__card-inner--reverse .stacked-cards__media {
    order: 1;
}

/* Content Left Column Styles */
.stacked-cards__content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.stacked-cards__sub-tag {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    color: var(--card-color, #ffffff);
    margin-bottom: 32px;
    display: inline-block;
}

.stacked-cards__sub-heading p,
.stacked-cards__sub-heading {
    font-family: 'Poppins', sans-serif;
    font-size: 64px;
    font-weight: 300;
    font-style: italic;
    max-width: 532px;
    line-height: 1.25;
    color: var(--card-color, #ffffff);
}

.stacked-cards__heading h1,
.stacked-cards__heading h2,
.stacked-cards__heading h3,
.stacked-cards__heading p,
.stacked-cards__heading {
    font-family: 'Poppins', sans-serif;
    font-size: 64px;
    font-weight: 800;
    line-height: 1.25;
    color: var(--card-color, #ffffff);
}

.stacked-cards__description {
    margin-top: 1.6rem;
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--card-color, #ffffff);
    font-weight: 300;
    margin-bottom: 28px;
    max-width: 532px;
}

.stacked-cards__description p {
    margin: 0 0 24px 0;
}

.stacked-cards__description p:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Bracket Button with button__outer (Matching Slideshow Button Design)
   ========================================================================== */

.stacked-cards__button-wrapper {
    display: flex;
    margin-top: 14px;
    position: relative;
}

.stacked-cards__button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 38px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.18);
    color: #ffffff;
    font-family: 'Poppins', sans-serif;
    font-weight: 300;
    font-size: 16px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.35s cubic-bezier(0.25, 1, 0.25, 1);
    text-decoration: none;
    cursor: pointer;
    border: 0;
    outline: none;
    box-shadow: none;
    box-sizing: border-box;
}

.stacked-cards__button:hover {
    background: #ffffff;
    color: #000000;
    border: 0;
    outline: none;
    box-shadow: none;
    transform: translateY(-1px);
}

.stacked-cards-section .button::after,
.stacked-cards-section .button:hover::after,
.stacked-cards__button::after,
.stacked-cards__button:hover::after {
    display: none;
    content: none;
    box-shadow: none;
    border: 0;
}

/* Outer Bracket Ring Container */
.stacked-cards-section .button__outer {
    position: absolute;
    inset: -8px;
    border-radius: 14px;
    border: 1.5px solid rgba(255, 255, 255, 0.45);
    pointer-events: none;
    overflow: visible;
    transition: border-color 0.35s ease;
}

.stacked-cards-section .stacked-cards__button:hover .button__outer {
    border-color: rgba(255, 255, 255, 0.85);
}

/* Bracket Accent 1: Top-Left Corner (Default) -> Moves to Middle Top (Hover) */
.stacked-cards-section .button__outer::before {
    content: '';
    position: absolute;
    top: -1px;
    left: -1px;
    width: 25px;
    height: 25px;
    border-top: 2.5px solid #ffffff;
    border-left: 2.5px solid #ffffff;
    border-top-left-radius: 14px;
    transform: translate(0, 0);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.25, 1);
}

/* Bracket Accent 2: Bottom-Right Corner (Default) -> Moves to Middle Bottom (Hover) */
.stacked-cards-section .button__outer::after {
    content: '';
    position: absolute;
    bottom: -1px;
    right: -1px;
    width: 25px;
    height: 25px;
    border-bottom: 2.5px solid #ffffff;
    border-right: 2.5px solid #ffffff;
    border-bottom-right-radius: 14px;
    transform: translate(0, 0);
    transition: all 0.4s cubic-bezier(0.25, 1, 0.25, 1);
}

/* Hover: Top-Left Accent Moves to Middle Top */
.stacked-cards-section .stacked-cards__button:hover .button__outer::before {
    top: -1px;
    left: 50%;
    transform: translate(-50%, 0);
    width: 20px;
    height: 0;
    border-left-color: transparent;
    border-top-left-radius: 0;
}

/* Hover: Bottom-Right Accent Moves to Middle Bottom */
.stacked-cards-section .stacked-cards__button:hover .button__outer::after {
    bottom: -1px;
    right: 50%;
    transform: translate(50%, 0);
    width: 20px;
    height: 0;
    border-right-color: transparent;
    border-bottom-right-radius: 0;
}

/* Media Right Column Styles */
.stacked-cards__media {
    width: 100%;
    height: 100%;
    min-height: 340px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border-radius: 20px;
}

.stacked-cards__image,
.stacked-cards__media img {
    width: 100%;
    height: 100%;
    max-height: 400px;
    object-fit: cover;
    object-position: center;
    border-radius: 20px;
    display: block;
}

.stacked-cards__placeholder {
    width: 100%;
    height: 340px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Responsive Mobile Layout (Mobile Phones under 750px) */
@media (max-width: 749px) {
    .stacked-cards-section {
        padding: 30px 12px 60px 12px;
    }

    .stacked-cards__card:first-child {
        top: -900px;
    }

    .stacked-cards__card:nth-child(2) {
        top: 60px;
        margin-top: 200vh;
    }

    .stacked-cards__card-inner {
        grid-template-columns: 1fr;
        padding: 28px 20px;
        gap: 24px;
        min-height: auto;
    }

    .stacked-cards__sub-heading p,
    .stacked-cards__sub-heading {
        font-size: 26px;
    }

    .stacked-cards__heading h1,
    .stacked-cards__heading h2,
    .stacked-cards__heading h3,
    .stacked-cards__heading p,
    .stacked-cards__heading {
        font-size: 30px;
    }

    .stacked-cards__media {
        min-height: 220px;
    }

    .stacked-cards__image,
    .stacked-cards__media img {
        max-height: 280px;
    }
}

@media (max-width: 959px) {
    .stacked-cards__card:first-child {
        top: -450px;
    }
}

@media (max-width: 1024px) {

    .stacked-cards__heading h1,
    .stacked-cards__heading h2,
    .stacked-cards__heading h3,
    .stacked-cards__heading p,
    .stacked-cards__heading,
    .stacked-cards__sub-heading p,
    .stacked-cards__sub-heading {
        font-size: 32px;
    }
}