/* Leg Up · compléments du site à la feuille de style des maquettes (legup.css, copiée telle quelle). */

/* Sélecteur de langue : des liens (une adresse par langue) plutôt que des boutons. */
.lang-switch a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 40px;
  padding: 0 10px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
  font-size: 14px;
  text-decoration: none;
}
.lang-switch a + a { border-left: var(--border); }
.lang-switch a[aria-current="true"] { background: var(--lime); }
.lang-switch a:focus-visible { outline-offset: -4px; }

/* Lien d'évitement, visible seulement au clavier. */
.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 20;
  padding: 10px 16px;
  border: var(--border);
  border-radius: var(--radius-pill);
  background: var(--lime);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }
main:focus { outline: none; }

/* Pages de contenu : sommaire collant seulement sur grand écran. */
@media (max-width: 899px) { .toc { position: static; } }

/* Contenu rédigé en Markdown : pas de marge au-dessus du premier titre. */
.prose > h2:first-child { margin-top: 0; }

/* Pages d'erreur. */
.error-code { font-size: clamp(96px, 22vw, 220px); line-height: 0.85; }

/* Pied de page toujours en bas, même sur une page courte. */
body { min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; }

/* ---------- Comptes et profils ---------- */

/* Pages de connexion et d'inscription : le texte d'accroche à gauche, le formulaire à droite. */
.auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 520px);
  gap: 40px;
  align-items: start;
  padding-block: 48px 64px;
}
@media (max-width: 899px) {
  .auth { grid-template-columns: minmax(0, 1fr); gap: 28px; padding-block: 32px 48px; }
}

/* Message affiché une fois après une action (« Enregistré »). */
.flash { border-bottom: var(--border); background: var(--lime); font-weight: 800; }
.flash .container { padding-block: 12px; }
.flash-alert { background: var(--orange); font-weight: 700; }

/* Champs : indication sous le champ, erreurs signalées par une pastille et un texte, pas par la couleur seule. */
.hint { font-size: 13px; font-weight: 400; }
.field-validation-valid, .validation-summary-valid { display: none; }
.field-validation-error { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; font-weight: 700; }
.field-validation-error::before {
  content: "";
  flex: none;
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--orange);
}
.input-validation-error { box-shadow: 0 0 0 3px var(--orange); }
.form-alert {
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--orange);
  padding: 12px 16px;
  font-weight: 700;
}
.form-alert ul { margin: 0; padding-left: 18px; }
.form-alert a { font-weight: 800; }

