/* layout.css — en-tête, menu, pied de page, bouton « retour en haut » */

/* ---------- En-tête ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #fff;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
    padding-top: env(safe-area-inset-top);
    transition: background-color 0.3s ease;
}

/* L'en-tête prend le MÊME fond que le bandeau (hero) de la page affichée.
   Par défaut il reste blanc (contact, cookies, FAQ, 404...).
   Les couleurs ci-dessous sont celles des bandeaux (loan.css, home.css). */
body:has(.hero) .site-header,
body:has(.about-hero) .site-header {
    background: var(--c-bg-soft);
    /* accueil, qui sommes-nous, conventions (mobile) */
    box-shadow: none;
}

body:has(.loan-hero.loan--salary) .site-header {
    background: #e5c8cd;
    box-shadow: none;
}

body:has(.loan-hero.loan--pension) .site-header {
    background: #94cde0;
    box-shadow: none;
}

body:has(.loan-hero.loan--personal) .site-header {
    background: #dbd2c8;
    box-shadow: none;
}

body:has(.loan-hero.loan--mortgage) .site-header {
    background: #b8d3cf;
    box-shadow: none;
}

/* Conventions : la photo bleue est tout en haut de la page (sur mobile comme sur ordinateur) */
body:has(.about-hero--photo) .site-header {
    background: #84acbc;
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(1.25rem, 3vw, 3rem);
    min-height: var(--header-h);
    padding-block: 0.5rem;
}

/* Logo horizontal (novafi-logo-navy.png, ratio 5,65:1) */
.brand {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: -0.35rem;
}

.brand img {
    display: block;
    height: 40px;
    /* petit mobile : ~226 px de large */
    width: auto;
    /* garde le ratio, jamais déformé */
    max-width: 100%;
    animation: brand-pulse 2.8s ease-in-out infinite;
}

@keyframes brand-pulse {

    0%,
    100% {
        opacity: 1;
        filter: drop-shadow(0 0 0 rgba(34, 38, 94, 0));
    }

    50% {
        opacity: 0.78;
        filter: drop-shadow(0 0 5px rgba(34, 38, 94, 0.28));
    }
}

@media (min-width: 480px) {
    .brand img {
        height: 46px;
        /* mobile / tablette : ~260 px */
    }
}

/* Bouton hamburger (mobile) */
.nav-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: var(--touch-min);
    height: var(--touch-min);
    padding: 0 10px;
    background: none;
    border: 0;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    height: 2px;
    background: var(--c-primary);
    transition: transform 0.2s, opacity 0.2s;
}

.nav-toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
}

.nav-toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Menu : panneau déroulant sur mobile */
.main-nav {
    display: none;
    position: absolute;
    inset: 100% 0 auto 0;
    padding: 1rem 1.25rem 1.5rem;
    background: #fff;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.08);
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
}

.main-nav.is-open {
    display: block;
}

.main-nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.main-nav a:not(.btn) {
    display: block;
    min-height: var(--touch-min);
    padding: 0.7rem 0;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
}

.sub {
    padding-left: 1rem;
}

.sub a {
    text-transform: none !important;
    font-weight: 500 !important;
    letter-spacing: 0 !important;
}

/* Menu sur grand écran : en ligne, sous-menu au survol */
@media (min-width: 992px) {
    .brand img {
        height: 48px;
        /* ~271 px : laisse la place au menu */
    }

    .nav-toggle {
        display: none;
    }

    .main-nav {
        display: flex;
        position: static;
        align-items: center;
        gap: clamp(1rem, 2vw, 2rem);
        padding: 0;
        box-shadow: none;
        max-height: none;
        overflow: visible;
    }

    .main-nav>ul {
        display: flex;
        align-items: center;
        gap: clamp(0.8rem, 1.5vw, 1.4rem);
    }

    .has-sub {
        position: relative;
    }

    .sub {
        display: none;
        position: absolute;
        top: 100%;
        left: -1rem;
        min-width: 280px;
        padding: 0.5rem 1rem;
        background: #fff;
        border-radius: 12px;
        box-shadow: var(--shadow);
    }

    .has-sub:hover .sub,
    .has-sub:focus-within .sub {
        display: block;
    }
}

/* Grand écran : logo à sa pleine taille (~317 px de large) */
@media (min-width: 1200px) {
    .brand img {
        height: 56px;
    }
}

/* ---------- Pied de page ---------- */
.site-footer {
    margin-top: 2rem;
    font-size: 0.85rem;
}

.footer-grid {
    display: grid;
    gap: 2rem;
    padding-block: 2.5rem;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

.footer-brand img {
    display: block;
    /* même logo horizontal que l'en-tête (novafi-logo-navy.png, ratio 5,65:1) */
    width: min(317px, 100%);
    height: auto;
    margin-bottom: 1rem;
}

.footer-title {
    font-size: 0.95rem;
    margin-bottom: 0.8rem;
}

.site-footer address {
    font-style: normal;
}

.footer-links {
    margin: 0;
    padding: 0;
    list-style: none;
}

.footer-links a {
    display: inline-block;
    padding: 0.3rem 0;
    text-decoration: none;
}

.phone-label {
    margin: 0;
    font-weight: 600;
    color: var(--c-primary);
}

.phone-number {
    font-size: 1.6rem;
    font-weight: 700;
    text-decoration: none;
}

.social {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.25rem;
    margin-top: 0.8rem;
}

.footer-legal {
    padding-block: 1.5rem;
    background: var(--c-bg-soft);
    font-size: 0.75rem;
    line-height: 1.6;
}

.copyright {
    margin: 0;
    font-weight: 600;
}

/* ---------- Bouton « retour en haut » ---------- */
.to-top {
    position: fixed;
    left: 1rem;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    z-index: 40;
    display: none;
    align-items: center;
    justify-content: center;
    width: var(--touch-min);
    height: var(--touch-min);
    background: #1d1d1d;
    color: #fff;
    border-radius: 6px;
    font-size: 1.4rem;
    text-decoration: none;
}

.to-top.is-visible {
    display: flex;
}

/* Lien « Effectuer une demande » : le formulaire s'arrête sous l'en-tête collé en haut */
#demande {
    scroll-margin-top: var(--header-h);
}