/* SYS Explore Beyond V2 — background-plane morph (not foreground overlay)
   Layer order: bg → morph → overlay → cards → content */

#explore-beyond-section.sys-eb {
    position: relative;
    width: 100%;
    overflow: hidden;
    isolation: isolate;
    z-index: 0;
    color: #fff;
    background: #0f2a1f;
}

.sys-eb-stage {
    position: relative;
    width: 100%;
    min-height: 680px;
    height: clamp(680px, 78vh, 920px);
    overflow: hidden;
}

/* ---- Committed background ---- */
.sys-eb-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-color: #0f2a1f;
    opacity: 0;
    overflow: hidden;
}

.sys-eb-bg.is-visible {
    opacity: 1;
}

.sys-eb-bg img,
.sys-eb-morph img,
.sys-eb-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    pointer-events: none;
    user-select: none;
}

/* Morph lives in BACKGROUND plane — under overlay + content + cards */
.sys-eb-morph {
    position: absolute;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    border-radius: 1.1rem;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
    will-change: left, top, width, height, border-radius, box-shadow;
    transform: translateZ(0);
}

.sys-eb-morph.is-active {
    opacity: 1;
}

/* Persistent overlay ABOVE morph — never removed per slide */
.sys-eb-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
    background:
        linear-gradient(90deg, rgba(8, 28, 20, 0.72) 0%, rgba(8, 28, 20, 0.42) 38%, rgba(8, 28, 20, 0.12) 68%, rgba(8, 28, 20, 0.22) 100%),
        linear-gradient(180deg, rgba(15, 42, 31, 0.18) 0%, rgba(15, 42, 31, 0.06) 40%, rgba(10, 55, 70, 0.48) 100%),
        linear-gradient(135deg, rgba(22, 101, 52, 0.16) 0%, transparent 55%);
}

/* ---- Content ABOVE background plane ---- */
.sys-eb-content {
    position: relative;
    z-index: 5;
    display: grid;
    grid-template-columns: 2.5rem minmax(0, 1fr);
    align-items: center;
    width: 100%;
    height: 100%;
    min-height: inherit;
    padding: clamp(1.5rem, 4vw, 3.5rem);
    box-sizing: border-box;
    pointer-events: none;
}

.sys-eb-content > * {
    pointer-events: auto;
}

.sys-eb-rail {
    position: relative;
    width: 2px;
    height: min(58vh, 26rem);
    align-self: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.18));
    border-radius: 999px;
}

.sys-eb-rail-dots { position: absolute; inset: 0; }

.sys-eb-dot {
    position: absolute;
    left: 50%;
    width: 10px;
    height: 10px;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.55);
    transform: translate(-50%, -50%) scale(1);
    cursor: pointer;
    transition: transform 0.35s ease, background 0.35s ease, box-shadow 0.35s ease, opacity 0.35s ease;
    opacity: 0.55;
}

.sys-eb-dot.is-past {
    opacity: 0.85;
    background: rgba(255, 255, 255, 0.75);
}

.sys-eb-dot.is-active {
    opacity: 1;
    background: #fff;
    transform: translate(-50%, -50%) scale(1.85);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.65);
}

.sys-eb-dot:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 4px;
}

.sys-eb-rail-progress {
    position: absolute;
    left: 50%;
    top: 0;
    width: 3px;
    height: 0;
    margin-left: -1.5px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    transform-origin: top center;
}

.sys-eb-copy {
    max-width: min(34rem, 38vw);
    min-width: 0;
    padding-left: 1.25rem;
}

.sys-eb-counter {
    display: none;
    margin: 0 0 0.65rem;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.85;
}

.sys-eb-title,
.sys-eb-desc {
    margin: 0;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.35);
    transition: opacity 380ms cubic-bezier(0.4, 0, 0.2, 1), transform 380ms cubic-bezier(0.4, 0, 0.2, 1);
}

.sys-eb-title {
    font-weight: 800;
    font-size: clamp(2rem, 3.2vw, 3.25rem);
    line-height: 1.08;
    letter-spacing: 0.01em;
}

