/* app.css — design system bi_pap (Pointe Ardennes Parapente).
 *
 * Direction : les Ardennes vues du décollage — ardoise des crêtes, bleu d'air,
 * orange de voile. Typographie « placard de site de vol » : Barlow Condensed
 * pour les titres et étiquettes, system-ui pour la lecture. Mobile d'abord :
 * l'interface se manipule au décollage, en plein soleil, à une main — d'où
 * des contrastes AA/AAA, des cibles ≥ 44 px et zéro finesse grise.
 */

@font-face {
  font-family: 'Barlow Condensed';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/public/fonts/barlow-condensed-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/public/fonts/barlow-condensed-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Barlow Condensed';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/public/fonts/barlow-condensed-700.woff2') format('woff2');
}

:root {
  /* Palette — contrastes vérifiés sur fond --fond (blanc froid) :
     encre 15.2:1 · ardoise 10.4:1 · bleu 6.6:1 · orange 5.9:1 · sapin 5.9:1 ·
     brique 7.0:1. L'orange de voile est l'accent SIGNATURE : il souligne, il
     ne tapisse pas. */
  --encre: #16212B;         /* texte principal */
  --ardoise: #33424F;       /* texte secondaire */
  --ardoise-brume: #5D6E7B; /* méta, jamais sous 4.5:1 sur --fond */
  --bleu: #205A87;          /* actions, liens */
  --bleu-nuit: #17415F;     /* hover/active */
  --voile: #A84610;         /* accent signature (orange de voile) */
  --sapin: #23684A;         /* GO, succès */
  --brique: #93261C;        /* NO-GO, erreurs */
  --fond: #FAFBFC;          /* blanc d'air */
  --carte: #FFFFFF;
  --trait: #C9D2D9;         /* filets décoratifs (jamais seuls porteurs de sens) */
  --trait-fort: #6E8291;    /* bordures de composants : 3.6:1 sur blanc
                               (SC 1.4.11 exige ≥ 3:1 — l'ancien #8DA0AE
                               plafonnait à 2.7:1) */
  --ciel-pale: #EAF1F6;     /* aplats discrets (bandeaux, hover de ligne) */
  --sable: #F6EFE7;         /* aplat chaud (encarts campagne) */

  --police-titre: 'Barlow Condensed', 'Arial Narrow', system-ui, sans-serif;
  --police-corps: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --rayon: 6px;
  --ombre: 0 1px 3px rgb(22 33 43 / 0.12);
  --focus: 3px solid var(--voile);
}

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

html { font-size: 100%; }

body {
  margin: 0;
  font-family: var(--police-corps);
  font-size: 1rem;
  line-height: 1.55;
  color: var(--encre);
  background: var(--fond);
  -webkit-text-size-adjust: 100%;
}

/* Focus visible épais partout — clavier ET plein soleil. */
:focus-visible {
  outline: var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

::selection { background: var(--ciel-pale); }

h1, h2, h3 {
  font-family: var(--police-titre);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.01em;
  margin: 0 0 0.5rem;
  text-wrap: balance;
}
h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); }
h2 { font-size: clamp(1.4rem, 4vw, 1.8rem); }
h3 { font-size: 1.2rem; }

p { margin: 0 0 1rem; max-width: 65ch; }

a { color: var(--bleu); text-underline-offset: 2px; }
a:hover { color: var(--bleu-nuit); }

hr { border: 0; border-top: 1px solid var(--trait); margin: 1.5rem 0; }

/* Étiquette « placard » : capitales condensées espacées — la voix des
   panneaux de site de vol. Sert d'eyebrow et de libellé de données. */
.etiquette {
  font-family: var(--police-titre);
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ardoise);
}

/* Données chiffrées (altitudes, durées, montants) : chiffres tabulaires. */
.donnee, td.num, .kpi-valeur {
  font-variant-numeric: tabular-nums;
}

/* ── Structure de page ────────────────────────────────────────────────────── */
.page {
  max-width: 42rem;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}
.page--large { max-width: 64rem; }

