/* ===== Charte graphique (tirée du logo FEDECAME) ===== */
:root {
    --blue: #009FE3;
    --red: #E30613;
    --yellow: #FFD500;
    --green: #00A651;
    --green-dark: #0B7A33;
    --ink: #14202b;
    --muted: #5b6b78;
    --paper: #ffffff;

    --header-h: 6rem; /* ajustée par app.js */
    --radius: 0.8rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    color: var(--ink);
    background: var(--paper);
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.5;
}

img { max-width: 100%; height: auto; }
a { color: var(--blue); }

.skip-link {
    position: absolute;
    left: 0.5rem;
    top: -4rem;
    z-index: 300;
    padding: 0.5rem 1rem;
    background: var(--ink);
    color: #fff;
    border-radius: var(--radius);
    transition: top 0.2s;
}
.skip-link:focus { top: 0.5rem; }

/* ===== HEADER (statique, translucide : le main passe dessous) ===== */
#site-header {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem clamp(0.75rem, 3vw, 2rem);
    font-size: clamp(0.85rem, 0.55rem + 0.9vw, 1rem);
    color: var(--ink);
}

/* le flou est sur un pseudo-élément : un backdrop-filter sur le header
   changerait le repère des menus en position fixed */
#site-header::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: rgba(255, 255, 255, 0.72);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    backdrop-filter: blur(14px) saturate(160%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.brand { flex: 0 0 auto; display: block; line-height: 0; }
.brand img { height: clamp(3rem, 7vw, 4.75rem); width: auto; display: block; }

.header-right {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35em;
}

/* Hauteurs fixes : list-view remesure son contenu à chaque recalcul, et sans hauteur
   imposée la barre change d'une fraction de pixel en boucle (clignotement). */
#menu-bar, #nav-bar { display: flex; align-items: flex-start; min-width: 0; }
#menu-bar { height: 2.2em; }
#nav-bar { height: 2.3em; font-size: 0.92em; }
#menu-bar list-view, #nav-bar list-view { width: 100%; }

/* recherche en superposition : couvre tout le header, de bord à bord */
#menu-bar {
    --sb-overlay-top: 0;
    --sb-overlay-inset: 0;
    --sb-overlay-height: var(--header-h);
    --sb-overlay-radius: 0;
}

/* ===== PETIT ÉCRAN (< 1240px) : une seule ligne =====
   hamburger | logo | ............ menu (recherche, langue, aide)
   Le seuil est le même que isSmall dans app.js. */
@media (max-width: 1239.98px) {
    #site-header { gap: 0.5rem; padding-block: 0.4rem; }

    .brand img { height: clamp(2.5rem, 9vw, 3.25rem); }

    .header-right { display: contents; } /* menu-bar et nav-bar deviennent des éléments de la ligne */

    #nav-bar {
        order: 0;
        flex: 0 0 auto;
        width: auto;
        height: 2.4em;
        font-size: 1em;
        align-items: center;
    }
    #nav-bar list-view { width: auto; }

    .brand { order: 1; }

    #menu-bar {
        order: 2;
        flex: 1 1 auto;
        height: 2.4em;
        align-items: center;
    }
}

/* ===== SIDEBAR (invisible pour l'instant) ===== */
#sidebar[hidden] { display: none; }

/* ===== MAIN (dynamique, occupe l'espace disponible) ===== */
#view {
    flex: 1 0 auto;
    outline: none;
    background:
        radial-gradient(circle at 15% 0%, rgba(0, 159, 227, 0.10), transparent 45%),
        radial-gradient(circle at 100% 100%, rgba(255, 213, 0, 0.10), transparent 40%),
        var(--paper);
}

/* page ordinaire : le contenu démarre sous le header */
.page {
    max-width: 70rem;
    margin: 0 auto;
    padding: calc(var(--header-h) + 2rem) clamp(1rem, 4vw, 2rem) 3rem;
}
.page h1 { margin-top: 0; color: var(--green-dark); }

/* ===== Accueil : bannière ===== */
.hero {
    min-height: calc(100dvh - 5rem);
    display: grid;
    place-items: center;
    text-align: center;
    padding: calc(var(--header-h) + 2rem) clamp(1rem, 4vw, 2rem) 3rem;
}
.hero-inner { max-width: 46rem; }
.hero-logo { width: min(16rem, 55vw); margin-bottom: 1rem; }
.hero h1 {
    margin: 0 0 0.75rem;
    font-size: clamp(1.4rem, 1rem + 2.2vw, 2.4rem);
    line-height: 1.2;
    color: var(--green-dark);
}
.hero-slogan { margin: 0 0 1.75rem; font-size: clamp(1rem, 0.9rem + 0.6vw, 1.25rem); color: var(--muted); }

.btn {
    display: inline-block;
    padding: 0.8em 1.7em;
    border-radius: 999px;
    background: var(--green);
    color: #fff;
    font-weight: 600;
    text-decoration: none;
    box-shadow: 0 6px 18px rgba(0, 166, 81, 0.35);
    transition: transform 0.15s, background 0.2s;
}
.btn:hover { background: var(--green-dark); transform: translateY(-1px); }

/* ===== FOOTER (statique) ===== */
#site-footer { flex: 0 0 auto; background: #f4f7f9; color: var(--ink); }
.flag-bar {
    height: 0.3rem;
    background: linear-gradient(90deg, var(--blue) 0 33.33%, var(--yellow) 33.33% 66.66%, var(--red) 66.66% 100%);
}
.footer-inner {
    max-width: 70rem;
    margin: 0 auto;
    padding: 1.25rem clamp(1rem, 4vw, 2rem);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 2rem;
}
.footer-logo { height: 3.2rem; width: auto; }
.footer-text { margin: 0; font-size: 0.85rem; color: var(--muted); }
.footer-text strong { color: var(--ink); }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; }
}
