/* =========================================================
   Hero (split / framed layouts) — wwa/hero
   Markup: template-parts/hero.php. Mobile first; desktop from 992px.
   Modifiers on .wwa-hero--cols:
     --split   text 8/7 cols + photo 4/5 cols
     --framed  photo fills the right side, optional frame overlay
       --half  text 6 + photo 6 columns
       --auto  text 8/7 + photo 4/5 columns, no fixed height
       --square (with --auto) square photo column
     --light   light background, dark band underneath
   The photo column bleeds to the viewport edge on desktop and
   sits full width under the text on mobile.
   ========================================================= */

.wwa-hero--cols {
    --wwa-hero-col: 33.333333%; /* photo column width inside the row */
    --wwa-hero-container: 100vw; /* current Bootstrap container width */
    display: flex;
    align-items: center;
    background-color: var(--wwa-green-100);
    margin-bottom: 104px;
    overflow-x: clip; /* 100vw bleed would add a horizontal scrollbar on Windows */
    position: relative;
}

.wwa-hero--light {
    background-color: var(--wwa-light-400);
}

/* No metric card: nothing hangs below the section, so no space is kept for it. */
.wwa-hero--no-cards:not(.wwa-hero--light) {
    margin-bottom: 0;
}

.wwa-hero--light::before {
    content: "";
    display: block;
    position: absolute;
    bottom: -105px;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--wwa-green-100);
    z-index: -1;
}

.wwa-hero--cols .container {
    position: relative;
    z-index: 2;
}

/* ---------- Text ---------- */

.wwa-hero--cols .wwa-hero__text-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding-block: 48px 0;
}

.wwa-hero--cols .wwa-hero__title {
    margin-bottom: 8px;
}

.wwa-hero__sub {
    margin-block: 0;
    padding-left: 8px;
    border-left: 3px solid var(--wwa-accent);
    min-height: 35px;
    align-content: center;
}

.wwa-hero__text h4 {
    font-weight: 500;
    font-size: 22px;
    line-height: 130%;
    margin-block: 0;
}

.wwa-hero__text p {
    margin-bottom: 12px;
}

.wwa-hero__text p:last-of-type {
    margin-bottom: 0;
}

.wwa-hero--cols .wwa-hero__buttons-wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    margin-top: 8px;
    width: 100%;
}

/* ---------- Photo (mobile: full bleed under the text) ---------- */

.wwa-hero__media {
    position: relative;
}

.wwa-hero__picture {
    width: 100vw;
    margin-inline: calc((100% - 100vw) / 2);
}

.wwa-hero__img {
    display: block;
    width: 100%;
    height: auto;
}

/* Optional frame overlay: cut-out photo (z-index 2) over a CSS frame line. */
.wwa-hero__overlay {
    position: absolute;
    top: 0;
    left: 50%;
    width: 100vw; /* matches the full-bleed photo */
    height: 100%;
    transform: translateX(-50%);
    object-fit: cover;
    object-position: center;
    pointer-events: none;
    z-index: 2;
}

.wwa-hero__frame {
    position: absolute;
    inset: 0;
    padding: 32px 0 32px 32px;
}

.wwa-hero__frame-line {
    width: 100%;
    height: 100%;
    border: 1.5px solid var(--wwa-light-300);
    border-left: 5px solid var(--wwa-light-300);
    border-right: 0;
}

.wwa-hero--light .wwa-hero__frame-line {
    border-color: var(--wwa-green-100);
}

/* Framed layout, mobile */
.wwa-hero--framed .wwa-hero__title {
    margin-bottom: 0;
}

.wwa-hero--framed .wwa-hero__buttons-wrapper {
    margin-top: 16px;
}

.wwa-hero--framed .wwa-hero__text-wrapper {
    padding-bottom: 16px;
}

/* ---------- Metric cards (template-parts/hero-metrics.php, metrics.js) ---------- */

.wwa-hero__metrics {
    position: absolute;
    bottom: -105px;
    right: 50%;
    z-index: 9;
    width: 366px;
    max-width: calc(100% - 24px);
    transform: translateX(50%);
}

.wwa-metrics {
    position: relative;
    z-index: 1;
    /*overflow: hidden; !* clips the card shadow like the old slider did *!*/
}

.wwa-metrics__track {
    display: grid; /* all slides share one cell: the track is as tall as the tallest slide */
    padding-bottom: 30px; /* room for the card shadow and the dots */
}

.wwa-metrics__slide {
    grid-area: 1 / 1;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.wwa-metrics__slide.is-active {
    opacity: 1;
    visibility: visible;
}

.wwa-metrics__card {
    display: flex;
    align-items: center;
    width: 100%;
    height: 100%; /* fills the slide, so every slide's card has the same height */
    min-height: 139px;
    margin-inline: auto;
    background-color: var(--wwa-white);
}

.wwa-hero--framed .wwa-metrics__card {
    background-color: var(--wwa-surface-metric);
}

.wwa-metrics__logo {
    flex: 0 0 114px;
    align-self: stretch; /* full card height, logo centred */
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--wwa-green-100);
}

/* The text box is centred in the card. Its margins are asymmetric (6px / 26px) so that the
   dots (16px high, 15px above the card's bottom edge) always keep an 11px gap below the text:
   a 139px card looks exactly as before, a card with longer text simply grows. */
.wwa-metrics__text {
    flex: 1;
    display: flex;
    flex-direction: column; /* value above label at every width */
    align-items: center;
    justify-content: flex-start;
    padding: 16px 8px;
    margin: 6px 0 26px;
    text-align: center;
}