.sys-eb-desc {
    margin-top: 0.9rem;
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    line-height: 1.65;
    opacity: 0.94;
    max-width: 36ch;
}

.sys-eb-copy.is-leaving .sys-eb-title,
.sys-eb-copy.is-leaving .sys-eb-desc {
    opacity: 0;
    transform: translateY(8px);
}

.sys-eb-copy.is-entering .sys-eb-title,
.sys-eb-copy.is-entering .sys-eb-desc {
    opacity: 0;
    transform: translateY(12px);
}

.sys-eb-copy.is-entered .sys-eb-title,
.sys-eb-copy.is-entered .sys-eb-desc {
    opacity: 1;
    transform: translateY(0);
}

/* ---- Cards ABOVE morph/overlay ---- */
.sys-eb-cards {
    position: absolute;
    inset: 0;
    z-index: 4;
    pointer-events: none;
}

.sys-eb-card {
    position: absolute;
    border: 0;
    padding: 0;
    overflow: hidden;
    cursor: pointer;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 1.1rem;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.35);
    outline: none;
    will-change: transform;
    transition: box-shadow 280ms ease;
}

.sys-eb-card::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
    pointer-events: none;
    z-index: 1;
}

.sys-eb-card:focus-visible {
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.85), 0 14px 36px rgba(0, 0, 0, 0.35);
}

/* Source card hidden only after morph is aligned — layout slot preserved */
.sys-eb-card.is-morph-source {
    visibility: hidden !important;
    pointer-events: none !important;
    box-shadow: none !important;
}

.sys-eb-card.is-lg {
    left: 45%;
    top: 28%;
    width: 18.5%;
    height: 48%;
    z-index: 5;
    opacity: 1;
}

.sys-eb-card.is-md {
    left: 65%;
    top: 31%;
    width: 15%;
    height: 42%;
    z-index: 4;
    opacity: 0.92;
}

.sys-eb-card.is-sm {
    left: 82%;
    top: 34%;
    width: 13.5%;
    height: 36%;
    z-index: 3;
    opacity: 0.8;
}

.sys-eb-card-label {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    padding: 1.75rem 0.75rem 0.7rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center;
    color: #fff;
    background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.55));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sys-eb-mobile-progress {
    display: none;
    align-items: center;
    gap: 0.4rem;
}

.sys-eb-mobile-dot {
    width: 7px;
    height: 7px;
    border-radius: 999px;
    border: 0;
    padding: 0;
    background: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: width 0.3s ease, background 0.3s ease;
}

.sys-eb-mobile-dot.is-active {
    width: 22px;
    background: #fff;
}

