/* ==========================================================================
   Block: Hero Home — title, text and four images as direct grid children
   ========================================================================== */

/* z-index: 0 makes this a stacking context, so the text's z-index:-1 backdrop
   paints above this block's own background instead of disappearing behind it. */
.block-hero-home {
    position: relative;
    z-index: 0;
    overflow: hidden;
    padding: var(--wp--preset--spacing--60) var(--wp--style--root--padding-right) var(--wp--preset--spacing--60) var(--wp--style--root--padding-left);
}

/* Every item (title, text, image 1–4) is a direct child, so the whole hero can
   be placed from this one grid. */
.block-hero-home__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    max-width: var(--wp--style--global--wide-size);
    margin-left: auto;
    margin-right: auto;
    padding-top: 4rem;
}

.block-hero-home__title {
    margin: 0 !important;
    max-width: 30rem;
    grid-column: 1 / 3;
}

.block-hero-home__text {
    margin: 0;
    max-width: 40rem;
    grid-column: 1 / 3;
}

/* Element prefix is needed here: it outweighs the `margin: 0 !important` above. */
p.block-hero-home__text {
    margin-top: 3rem !important;
    margin-bottom: 0 !important;
}


h1.block-hero-home__title {
    margin-top: 3rem !important;
    font-size: clamp(60px, 7vw, 85px) !important;
    display: flex;
    flex-direction: column;
    line-height: 0.8;
}

.block-hero-home__image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: var(--ratio, 3 / 4);
    object-fit: cover;
}

/* Aspect ratio per image — applies at every breakpoint. */
.block-hero-home__image--1 { --ratio: 3 / 2; }
.block-hero-home__image--2 { --ratio: 3 / 4; }
.block-hero-home__image--3 { --ratio: 1 / 1; }
.block-hero-home__image--4 { --ratio: 3 / 4; }

/* Mobile layout — image 1 spans both columns, 2 and 3 side by side, 4 dropped.
   Scoped to a max-width query because these offsets have no desktop equivalent
   and would otherwise leak past the 992px breakpoint. */
@media (max-width: 991.98px) {
    h1.block-hero-home__title {
        margin-bottom: 2rem !important;
    }

    .block-hero-home__image--1 {
        grid-column: 1 / 3;
        width: 85%;
        justify-self: flex-end;
        margin-right: 5%;
    }

    .block-hero-home__image--2 {
        width: 90%;
        justify-self: flex-start;
        margin-top: -20%;
    }

    .block-hero-home__image--3 {
        margin-top: 20%;
        width: 90%;
        justify-self: flex-end;
    }

    .block-hero-home__image--4 {
        display: none;
    }

}

@media (min-width: 992px) {
    .block-hero-home__inner {
        grid-template-columns: repeat(10, 1fr);
        /* Rows scale with the viewport but never drop below the floor, so the
           hero still works on short laptop screens. */
        grid-template-rows: repeat(3, minmax(225px, 25vh));
        align-items: start;
        padding: 2rem 0 0 0;
    }

    .block-hero-home__image--1 {
        grid-column: 1 / 6;
        grid-row: 1 / 3;
        align-self: center;
        width: 90%;
    }

    .block-hero-home__image--2 {
        grid-column: 5 / 7;
        grid-row: 2 / 3;
        z-index: 1;
        width: 100%;
        justify-self: center;
        margin-right: -15%;
    }

    .block-hero-home__image--3 {
        grid-column: 7 / 9;
        align-self: center;
        grid-row: 1 / 3;
        justify-self: flex-end;
    }

    .block-hero-home__image--4 {
        grid-column: 9 / 11;
        grid-row: 1 / 3;
        align-self: center;
        justify-self: flex-end;
        width: 80%;
        margin-bottom: -40%;
    }

    .block-hero-home__title {
        grid-row: 3;
        grid-column: 1 / 5;
    }

    .block-hero-home__text {
        grid-column: 8 / 11;
        grid-row: 3;
    }
}

/* Small desktop / landscape tablet — the 10-column grid is on, but 3 columns is
   too narrow for the paragraph, so give it more room. Must sit after the 992px
   block to win on source order. */
@media (min-width: 992px) and (max-width: 1200px) {
    .block-hero-home__text {
        grid-column: 6 / 11;
    }
}

/* Mobile: no extra space above the intro text */
@media (max-width: 767px) {
    p.block-hero-home__text {
        margin-top: 0 !important;
    }
}

/* Desktop: same bottom space as below the photos in the other heroes
   (= breadcrumbs height, see .block-hero-page__image in hero-page.css) */
@media (min-width: 992px) {
    .block-hero-home {
        padding-bottom: calc(2rem + var(--wp--preset--font-size--small) * 1.45);
    }
}
