:root {
    color-scheme: light dark;
    --texte: #1d2433;
    --texte-secondaire: #5b6475;
    --fond: #f3f5f9;
    --carte: #ffffff;
    --champ: #ffffff;
    --bordure: #dde2ea;
    --accent: #1f4e8c;
    --accent-fonce: #173b6a;
    --accent-doux: #e8eff9;
    --lien: #1f4e8c;
    --or: #d99a2b;
    --haut-debut: #1f4e8c;
    --haut-fin: #0e2547;
    --ombre: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 8px rgba(16, 24, 40, .06);
    --ombre-survol: 0 4px 12px rgba(16, 24, 40, .08), 0 12px 32px rgba(16, 24, 40, .08);
    --erreur: #b3261e;
    --succes: #1e7a3c;
    --succes-fond: #e6f4ea;
    --avertissement: #8a5a00;
    --avertissement-fond: #fff4e0;
    --motif: #1f4e8c;
}

/* Thème sombre : selon le système (mode automatique), sauf choix explicite du thème clair via le bouton */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --texte: #e3e6ec;
        --texte-secondaire: #a3abba;
        --fond: #12151b;
        --carte: #1b1f27;
        --champ: #232832;
        --bordure: #313845;
        --accent: #3b72c4;
        --accent-fonce: #4d82d1;
        --accent-doux: #1e2b40;
        --lien: #8db6f2;
        --or: #e8b04a;
        --haut-debut: #18345c;
        --haut-fin: #0b1628;
        --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px rgba(0, 0, 0, .25);
        --ombre-survol: 0 4px 12px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .3);
        --erreur: #f2938c;
        --succes: #8fd6a4;
        --succes-fond: #1b3324;
        --avertissement: #f0c674;
        --avertissement-fond: #3a2e14;
        --motif: #8db6f2;
        color-scheme: dark;
    }
}

/* Thème sombre choisi explicitement via le bouton (mêmes valeurs que ci-dessus) */
:root[data-theme="dark"] {
    --texte: #e3e6ec;
    --texte-secondaire: #a3abba;
    --fond: #12151b;
    --carte: #1b1f27;
    --champ: #232832;
    --bordure: #313845;
    --accent: #3b72c4;
    --accent-fonce: #4d82d1;
    --accent-doux: #1e2b40;
    --lien: #8db6f2;
    --or: #e8b04a;
    --haut-debut: #18345c;
    --haut-fin: #0b1628;
    --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px rgba(0, 0, 0, .25);
    --ombre-survol: 0 4px 12px rgba(0, 0, 0, .35), 0 12px 32px rgba(0, 0, 0, .3);
    --erreur: #f2938c;
    --succes: #8fd6a4;
    --succes-fond: #1b3324;
    --avertissement: #f0c674;
    --avertissement-fond: #3a2e14;
    --motif: #8db6f2;
    color-scheme: dark;
}

:root[data-theme="light"] { color-scheme: light; }

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.55;
    color: var(--texte);
    background: var(--fond);
}

/* Illustration de fond, fixe derrière le contenu */
.fond-page {
    position: fixed; inset: 0; z-index: -1; width: 100%; height: 100%;
    color: var(--motif); pointer-events: none;
}

a { color: var(--lien); }
address { font-style: normal; }
h1 { font-size: 1.75rem; line-height: 1.25; margin: 0; }
h2 { font-size: 1.2rem; line-height: 1.3; margin: 0; }
.conteneur { max-width: 900px; margin: 0 auto; padding: 0 16px; }
.secondaire { color: var(--texte-secondaire); font-size: .95rem; }