/* ---- Tablet only (desktop ≥1024 unchanged) ---- */
@media (max-width: 1023px) {
    .sys-eb-stage {
        display: flex;
        flex-direction: column;
        min-height: min(640px, 88svh);
        height: auto;
    }

    .sys-eb-bg,
    .sys-eb-morph,
    .sys-eb-overlay {
        position: absolute;
        inset: 0;
    }

    .sys-eb-overlay {
        background:
            linear-gradient(90deg, rgba(8, 28, 20, 0.55) 0%, rgba(8, 28, 20, 0.22) 55%, rgba(8, 28, 20, 0.18) 100%),
            linear-gradient(180deg, rgba(8, 28, 20, 0.2) 0%, rgba(8, 28, 20, 0.12) 28%, rgba(8, 28, 20, 0.55) 72%, rgba(8, 28, 20, 0.78) 100%),
            linear-gradient(135deg, rgba(22, 101, 52, 0.14) 0%, transparent 55%);
    }

    .sys-eb-content {
        position: relative;
        z-index: 5;
        display: grid;
        grid-template-columns: 2rem minmax(0, 1fr);
        align-items: start;
        width: 100%;
        height: auto;
        min-height: 0;
        padding: clamp(1.75rem, 4.5vw, 2.5rem) 1.35rem 0.75rem;
        flex: 0 0 auto;
        order: 1;
    }

    .sys-eb-rail {
        height: 9.5rem;
        margin-top: 0.35rem;
        align-self: start;
    }

    .sys-eb-copy {
        max-width: none;
        padding-top: 0.15rem;
        padding-left: 0.85rem;
    }

    .sys-eb-title {
        font-size: clamp(1.85rem, 4.2vw, 2.6rem);
    }

    .sys-eb-desc {
        max-width: 42ch;
    }

    /* Cards become a flow strip under copy (not absolute over empty stage) */
    .sys-eb-cards {
        position: relative;
        inset: auto;
        z-index: 4;
        width: 100%;
        height: 12.75rem;
        min-height: 12.75rem;
        margin-top: 1.35rem;
        padding: 0.35rem 1.25rem 1.75rem;
        flex: 0 0 auto;
        box-sizing: border-box;
        order: 2;
    }

    .sys-eb-card.is-lg {
        left: 0;
        top: 0.35rem;
        bottom: auto;
        width: min(42%, 15rem);
        height: auto;
        aspect-ratio: 4 / 3;
        max-height: 11.5rem;
    }

    .sys-eb-card.is-md {
        left: 38%;
        top: 1rem;
        bottom: auto;
        width: min(30%, 11rem);
        height: auto;
        aspect-ratio: 4 / 3;
        max-height: 10rem;
    }

    .sys-eb-card.is-sm {
        left: 66%;
        top: 1.5rem;
        bottom: auto;
        width: min(24%, 9rem);
        height: auto;
        aspect-ratio: 4 / 3;
        max-height: 8.75rem;
    }
}

