/* Property order: custom props → display/flex → z-index, position → sizing → spacing → typography → colors/borders → rest */

/* ====== */
/*  Hero  */
/* ====== */

.hero-header {
    /* Original: --title-fit: 10; */
    --title-fit: 10.4;
    --title-size: calc((100cqw * 8 / 12 - var(--space)) / var(--title-fit));
    --hero-offset: var(--title-size);

    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-template-rows: auto auto minmax(0, 1fr);
    isolation: isolate;
    padding-bottom: var(--section-pad);
    padding-inline: var(--gutter);
    container-type: inline-size;

    &::before {
        --r: var(--radius-l);
        --s: var(--radius-xl);

        grid-column: 6 / 9;
        grid-row: 1;
        z-index: 1;
        margin-top: var(--hero-offset);
        margin-right: calc(-1 * var(--r));
        margin-bottom: calc(-1 * var(--r));
        background: var(--clr-bg);
        content: "";
        transform: translate(-1px, -1px);
        clip-path: shape(
            from 0 0,
            hline to 100%,
            arc to calc(100% - var(--r)) var(--r) of var(--r) ccw,
            vline to calc(100% - var(--r) - var(--s)),
            arc to calc(100% - var(--r) - var(--s)) calc(100% - var(--r)) of var(--s) cw,
            hline to var(--r),
            arc to 0 100% of var(--r) ccw,
            close
        );
    }

    > .title {
        grid-column: 1 / 9;
        grid-row: 1;
        z-index: 2;
        padding-right: var(--space);
        padding-bottom: var(--space-xs);
        font-size: var(--title-size);
        letter-spacing: -0.05em;
        white-space: nowrap;

        > span {
            display: block;
        }

        > span:last-child {
            text-align: end;
        }

        @media (width <= 768px) {
            padding: 0;
        }
    }

    /* The right padding is the space between the text and the image. */
    > .description {
        grid-column: 1 / 6;
        grid-row: 2;
        margin-top: var(--space);
        padding-right: var(--space);
        line-height: var(--lh-body);

        > .trees {
            display: block;
            width: 100%;
            aspect-ratio: 10 / 3;
            background-color: color-mix(in srgb, var(--clr-text) 15%, transparent);
            mask: var(--url-trees) center / contain no-repeat;
            margin-bottom: 2rem;
            margin-top: 6rem;
        }

        > .text {
            margin: 0 0 var(--space-s);
            font-size: var(--fs-lead);
        }

        > .button-row {
            display: flex;
            width: 100%;
            gap: var(--space-s);
            justify-content: flex-end;
        }

        @media (width <= 768px) {
            padding-right: 0;
        }
    }

    > .media {
        display: grid;
        grid-column: 6 / 13;
        grid-row: 1 / 4;
        align-self: start;
        margin-top: var(--hero-offset);

        > img {
            grid-area: 1 / 1;
            width: 100%;
            height: auto;
            aspect-ratio: 1;
        }

        > .link-button {
            grid-area: 1 / 1;
            align-self: end;
            justify-self: end;
        }

        > .caption {
            gap: var(--space-xs);

            > time {
                white-space: nowrap;
            }
        }

        @media (width <= 768px) {
            align-self: stretch;
        }
    }

    @media (width <= 768px) {
        --title-size: calc(100cqw / var(--title-fit));
        --hero-offset: 0;

        display: flex;
        flex-direction: column;
        gap: var(--space);
        padding-top: var(--space-l);

        &::before {
            display: none;
        }
    }
}

.nav-bar.-static {
    padding-inline: var(--gutter);
    background: none;

    @media (width > 768px) {
        margin-top: var(--space);
        margin-bottom: var(--space-xl);
    }

    > .nav-logo {
        padding: 0;

        &::before {
            mask-position: left;
        }
    }

    > .lang-select {
        margin-right: 0;
        margin-left: var(--nav-padding);
    }
}

/* ========== */
/*  Sections  */
/* ========== */
.page-section {
    padding-block: var(--section-pad);

    > * {
        width: var(--content-width);
        margin-inline: auto;
    }
}

/* Heading held in a narrow rail so the prose keeps its measure. */
.fondation-intro {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space);

    @media (width > 960px) {
        grid-template-columns: minmax(0, 16rem) minmax(0, 1fr);
        column-gap: var(--space-xl);
    }

    > .body {
        max-width: var(--measure);
    }

    > .body > p {
        margin: 0 0 var(--space-s);
        line-height: var(--lh-body);
        color: var(--clr-text-variant);

        &:last-child {
            margin-bottom: 0;
        }
    }
}

.domaine-section {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(2, auto);
    gap: var(--space);

    > .head {
        grid-area: 1 / 2;
        max-width: var(--measure);
        height: fit-content;
    }

    > .head > .lead {
        margin-top: var(--space-2xs);
        font-size: var(--fs-lead);
        line-height: var(--lh-body);
        color: var(--clr-text-variant);
    }

    > .media {
        grid-area: 1 / 1 / 3 / 1;
    }

    > .media > .image {
        display: block;
        width: auto;
        height: 100%;
        border-radius: var(--radius);
    }

    > .zones {
        grid-area: 2 / 2;
        border-top: 1px solid var(--hairline);
    }
}

.zone-item {
    border-bottom: 1px solid var(--hairline);

    > .label {
        padding-block: var(--space-xs);
        cursor: pointer;
    }

    > .label > .area {
        font-size: var(--fs-meta);
        color: var(--clr-text-muted);
    }

    > .text {
        margin: 0 0 var(--space-xs);
        line-height: var(--lh-body);
        color: var(--clr-text-variant);
    }
}

.activite-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-s);
    margin-block: 0;
    padding: 0;
    list-style: none;

    @media (width > 768px) {
        grid-template-columns: repeat(2, 1fr);
    }

    @media (width > 960px) {
        grid-template-columns: repeat(3, 1fr);
    }

    /* The concert. Spans 2×2 at three columns so the six pillars still
       resolve to a full 3×3 with no holes, and the video gets real size. */
    > .activite-card.-media {
        @media (width > 768px) {
            grid-column: span 2;
        }

        @media (width > 960px) {
            grid-row: span 2;
        }
    }
}

.activite-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    padding: var(--space);
    background: var(--clr-surface);
    border: 1px solid transparent;
    border-radius: var(--radius);

    > .text {
        margin: 0;
        line-height: var(--lh-body);
        color: var(--clr-text-variant);
    }

    > .video {
        display: block;
        width: 100%;
        aspect-ratio: 16 / 9;
        margin-top: auto;
        border: 0;
        border-radius: var(--radius-s);
    }

    /* No copy supplied. Held open rather than filled: an outline reads as
       named-but-not-yet-written; a filled card reads as broken. */
    &.-bare {
        justify-content: flex-end;
        min-height: 9rem;
        background: transparent;
        border-color: var(--hairline);
    }

    &.-bare > .title {
        color: var(--clr-text-muted);
    }
}
