/* =============================================================================
   Haut de page

   .hdp--plein-ecran, .hdp--compact            → page d'accueil, structure SMB (diaporama plein écran)
   .hdp--head / --section → autres pages, structure historique du thème
   ============================================================================= */

/* -----------------------------------------------------------------------------
   Structure SMB, commune aux deux variantes
   -------------------------------------------------------------------------- */
.hdp--plein-ecran,
.hdp--compact {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    margin: 0 var(--hero-inset) var(--hero-inset);
    padding: 0;
    border-radius: var(--border-radius-lg);

    .hdp__media {
        position: absolute;
        inset: 0;
        z-index: -1;
        overflow: hidden;
        border-radius: var(--border-radius-lg);
    }

    .hdp__slide {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
        object-position: 100% 30%;
        opacity: 0;
        transition: opacity 1s ease;
    }

    .hdp__slide.is-active {
        opacity: 1;
        animation: hdp-ken-burns 18s ease-out both;
    }

    .hdp__overlay {
        position: absolute;
        inset: 0;
        background: linear-gradient(to bottom,
                hsl(var(--hsl-ink) / 0.7) 0%,
                hsl(var(--hsl-ink) / 0.5) 50%,
                hsl(var(--hsl-ink) / 0.85) 100%);
    }

    .container {
        position: relative;
        display: flex;
        flex-direction: column;
        justify-content: flex-end;
        padding-top: var(--space-4xl);
        padding-bottom: var(--space-4xl);
    }

    .hdp__content {
        max-width: 896px;
        animation: hdp-slide-up 0.8s var(--ease-out-expo) both;
    }

    /* Pastille */
    .hdp__eyebrow {
        display: inline-flex;
        align-items: center;
        gap: var(--space-xs);
        margin: 0;
        padding: var(--space-2xs) var(--space-sm);
        border-radius: var(--border-radius-full);
        background: hsl(var(--hsl-white) / 0.15);
        box-shadow: inset 0 0 0 1px hsl(var(--hsl-white) / 0.2);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        color: var(--color-text-invert);
        font-size: var(--fs-sm);
        font-weight: var(--medium);
    }

    .hdp__title {
        margin: var(--space-md) 0 0;
        color: var(--color-text-invert);
        font-size: var(--fs-5xl);
        line-height: var(--lh-tight);
    }

    .hdp__intro {
        max-width: 672px;
        margin-top: var(--space-lg);
        color: hsl(var(--hsl-white) / 0.9);

        p {
            margin: 0;
            font-size: var(--fs-lg);
            line-height: var(--lh-relaxed);
        }

        p+p {
            margin-top: var(--space-sm);
        }
    }

    /* Barre de recherche */
    .hdp__search {
        display: flex;
        align-items: center;
        gap: var(--space-2xs);
        width: 100%;
        max-width: 672px;
        margin-top: var(--space-xl);
        padding: var(--space-2xs);
        border-radius: var(--border-radius-full);
        background: var(--color-white);
        box-shadow: var(--shadow-2xl), inset 0 0 0 1px hsl(var(--hsl-white) / 0.3);
        transition: var(--transition);
    }

    .hdp__search:focus-within {
        box-shadow: var(--shadow-2xl), inset 0 0 0 2px var(--color-primary);
    }

    .hdp__search-icon {
        flex: 0 0 auto;
        width: 20px;
        height: 20px;
        margin-left: var(--space-sm);
        background-color: var(--color-primary);
        -webkit-mask: url('../../img/icon_search.svg') no-repeat center / contain;
        mask: url('../../img/icon_search.svg') no-repeat center / contain;
    }

    .hdp__search-input {
        flex: 1 1 auto;
        min-width: 0;
        width: auto;
        padding: var(--space-2xs);
        border: 0;
        background: none;
        color: var(--color-text);
        font-size: var(--fs-base);
        font-weight: var(--regular);
    }

    .hdp__search-input:focus-visible {
        outline: none;
    }

    .hdp__search-input::placeholder {
        color: var(--color-text-muted);
    }

    .hdp__search-submit {
        flex: 0 0 auto;
        padding: var(--space-xs) var(--space-xl);
        margin: 0;
    }

    .hdp__search-submit:hover {
        background-color: var(--color-primary-dark);
    }

    /* La flèche vient de la règle globale .bouton::after (css/base/cta.css) */
    .hdp__search-label {
        display: none;
    }

    .section__btn {
        margin-top: var(--space-xl);
        margin-bottom: 0;
    }
}

@media (min-width: 576px) {
    .hdp--plein-ecran, .hdp--compact {
        .container {
            padding-top: var(--space-5xl);
            padding-bottom: var(--space-5xl);
        }

        .hdp__title {
            font-size: var(--fs-6xl);
        }

        .hdp__intro p {
            font-size: var(--fs-xl);
        }

        .hdp__search-submit {
            padding: var(--space-xs) var(--space-md);
        }

        .hdp__search-label {
            display: inline;
        }
    }
}

