/* Socle commun à tous les sites : structure, grilles des zones, formulaires, accessibilité.
   Aucune identité ici : l'aspect par défaut est volontairement neutre. Couleurs, polices et
   formes sont des variables, redéfinies par css/theme.css (couche « theme », qui l'emporte).
   Ce fichier est remplacé à chaque mise à jour du modèle : ne rien y écrire de propre à un client. */
@layer socle, theme;

@layer socle {
    :root {
        --encre: #1d2126;          /* titres, marque */
        --texte: #2e333a;
        --doux: #5b636d;           /* textes secondaires */
        --fond: #ffffff;
        --surface: #ffffff;        /* cartes, champs */
        --ligne: #dde1e5;
        --ligne-forte: #b8bec6;    /* bords des champs */
        --accent: #1d2126;         /* liens, boutons, focus */
        --accent-survol: #454c55;
        --accent-clair: #eef0f2;   /* fonds de survol */
        --texte-sur-accent: #ffffff;
        --bandeau-fond: #1d2126;   /* bandeau sans photo */
        --pied-fond: #1d2126;
        --pied-texte: #c9ced4;

        --police-texte: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        --police-titre: var(--police-texte);
        --graisse-titre: 650;

        --largeur: 72rem;
        --largeur-etroite: 42rem;  /* colonne de texte : moins de 80 caractères par ligne */
        --gouttiere: clamp(1rem, 4vw, 2rem);
        --espace-section: clamp(3rem, 7vw, 6rem);
        --rayon: 4px;
    }

    /* ---------- Base ---------- */
    *, *::before, *::after { box-sizing: border-box; }
    html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
    body {
        margin: 0;
        background: var(--fond);
        color: var(--texte);
        font: 400 1.0625rem/1.6 var(--police-texte);
    }
    img { display: block; max-width: 100%; height: auto; }
    a { color: var(--accent); text-underline-offset: .18em; }
    a:hover { color: var(--accent-survol); }
    :focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }

    h1, h2, h3 {
        margin: 0 0 .5em;
        color: var(--encre);
        font-family: var(--police-titre);
        font-weight: var(--graisse-titre);
        line-height: 1.15;
        letter-spacing: -.02em;
    }
    h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); }
    h2 { font-size: clamp(1.6rem, 3.2vw, 2.25rem); }
    h3 { font-size: 1.25rem; letter-spacing: -.01em; }

    .conteneur { width: min(100% - 2 * var(--gouttiere), var(--largeur)); margin-inline: auto; }
    /* colonne de lecture : même bord gauche que le reste de la page, lignes limitées en longueur */
    .conteneur--etroit > * { max-width: var(--largeur-etroite); }

    .lien-evitement {
        position: absolute; left: 1rem; top: -4rem; z-index: 10;
        padding: .6rem 1rem; background: var(--encre); color: var(--fond); border-radius: var(--rayon);
    }
    .lien-evitement:focus { top: 1rem; }
    .visuellement-cache {
        position: absolute; width: 1px; height: 1px; overflow: hidden;
        clip: rect(0 0 0 0); white-space: nowrap;
    }

    /* textes riches saisis dans le BO */
    .texte > :first-child { margin-top: 0; }
    .texte > :last-child { margin-bottom: 0; }
    .texte p, .texte ul, .texte ol { margin: 0 0 1em; }
    .accroche { margin: -.2em 0 1.2em; color: var(--doux); font-size: 1.2rem; line-height: 1.5; }
    .surtitre { margin: 0 0 .6rem; font-weight: 600; }

    .bouton {
        display: inline-block;
        padding: .8rem 1.5rem;
        border: 0;
        border-radius: var(--rayon);
        background: var(--accent);
        color: var(--texte-sur-accent);
        font: 600 1rem/1.2 var(--police-texte);
        text-decoration: none;
        cursor: pointer;
    }
    .bouton:hover { background: var(--accent-survol); color: var(--texte-sur-accent); }

    /* ---------- En-tête, menu et langues ---------- */
    .entete {
        position: sticky; top: 0; z-index: 5;
        background: var(--fond);
        border-bottom: 1px solid var(--ligne);
    }
    .entete__barre { display: flex; align-items: center; gap: 1.5rem; min-height: 4.5rem; }
    .marque {
        margin-right: auto;
        color: var(--encre);
        font: var(--graisse-titre) 1.35rem/1.1 var(--police-titre);
        letter-spacing: -.02em;
        text-decoration: none;
    }
    .menu ul, .langues { margin: 0; padding: 0; list-style: none; }
    .menu > ul { display: flex; gap: .25rem; }
    .menu a {
        display: block;
        padding: .55rem .9rem;
        border-radius: var(--rayon);
        color: var(--texte);
        font-weight: 500;
        text-decoration: none;
    }
    .menu a:hover { background: var(--accent-clair); color: var(--encre); }
    .menu a[aria-current="page"] { color: var(--encre); font-weight: 650; }
    .menu .a-sous-menu { position: relative; }
    .menu .a-sous-menu > ul {
        position: absolute; top: 100%; left: 0; min-width: 14rem;
        padding: .4rem;
        background: var(--surface);
        border: 1px solid var(--ligne);
        border-radius: var(--rayon);
        visibility: hidden;
    }
    .menu .a-sous-menu:hover > ul, .menu .a-sous-menu:focus-within > ul { visibility: visible; }

    .langues { display: flex; gap: .15rem; font-size: .9rem; }
    .langues a { display: block; padding: .35rem .5rem; color: var(--doux); text-decoration: none; }
    .langues a[aria-current="true"] { color: var(--encre); font-weight: 650; }

    .menu-bouton { display: none; }

    @media (max-width: 52rem) {
        .menu-bouton {
            display: grid; place-items: center;
            width: 2.75rem; height: 2.75rem;
            border: 1px solid var(--ligne); border-radius: var(--rayon);
            background: var(--surface); cursor: pointer;
        }
        .menu-bouton__trait, .menu-bouton__trait::before, .menu-bouton__trait::after {
            display: block; width: 1.2rem; height: 2px; background: var(--encre); content: "";
            transition: transform .2s;
        }
        .menu-bouton__trait { position: relative; }
        .menu-bouton__trait::before { position: absolute; left: 0; top: -6px; }
        .menu-bouton__trait::after { position: absolute; left: 0; top: 6px; }
        .menu-bouton[aria-expanded="true"] .menu-bouton__trait { background: transparent; }
        .menu-bouton[aria-expanded="true"] .menu-bouton__trait::before { transform: translateY(6px) rotate(45deg); }
        .menu-bouton[aria-expanded="true"] .menu-bouton__trait::after { transform: translateY(-6px) rotate(-45deg); }

        .menu {
            display: none;
            position: absolute; top: 100%; left: 0; right: 0;
            padding: .75rem var(--gouttiere) 1.25rem;
            background: var(--fond);
            border-bottom: 1px solid var(--ligne);
        }
        .menu--ouvert { display: block; }
        .menu > ul { flex-direction: column; }
        .menu .a-sous-menu > ul { position: static; visibility: visible; padding: 0 0 0 1rem; border: 0; }
    }

    /* ---------- Titre de page et zones ---------- */
    .titre-page { padding: var(--espace-section) 0 0; }
    .titre-page h1 { margin: 0; }

    .zone { padding-block: var(--espace-section) 0; }
    main > :last-child { padding-bottom: var(--espace-section); }
    .intro { max-width: var(--largeur-etroite); margin-bottom: 2.5rem; }
    .espace { height: var(--espace-section); }

    /* bandeau pleine largeur */
    .bandeau {
        display: grid; align-items: end;
        min-height: min(70vh, 40rem);
        padding: var(--espace-section) 0;
        background: var(--bandeau-fond);
        color: rgb(255 255 255 / .88);
    }
    .bandeau--image {
        background:
            linear-gradient(180deg, rgb(0 0 0 / .1) 0%, rgb(0 0 0 / .65) 100%),
            var(--image-fond) center / cover no-repeat;
    }
    .bandeau h1, .bandeau h2 { max-width: 18ch; color: #fff; }
    .bandeau .accroche { color: inherit; }
    .bandeau__contenu .texte { max-width: 38rem; font-size: 1.15rem; }

    /* texte + photo */
    .media { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: clamp(2rem, 5vw, 4.5rem); }
    .media--inverse .media__image { order: -1; }
    .media__image { margin: 0; }
    .media__image img { width: 100%; border-radius: var(--rayon); }

    .colonnes { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(2rem, 5vw, 4rem); }

    /* cartes */
    .cartes, .galerie { display: grid; gap: 1.5rem; margin: 0; padding: 0; list-style: none; }
    .cartes { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
    .carte {
        display: flex; flex-direction: column;
        background: var(--surface);
        border: 1px solid var(--ligne);
        border-radius: var(--rayon);
        overflow: hidden;
    }
    .carte img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
    .carte__corps { padding: 1.4rem 1.5rem 1.6rem; }
    .carte__corps h3 { margin-bottom: .3rem; }
    .carte__chapeau { margin: 0 0 .8rem; color: var(--doux); font-weight: 600; }

    /* galerie */
    .galerie { grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr)); }
    .galerie figure { margin: 0; }
    .galerie img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--rayon); }
    .galerie figcaption { margin-top: .5rem; color: var(--doux); font-size: .92rem; }

    /* FAQ */
    .faq details { border-bottom: 1px solid var(--ligne); }
    .faq details:first-child { border-top: 1px solid var(--ligne); }
    .faq summary {
        display: flex; justify-content: space-between; align-items: center; gap: 1rem;
        padding: 1.2rem 0;
        color: var(--encre);
        font: var(--graisse-titre) 1.15rem/1.35 var(--police-titre);
        list-style: none;
        cursor: pointer;
    }
    .faq summary::-webkit-details-marker { display: none; }
    .faq summary::after { content: "+"; font: 400 1.6rem/1 var(--police-texte); transition: transform .2s; }
    .faq details[open] summary::after { transform: rotate(45deg); }
    .faq details .texte { padding-bottom: 1.3rem; }

    /* vidéo */
    .video { margin-top: 2rem; }
    .video iframe { display: block; width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: var(--rayon); }

    /* coordonnées et mentions */
    .coordonnees { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1.5rem; margin: 2rem 0 0; }
    .coordonnees dt, .mentions dt { color: var(--doux); font-size: .9rem; font-weight: 600; }
    .coordonnees dd { margin: .3rem 0 0; }
    .mentions { display: grid; grid-template-columns: minmax(10rem, max-content) 1fr; gap: .6rem 1.5rem; margin: 0 0 2rem; }
    .mentions dt { padding-top: .1em; }
    .mentions dd { margin: 0; }

    /* formulaire */
    .formulaire { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem 1.5rem; margin-top: 2rem; }
    .champ { display: grid; gap: .4rem; }
    .champ--large, .formulaire .bouton { grid-column: 1 / -1; }
    .formulaire .bouton { justify-self: start; }
    .champ label { color: var(--encre); font-weight: 600; font-size: .95rem; }
    .facultatif { color: var(--doux); font-weight: 400; }
    .champ input, .champ textarea {
        width: 100%;
        padding: .75rem .9rem;
        border: 1px solid var(--ligne-forte);
        border-radius: var(--rayon);
        background: var(--surface);
        color: var(--texte);
        font: inherit;
    }
    .champ input:focus, .champ textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-clair); }
    .champ-piege { position: absolute; left: -9999px; }
    .message { margin: 1.5rem 0 0; padding: 1rem 1.2rem; border-radius: var(--rayon); font-weight: 500; }
    .message--ok { background: #e6f2ea; color: #1f5a33; }
    .message--erreur { background: #fbe9e6; color: #8a2a1a; }

    /* plan du site */
    .plan-du-site ul { padding-left: 1.2rem; }
    .plan-du-site li { margin: .3rem 0; }

    /* ---------- Pied de page ---------- */
    .pied { padding: 3.5rem 0 2rem; background: var(--pied-fond); color: var(--pied-texte); }
    .pied a { color: #fff; text-decoration: none; }
    .pied a:hover { text-decoration: underline; }
    .pied__grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 2rem; }
    .pied p { margin: 0 0 .5rem; }
    .pied__nom { color: #fff; font: var(--graisse-titre) 1.25rem/1.2 var(--police-titre); }
    .pied ul { margin: 0; padding: 0; list-style: none; }
    .pied li { margin-bottom: .5rem; }
    .pied__mention { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid rgb(255 255 255 / .12); font-size: .88rem; }

    /* ---------- Petits écrans ---------- */
    @media (max-width: 44rem) {
        .media, .colonnes, .formulaire { grid-template-columns: 1fr; }
        .media--inverse .media__image { order: 0; }
        .mentions { grid-template-columns: 1fr; gap: .2rem; }
        .mentions dd { margin-bottom: .8rem; }
    }

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