/* Inscription : coureur ou marque. Seuls les champs du type choisi restent affichés. */
.kind-choice { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 12px; }
.option-card:has(input:checked) { background: var(--lime); box-shadow: 4px 4px 0 var(--ink); }
.signup-form:has(#kind-brand:checked) [data-for-kind="Runner"],
.signup-form:has(#kind-runner:checked) [data-for-kind="Brand"] { display: none; }

/* Pastilles à cocher (catégories refusées) : coche visible en plus du fond. */
label.chip { gap: 6px; }
label.chip:has(input:checked) { background: var(--lime); }
label.chip:has(input:checked)::before { content: "✓"; font-weight: 800; }

/* Bouton d'enregistrement des longs formulaires : il flotte en bas de l'écran, toujours à portée. */
.save-bar {
  position: sticky;
  bottom: 16px;
  z-index: 5;
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
  pointer-events: none;
}
.save-bar .btn { pointer-events: auto; box-shadow: 4px 4px 0 var(--ink); }

/* Mon compte */
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.facts dt { font-weight: 800; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.danger-zone { border-style: dashed; }

/* Profils publics */
.brand-mark {
  width: 140px;
  flex: none;
  border-radius: 28px;
  border: 3px solid var(--lime);
  background: var(--paper);
  font-size: 48px;
}
.link-badges { list-style: none; margin: 0; padding: 0; }
.band-dark .link-badges .badge { border-color: var(--paper); color: var(--paper); text-decoration: none; }
.band-dark .link-badges .badge:hover { background: var(--paper); color: var(--ink); }
.band-dark .muted { opacity: 0.85; }

/* Sur les bandeaux noirs, le texte des éléments verts reste noir (contraste). */
.band-dark .btn-primary, .band-dark .btn-primary:hover, .band-dark .badge-lime { color: var(--ink); }

/* Adresse e-mail longue : retour à la ligne plutôt que débordement sur mobile. */
.break-anywhere { overflow-wrap: anywhere; }

/* ---------- Courses et événements ---------- */

/* Contrôle segmenté fait de liens (À venir / Passés). */
.segmented a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  background: var(--paper);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}
.segmented a + a { border-left: var(--border); }
.segmented a[aria-current="page"] { background: var(--ink); color: var(--paper); }

/* Filtres en liens (zones d'un événement). */
a.chip[aria-current="page"] { background: var(--ink); color: var(--paper); }

/* Cartes de course : le pied reste en bas quand les titres n'ont pas la même longueur,
   et une carte seule garde la largeur d'une colonne. */
.race-card { height: 100%; }
.race-grid { --min: 300px; grid-template-columns: repeat(auto-fill, minmax(min(var(--min), 100%), 1fr)); }

/* Liens du bandeau noir d'un événement. */
.band-dark a:not(.btn) { color: inherit; }

/* Zones à louer : une tuile par partie du corps, le prix s'affiche quand la zone est cochée. */
.zone-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 10px; align-items: start; }
.zone-tile {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  border: var(--border);
  border-radius: var(--radius-m);
  background: var(--paper);
}
.zone-tile .check { font-weight: 800; min-height: 32px; }
.zone-tile:has(.zone-check:checked) { background: var(--lime); box-shadow: 4px 4px 0 var(--ink); }
.zone-tile.is-forbidden { background: var(--mist); border-style: dashed; }
.zone-tile.is-forbidden .check { text-decoration: line-through; }
.zone-price { display: none; align-items: center; gap: 8px; font-weight: 800; }
.zone-tile:has(.zone-check:checked) .zone-price { display: flex; }
.zone-price .input { width: 110px; min-height: 44px; }

/* Espace Leg Up : étiquette à côté du logo. */
.site-header .header-tag { align-self: center; }

/* Interrupteur porté par une vraie case à cocher (« tout ou rien ») : même dessin que .switch. */
label.switch-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px 0 6px;
  border: var(--border);
  border-radius: var(--radius-pill);
  background: var(--paper);
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
}
label.switch-check::before {
  content: "";
  width: 44px;
  height: 28px;
  flex: none;
  border: var(--border);
  border-radius: var(--radius-pill);
  background: radial-gradient(circle at 12px 50%, var(--ink) 8px, transparent 9px) var(--mist);
}
label.switch-check:has(input:checked)::before {
  background: radial-gradient(circle at 30px 50%, var(--ink) 8px, transparent 9px) var(--lime);
}

/* Réglages propres à l'option choisie : délai des candidatures, liste d'attente, adresse de retrait. */
.choice-reveal .reveal-when { display: none; }
.choice-reveal:has(input[value="Applications"]:checked) [data-when="Applications"] { display: flex; }
.choice-reveal:has(input[value="FirstCome"]:checked) [data-when="FirstCome"] { display: flex; }
.choice-reveal:has(input[value="Pickup"]:checked) [data-when="Pickup"] { display: grid; }
.post-reveal .reveal-post { display: none; }
.post-reveal:has(input[name="Input.AddPost"]:checked) .reveal-post { display: grid; }

/* Jauge du minimum sur petit écran : les libellés passent à la ligne au lieu d'être coupés. */
@media (max-width: 600px) {
  .threshold-bar { height: auto; min-height: 48px; font-size: 12px; line-height: 1.2; }
  .threshold-bar .zone-off,
  .threshold-bar .zone-on { white-space: normal; padding-block: 6px; }
  .threshold-bar .zone-off { flex: 0 1 auto; padding-left: 12px; padding-right: 6px; }
  .threshold-bar .zone-on { min-width: 92px; padding-left: 8px; padding-right: 12px; text-align: right; }
}

/* Montants alignés à droite dans les tableaux (paiement, factures, gains). */
.num { text-align: right; white-space: nowrap; }
tfoot th, tfoot td { border-top: var(--border); background: var(--paper); padding: 12px 16px; }