@media (min-width: 992px) {
    .hdp--plein-ecran, .hdp--compact .hdp__title {
        font-size: var(--fs-7xl);
    }
}

@media (min-width: 1200px) {
    .hdp--plein-ecran, .hdp--compact .hdp__title {
        font-size: var(--fs-8xl);
    }
}

/* Le diaporama et l'entrée animée sont désactivés si l'utilisateur le demande.
   Le JS s'aligne sur la même préférence (js/sections_builder/haut_de_page_fixe.js). */
@media (prefers-reduced-motion: reduce) {
    .hdp--plein-ecran, .hdp--compact {

        .hdp__slide.is-active {
            animation: none;
        }

        .hdp__content {
            animation: none;
        }
    }
}

@keyframes hdp-ken-burns {
    from {
        transform: scale(1);
    }

    to {
        transform: scale(1.08);
    }
}

@keyframes hdp-slide-up {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* -----------------------------------------------------------------------------
   Autres pages — structure historique, inchangée
   -------------------------------------------------------------------------- */
.hdp {
    &.hdp--head {
        position: relative;

        .container {
            height: 100%;
            display: flex;

            .hdp__img {
                height: 100%;
                left: 0;
                object-fit: cover;
                position: absolute;
                top: 0;
                width: 100%;
                z-index: 1;
            }

            .hdp__content {
                display: flex;
                flex-direction: column;
                justify-content: center;
                text-align: center;
                position: relative;
                z-index: 2;
                height: fit-content;
                margin: auto;
                gap: 10px;

                .section__btn {
                    margin: auto;
                }

                @media (max-width: 767px) {
                    padding-top: 80px;
                }

                .cta {
                    margin: auto;
                }

                .hdp__title {
                    display: flex;
                    flex-direction: column;
                    gap: var(--space-sm);
                }

                .hdp__intro {
                    max-width: 960px;
                    margin: 0 auto;
                    color: var(--color-text-muted);

                    p {
                        margin: 0;
                    }
                }

                .hdp__elements_bas {
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    gap: var(--space-sm);
                    margin-bottom: var(--space-lg);
                    flex-wrap: wrap;
                }
            }
        }
    }

    &.hdp--section {
        background-size: cover;
        background-repeat: no-repeat;
        background-position: center;
        min-height: 560px;
        display: flex;
        align-items: center;
        padding: 80px 0 20px 0;

        @media (min-width: 992px) {
            padding: 150px 0 20px 0;
        }

        &:not(.single) {
            background-image: url('../../img/bg_hdp.jpg');

            .container {
                .hdp__intro {
                    max-width: 960px;
                    margin: 0 auto;
                }

                .hdp__elements_bas {
                    display: flex;
                    justify-content: center;
                    align-items: center;
                    gap: var(--space-sm);
                    margin-bottom: var(--space-lg);
                }
            }
        }

        &.single {
            background-image: url('../../img/bg_single.jpg');

            .container {
                h1 {
                    color: var(--color-primary);
                    margin: 20px auto 0 auto !important;
                }

                h2 {
                    color: var(--color-text-invert);
                    font-size: var(--fs-4xl);
                    line-height: var(--lh-heading);
                }
            }
        }

        .container {
            color: var(--color-text);
            position: relative;

            .hdp__content {
                text-align: center;

                h1 {
                    max-width: 800px;
                    margin: 10px auto;
                    color: var(--color-ink);
                }
            }
        }
    }
}


/* -----------------------------------------------------------------------------
   Variantes de hauteur et d'alignement
   -------------------------------------------------------------------------- */

/* Accueil : occupe la fenêtre, contenu ancré en bas */
.hdp--plein-ecran .container {
    justify-content: flex-end;
    min-height: calc(100vh - var(--header-height) - var(--hero-inset));
    padding-top: var(--space-5xl);
}

/* Pages intérieures : bandeau court, contenu centré verticalement */
.hdp--compact .container {
    justify-content: center;
    min-height: 360px;
}

.hdp--compact .hdp__title {
    font-size: var(--fs-4xl);
}

/* Alignement centré */
.hdp--centre .hdp__content {
    margin-left: auto;
    margin-right: auto;
    max-width: 768px;
    text-align: center;
}

.hdp--centre .hdp__intro {
    margin-left: auto;
    margin-right: auto;
}

.hdp--centre .hdp__search,
.hdp--centre .section__btn {
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 576px) {
    .hdp--compact .container {
        min-height: 420px;
        padding-top: var(--space-4xl);
        padding-bottom: var(--space-4xl);
    }

    .hdp--compact .hdp__title {
        font-size: var(--fs-5xl);
    }
}

@media (min-width: 992px) {
    .hdp--compact .hdp__title {
        font-size: var(--fs-6xl);
    }
}

@media (min-width: 1200px) {
    .hdp--compact .hdp__title {
        font-size: var(--fs-7xl);
    }
}
