/* Loaded last — overrides legacy solution/product card CSS for shared scroll stack */

html:has(.scroll-card-stack) {
    scroll-behavior: smooth;
}

@media (min-width: 1101px) {
    /* Tighter strip gap for legacy solution/product pages only — not Pharmacy/Solution */
    .scroll-card-stack:not(.PharmacyScrollCards) {
        --stack-strip-gap: 5px;
        --card-top-offset: 5px;
        --card-stack-overlap: calc(var(--card-stack-height, 400px) - 5px);
    }

    /* Kill legacy list grid/gap/offset vars (e.g. veternary gap: 4vw, --card-top-offset: 1em) */
    .scroll-card-stack:not(.PharmacyScrollCards) ul[id$="-cards-list"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 0 !important;
        grid-template-columns: unset !important;
        grid-template-rows: unset !important;
        padding-bottom: 0 !important;
        margin-bottom: 0 !important;
        --card-top-offset: 5px !important;
        --stack-strip-gap: 5px !important;
        --card-stack-overlap: calc(var(--card-stack-height, 400px) - 5px) !important;
    }

    .scroll-card-stack {
        align-items: stretch !important;
    }

    .scroll-card-stack [class*="-cards-main"],
    .scroll-card-stack ul[id$="-cards-list"] {
        overflow: visible !important;
        background: transparent !important;
    }

    /* Reset legacy scale/sticky rules — stack uses width progression instead */
    .scroll-card-stack:not(.PharmacyScrollCards) .Pharmacy-card,
    .scroll-card-stack:not(.PharmacyScrollCards) [class*="-card"].Pharmacy-card,
    .scroll-card-stack:not(.PharmacyScrollCards) [class$="-card"] {
        position: sticky !important;
        top: var(--pharmacy-card-sticky-top) !important;
        padding-top: calc((var(--index, 1) - 1) * 7px) !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        display: flex !important;
        justify-content: center !important;
        align-items: flex-start !important;
        transition: z-index 0.3s ease;
    }

    .scroll-card-stack [id*="-card-"] [class*="-card-content"],
    .scroll-card-stack .Pharmacy-card-content {
        background: #ffffff !important;
        color: #131212;
        border-radius: var(--card-stack-radius, 13px);
        overflow: hidden;
        display: grid !important;
        grid-template-areas: "text img" !important;
        grid-template-columns: 1.2fr 0.8fr !important;
        align-items: center;
        padding: 2em;
        margin: 0 auto !important;
        height: var(--card-stack-height, 400px);
        max-width: min(1000px, calc(860px + (var(--index, 1) - 1) * 18px)) !important;
        width: min(100%, calc(var(--card-width-min, 88%) + (var(--index, 1) - 1) * var(--card-width-step, 2%))) !important;
        transform: none !important;
        scale: none !important;
        box-shadow: none;
        position: relative;
        z-index: 0;
        flex-shrink: 0;
        transition:
            width 0.65s cubic-bezier(0.22, 1, 0.36, 1),
            max-width 0.65s cubic-bezier(0.22, 1, 0.36, 1),
            height 0.65s cubic-bezier(0.22, 1, 0.36, 1),
            transform 0.65s cubic-bezier(0.22, 1, 0.36, 1),
            box-shadow 0.65s cubic-bezier(0.22, 1, 0.36, 1),
            border-radius 0.45s ease,
            padding 0.65s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .scroll-card-stack [id*="-card-"] [class*="-card-content"]::before,
    .scroll-card-stack .Pharmacy-card-content::before {
        content: '' !important;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        border-radius: inherit;
        padding: 2px;
        background: linear-gradient(270deg, #8873d7 0%, #1c48b2 100%) !important;
        -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
        -webkit-mask-composite: destination-out;
        mask-composite: exclude;
        z-index: -1;
        pointer-events: none;
    }

    .scroll-card-stack:not(.PharmacyScrollCards) [id*="-card-"] [class*="-card-content"]:hover,
    .scroll-card-stack:not(.PharmacyScrollCards) .Pharmacy-card-content:hover {
        transform: none !important;
        scale: none !important;
        box-shadow: none !important;
    }

    .scroll-card-stack:not(.PharmacyScrollCards) .Pharmacy-card.is-incoming [class*="-card-content"]:hover,
    .scroll-card-stack:not(.PharmacyScrollCards) .Pharmacy-card.is-incoming .Pharmacy-card-content:hover {
        transform: translateY(calc((1 - var(--enter-progress, 0)) * 72px)) !important;
        box-shadow: 0 14px 40px rgba(28, 72, 178, 0.1) !important;
    }

    .scroll-card-stack .Pharmacy-card.is-active {
        z-index: 200;
    }

    .scroll-card-stack .Pharmacy-card.is-incoming {
        z-index: 300;
    }

    .scroll-card-stack .Pharmacy-card.is-far-below {
        visibility: hidden;
        pointer-events: none;
    }

    .scroll-card-stack .Pharmacy-card.is-past {
        pointer-events: none;
    }

    /* Collapsed purple border strips at top */
    .scroll-card-stack:not(.PharmacyScrollCards) .Pharmacy-card.is-past .Pharmacy-card-content,
    .scroll-card-stack:not(.PharmacyScrollCards) .Pharmacy-card.is-past [class*="-card-content"] {
        height: 5px !important;
        min-height: 5px !important;
        max-height: 5px !important;
        overflow: hidden !important;
        padding: 0 !important;
        box-shadow: none !important;
        border-radius: var(--card-strip-radius, 6px) var(--card-strip-radius, 6px) 0 0 !important;
        background: #ffffff !important;
        clip-path: inset(0 round var(--card-strip-radius, 6px) var(--card-strip-radius, 6px) 0 0);
        contain: paint;
        transform: translateY(0) !important;
    }

    .scroll-card-stack .Pharmacy-card.is-past .Pharmacy-card-content::before,
    .scroll-card-stack .Pharmacy-card.is-past [class*="-card-content"]::before {
        border-radius: var(--card-strip-radius, 6px) var(--card-strip-radius, 6px) 0 0 !important;
        bottom: 0;
        padding: 2px 2px 0;
    }

    .scroll-card-stack .Pharmacy-card.is-past .Pharmacy-card-content > div,
    .scroll-card-stack .Pharmacy-card.is-past .Pharmacy-card-content > figure,
    .scroll-card-stack .Pharmacy-card.is-past [class*="-card-content"] > div,
    .scroll-card-stack .Pharmacy-card.is-past [class*="-card-content"] > figure {
        display: none !important;
    }

    .scroll-card-stack .Pharmacy-card.is-active .Pharmacy-card-content,
    .scroll-card-stack .Pharmacy-card.is-active [class*="-card-content"] {
        border-radius: var(--card-stack-radius, 13px) !important;
        background: #ffffff !important;
        box-shadow: 0 10px 36px rgba(28, 72, 178, 0.08);
        transform: translateY(0) !important;
    }

    .scroll-card-stack .Pharmacy-card.is-active .Pharmacy-card-content::before,
    .scroll-card-stack .Pharmacy-card.is-active [class*="-card-content"]::before {
        border-radius: var(--card-stack-radius, 13px) !important;
    }

    .scroll-card-stack .Pharmacy-card.is-incoming .Pharmacy-card-content,
    .scroll-card-stack .Pharmacy-card.is-incoming [class*="-card-content"] {
        transform: translateY(calc((1 - var(--enter-progress, 0)) * 72px)) !important;
        border-radius: var(--card-stack-radius, 13px) !important;
        background: #ffffff !important;
        box-shadow: 0 14px 40px rgba(28, 72, 178, 0.1);
        transition:
            transform 0.12s linear,
            box-shadow 0.65s cubic-bezier(0.22, 1, 0.36, 1),
            width 0.65s cubic-bezier(0.22, 1, 0.36, 1),
            max-width 0.65s cubic-bezier(0.22, 1, 0.36, 1) !important;
    }

    .scroll-card-stack .Pharmacy-card.is-incoming .Pharmacy-card-content::before,
    .scroll-card-stack .Pharmacy-card.is-incoming [class*="-card-content"]::before {
        border-radius: var(--card-stack-radius, 13px) !important;
    }

    .scroll-card-stack [class*="-tabs-container"].detached {
        position: sticky !important;
        top: var(--pharmacy-sticky-offset) !important;
    }

    .scroll-card-stack nav[id*="sticky-tabs"],
    .scroll-card-stack [class*="-tabs-container"].Pharmacy-tabs-container {
        position: sticky !important;
        top: var(--pharmacy-sticky-offset) !important;
        background-color: #ecfaff !important;
        z-index: 600 !important;
        align-self: flex-start !important;
    }
}

@media (max-width: 1100px) {
    .scroll-card-stack ul[id$="-cards-list"] {
        background: #ecfaff;
    }

    .scroll-card-stack .Pharmacy-card,
    .scroll-card-stack [class*="-card"].Pharmacy-card {
        position: static !important;
        padding-top: 0 !important;
    }

    .scroll-card-stack [class*="-card-content"],
    .scroll-card-stack .Pharmacy-card-content {
        transform: none !important;
        scale: none !important;
        height: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        background: #ffffff !important;
    }
}