/* Argent qui attend une action du coureur (compte de versement à ajouter). */
.card-orange { background: var(--orange); }

/* Factures : seul le document s'imprime. */
@media print {
  .site-header, .site-footer, .flash, .skip-link, .no-print { display: none !important; }
  body { background: #fff; }
  .invoice { border: none; box-shadow: none; padding: 0; max-width: none; }
}

/* Preuves : zone de dépôt avec aperçu, vignettes, photo à valider. */
.upload-zone { flex: 1 1 260px; min-height: 260px; align-items: center; justify-content: center; text-align: center; border-radius: var(--radius-m); cursor: pointer; position: relative; overflow: hidden; }
.upload-zone [data-upload-preview] { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--mist); }
.upload-zone-s { min-height: 0; padding: 18px; }
.proof-thumb { display: block; width: 120px; height: 120px; object-fit: cover; border: var(--border); border-radius: var(--radius-s); background: var(--mist); }
.proof-photo { display: block; width: 100%; max-height: 560px; object-fit: contain; border: var(--border); border-radius: var(--radius-m); background: var(--mist); }
.check-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.step-num.is-off { background: var(--orange); }
.step-num.is-unknown { background: var(--mist); }
a.option-card { text-decoration: none; }
.option-card[aria-current="true"] { background: var(--lime); box-shadow: 4px 4px 0 var(--ink); }
.reject-panel { flex: 0 0 auto; }
.reject-panel[open] { flex-basis: 100%; order: 2; }
.reject-panel > summary { list-style: none; cursor: pointer; }
.reject-panel > summary::-webkit-details-marker { display: none; }

/* Photo du coureur, logo de la marque : à la place des initiales. */
img.avatar.is-image { object-fit: cover; padding: 0; }
img.brand-mark.is-image { object-fit: contain; padding: 0.2em; background: #fff; height: auto; }
.file-button { cursor: pointer; }
.file-button:focus-within { outline: 3px solid var(--ink); outline-offset: 3px; }

/* Messagerie (lot 7) : zone de saisie sur plusieurs lignes, note sous le fil */
.channel-form { align-items: flex-end; }
.channel-form .textarea { flex: 1; min-width: 0; min-height: 48px; }
.channel-note { display: block; margin: 0; padding: 12px 18px; border-top: var(--border); font-size: 14px; }
.channel-note:empty { display: none; }
.channel-body { max-height: 70vh; overflow-y: auto; }

/* En-tête : sept liens pour les coureurs, six pour l'équipe ; on resserre avant de passer à la ligne. */
@media (min-width: 960px) and (max-width: 1440px) {
  .nav { gap: 2px; font-size: 14px; }
  .nav a { padding: 10px 10px; }
}

/* Galerie (lot 9) : boutons sur la barre de sélection sombre, photo qui remplit sa case */
.btn-on-dark { background: var(--ink); color: var(--paper); border-color: var(--paper); }
.btn-on-dark:hover { color: var(--paper); }
.photo > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo > .photo-check, .photo > .photo-corner, .photo > .photo-tag { z-index: 1; }

/* Contrat de campagne (cadrage, 4.19) : les clauses ajoutées par la marque, mises en évidence. */
.contract-clauses { background: color-mix(in srgb, var(--orange) 14%, var(--paper)); border: var(--border); border-left: 8px solid var(--orange); border-radius: var(--radius-m); padding: 14px 18px; }
.prose .contract-clauses { margin: 36px 0 0; padding: 4px 22px 8px; }
.prose .contract-clauses h2 { margin-top: 16px; }
.prose ul ul { margin: 6px 0 0; }
.card-clauses { border-left: 8px solid var(--orange); }

/* Page d'ouverture (cadrage, 4.20) : champ piège caché aux personnes, courses à cocher, étapes sur fond sombre. */
.trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.chip-check { position: relative; }
.chip-check:has(input:checked) { background: var(--lime); }
.chip-check:has(input:checked)::before { content: "✓"; margin-right: 6px; }
.step-num-on-dark { border-color: var(--lime); color: var(--lime); }
.link-on-dark { color: var(--lime); }

/* Bouton désactivé (invitations avant l'ouverture, offre sans adresse…) : il se voit. */
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
