/*
 * Charte reprise du site existant (docs/site-existant/ecrans-13-design.md). Les pages de l'application
 * (body.application) : fond cyan #22b8c7, panneaux blancs translucides à texte sombre, liens bleus, boutons et
 * étiquettes à la Bootstrap 3, comme l'application d'inscription existante (assets/styles/application.css).
 * Les pages du site (« / », FAQ, charte) sont celles du landing, servies telles quelles (landing/files/style.css).
 * CSS écrit à la main (AssetMapper, pas de chaîne Node) ; variables en tête, composants ensuite. Les
 * composants ne connaissent que les variables : l'ambiance ne change que les variables et quelques règles.
 * Conventions : classes en français, préfixe par composant (.carte, .bouton, .alerte, .champ).
 */
:root {
    --nuit-fond: #051923;
    --nuit-fond-2: #082330;
    --nuit-surface: rgba(255, 255, 255, 0.03);
    --nuit-surface-2: rgba(255, 255, 255, 0.06);
    --nuit-bord: rgba(34, 184, 199, 0.35);
    --nuit-texte: #eee;
    --nuit-texte-2: #c1c1c1;
    --nuit-lune: #ecc427;
    --nuit-lune-2: #feff90;
    --nuit-cyan: #22b8c7;
    --nuit-succes: #5cb85c;
    --nuit-erreur: #e05252;
    --nuit-info: #22b8c7;
    --champ-fond: rgba(5, 25, 35, 0.7);
    --champ-texte: #eee;
    --rayon: 6px;
    --ombre: none;
    --largeur: 68rem;
    --police: 'Barlow', 'Raleway', Trebuchet, Arial, sans-serif;
    --police-titres: 'Raleway', Trebuchet, Arial, sans-serif;
    color-scheme: dark;
    font-family: var(--police);
    font-size: 1.05rem;
    line-height: 1.5;
}

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

html { scroll-behavior: smooth; }

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    color: var(--nuit-texte);
    background-color: var(--nuit-fond);
}