/* ---- Phone / small devices ---- */
@media (max-width: 767px) {
    .sys-eb-stage {
        min-height: min(640px, 100svh);
        height: auto;
    }

    .sys-eb-bg img,
    .sys-eb-morph img {
        /* Bias crop downward to reduce empty sky on mobile */
        object-position: center 62%;
    }

    .sys-eb-overlay {
        background:
            linear-gradient(180deg,
                rgba(8, 28, 20, 0.12) 0%,
                rgba(8, 28, 20, 0.22) 28%,
                rgba(8, 28, 20, 0.58) 58%,
                rgba(8, 28, 20, 0.78) 100%),
            linear-gradient(135deg, rgba(22, 101, 52, 0.12) 0%, transparent 50%);
    }

    .sys-eb-content {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        align-items: stretch;
        gap: 0;
        width: 100%;
        height: auto;
        min-height: 0;
        /* Scenic breathing room — content starts higher, not bottom-anchored */
        padding: clamp(2.75rem, 9svh, 4rem) 1rem 0;
        order: 1;
    }

    .sys-eb-rail { display: none; }

    .sys-eb-copy {
        max-width: none;
        width: 100%;
        padding-left: 0;
        margin-top: 0;
    }

    .sys-eb-counter {
        display: flex;
        margin: 0 0 0.45rem;
        font-size: 0.75rem;
    }

    .sys-eb-mobile-progress {
        display: flex;
        margin: 0 0 0.7rem;
        gap: 0.35rem;
    }

    .sys-eb-title {
        font-size: clamp(1.7rem, 7vw, 2.2rem);
        max-width: 16ch;
        line-height: 1.12;
    }

    .sys-eb-desc {
        margin-top: 0.5rem;
        font-size: 0.94rem;
        line-height: 1.5;
        max-width: none;
        display: -webkit-box;
        -webkit-line-clamp: 3;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .sys-eb-cards {
        position: relative;
        inset: auto;
        width: 100%;
        height: auto;
        margin-top: clamp(4.25rem, 16vw, 6.25rem);
        min-height: 9.5rem;
        padding: 0.25rem 0 1.75rem;
        overflow: hidden;
        touch-action: pan-y;
        order: 2;
    }

    .sys-eb-card {
        border-radius: 0.9rem;
    }

    .sys-eb-card-label {
        padding: 1.15rem 0.55rem 0.55rem;
        font-size: 0.65rem;
    }

    .sys-eb-card.is-lg {
        left: 36%;
        top: 0.85rem;
        bottom: auto;
        width: min(64vw, 14rem);
        height: auto;
        aspect-ratio: 4 / 3;
        max-height: 8.5rem;
        z-index: 5;
        opacity: 1;
    }

    .sys-eb-card.is-md {
        left: 82%;
        top: 1.15rem;
        bottom: auto;
        width: min(38vw, 8.25rem);
        height: auto;
        aspect-ratio: 4 / 3;
        max-height: 6.75rem;
        z-index: 4;
        opacity: 0.86;
    }

    .sys-eb-card.is-sm {
        left: 104%;
        top: 1.35rem;
        bottom: auto;
        width: min(26vw, 5.5rem);
        height: auto;
        aspect-ratio: 4 / 3;
        max-height: 5rem;
        z-index: 3;
        opacity: 0.28;
    }
}

@media (max-width: 430px) {
    .sys-eb-stage {
        min-height: min(620px, 100svh);
    }

    .sys-eb-cards {
        margin-top: clamp(4.5rem, 18vw, 6.5rem);
        min-height: 8.75rem;
        padding-bottom: 1.5rem;
        overflow: hidden;
    }

    .sys-eb-card.is-lg {
        left: 38%;
        top: 0.9rem;
        width: min(64vw, 13.25rem);
        max-height: 8rem;
    }

    .sys-eb-card.is-md {
        left: 86%;
        top: 1.2rem;
        width: min(36vw, 7.75rem);
        max-height: 6.25rem;
    }

    .sys-eb-card.is-sm {
        left: 110%;
        top: 0.85rem;
        width: min(28vw, 6rem);
        max-height: 5.5rem;
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
    }
}

@media (max-width: 360px) {
    .sys-eb-stage {
        min-height: min(600px, 100svh);
    }

    .sys-eb-content {
        padding: 2.5rem 0.85rem 0;
    }

    .sys-eb-title {
        font-size: clamp(1.55rem, 7.2vw, 1.95rem);
    }

    .sys-eb-cards {
        margin-top: 4.25rem;
        min-height: 8.25rem;
        padding-bottom: 1.35rem;
        overflow: hidden;
    }

    .sys-eb-card.is-lg {
        left: 40%;
        width: min(62vw, 12.25rem);
        max-height: 7.5rem;
    }

    .sys-eb-card.is-md {
        left: 88%;
        width: min(34vw, 7.25rem);
        max-height: 5.75rem;
    }

    .sys-eb-card.is-sm {
        left: 110%;
        opacity: 0;
        pointer-events: none;
        visibility: hidden;
    }
}

/* Short landscape phones — compact, avoid extreme height */
@media (max-width: 900px) and (max-height: 480px) and (orientation: landscape) {
    .sys-eb-stage {
        min-height: 0;
        height: auto;
    }

    .sys-eb-content {
        padding: 1.25rem 1rem 0;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-end;
        gap: 0.5rem 1rem;
    }

    .sys-eb-copy {
        flex: 1 1 42%;
        min-width: 12rem;
    }

    .sys-eb-title {
        font-size: 1.45rem;
        max-width: none;
    }

    .sys-eb-desc {
        -webkit-line-clamp: 2;
        font-size: 0.85rem;
    }

    .sys-eb-cards {
        flex: 1 1 48%;
        margin-top: 0;
        min-height: 8.5rem;
        height: 8.5rem;
        padding: 0 0 1rem;
    }

    .sys-eb-card.is-lg {
        width: 55%;
        max-height: 7.75rem;
        top: 0;
    }

    .sys-eb-card.is-md {
        left: 48%;
        width: 38%;
        max-height: 6.75rem;
        top: 0.4rem;
    }

    .sys-eb-card.is-sm {
        left: 78%;
        width: 28%;
        max-height: 5.75rem;
        top: 0.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sys-eb-title,
    .sys-eb-desc,
    .sys-eb-card,
    .sys-eb-morph {
        transition-duration: 120ms !important;
    }
}