.wwa-metrics__text p {
    margin-block: 0;
}

.wwa-metrics__dots {
    position: absolute;
    z-index: 99;
    bottom: 45px;
    left: 0;
    right: 0;
    margin-left: auto; /* pins the dots over the text area, right of the logo */
    width: calc(100% - 114px);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px;
}

.wwa-metrics__dot {
    width: 16px;
    height: 16px;
    margin: 0 4px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background-color: var(--wwa-green-300);
    cursor: pointer;
}

.wwa-metrics__dot.is-active {
    background-color: var(--wwa-green-100);
}

.wwa-metrics__dot:focus-visible {
    outline: 2px solid var(--wwa-accent-200);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .wwa-metrics__slide {
        transition: none;
    }
}

/* ---------- ≥576px ---------- */

@media (min-width: 576px) {
    .wwa-hero--cols .wwa-hero__buttons-wrapper {
        width: auto;
    }
}

/* ---------- ≥768px ---------- */

@media (min-width: 768px) {
    .wwa-hero__text h4 {
        font-size: 26px;
    }

    .wwa-hero__frame {
        padding: 60px 0 60px 60px;
    }

    .wwa-hero__frame-line {
        border-width: 3px;
        border-left-width: 9px;
    }
}

/* ---------- ≥992px: two columns ---------- */

@media (min-width: 992px) {
    .wwa-hero--cols {
        --wwa-hero-container: 960px;
    }

    .wwa-hero--cols .wwa-hero__text-wrapper {
        gap: 24px;
        padding-bottom: 48px;
    }

    .wwa-hero--cols .wwa-hero__title {
        margin-bottom: 0;
    }

    /* Framed: photo column bleeds to the viewport edge. */
    .wwa-hero--framed .wwa-hero__media {
        --wwa-hero-bleed: calc((100vw - var(--wwa-hero-container)) / 2);
        width: calc(var(--wwa-hero-col) + var(--wwa-hero-bleed));
        margin-left: auto;
        margin-right: calc(-1 * var(--wwa-hero-bleed));
        padding: 0;
    }

    .wwa-hero--framed .wwa-hero__text-wrapper {
        justify-content: center;
        padding-block: 48px;
    }

    .wwa-hero--framed .wwa-hero__buttons-wrapper {
        margin-top: 8px;
    }

    .wwa-hero--framed .wwa-hero__text {
        max-width: 520px;
    }

    .wwa-hero--auto .wwa-hero__text {
        max-width: 100%;
    }

    .wwa-hero--framed .row {
        min-height: 720px; /* photo stays square at 1440; grows with the text */
    }

    .wwa-hero--auto .row {
        min-height: 0;
    }

    .wwa-hero--auto .wwa-hero__media {
        min-height: 488px;
    }

    .wwa-hero--square .wwa-hero__media {
        aspect-ratio: 1 / 1;
    }

    .wwa-hero--framed {
        --wwa-hero-col: 50%;
    }

    .wwa-hero--framed.wwa-hero--auto {
        --wwa-hero-col: 33.333333%;
    }

    .wwa-hero--cols .wwa-hero__picture {
        position: absolute;
        inset: 0;
        width: auto;
        margin: 0;
    }

    .wwa-hero--cols .wwa-hero__img {
        height: 100%;
        object-fit: cover;
        object-position: 0 0;
    }

    .wwa-hero--framed .wwa-hero__overlay {
        position: relative;
        left: 0;
        width: 100%;
        transform: none;
        object-position: top left;
    }

    /* Metric card, desktop. */
    .wwa-hero__metrics {
        right: 15px;
        width: 460px;
        max-width: 100%;
        transform: none;
    }

    .wwa-metrics__card {
        width: 386px;
        max-width: 100%;
        margin-left: auto;
        margin-right: 0;
    }

    .wwa-metrics__dots {
        width: 272px;
        max-width: 100%;
    }

    /* Framed half (Figma hero v3): card starts 32px into the photo column,
       hangs 43px below the section. */
    .wwa-hero--framed .wwa-hero__metrics {
        left: calc(50% + 32px);
        right: auto;
        bottom: -73px;
        width: 386px;
    }

    .wwa-hero--framed .wwa-metrics__card {
        margin-left: 0;
    }

    /* Framed auto (Figma hero v1): card right edge on the container's inner
       edge, hangs 72px below the section. */
    .wwa-hero--framed.wwa-hero--auto .wwa-hero__metrics {
        left: auto;
        right: 12px;
        bottom: -102px;
        width: 460px;
    }

    .wwa-hero--framed.wwa-hero--auto .wwa-metrics__card {
        margin-left: auto;
    }
}

/* Split: photo bleeds to the edge on lg + xl only; from 1400px it stays inside the container. */
@media (min-width: 992px) and (max-width: 1399.98px) {
    .wwa-hero--split .wwa-hero__media {
        --wwa-hero-bleed: calc((100vw - var(--wwa-hero-container)) / 2);
        width: calc(var(--wwa-hero-col) + var(--wwa-hero-bleed));
        margin-left: auto;
        margin-right: calc(-1 * var(--wwa-hero-bleed));
        padding: 0;
    }
}

@media (min-width: 1200px) {
    .wwa-hero--cols {
        --wwa-hero-container: 1140px;
    }

    .wwa-hero--split,
    .wwa-hero--framed.wwa-hero--auto {
        --wwa-hero-col: 41.666667%;
    }
}

@media (min-width: 1400px) {
    .wwa-hero--cols {
        --wwa-hero-container: 1320px;
    }
}
