/*
 * Osmova Split Hero — block styling contract.
 *
 * Plain CSS, semantic `o-split-hero*` classes, neutral baseline tokens with
 * literal fallbacks. Static layout lives here; the desktop hover expansion is
 * driven by a small pointer-zone controller (assets/js/split-hero.js) that
 * sets `data-o-active-panel` on the hero. Once the controller has attached
 * (`data-o-split-hero-js`), the CSS-only :has() hover fallback is disabled so
 * the center dead-zone stays balanced.
 *
 * Child themes re-skin by overriding these classes; no brand colors, fonts or
 * copy here beyond neutral fallbacks.
 */

.o-split-hero {
    --o-sh-ink: var(--osmova-base-color-text, #111827);
    --o-sh-surface: var(--osmova-base-color-surface, #f3f4f6);
    --o-sh-overlay: rgba(17, 24, 39, 0.45);
}

.o-split-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    min-height: 72svh;
    overflow: hidden;
    background: var(--o-sh-surface);
}

@media (min-width: 48rem) {
    .o-split-hero {
        flex-direction: row;
        min-height: 42.5rem;
    }
}

/* Height variants. */
.o-split-hero--h-auto {
    min-height: 72svh;
}

.o-split-hero--h-md {
    min-height: 60svh;
}

@media (min-width: 48rem) {
    .o-split-hero--h-md {
        min-height: 37.5rem;
    }
}

.o-split-hero--h-tall,
.o-split-hero--h-full {
    min-height: 72svh;
}

@media (min-width: 48rem) {
    .o-split-hero--h-tall,
    .o-split-hero--h-full {
        min-height: 42.5rem;
    }
}

/* Full height owns the viewport from the configured breakpoint. */
@media (min-width: 64rem) {
    .o-split-hero--h-full.o-split-hero--from-lg {
        min-height: 100svh;
    }
}

@media (min-width: 80rem) {
    .o-split-hero--h-full.o-split-hero--from-xl {
        min-height: 100svh;
    }
}

.o-split-hero__panel {
    position: relative;
    display: flex;
    flex: 1 1 0%;
    min-height: 36svh;
    align-items: flex-end;
    overflow: hidden;
    transition: flex-grow 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

@media (min-width: 48rem) {
    .o-split-hero__panel {
        min-height: 0;
    }

    .o-split-hero__panel--second {
        justify-content: flex-end;
        text-align: right;
    }
}

.o-split-hero__media {
    position: absolute;
    inset: 0;
    z-index: 0;
    background-color: var(--o-sh-surface);
    background-size: cover;
    background-position: center;
    transition: filter 600ms, transform 600ms;
}

.o-split-hero__scrim {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(to top, var(--o-sh-overlay), transparent 55%);
    transition: background-color 600ms;
}

.o-split-hero__label {
    position: relative;
    z-index: 2;
    padding: 2rem;
    color: #fff;
}

@media (min-width: 48rem) {
    .o-split-hero__label {
        padding: 3.5rem;
    }
}

@media (min-width: 64rem) {
    .o-split-hero__label {
        padding: 4rem;
    }
}

.o-split-hero__label-title {
    display: block;
    font-size: clamp(1.5rem, 4vw, 3rem);
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.03em;
}

.o-split-hero__label-sub {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: rgb(255 255 255 / 0.9);
}

@media (min-width: 48rem) {
    .o-split-hero__label-sub {
        font-size: 1rem;
    }
}

.o-split-hero__wordmark {
    pointer-events: none;
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: clamp(3.5rem, 10vw, 9.5rem);
    font-weight: 900;
    line-height: 0.82;
    letter-spacing: -0.055em;
    color: var(--o-sh-surface);
    text-shadow: 0 3px 0 rgb(0 0 40 / 0.55), 0 18px 42px rgb(0 0 0 / 0.42);
    transition: opacity 600ms;
}

.o-split-hero__wordmark-word {
    display: block;
}

/*
 * Desktop hover expansion. JS path: the controller decides which panel is
 * active (center dead-zone keeps both balanced). No-JS path: a pure :has()
 * fallback, active only until the controller attaches its flag attribute.
 * Real pointers and viewport width only.
 */
@media (min-width: 48rem) and (hover: hover) {
    .o-split-hero[data-o-active-panel="first"] .o-split-hero__panel--first,
    .o-split-hero[data-o-active-panel="second"] .o-split-hero__panel--second {
        flex-grow: 3;
    }

    .o-split-hero[data-o-active-panel="first"] .o-split-hero__panel:not(.o-split-hero__panel--first),
    .o-split-hero[data-o-active-panel="second"] .o-split-hero__panel:not(.o-split-hero__panel--second) {
        flex-grow: 1;
    }

    .o-split-hero[data-o-active-panel="first"] .o-split-hero__panel:not(.o-split-hero__panel--first) .o-split-hero__media,
    .o-split-hero[data-o-active-panel="second"] .o-split-hero__panel:not(.o-split-hero__panel--second) .o-split-hero__media {
        transform: scale(1.05);
        filter: blur(6px) brightness(0.55);
    }

    .o-split-hero[data-o-active-panel="first"] .o-split-hero__wordmark,
    .o-split-hero[data-o-active-panel="second"] .o-split-hero__wordmark {
        opacity: 0.5;
    }

    .o-split-hero:not([data-o-split-hero-js]):has(.o-split-hero__panel--first:hover) .o-split-hero__panel--first,
    .o-split-hero:not([data-o-split-hero-js]):has(.o-split-hero__panel--second:hover) .o-split-hero__panel--second {
        flex-grow: 3;
    }

    .o-split-hero:not([data-o-split-hero-js]):has(.o-split-hero__panel:hover) .o-split-hero__panel:not(:hover) {
        flex-grow: 1;
    }

    .o-split-hero:not([data-o-split-hero-js]):has(.o-split-hero__panel:hover) .o-split-hero__panel:not(:hover) .o-split-hero__media {
        transform: scale(1.05);
        filter: blur(6px) brightness(0.55);
    }

    .o-split-hero:not([data-o-split-hero-js]):has(.o-split-hero__panel:hover) .o-split-hero__wordmark {
        opacity: 0.5;
    }
}

/* Mobile: stacked panels; pin the wordmark to a band below the seam. */
@media (max-width: 47.999rem) {
    .o-split-hero__wordmark {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0 0.5rem;
        inset-inline: 0;
        top: auto;
        bottom: auto;
        top: calc(36svh + 0.5rem);
        font-size: clamp(1.75rem, 9vw, 2.75rem);
    }

    .o-split-hero__wordmark::before {
        content: "";
        position: absolute;
        inset-inline: 0;
        inset-block: -0.5rem;
        z-index: -1;
        background: rgb(0 0 0 / 0.35);
        backdrop-filter: blur(2px);
    }
}