.entete {
  background: var(--encre);
  color: #fff;
  border-bottom: 4px solid var(--voile); /* le liseré de voile : marque du site */
}
.entete__inner {
  max-width: 64rem;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.entete a { color: #fff; text-decoration: none; }
.entete a:hover { text-decoration: underline; }
.marque {
  font-family: var(--police-titre);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.marque svg { flex: none; }
.marque__sous {
  font-family: var(--police-corps);
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: #B8C6D1;
  display: block;
}

.entete__espace { flex: 1; }
.entete__nom { color: #B8C6D1; font-size: 0.92rem; }
.btn--entete { color: #D5DEE5; padding: 0.3rem 0.5rem; }
.btn--entete:hover { color: #fff; background: transparent; }
/* Sous 560px, le nom du gestionnaire disparaît pour garder marque et
   déconnexion sur UNE ligne (l'entête ne doit pas manger l'écran du déco). */
@media (max-width: 560px) {
  .entete__nom { display: none; }
  .marque { font-size: 1.15rem; }
}

/* Navigation back-office : barre défilante sur mobile, cibles 44px. */
.nav-admin {
  background: var(--encre);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.nav-admin ul {
  display: flex;
  gap: 0.25rem;
  margin: 0 auto;
  padding: 0 0.75rem;
  max-width: 64rem;
  list-style: none;
}
.nav-admin a {
  display: block;
  padding: 0.7rem 0.85rem;
  color: #D5DEE5;
  text-decoration: none;
  font-family: var(--police-titre);
  font-weight: 500;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.nav-admin a:hover { color: #fff; }
.nav-admin a[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--voile);
}

main { display: block; margin-top: 1.5rem; }

/* Lien d'évitement */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--voile);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 10;
}
.skip:focus { left: 0; }

/* ── Cartes, tableaux, listes ─────────────────────────────────────────────── */
.carte {
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 1rem;
  box-shadow: var(--ombre);
}

.cartes { display: grid; gap: 0.75rem; margin: 1rem 0; padding: 0; list-style: none; }
@media (min-width: 700px) {
  .cartes--2 { grid-template-columns: 1fr 1fr; }
  .cartes--3 { grid-template-columns: repeat(3, 1fr); }
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
}
caption {
  text-align: left;
  font-family: var(--police-titre);
  font-weight: 600;
  font-size: 1.1rem;
  padding: 0.5rem 0;
}
th {
  font-family: var(--police-titre);
  font-weight: 600;
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  color: var(--ardoise);
  border-bottom: 2px solid var(--trait-fort);
  padding: 0.6rem 0.75rem;
}
td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--trait);
  vertical-align: top;
}
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--ciel-pale); }
td.num, th.num { text-align: right; }

/* Tableau → cartes empilées sous 640px (chaque cellule porte son étiquette
   via data-label). */
@media (max-width: 640px) {
  .t-cartes thead { position: absolute; left: -9999px; }
  .t-cartes tr {
    display: block;
    border-bottom: 4px solid var(--trait);
    padding: 0.5rem 0;
  }
  .t-cartes td {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    border: 0;
    padding: 0.35rem 0.75rem;
    text-align: right;
  }
  .t-cartes td.num { text-align: right; }
  .t-cartes td::before {
    content: attr(data-label);
    font-family: var(--police-titre);
    font-weight: 500;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ardoise);
    text-align: left;
  }
}

/* ── Placard de site de vol (signature secondaire) ────────────────────────── */
.placard {
  border: 2px solid var(--encre);
  border-radius: var(--rayon);
  background: var(--carte);
  padding: 0.85rem 1rem;
}
.placard__nom {
  font-family: var(--police-titre);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
}
.placard__altitudes {
  font-variant-numeric: tabular-nums;
  color: var(--ardoise);
}
.placard__ferme {
  color: var(--brique);
  font-weight: 600;
}

/* ── Badges d'état ────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-family: var(--police-titre);
  font-weight: 600;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 0.1rem 0.5rem;
  border-radius: 3px;
  border: 1.5px solid currentColor;
  white-space: nowrap;
}
.badge--neutre { color: var(--ardoise); }
.badge--bleu { color: var(--bleu); }
.badge--go { color: var(--sapin); }
.badge--stop { color: var(--brique); }
.badge--voile { color: var(--voile); }
.badge--plein {
  background: var(--sapin);
  color: #fff;
  border-color: var(--sapin);
}

/* ── Formulaires ──────────────────────────────────────────────────────────── */
.champ { margin-bottom: 1.1rem; }
.champ > label, fieldset legend {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.champ .aide {
  font-size: 0.9rem;
  color: var(--ardoise);
  margin: 0.15rem 0 0.35rem;
}
input[type="text"], input[type="email"], input[type="tel"], input[type="date"],
input[type="number"], input[type="time"], input[type="password"], select, textarea {
  font: inherit;
  color: var(--encre);
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  border: 1.5px solid var(--trait-fort);
  border-radius: var(--rayon);
  background: var(--carte);
}
input:focus, select:focus, textarea:focus {
  outline: var(--focus);
  outline-offset: 0;
  border-color: var(--voile);
}
input[aria-invalid="true"], select[aria-invalid="true"] {
  border-color: var(--brique);
  border-width: 2px;
}
fieldset {
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 0.75rem 1rem 0.5rem;
  margin: 0 0 1.1rem;
}
legend { padding: 0 0.4rem; font-weight: 600; }

/* Cases et radios : cibles larges, la LIGNE entière est cliquable. */
.choix {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.5rem 0.25rem;
  border-radius: var(--rayon);
}
.choix:hover { background: var(--ciel-pale); }
.choix input {
  width: 1.35rem;
  height: 1.35rem;
  margin-top: 0.15rem;
  flex: none;
  accent-color: var(--bleu);
}
.choix label { font-weight: 400; }

/* Créneau de disponibilité fermé : visible, explicitement non proposé. */
.choix--ferme { color: var(--ardoise-brume); }
.choix--ferme:hover { background: transparent; }
.choix--ferme input { accent-color: var(--trait); cursor: not-allowed; }

.erreur-champ {
  color: var(--brique);
  font-weight: 600;
  font-size: 0.92rem;
  margin-top: 0.25rem;
}

/* Récapitulatif d'erreurs en tête de formulaire. */
.erreurs {
  border: 2px solid var(--brique);
  border-left-width: 6px;
  border-radius: var(--rayon);
  background: var(--carte);
  padding: 0.85rem 1rem;
  margin-bottom: 1.25rem;
}
.erreurs h2 { color: var(--brique); font-size: 1.15rem; margin-bottom: 0.4rem; }
.erreurs ul { margin: 0; padding-left: 1.2rem; }

/* Pot de miel : hors écran, pas display:none (certains robots le détectent). */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ── Boutons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  padding: 0.55rem 1.2rem;
  border-radius: var(--rayon);
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  background: var(--bleu);
  color: #fff;
}
.btn:hover { background: var(--bleu-nuit); color: #fff; }
.btn--second {
  background: transparent;
  color: var(--bleu);
  border-color: var(--bleu);
}
.btn--second:hover { background: var(--ciel-pale); color: var(--bleu-nuit); }
.btn--go { background: var(--sapin); }
.btn--go:hover { background: #1B5039; }
.btn--stop { background: var(--brique); }
.btn--stop:hover { background: #741E16; }
.btn--voile { background: var(--voile); }
.btn--voile:hover { background: #8A3A0D; }
.btn--discret {
  background: transparent;
  color: var(--bleu);
  border: 0;
  text-decoration: underline;
  min-height: 44px;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
/* Bouton pré-sélectionné par le lien de l'email (?r=dispo) : mise en avant
   VISUELLE seulement — pas d'autofocus. */
.btn--presel { box-shadow: 0 0 0 3px var(--sable), 0 0 0 5px var(--voile); }

/* La marque de l'entête doit rester une cible confortable. */
.marque a, .entete .marque { padding: 0.35rem 0; }

.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; margin: 1.25rem 0; }

/* ── Messages flash / encarts ─────────────────────────────────────────────── */
.flash {
  border-radius: var(--rayon);
  border: 2px solid;
  border-left-width: 6px;
  padding: 0.85rem 1rem;
  margin: 1rem 0;
  background: var(--carte);
}
.flash--ok { border-color: var(--sapin); }
.flash--erreur { border-color: var(--brique); }
.flash--info { border-color: var(--bleu); }
.flash--voile { border-color: var(--voile); background: var(--sable); }

/* ── KPI (stats) ──────────────────────────────────────────────────────────── */
.kpis { display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); margin: 1rem 0; }
.kpi {
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  padding: 0.75rem 0.9rem;
}
.kpi-valeur {
  font-family: var(--police-titre);
  font-weight: 700;
  font-size: 2.1rem;
  line-height: 1.1;
  display: block;
}
.kpi--principal { border: 2px solid var(--voile); }
.kpi--principal .kpi-valeur { color: var(--voile); }

/* Barres simples (répartition S/M/XL…) — pas de lib de graphes. */
.barres { display: grid; gap: 0.4rem; margin: 0.75rem 0; padding: 0; list-style: none; }
.barre { display: grid; grid-template-columns: 6rem 1fr 3.5rem; align-items: center; gap: 0.6rem; }
.barre__piste { background: var(--ciel-pale); border-radius: 3px; height: 1.15rem; overflow: hidden; }
.barre__valeur { background: var(--bleu); height: 100%; min-width: 2px; display: block; }
.barre--voile .barre__valeur { background: var(--voile); }
/* Largeurs par pas de 5 % : la CSP interdit les style= inline, les gabarits
   arrondissent le pourcentage à la classe la plus proche. */
.w-0 { width: 0; } .w-5 { width: 5%; } .w-10 { width: 10%; }
.w-15 { width: 15%; } .w-20 { width: 20%; } .w-25 { width: 25%; }
.w-30 { width: 30%; } .w-35 { width: 35%; } .w-40 { width: 40%; }
.w-45 { width: 45%; } .w-50 { width: 50%; } .w-55 { width: 55%; }
.w-60 { width: 60%; } .w-65 { width: 65%; } .w-70 { width: 70%; }
.w-75 { width: 75%; } .w-80 { width: 80%; } .w-85 { width: 85%; }
.w-90 { width: 90%; } .w-95 { width: 95%; } .w-100 { width: 100%; }

/* Masquage visuel accessible (captions de tableaux, libellés). */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.placard--ferme { opacity: 0.75; border-style: dashed; }
.liste-reponses { list-style: none; padding: 0; margin: 0.5rem 0; }
.liste-reponses li { padding: 0.45rem 0.25rem; border-bottom: 1px solid var(--trait); }
.liste-reponses li:last-child { border-bottom: 0; }
.h-rotation { font-size: 1.25rem; }

/* ── Rose des vents (signature) ───────────────────────────────────────────── */
/* Huit secteurs en radio. La rose est un fieldset : accessible au clavier et
   au lecteur d'écran comme n'importe quel groupe de radios. */
.rose {
  display: grid;
  grid-template-columns: repeat(3, minmax(3.4rem, 4.5rem));
  grid-template-areas:
    "no n ne"
    "o  c e"
    "so s se";
  gap: 0.4rem;
  justify-content: start;
  margin: 0.5rem 0;
}
.rose__centre {
  grid-area: c;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ardoise-brume);
}
.rose .secteur { position: relative; }
.rose .secteur--n { grid-area: n; } .rose .secteur--ne { grid-area: ne; }
.rose .secteur--e { grid-area: e; } .rose .secteur--se { grid-area: se; }
.rose .secteur--s { grid-area: s; } .rose .secteur--so { grid-area: so; }
.rose .secteur--o { grid-area: o; } .rose .secteur--no { grid-area: no; }
.rose input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.rose label {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 2px solid var(--trait-fort);
  border-radius: var(--rayon);
  font-family: var(--police-titre);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  background: var(--carte);
  color: var(--ardoise);
}
.rose input:hover + label { border-color: var(--bleu); color: var(--bleu); }
.rose input:checked + label {
  background: var(--voile);
  border-color: var(--voile);
  color: #fff;
}
.rose input:focus-visible + label {
  outline: var(--focus);
  outline-offset: 2px;
}

/* ── Divers ───────────────────────────────────────────────────────────────── */
.meta { color: var(--ardoise-brume); font-size: 0.92rem; }
.vide {
  border: 1.5px dashed var(--trait-fort);
  border-radius: var(--rayon);
  padding: 1.5rem 1rem;
  text-align: center;
  color: var(--ardoise);
  margin: 1rem 0;
}
.grille-detail {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.3rem 1.25rem;
  margin: 0.75rem 0;
}
.grille-detail dt { font-weight: 600; color: var(--ardoise); }
.grille-detail dd { margin: 0; }

/* Indicateur htmx : visible pendant la requête. */
.htmx-indicator { display: none; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { display: inline; }

/* ── Mouvement : sobre, et respecte prefers-reduced-motion ────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .flash, main > .carte { animation: apparait 0.25s ease-out; }
  @keyframes apparait {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
  }
}

/* ── Ajouts candidats/pilotes ─────────────────────────────────────────────── */
/* Filtres par liens (liste des candidats) : pastilles, cibles 44px. */
.filtres {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}
.filtres a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.35rem 0.95rem;
  border: 1.5px solid var(--trait-fort);
  border-radius: 999px;
  background: var(--carte);
  color: var(--ardoise);
  font-weight: 600;
  text-decoration: none;
}
.filtres a:hover { border-color: var(--bleu); color: var(--bleu); }
.filtres a[aria-current="true"] {
  background: var(--encre);
  border-color: var(--encre);
  color: #fff;
}

/* Bloc repliable natif (details/summary) : zéro JS, carte à l'ouverture. */
.repli {
  background: var(--carte);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  margin: 1rem 0;
}
.repli > summary {
  cursor: pointer;
  min-height: 44px;
  padding: 0.75rem 1rem;
  font-family: var(--police-titre);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}
.repli > summary:hover { background: var(--ciel-pale); }
.repli[open] > summary { border-bottom: 1px solid var(--trait); }
.repli__corps { padding: 1rem; }

/* ── Impression (fiche de session → PDF navigateur) ───────────────────────── */
@media print {
  .entete, .nav-admin, .actions, .btn, .skip, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .page { max-width: none; padding: 0; }
  .carte, table { box-shadow: none; }
  a { color: inherit; text-decoration: none; }
}

/* ── Ajouts admin/sites/campagnes ─────────────────────────────────────────── */

/* Groupe de badges (orientations d'un site…) : retours à la ligne propres. */
.badges { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }

/* Dangers d'un site : même voix que la fermeture — l'avertissement se voit. */
.placard__danger { color: var(--brique); }

/* Espacement des sections d'un écran back-office. */
.section { margin-top: 2.25rem; }

/* Texte pour lecteurs d'écran uniquement (boutons contextualisés :
   « Désactiver le créneau “Le week-end” »). */
.masque-visuel {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
