/* =============================================
   PMS Stack Cards — style.css
   Apple-level sticky scroll stacking effect
   Built to work reliably on desktop AND mobile.
   ============================================= */

/* ---------------------------------------------------------------
   CRITICAL: position:sticky silently fails if ANY ancestor element
   has overflow:hidden/auto/scroll applied. This is the #1 cause of
   "cards just stack flat on mobile" — far more common than any JS
   issue, since mobile theme/Elementor breakpoints are more likely
   to add overflow-x:hidden on sections to prevent horizontal
   scroll bugs.

   Scoped narrowly: only ancestors that actually CONTAIN our widget
   (.elementor-widget-psc_stack_cards) are affected, so other
   widgets elsewhere on the page that rely on overflow:hidden
   (carousels, image masks, etc.) are left untouched.
--------------------------------------------------------------- */
body:has(.elementor-widget-psc_stack_cards),
.elementor-section:has(.elementor-widget-psc_stack_cards),
.elementor-container:has(.elementor-widget-psc_stack_cards),
.elementor-column:has(.elementor-widget-psc_stack_cards),
.elementor-widget-wrap:has(.elementor-widget-psc_stack_cards),
.e-con:has(.elementor-widget-psc_stack_cards),
.e-con-inner:has(.elementor-widget-psc_stack_cards) {
    overflow: visible !important;
}

/* Fallback for browsers without :has() support (older mobile browsers):
   broader but still only fires overflow-x as clip, not full visible,
   so it is lower-risk as a blanket rule. */
@supports not selector(:has(a)) {
    html, body {
        overflow-x: clip;
    }
}


.psc-wrapper {
    position: relative;
}

.psc-card {
    position: sticky;
    left: 0;
    right: 0;
    width: 100%;
    min-height: var(--psc-min-h, 480px);
    border-radius: 24px;
    overflow: hidden;
    margin-bottom: 0;
    will-change: transform;
    transform-origin: top center;
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow:
        0 2px 4px rgba(0,0,0,.04),
        0 8px 24px rgba(0,0,0,.08),
        0 24px 48px rgba(0,0,0,.06);
}

.psc-card.is-scaled {
    box-shadow:
        0 1px 2px rgba(0,0,0,.02),
        0 4px 12px rgba(0,0,0,.04);
}


/* Inner layout: default side-by-side */
.psc-card__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: inherit;
    align-items: center;
}

.psc-card__inner.psc-layout--left {
    direction: rtl;
}
.psc-card__inner.psc-layout--left > * {
    direction: ltr;
}

.psc-card__inner.psc-layout--top {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
}
.psc-card__inner.psc-layout--top .psc-card__media {
    order: -1;
    height: 320px;
}

/* Single column: no image */
.psc-card__inner:not(.psc-layout--right):not(.psc-layout--left):not(.psc-layout--top) {
    grid-template-columns: 1fr;
}

/* Content */
.psc-card__content {
    padding: 48px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    justify-content: center;
}

.psc-card__label {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0.85;
}

.psc-card__title {
    font-size: clamp(28px, 3.5vw, 48px);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.02em;
    margin: 0;
}

.psc-card__desc {
    font-size: clamp(16px, 1.4vw, 19px);
    line-height: 1.65;
    opacity: 0.7;
    margin: 0;
    max-width: 480px;
}

.psc-card__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    align-self: flex-start;
    margin-top: 8px;
    padding: 12px 22px;
    border: 1.5px solid currentColor;
    border-radius: 100px;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: background 0.2s ease, color 0.2s ease;
    letter-spacing: -0.01em;
}
.psc-card__btn:hover {
    background: currentColor;
}
.psc-card__btn:hover span,
.psc-card__btn:hover {
    filter: invert(1);
}

/* Media */
.psc-card__media {
    height: 100%;
    min-height: 340px;
    overflow: hidden;
    position: relative;
}
.psc-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.psc-card:hover .psc-card__media img {
    transform: scale(1.03);
}

/* Question / Highlight zone */
.psc-card__question {
    position: relative;
    padding: 18px 20px 18px 24px;
    border-radius: 12px;
    background: rgba(0,0,0,0.04);
    font-size: clamp(15px, 1.3vw, 18px);
    font-weight: 600;
    line-height: 1.5;
    font-style: italic;
    letter-spacing: -0.01em;
    border-left: 3px solid currentColor;
    opacity: 0.9;
}

.psc-card__question-mark {
    display: block;
    font-size: 28px;
    line-height: 1;
    margin-bottom: 4px;
    opacity: 0.35;
    font-style: normal;
}

/* ---- Mobile (≤768px wide) ----
   Cards are taller here on purpose (--psc-min-h-mobile) so there's
   enough room for the full text to be visible before the next
   card docks on top of it.
--------------------------------------------------------------- */
@media (max-width: 768px) {
    .psc-card {
        min-height: var(--psc-min-h-mobile, 560px);
    }

    .psc-card__inner,
    .psc-card__inner.psc-layout--right,
    .psc-card__inner.psc-layout--left {
        grid-template-columns: 1fr;
        direction: ltr;
    }
    .psc-card__inner .psc-card__media {
        order: -1;
        min-height: 200px;
        height: 200px;
    }
    .psc-card__content {
        padding: 28px 20px;
        gap: 12px;
    }
    .psc-card__title {
        font-size: 24px;
    }
    .psc-card__desc {
        font-size: 15px;
    }
    .psc-card__question {
        font-size: 14px;
        padding: 12px 14px 12px 16px;
    }
}

/* ---- Landscape phones: tall content, short viewport ---- */
@media (max-height: 500px) and (orientation: landscape) {
    .psc-card {
        min-height: 0;
    }

    .psc-card__inner,
    .psc-card__inner.psc-layout--right,
    .psc-card__inner.psc-layout--left {
        grid-template-columns: 40% 1fr;
        direction: ltr;
        align-items: start;
    }

    .psc-card__inner .psc-card__media {
        order: 0;
        height: 100%;
        min-height: 0;
        align-self: stretch;
    }

    .psc-card__content {
        padding: 20px 24px;
        gap: 10px;
        overflow-y: auto;
        max-height: 90vh;
    }

    .psc-card__title  { font-size: 20px; line-height: 1.15; }
    .psc-card__label  { font-size: 11px; }
    .psc-card__desc   { font-size: 13px; line-height: 1.5; }
    .psc-card__question {
        font-size: 13px;
        padding: 10px 12px 10px 14px;
    }
    .psc-card__question-mark { font-size: 20px; margin-bottom: 2px; }
    .psc-card__btn {
        font-size: 13px;
        padding: 8px 16px;
        margin-top: 4px;
    }
    .psc-card { border-radius: 16px; }

    .psc-card__inner.psc-layout--top {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
    .psc-card__inner.psc-layout--top .psc-card__media {
        display: none;
    }
}

/* ---- Editor preview: disable sticky so Elementor canvas behaves ---- */
.elementor-editor-active .psc-card {
    position: relative !important;
    top: auto !important;
    margin-bottom: 24px;
    transform: none !important;
}