/* En-tête : bandeau bleu illustré (cadré sur le haut de l'illustration, où se trouve l'avion) */
.haut {
    color: #fff;
    background:
        url("../images/fond-aero.svg") right top / cover no-repeat,
        linear-gradient(135deg, var(--haut-debut), var(--haut-fin));
}
.haut a { color: inherit; }
header .conteneur {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
    gap: 12px 24px; padding-block: 12px;
}
.marque { display: flex; align-items: center; gap: 16px; font-size: 1.25rem; font-weight: 600; text-decoration: none; }
/* Logo JPEG sur fond blanc : présenté dans une pastille blanche, lisible en mode clair comme sombre */
.marque img { display: block; height: 56px; width: auto; background: #fff; border-radius: 8px; padding: 4px; }
header nav a { font-size: .95rem; text-decoration: none; opacity: .85; }
header nav a:hover { opacity: 1; text-decoration: underline; }
header nav { display: flex; align-items: center; gap: 8px 20px; flex-wrap: wrap; }
.bascule-theme {
    display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
    border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px;
    background: rgba(255, 255, 255, .08); color: #fff; font: inherit; font-size: .9rem; cursor: pointer;
    transition: background .2s, border-color .2s;
}
.bascule-theme:hover { background: rgba(255, 255, 255, .18); border-color: rgba(255, 255, 255, .6); }
.bascule-theme:focus-visible { outline: 2px solid var(--or); outline-offset: 2px; }
.bascule-theme[hidden] { display: none; }
.bascule-theme svg { width: 16px; height: 16px; display: none; }
/* Icône correspondant au mode en cours */
:root:not([data-mode-theme]) .bascule-theme .icone-auto,
:root[data-mode-theme="auto"] .bascule-theme .icone-auto,
:root[data-mode-theme="clair"] .bascule-theme .icone-clair,
:root[data-mode-theme="sombre"] .bascule-theme .icone-sombre { display: block; }

.bandeau { padding-block: 32px 4px; }
.bandeau h1::after {
    content: ""; display: block; width: 56px; height: 3px; margin-top: 12px;
    border-radius: 2px; background: var(--or);
}
.bandeau .accroche { margin: 14px 0 0; max-width: 620px; font-size: 1.05rem; color: var(--texte-secondaire); }
.bandeau .pastilles { margin-top: 14px; }
.fil-ariane { font-size: .9rem; margin-bottom: 10px; color: var(--texte-secondaire); }
.fil-ariane a { text-decoration: none; }
.fil-ariane a:hover { text-decoration: underline; }

main { padding-block: 24px 56px; }
main > h2 { margin: 32px 0 0; }
main > h2:first-child { margin-top: 0; }
main > h2 + .carte { margin-top: 16px; }

/* Cartes */
.liste { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 16px; }
.carte {
    background: var(--carte); border: 1px solid var(--bordure); border-radius: 12px;
    padding: 20px 22px; box-shadow: var(--ombre);
}
.carte p { margin: 10px 0 0; }
section.carte + section.carte { margin-top: 16px; }
.carte-lien { position: relative; transition: box-shadow .2s, transform .2s, border-color .2s; }
.carte-lien:hover { box-shadow: var(--ombre-survol); transform: translateY(-2px); border-color: var(--accent); }
.carte-lien h2 a { text-decoration: none; }
/* Toute la carte est cliquable */
.carte-lien h2 a::after { content: ""; position: absolute; inset: 0; border-radius: 12px; }
.carte-lien .suite { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font-weight: 600; color: var(--lien); }
.carte-lien .suite svg { width: 18px; height: 18px; flex: none; }
.carte-lien .suite.aucun { font-weight: 400; color: var(--texte-secondaire); }
.description > :first-child { margin-top: 10px; }
.description > :last-child { margin-bottom: 0; }

/* Pastilles d'information (date de clôture, n° de poste...) */
.pastilles { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pastille {
    display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
    border-radius: 999px; font-size: .85rem; background: var(--accent-doux); color: var(--texte);
}
.pastille svg { width: 14px; height: 14px; flex: none; }
.pastille.proche { background: var(--avertissement-fond); color: var(--avertissement); font-weight: 600; }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 16px; }

/* Boutons */
.bouton {
    display: inline-block; border: 1px solid var(--accent); border-radius: 8px; padding: 9px 18px;
    background: var(--accent); color: #fff; font: inherit; font-weight: 600;
    text-decoration: none; cursor: pointer; transition: background .2s, border-color .2s;
}
.bouton:hover { background: var(--accent-fonce); border-color: var(--accent-fonce); }
.bouton.secondaire { background: transparent; color: var(--lien); border-color: var(--bordure); font-size: 1rem; }
.bouton.secondaire:hover { border-color: var(--accent); background: var(--accent-doux); }
.bouton.principal { padding: 12px 28px; font-size: 1.05rem; }

/* États vides et messages */
.vide { text-align: center; padding: 40px 24px; color: var(--texte-secondaire); }
.vide svg { width: 48px; height: 48px; color: var(--accent); opacity: .6; margin-bottom: 8px; }
.message { border-radius: 10px; padding: 14px 18px; margin: 16px 0; }
.message.succes { background: var(--succes-fond); color: var(--succes); }
.message.avertissement { background: var(--avertissement-fond); color: var(--avertissement); }
.confirmation, .page-erreur { text-align: center; padding: 40px 24px; }
.confirmation svg, .page-erreur svg { width: 64px; height: 64px; }
.confirmation svg { color: var(--succes); }
.page-erreur svg { color: var(--accent); }
.confirmation h2, .page-erreur h2 { margin: 12px 0 0; font-size: 1.4rem; }
.confirmation p, .page-erreur p { max-width: 520px; margin-inline: auto; }
.confirmation .actions, .page-erreur .actions { justify-content: center; margin-top: 24px; }

/* Formulaire */
.etape { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.etape .numero {
    display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none;
    border-radius: 50%; background: var(--accent); color: #fff; font-weight: 700;
}
.etape p { margin: 2px 0 0; }
.grille-2 { display: grid; gap: 0 16px; }
@media (min-width: 640px) { .grille-2 { grid-template-columns: 1fr 1fr; } }
/* Espacement des lignes du formulaire (div générées par form_row) */
.grille-2 > div, form .carte > div:not(.etape, .grille-2, [id$="_documents"]), [id$="_documents"] > div { margin-bottom: 18px; }
form .carte > :last-child, [id$="_documents"] > div:last-child { margin-bottom: 0; }
form .carte + .carte { margin-top: 16px; }
label { display: block; font-weight: 600; margin-bottom: 6px; }
label.required::after { content: " *"; color: var(--erreur); }
input[type=text], input[type=email] {
    width: 100%; padding: 10px 12px; font: inherit;
    border: 1px solid var(--bordure); border-radius: 8px; background: var(--champ); color: var(--texte);
    transition: border-color .2s, box-shadow .2s;
}
input[type=text]:focus, input[type=email]:focus, input[type=file]:focus-visible {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux);
}
input[type=file] {
    width: 100%; padding: 8px; font: inherit; font-size: .95rem; color: var(--texte-secondaire);
    border: 1px dashed var(--bordure); border-radius: 8px; background: var(--fond);
}
input[type=file]::file-selector-button {
    margin-right: 12px; padding: 7px 14px; border: 1px solid var(--accent); border-radius: 6px;
    background: var(--carte); color: var(--lien); font: inherit; font-weight: 600; cursor: pointer;
}
input[type=file]::file-selector-button:hover { background: var(--accent-doux); }
.help-text { color: var(--texte-secondaire); font-size: .9rem; margin-top: 6px; overflow-wrap: anywhere; }
/* Listes d'erreurs générées par les formulaires Symfony */
form ul { color: var(--erreur); margin: 6px 0; padding-left: 20px; }
.envoi { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 20px; }
.envoi p { margin: 0; }
.obligatoire { color: var(--erreur); }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
    .carte-lien:hover { transform: none; }
}