a, a:link, a:visited { color: var(--nuit-lune); text-decoration-thickness: 1px; text-underline-offset: 0.15em; }
a:hover { color: var(--nuit-lune-2); }
:focus-visible { outline: 3px solid var(--nuit-lune); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3, h4, h5 { line-height: 1.15; margin: 0 0 0.5em; }
h1 { color: #fff; font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 300; text-transform: uppercase; }
h2 { color: var(--nuit-lune); font-size: clamp(1.4rem, 3vw, 1.9rem); font-weight: 400; }
h3 { color: var(--nuit-lune); font-size: 1.35rem; font-weight: 400; text-transform: uppercase; font-family: var(--police-titres); }
h4, h5 { color: var(--nuit-cyan); font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }
code { background: rgba(255, 255, 255, 0.08); padding: 0.1em 0.4em; border-radius: 6px; font-size: 0.95em; }

/* Choix du rôle (tête du tableau de bord). */
.contexte-role { display: inline-flex; align-items: center; color: #c1c1c1; font-size: 0.85rem; font-weight: 700; line-height: 3em; padding-left: 1em; text-transform: uppercase; }
.contexte-role form { display: inline; }
.contexte-role button { padding: 0 0.5em; font-size: 0.85rem; font-weight: 700; line-height: 3em; color: #22b8c7; background: transparent; border: 0; cursor: pointer; font-family: inherit; text-transform: uppercase; }
.contexte-role button[disabled] { color: #ecc427; cursor: default; }
/* Contenu ------------------------------------------------------------- */
main {
    flex: 1;
    width: 100%;
    max-width: var(--largeur);
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}
.etroit { max-width: 32rem; margin-inline: auto; }
.moyen { max-width: 46rem; margin-inline: auto; }

.carte {
    background: var(--nuit-surface);
    border: 1px solid var(--nuit-bord);
    border-radius: var(--rayon);
    padding: 1.5rem;
    box-shadow: var(--ombre);
}
.carte + .carte { margin-top: 1.25rem; }
.carte__titre { margin-top: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: center; }

.pastille {
    display: inline-block;
    padding: 0.15em 0.65em;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 700;
    background: rgba(255, 255, 255, 0.1);
    color: var(--nuit-texte-2);
}
.pastille--ouvert { background: rgba(92, 184, 92, 0.2); color: var(--nuit-succes); }
.pastille--ferme { background: rgba(224, 82, 82, 0.2); color: var(--nuit-erreur); }
/* Archives des éditions passées : sélecteur d'année, un bloc par défi, résultats en texte libre. */
.archives__annees .actions { justify-content: flex-start; padding: 0; list-style: none; }
.archives__defi { border-top: 1px solid var(--nuit-bord); padding: 0.75rem 0; }
.archives__defi h3 { margin: 0 0 0.25rem; }
.archives__resultats { white-space: pre-line; }
.archives__banniere { display: block; max-width: 100%; height: auto; }
.pastille--lune { background: rgba(236, 196, 39, 0.18); color: var(--nuit-lune); }

/* Boutons : pilule du site existant (fond nuit translucide, texte et bordure jaunes ; au survol, coins à 10 px). */
.bouton {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.4rem;
    border-radius: 50px;
    border: 2px solid var(--nuit-lune);
    font: inherit;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    color: var(--nuit-lune) !important;
    background: rgba(5, 25, 35, 0.75);
    transition: border-radius 0.1s ease, background 0.15s ease, color 0.15s ease;
}
.bouton:hover, .bouton:focus { border-radius: 10px; background: var(--nuit-lune); color: var(--nuit-fond) !important; }
.bouton--secondaire { color: var(--nuit-cyan) !important; border-color: var(--nuit-cyan); }
.bouton--secondaire:hover, .bouton--secondaire:focus { background: var(--nuit-cyan); color: var(--nuit-fond) !important; }
.bouton--danger { color: #fff !important; border-color: var(--nuit-erreur); background: var(--nuit-erreur); }
.bouton--danger:hover { background: #b51515; color: #fff !important; }
.bouton--petit { padding: 0.3rem 0.9rem; font-size: 0.9rem; border-width: 1px; }

/* Messages ------------------------------------------------------------ */
.alerte {
    padding: 0.85rem 1rem;
    border-radius: var(--rayon);
    border: 1px solid;
    margin: 0 0 1.25rem;
}
.alerte--succes { border-color: rgba(92, 184, 92, 0.6); background: rgba(92, 184, 92, 0.15); }
.alerte--erreur { border-color: rgba(224, 82, 82, 0.6); background: rgba(224, 82, 82, 0.15); }
.alerte--info { border-color: rgba(34, 184, 199, 0.6); background: rgba(34, 184, 199, 0.15); }

/* Formulaires --------------------------------------------------------- */
.champ { margin-bottom: 1.1rem; }
.champ label, .champ legend { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.champ__aide { color: var(--nuit-texte-2); font-size: 0.9rem; margin: 0.3rem 0 0; }
.champ__erreur { color: var(--nuit-erreur); font-size: 0.9rem; margin: 0.35rem 0 0; }
.champ--case { display: flex; gap: 0.6rem; align-items: flex-start; }
.champ--case label { font-weight: 500; margin: 0; }
.champ--case input { margin-top: 0.3rem; width: 1.1rem; height: 1.1rem; accent-color: var(--nuit-lune); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="url"], input[type="datetime-local"], select, textarea {
    width: 100%;
    padding: 0.55rem 0.8rem;
    border-radius: 4px;
    border: 1px solid var(--nuit-bord);
    background: var(--champ-fond);
    color: var(--champ-texte);
    font: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--nuit-cyan); outline: none; box-shadow: 0 0 0 3px rgba(34, 184, 199, 0.3); }
fieldset { border: 1px solid var(--nuit-bord); border-radius: var(--rayon); padding: 1rem 1.25rem; margin: 0 0 1.25rem; }
legend { padding: 0 0.5rem; font-weight: 700; }
form .bouton { margin-top: 0.25rem; }

/* Listes et tableaux -------------------------------------------------- */
.liste-propre { list-style: none; padding: 0; margin: 0; }
.liste-propre li { padding: 0.6rem 0; border-bottom: 1px solid var(--nuit-bord); }
.liste-propre li:last-child { border-bottom: 0; }
.tableau { width: 100%; border-collapse: collapse; }
.tableau th, .tableau td { text-align: left; padding: 0.6rem 0.5rem; border-bottom: 1px solid var(--nuit-bord); vertical-align: top; }
.tableau th { color: var(--nuit-texte-2); font-weight: 700; font-size: 0.9rem; }
/* Éditions (bureau) : ligne de l'édition courante. */
.edition--courante td { background: rgba(92, 184, 92, 0.12); }
.defilable { overflow-x: auto; }

@media (max-width: 40rem) {
    .carte { padding: 1.1rem; }
    main { padding-top: 1.25rem; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .bouton { transition: none; }
}

/* Texte réservé aux lecteurs d'écran (libellés de champs dans un tableau, par exemple). */
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Accessibilité (RGAA) : lien d'évitement visible au clavier seulement ; cible du lien focalisable sans contour parasite. */
.lien-evitement { position: absolute; left: -999px; top: 0.5rem; z-index: 1000; padding: 0.5rem 1rem; background: var(--nuit-lune); color: var(--nuit-fond); font-weight: 700; border-radius: 4px; }
.lien-evitement:focus { left: 0.5rem; }
main:focus { outline: none; }
/* Bandeau du site de test (staging, _bandeau_site_de_test.html.twig) : dans le flux, en tête de page, il défile avec
   elle et ne recouvre aucun menu. Blanc sur #b00020 : 7,3:1. Les pages du landing reçoivent le leur de
   config/landing/entree.php (App\Landing\ReecritureLiens). */
.bandeau-site-de-test { margin: 0; padding: 0.4rem 1rem; background: #b00020; color: #fff; font-size: 1rem; font-weight: 700; line-height: 1.4; text-align: center; }

/* Mode maintenance actif (_bandeau_maintenance.html.twig, 31/10/2026) : rappel aux administrateurs, seuls à voir encore
   les pages ; noir sur ambre (12,6:1), fixe en thème clair et sombre, dans le flux comme le bandeau du site de test. */
.bandeau-maintenance { margin: 0; padding: 0.4rem 1rem; background: #ffd166; color: #1b1b1b; font-size: 1rem; line-height: 1.4; text-align: center; }
.bandeau-maintenance a { color: #1b1b1b; font-weight: 700; }

/* Podium : une ligne par équipe primée, médaille en tête. */
.podium { counter-reset: none; }
.podium li { margin: 0.25rem 0; }

/* Mur des logos : tuiles de taille bornée, image contenue, nom en repli. Les images viennent d'adresses
   fournies par les organisations : largeur et hauteur fixes pour éviter tout saut de mise en page. */
.logos { display: grid; grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); gap: 1rem; list-style: none; padding: 0; margin: 0; }
.logos__tuile { display: flex; align-items: center; justify-content: center; min-height: 5.5rem; padding: .5rem; background: #fff; border-radius: .5rem; }
.logos__nom { color: var(--nuit-fond); }
.logos__tuile img { max-width: 100%; height: auto; max-height: 5rem; object-fit: contain; }
.logos__nom { font-weight: 600; text-align: center; }
.defi__societe { display: flex; align-items: center; gap: .5rem; }
.defi__logo { height: 2.5rem; width: auto; max-width: 7rem; object-fit: contain; }

/* Carte des sites (lot 2) : hauteur fixe comme sur le site existant, boutons de recentrage, vignettes
   d'écoles et de sponsors, état des inscriptions. */
.carte-sites { height: 600px; border-radius: var(--rayon); overflow: hidden; background: var(--nuit-fond-2); }
.carte-sites .leaflet-popup-content p { margin: 0 0 0.35rem; font-weight: 600; }
.carte-sites .leaflet-popup-content ul { margin: 0; padding-left: 1.1rem; }
.carte-sites__vues a { width: auto !important; padding: 0 0.6rem; font-size: 0.85rem; }
.vignettes { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr)); margin: 0; padding: 0; list-style: none; }
.vignettes li { text-align: center; border: 1px solid var(--nuit-bord); border-radius: var(--rayon); padding: 0.75rem; }
.vignettes img { max-width: 100%; height: auto; max-height: 5rem; object-fit: contain; }
.vignettes strong { display: block; margin-top: 0.5rem; }
.etat-inscriptions { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.etat-inscriptions li { padding: 0.6rem 0.9rem; border-radius: var(--rayon); border: 1px solid var(--nuit-bord); text-align: center; }
.etat-inscriptions .etat--ouvert { border-color: rgba(69, 212, 131, 0.5); background: rgba(69, 212, 131, 0.12); }
.etat-inscriptions .etat--ferme { border-color: rgba(255, 107, 122, 0.5); background: rgba(255, 107, 122, 0.12); }
.etat-inscriptions .etat--info { border-color: rgba(111, 182, 255, 0.5); background: rgba(111, 182, 255, 0.12); }
.liste-sites h3 { margin: 1rem 0 0.25rem; color: var(--nuit-lune); }

/* Cartes des défis et fiche d'un défi (lot 3) : titre et thème, podium (rang1 à rang3), logo et lot, compteur. */
.defi--national { border-color: var(--nuit-lune); }
.defi__theme { color: var(--nuit-texte-2); margin: 0 0 0.5rem; }
.defi__podium { list-style: none; padding: 0; margin: 0 0 0.75rem; }
.defi__podium li { padding-left: 1.6rem; position: relative; margin: 0.2rem 0; }
.defi__podium li::before { position: absolute; left: 0; font-weight: 700; color: var(--nuit-lune); }
.defi__podium .rang1::before { content: '1er'; }
.defi__podium .rang2::before { content: '2e'; }
.defi__podium .rang3::before { content: '3e'; }
.defi__lot { border-top: 1px solid var(--nuit-bord); padding-top: 0.75rem; }
.defi__participants { margin: 0.75rem 0 0; color: var(--nuit-texte-2); }
.defi__compte { display: inline-block; margin-left: 0.4rem; font-size: 1.4rem; font-weight: 700; color: var(--nuit-texte); }
.defi__logo-bloc { text-align: center; margin: 0 0 0.75rem; }
.defi__logo-bloc img { max-width: 100%; height: auto; max-height: 7.5rem; object-fit: contain; }
.defi__encadres { grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); margin-bottom: 1rem; }
.defi__encadres h3 { margin: 0 0 0.3rem; font-size: 1rem; }
.defi__encadres p { margin: 0; }
.defi__resultats { margin-bottom: 1rem; }


/* Panel administrateur (lot 12). */
.panel__compteurs { font-size: 1.1rem; }
#panel-admin h3 { margin: 0 0 0.5rem; font-size: 1rem; color: var(--nuit-lune); }

/* Teintes des labels Bootstrap 3 assombries pour un contraste d'au moins 4,5:1 (RGAA, texte de 12 px en gras) :
   blanc sur #666 (5,7:1), sur #3c763d (5,5:1), sur #a94442 (5,9:1) ; #333 sur l'orange #f0ad4e (6,5:1). */



.defi-liste { display: flex; flex-direction: column; gap: 10px; }
.index-lettres { text-align: center; margin: 1em; font-size: 1.2em; }

/* Cartes empilées. */
.pile > .carte + .carte { margin-top: 1.25rem; }

/* Actions du bureau avec case de confirmation (éditions, relances). */
.action-confirmee { margin: 0.4rem 0; }
.action-confirmee .champ--case { display: block; font-size: 0.85rem; margin: 0 0 0.2rem; }

/* Listes d'administration (écrans génériques du back-office) : recherche, tableau défilant sur mobile, pagination. */
.administration__recherche { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0 0 0.75rem; }
.administration__recherche .champ__aide { flex-basis: 100%; margin: 0; }
.administration__recherche-message { flex-basis: 100%; margin: 0; }
.administration__tableau { overflow-x: auto; }
.administration__actions { white-space: nowrap; }
.administration__pagination .actions { justify-content: center; padding: 0; list-style: none; }
.administration__pagination [aria-current="page"] { font-weight: 700; }
