/* ==========================================================
   Nordic Skulls — feuille de style principale
   Sombre, épuré, coins arrondis, accent bleu.

   Sommaire
     1. Base (variables, éléments, utilitaires)
     2. Header : logo, radio, menu, compte, disposition selon la largeur
     3. Contenu commun : en-têtes de page, étiquettes, avatars, pied de page
     4. Formulaires : boutons, champs, alertes, fenêtres modales
     5. Pages : connexion, accueil, discussion, galerie, road planner,
        goodies, mon compte
   ========================================================== */

/* ==========================================================
   1. Base
   ========================================================== */

:root {
  --bg: #0a0e16;
  --surface: #111724;
  --surface-2: #18202f;
  --line: rgba(255, 255, 255, .08);
  --text: #e6ebf2;
  --muted: #8b95a7;
  --accent: #3b82f6;
  --accent-hot: #60a5fa;
  --accent-soft: rgba(59, 130, 246, .14);

  --font: "Plus Jakarta Sans", system-ui, sans-serif;

  --header-h: 76px;
  --gutter: clamp(16px, 4vw, 48px);
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 32px -12px rgba(0, 0, 0, .5);
}

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

html { color-scheme: dark; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(1000px 500px at 85% -10%, rgba(59, 130, 246, .12), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 400 16px/1.65 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -.02em;
  line-height: 1.15;
  margin: 0;
}

/* Champ piège du formulaire d'adhésion : hors écran pour les humains, rempli par les robots. */
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.site-main {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 88px) var(--gutter);
}
/* focus posé par navigation.js après un changement de page */
.site-main:focus { outline: none; }

/* ==========================================================
   2. Header
   ========================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  /* logo · radio · menu · compte (voir « Disposition selon la largeur » plus bas) */
  grid-template-columns: 1fr auto 1fr auto;
  --brand-banner-max: 34px;
  --brand-others: 1118px;
  align-items: center;
  gap: 24px;
  min-height: var(--header-h);
  padding: 0 var(--gutter);
  background: rgba(10, 14, 22, .75);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  justify-self: start;
}

/* les icônes occupent presque toute la hauteur du header (4px de marge en haut et en bas) */
.brand__logo { display: block; flex: none; width: calc(var(--header-h) - 8px); height: calc(var(--header-h) - 8px); object-fit: contain; }

/* La bannière se réduit quand la ligne manque de place :
   --brand-others = largeur de tout le reste de la ligne (icônes, espaces, radio, menu, compte),
   6.19 = rapport largeur / hauteur de la bannière. */
.brand__banner {
  display: block;
  flex: none;
  width: auto;
  height: min(var(--brand-banner-max), calc((100vw - 2 * var(--gutter) - var(--brand-others)) / 6.19));
}

/* ---------- Lecteur radio ---------- */

.radio {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px 6px 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.radio__toggle {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: background .15s, transform .15s;
}
.radio__toggle:hover { background: var(--accent-hot); transform: scale(1.05); }
.radio__toggle:focus-visible { outline: 2px solid var(--accent-hot); outline-offset: 3px; }

.radio__icon { width: 16px; height: 16px; fill: currentColor; }
.radio__icon--play { margin-left: 2px; }
.radio__icon--pause,
.radio[data-state="playing"] .radio__icon--play,
.radio[data-state="loading"] .radio__icon--play { display: none; }
.radio[data-state="playing"] .radio__icon--pause,
.radio[data-state="loading"] .radio__icon--pause { display: block; }

.radio__info { display: flex; flex-direction: column; line-height: 1.25; min-width: 104px; }
.radio__name { font-weight: 600; font-size: .9rem; }
.radio__status { font-size: .75rem; color: var(--muted); }
.radio[data-state="playing"] .radio__status { color: var(--accent-hot); }
.radio[data-state="error"] .radio__status { color: #f87171; }

/* égaliseur animé quand le flux joue */
.radio__bars { display: flex; align-items: flex-end; gap: 3px; height: 16px; }
.radio__bars i { display: block; width: 3px; height: 4px; border-radius: 2px; background: var(--muted); opacity: .5; }
.radio[data-state="playing"] .radio__bars i { background: var(--accent-hot); opacity: 1; animation: eq .9s ease-in-out infinite alternate; }
.radio[data-state="playing"] .radio__bars i:nth-child(2) { animation-delay: -.3s; }
.radio[data-state="playing"] .radio__bars i:nth-child(3) { animation-delay: -.6s; }
.radio[data-state="playing"] .radio__bars i:nth-child(4) { animation-delay: -.15s; }
@keyframes eq { from { height: 4px; } to { height: 16px; } }


/* ---------- Menu ---------- */

.site-nav { display: flex; align-items: center; gap: 4px; justify-self: end; }

.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 500;
  font-size: .95rem;
  text-decoration: none;
  /* le menu ne passe jamais à la ligne ; sur petit écran il se réduit à ses icônes */
  white-space: nowrap;
  color: var(--muted);
  transition: color .15s, background .15s;
}
.site-nav a:hover { color: var(--text); background: var(--surface-2); }
.site-nav a[aria-current="page"] { color: var(--accent-hot); background: var(--accent-soft); }
.site-nav a.is-locked { opacity: .75; }
.site-nav a.is-locked:hover { opacity: 1; }
/* Icônes des rubriques : traits fins de la couleur du texte, volontairement discrets. */
.nav-icon { flex: none; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .65; transition: opacity .15s; }
.site-nav a:hover .nav-icon,
.site-nav a[aria-current="page"] .nav-icon { opacity: 1; }
.lock { width: 12px; height: 12px; margin-right: 4px; fill: currentColor; vertical-align: -1px; }

/* Bulle « messages non lus » à côté de « Discussion » */
.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: .68rem;
  font-weight: 700;
  line-height: 1;
  vertical-align: 1px;
  box-shadow: 0 0 0 2px var(--bg);
}
.nav-badge[hidden] { display: none; }
.site-nav__label { white-space: nowrap; }
/* Pastille posée sur l'icône du compte (demandes d'accès en attente) */
.account__badge { position: absolute; top: -4px; right: -6px; z-index: 1; margin: 0; pointer-events: none; }
.account__item .nav-badge { margin-left: auto; }

/* ---------- Menu compte ---------- */

.account {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: end;
}
.account form { margin: 0; }

.account__trigger {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.account__trigger:hover,
.account__trigger[aria-expanded="true"] { color: var(--text); border-color: rgba(59, 130, 246, .5); background: var(--surface-2); }
.account__trigger:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, .45); }
.account__icon { width: 20px; height: 20px; fill: currentColor; }
.account__photo { display: block; width: 100%; height: 100%; object-fit: cover; }

.account__menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  z-index: 20;
  width: 250px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 48px -16px rgba(0, 0, 0, .7);
}
.account__menu[hidden] { display: none; }
.account__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 12px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--line);
  line-height: 1.3;
}
.account__head strong { display: block; font-size: .95rem; }
.account__head span:not(.avatar) { font-size: .8rem; color: var(--muted); }

.account__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: 500 .9rem var(--font);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.account__item svg { width: 18px; height: 18px; flex: none; fill: var(--muted); }
.account__item:hover { background: var(--surface-2); }
.account__item .tag { margin-left: auto; }
.account__logout { margin-top: 6px !important; padding-top: 6px; border-top: 1px solid var(--line); }
.account__logout .account__item:hover { background: rgba(248, 113, 113, .1); color: #fca5a5; }
.account__logout .account__item:hover svg { fill: #fca5a5; }

/* ---------- Disposition selon la largeur ----------
   > 1560 px     : une ligne (logo · radio · menu · compte)
   1450-1560 px  : une ligne resserrée
   1060-1449 px  : une ligne resserrée, menu réduit à ses icônes
   790-1059 px   : logo · compte  /  menu · radio
   561-789 px    : logo · compte  /  menu  /  radio
   <= 560 px     : idem, menu et radio en pleine largeur, header non collant
   Les libellés masqués restent lus par les lecteurs d'écran et s'affichent au survol. */

@media (min-width: 1060px) and (max-width: 1560px) {
  .site-header { gap: 16px; --brand-others: 1054px; }
  .site-nav a { padding: 8px 10px; }
}

@media (max-width: 1449px) {
  .site-nav a { position: relative; }
  .nav-icon { width: 18px; height: 18px; }
  .site-nav__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .site-nav .nav-badge { position: absolute; top: 0; right: 0; margin: 0; }
}

@media (min-width: 1060px) and (max-width: 1449px) {
  .site-header { --brand-others: 681px; }
}

@media (max-width: 1059px) {
  .site-header { grid-template-columns: 1fr auto; padding-top: 6px; padding-bottom: 12px; row-gap: 8px; --brand-others: 236px; }
  .brand { grid-area: brand; }
  .site-nav { grid-area: nav; justify-self: start; margin-left: -14px; }
  .radio { grid-area: radio; }
  .account { grid-area: account; }
}

@media (min-width: 790px) and (max-width: 1059px) {
  /* ici la radio partage la colonne du compte : c'est elle qui limite la place du logo */
  .site-header { grid-template-areas: "brand account" "nav radio"; --brand-others: 411px; }
  .radio { justify-self: end; }
}

@media (max-width: 789px) {
  .site-header { grid-template-areas: "brand account" "nav nav" "radio radio"; }
  .radio { justify-self: start; }
}

/* Petit écran : menu resserré, cadenas masqués (les liens réservés restent grisés). */
@media (max-width: 560px) {
  .site-header { position: static; column-gap: 12px; }
  .brand { gap: 8px; min-width: 0; }
  .brand__logo { width: 48px; height: 48px; }
  .brand__banner { display: none; }  /* seuls les logos restent */
  /* Cinq icônes réparties sur toute la largeur, faciles à toucher. */
  .site-nav { justify-self: stretch; justify-content: space-between; margin-left: 0; }
  .site-nav a { padding: 8px 12px; }
  .nav-icon { width: 20px; height: 20px; }
  .radio { justify-self: stretch; }
  .radio__bars { margin-left: auto; }
}

/* Invité : bouton « Se connecter » plus large que l'icône du compte, rubriques avec cadenas.
   Quand la place manque, le cadenas devient un petit badge dans le coin de l'icône (il ne prend pas de place). */
.site-header:has(.site-nav .is-locked) { --brand-others: 1270px; }

@media (max-width: 1760px) {
  .site-nav a.is-locked { position: relative; }
  .site-nav .lock { position: absolute; top: 3px; right: 3px; width: 11px; height: 11px; margin: 0; }
  .site-header:has(.site-nav .is-locked) { --brand-others: 1196px; }
}

@media (min-width: 1450px) and (max-width: 1560px) {
  .site-header:has(.site-nav .is-locked) { --brand-others: 1112px; }
}

@media (min-width: 1060px) and (max-width: 1449px) {
  .site-header:has(.site-nav .is-locked) { --brand-others: 739px; }
}

@media (min-width: 790px) and (max-width: 1059px) {
  .site-header:has(.site-nav .is-locked) { --brand-others: 411px; }
}

@media (min-width: 561px) and (max-width: 789px) {
  .site-header:has(.site-nav .is-locked) { --brand-others: 314px; }
}

/* Sur téléphone, le bouton passe à côté de la radio pour laisser la ligne aux logos. */
@media (max-width: 560px) {
  .site-header:has(.site-nav .is-locked) {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "brand brand" "nav nav" "radio account";
  }
  .site-header:has(.site-nav .is-locked) .radio { min-width: 0; }
}

@media (max-width: 380px) {
  .site-header:has(.site-nav .is-locked) .radio__bars { display: none; }
}



/* ==========================================================
   3. Contenu commun
   ========================================================== */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: clamp(32px, 5vw, 56px);
}
.page-head__title { font-size: clamp(2rem, 4.5vw, 3.2rem); font-weight: 800; letter-spacing: -.035em; }
.page-head__intro { max-width: 60ch; margin: 16px 0 0; color: var(--muted); font-size: 1.05rem; }
.page-head__intro--wide { max-width: none; }
.nowrap { white-space: nowrap; }
.page-head .btn { flex: none; }

@media (max-width: 760px) {
  .page-head { flex-direction: column; align-items: flex-start; }
}

/* En-tête réduit (toutes les pages à titre) : le contenu commence plus haut. */
body:has(.page-head--slim) .site-main { padding-top: clamp(20px, 3vw, 32px); }
.page-head--slim { align-items: center; margin-bottom: 16px; }
.page-head--slim .page-head__title { font-size: clamp(1.5rem, 2.6vw, 2rem); }
.page-head--slim .page-head__intro { margin-top: 4px; font-size: .92rem; }
@media (max-width: 760px) {
  .page-head--slim { align-items: flex-start; }  /* titre empilé : aligné à gauche, pas centré */
}

.eyebrow {
  display: inline-block;
  margin: 0 0 20px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-hot);
  font-weight: 600;
  font-size: .8rem;
}

.section { margin-bottom: clamp(40px, 6vw, 64px); }
.section__title { font-size: 1.25rem; margin-bottom: 20px; }

.empty { margin: 0; color: var(--muted); }

.empty-state {
  display: grid;
  justify-items: center;
  gap: 16px;
  padding: 64px 16px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-align: center;
}
.empty-state p { margin: 0; }

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
  vertical-align: middle;
}
/* tag--chill / --rythme / --sport : niveau d'une sortie du Road Planner */
.tag--accent,
.tag--chill { background: var(--accent-soft); color: var(--accent-hot); }
.tag--rythme { background: rgba(250, 204, 21, .12); color: #facc15; }
.tag--sport { background: rgba(248, 113, 113, .12); color: #f87171; }

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  overflow: hidden;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #1e3a8a);
  color: #fff;
  font-weight: 700;
}
/* Avatar coloré selon l'utilisateur (--hue fourni par le serveur). */
.avatar[style*="--hue"] {
  background: linear-gradient(135deg, hsl(var(--hue) 70% 55%), hsl(calc(var(--hue) + 40) 65% 32%));
}
.avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* Icônes d'utilisateur de la discussion et de la page Membres : légèrement agrandies au survol. */
.chat-msg .avatar,
.chat-bubble .avatar,
.member-card .avatar { transition: transform .15s; }
@media (hover: hover) {
  .chat-msg .avatar:hover,
  .chat-bubble:hover .avatar,
  .member-card .avatar:hover { transform: scale(1.12); }
}
.avatar[data-lightbox-photo] { cursor: zoom-in; }
.avatar--lg { width: 56px; height: 56px; font-size: 1.3rem; }
.avatar--xl { width: 96px; height: 96px; font-size: 2.2rem; }
.avatar--sm { width: 30px; height: 30px; font-size: .8rem; }

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.page-head--slim + .tabs { margin-bottom: 20px; }
.tabs__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: -1px;
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: .92rem;
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.tabs__item:hover { color: var(--text); }
.tabs__item[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.tabs__count {
  min-width: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: .72rem;
  text-align: center;
}
.tabs__item[aria-current="page"] .tabs__count { background: var(--accent-soft); color: var(--accent-hot); }

.site-footer {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 24px var(--gutter);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
}

@media (max-width: 560px) {
  .panel { padding: 20px; }
  .tabs { overflow-x: auto; scrollbar-width: none; }
}

/* Onglets trop nombreux pour tenir sur une ligne (galerie) : ils défilent dès que la largeur manque. */
@media (max-width: 1040px) {
  .tabs--wide { overflow-x: auto; scrollbar-width: none; }
}

/* ==========================================================
   4. Formulaires
   ========================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font: 600 .95rem var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, .45); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hot); }
.btn--secondary { background: var(--surface-2); border-color: var(--line); color: var(--text); }
.btn--secondary:hover { border-color: rgba(255, 255, 255, .18); background: #1f2838; }
.btn--ghost-danger { background: transparent; border-color: rgba(248, 113, 113, .35); color: #fca5a5; }
.btn--ghost-danger:hover { background: rgba(248, 113, 113, .1); }
.btn--block { width: 100%; }
.btn--sm { height: 34px; padding: 0 14px; border-radius: 999px; font-size: .85rem; }
.btn__icon { width: 18px; height: 18px; fill: currentColor; }

/* Champ avec icône : <label class="input"> <span class="input__control"> svg + input|textarea */
.input { display: grid; gap: 6px; }
.input__label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.input__control { position: relative; display: block; }
.input__control svg {
  position: absolute;
  left: 14px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: var(--muted);
  pointer-events: none;
  transition: fill .15s;
}
.input__control--textarea svg { top: 13px; transform: none; }
.input__control input,
.input__control textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .03);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input__control input { height: 46px; padding: 0 14px 0 42px; font: 400 .95rem var(--font); }
.input__control textarea { display: block; min-height: 96px; padding: 11px 14px 11px 42px; font: 400 .95rem/1.45 var(--font); resize: vertical; }
.input__control input::placeholder,
.input__control textarea::placeholder { color: #566074; }
.input__control input:hover,
.input__control textarea:hover { border-color: rgba(255, 255, 255, .16); }
.input__control input:focus,
.input__control textarea:focus { outline: none; border-color: var(--accent); background: rgba(59, 130, 246, .05); box-shadow: 0 0 0 3px var(--accent-soft); }
.input__control:focus-within svg { fill: var(--accent-hot); }
.input__error { color: #fca5a5; font-size: .8rem; }
.input__help { color: #6b7587; font-size: .78rem; }
.input--invalid .input__control input,
.input--invalid .input__control textarea { border-color: rgba(248, 113, 113, .6); }
.input--invalid .input__control svg { fill: #f87171; }

/* Variante sans icône (fenêtres d'ajout de l'admin) : champs texte, nombres, dates et listes. */
.input__optional { font-weight: 400; color: #6b7587; }
.input__control--plain input,
.input__control--plain select,
.input__control--plain textarea { padding-left: 14px; }
.input__control select {
  width: 100%;
  height: 46px;
  padding-right: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: 400 .95rem var(--font);
}
.input__control select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input--invalid .input__control select { border-color: rgba(248, 113, 113, .6); }
/* Liste bloquée (choix du club) : icône de cadenas à gauche, aspect atténué. */
.input__control select:disabled { padding-left: 42px; color: var(--muted); opacity: 1; cursor: not-allowed; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: start; }

.check { display: flex; align-items: center; gap: 10px; min-height: 46px; font-size: .9rem; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }

@media (max-width: 560px) {
  .form-row { grid-template-columns: 1fr; }
}

.alert { margin: 0 0 16px; padding: 10px 14px; border-radius: var(--radius-sm); font-size: .875rem; }
.alert--info { background: var(--accent-soft); color: var(--accent-hot); }
.alert--success { background: rgba(34, 197, 94, .12); color: #86efac; }
.alert--error { background: rgba(248, 113, 113, .12); color: #fca5a5; }

/* ---------- Fenêtre modale (<dialog>) ---------- */

.dialog {
  width: min(480px, calc(100% - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 64px -16px rgba(0, 0, 0, .8);
}
.dialog::backdrop { background: rgba(5, 8, 14, .7); backdrop-filter: blur(4px); }
.dialog__form { display: grid; gap: 16px; padding: 24px; }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog__head h2 { font-size: 1.15rem; }
.dialog__close {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.dialog__close:hover { background: var(--surface-2); color: var(--text); }
.dialog__close svg { width: 18px; height: 18px; fill: currentColor; }
.dialog__text { margin: -8px 0 0; color: var(--muted); font-size: .88rem; }
.dialog__text strong { color: var(--text); }
.dialog__actions { display: flex; justify-content: flex-end; gap: 10px; }

/* Zone d'envoi de photos (avec aperçu des fichiers choisis) */
.dropzone {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 200px;
  overflow: hidden;
  border: 1.5px dashed rgba(255, 255, 255, .15);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, .02);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover,
.dropzone:focus-within { border-color: var(--accent); background: rgba(59, 130, 246, .05); }
.dropzone__hint { display: grid; justify-items: center; gap: 4px; padding: 24px; color: var(--muted); font-size: .8rem; text-align: center; }
.dropzone__hint svg { width: 28px; height: 28px; margin-bottom: 4px; fill: var(--accent-hot); }
.dropzone__hint strong { color: var(--text); font-size: .95rem; }
.dropzone__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  width: 100%;
  padding: 10px 10px 34px;
}
.dropzone__grid img,
.dropzone__more { width: 100%; aspect-ratio: 1; border-radius: 6px; object-fit: cover; }
.dropzone__more { display: grid; place-items: center; background: var(--surface-2); color: var(--muted); font-weight: 700; }
.dropzone__grid::after {
  content: attr(data-count) " · cliquer pour changer";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 9px;
  color: var(--muted);
  font-size: .78rem;
  text-align: center;
}
.dropzone__grid[hidden],
.dropzone__hint[hidden] { display: none; }
.dropzone--compact { min-height: 150px; }
.dropzone--compact.input--invalid { border-color: rgba(248, 113, 113, .6); }

/* Images déjà enregistrées d'un goodie (fenêtre de modification) */
.existing-images { display: grid; gap: 8px; }
.existing-images[hidden] { display: none; }
.existing-images__grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.existing-image { position: relative; display: grid; gap: 4px; justify-items: center; font-size: .72rem; color: var(--muted); cursor: pointer; }
.existing-image img { width: 100%; aspect-ratio: 1; border: 2px solid transparent; border-radius: 8px; background: var(--surface-2); object-fit: contain; }
.existing-image input { position: absolute; top: 4px; right: 4px; width: 16px; height: 16px; margin: 0; accent-color: #ef4444; }
.existing-image:has(input:checked) img { border-color: #ef4444; opacity: .45; }
.existing-image:has(input:checked) span { color: #fca5a5; }

/* Boutons admin posés sur une carte (modifier, supprimer) */
.item-actions { position: absolute; top: 10px; right: 10px; z-index: 2; display: flex; gap: 6px; }
.item-actions form { margin: 0; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(10, 14, 22, .8);
  backdrop-filter: blur(6px);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.icon-btn svg { width: 16px; height: 16px; fill: currentColor; }
.icon-btn:hover { border-color: rgba(59, 130, 246, .5); background: var(--surface-2); }
.icon-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, .45); }
.icon-btn--danger:hover { border-color: rgba(248, 113, 113, .5); background: rgba(248, 113, 113, .15); color: #fca5a5; }

@media (max-width: 560px) {
  .dialog__form { padding: 20px; }
}

/* ==========================================================
   5. Pages
   ========================================================== */

/* ---------- Connexion et demande d'adhésion (layout « auth ») ---------- */

body[data-layout="auth"] {
  background:
    radial-gradient(600px 400px at 50% 0%, rgba(59, 130, 246, .18), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .05) 1px, transparent 0) 0 0 / 24px 24px,
    var(--bg);
}
body[data-layout="auth"] .site-main { display: grid; place-items: center; max-width: 1600px; min-height: 100vh; padding-top: 32px; padding-bottom: 32px; }

/* Formulaire entre deux grandes images ; sur écran étroit, les images passent au-dessus. */
.auth-stage {
  display: grid;
  grid-template-columns: 1fr minmax(0, 400px) 1fr;
  align-items: center;
  gap: clamp(24px, 4vw, 64px);
  width: 100%;
}
.auth-stage__image { display: block; width: 100%; max-width: 460px; height: auto; }
.auth-stage__image--left { justify-self: end; }
.auth-stage__image--right { justify-self: start; }

.auth { width: 100%; }

.auth-card {
  padding: 36px 32px 28px;
  background: rgba(17, 23, 36, .85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 24px 64px -24px rgba(0, 0, 0, .7);
}
.auth-card__brand { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 28px; }
.auth-card__banner { width: 190px; height: auto; }
.auth-card__title { font-size: 1.5rem; text-align: center; }
.auth-card__subtitle { margin: 6px 0 24px; color: var(--muted); font-size: .9rem; text-align: center; }
.auth-form { display: grid; gap: 16px; }
.auth-form .btn { margin-top: 4px; }
.auth-form__forgot { justify-self: end; margin-top: -8px; font-size: .82rem; }
.auth-card__footer {
  margin: 24px -32px 0;
  padding: 18px 32px 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .85rem;
  text-align: center;
}
.auth-card__link { color: var(--accent-hot); font-weight: 600; text-decoration: none; white-space: nowrap; }
.auth-card__link:hover { text-decoration: underline; }
.auth-card__success { display: grid; place-items: center; margin-bottom: 16px; }
.auth-card__success svg { width: 48px; height: 48px; fill: #22c55e; }
.auth-card__locked svg { fill: #f87171; }

/* Conseil « prévenir le chef du chapter par SMS » (/rejoindre) */
.sms-tip {
  display: flex;
  gap: 12px;
  margin: 0 0 20px;
  padding: 12px 14px;
  border: 1px solid rgba(59, 130, 246, .25);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  font-size: .85rem;
  line-height: 1.45;
  text-align: left;
}
.sms-tip svg { width: 20px; height: 20px; flex: none; margin-top: 1px; fill: var(--accent-hot); }
.sms-tip p { margin: 0; color: #c3cfe2; }
.sms-tip strong { color: var(--text); }

@media (max-width: 899px) {
  .auth-stage {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas: "left right" "form form";
    max-width: 400px;
    gap: 16px;
  }
  .auth-stage__image { max-width: 120px; }
  .auth-stage__image--left { grid-area: left; }
  .auth-stage__image--right { grid-area: right; }
  .auth { grid-area: form; }
}

@media (max-width: 560px) {
  .auth-card { padding: 28px 20px 22px; }
  .auth-card__footer { margin: 20px -20px 0; padding: 16px 20px 0; }
}

/* ---------- Accueil ----------
   Le bloc de bienvenue occupe toute la hauteur sous le header, centré, sans défilement de page.
   Les tailles suivent aussi la hauteur de l'écran (vh) pour tenir sur les petits écrans. */

.welcome { margin-bottom: clamp(48px, 7vw, 80px); }

.welcome--with-logo {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: clamp(24px, 5vw, 64px);
}

.welcome__logo {
  display: block;
  width: clamp(220px, 28vw, 340px);
  height: auto;
  filter: drop-shadow(0 20px 40px rgba(59, 130, 246, .25));
}

.welcome__title { font-size: clamp(2.2rem, 5.5vw, 4rem); font-weight: 800; letter-spacing: -.035em; }
.welcome__title span {
  background: linear-gradient(90deg, var(--accent), #93c5fd);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.welcome__text {
  max-width: 58ch;
  margin: 20px 0 0;
  color: var(--muted);
  font-size: 1.1rem;
}

@media (max-width: 760px) {
  .welcome--with-logo { grid-template-columns: 1fr; }
  .welcome__logo { order: -1; width: min(240px, 70%); margin: 0 auto; }
}

body:has(.welcome--home) { height: 100dvh; min-height: 0; overflow: hidden; }
body:has(.welcome--home) .site-main {
  display: flex;
  align-items: center;
  min-height: 0;
  overflow-y: auto; /* filet de sécurité sur les écrans très bas : seul le bloc défile */
  padding-top: clamp(16px, 4vh, 48px);
  padding-bottom: clamp(16px, 4vh, 48px);
}
.welcome--home { width: 100%; margin: 0; }
.welcome--home .welcome__title { font-size: clamp(1.9rem, min(5.5vw, 8vh), 4.2rem); }
.welcome--home .welcome__text { margin-top: clamp(12px, 2.5vh, 24px); }
.welcome--home .welcome__logo { width: clamp(150px, min(30vw, 48vh), 400px); }

@media (max-width: 760px) {
  .welcome--home { gap: clamp(12px, 3vh, 28px); }
  .welcome--home .welcome__logo { width: clamp(110px, 24vh, 220px); }
  .welcome--home .welcome__text { font-size: clamp(.9rem, 2vh, 1.05rem); }
  .welcome--home .eyebrow { margin-bottom: 10px; }
}

@media (max-width: 760px) and (max-height: 720px) {
  .welcome--home .welcome__logo { width: clamp(90px, 15vh, 160px); }
  body:has(.welcome--home) .site-main { padding-top: 10px; padding-bottom: 10px; }
  .welcome--home .welcome__title { font-size: clamp(1.6rem, 6vh, 2.2rem); }
}

/* ---------- Discussion (chat plein écran) ----------
   La page occupe toute la hauteur sous le header, sans bordure ni défilement de page :
   seule la liste des messages défile. :has() suit aussi les changements de page de navigation.js. */

.chat {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat__list {
  list-style: none;
  margin: 0;
  padding: 16px 20px;
  height: clamp(320px, calc(100vh - 390px), 720px);
  overflow-y: auto;
}
.chat__empty { padding: 48px 0; color: var(--muted); text-align: center; }

.chat-day {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: .75rem;
  font-weight: 600;
}
.chat-day::before,
.chat-day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.chat-day:first-child { margin-top: 0; }

.chat-msg {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  margin: 0 -12px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
}
.chat-msg:hover { background: rgba(255, 255, 255, .02); }

/* Suppression d'un message (admin) : visible au survol, toujours visible sur écran tactile. */
.chat-msg { position: relative; }
.chat-msg__delete {
  position: absolute;
  top: 6px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, color .15s, border-color .15s, background .15s;
}
.chat-msg__delete svg { width: 14px; height: 14px; fill: currentColor; }
.chat-msg:hover .chat-msg__delete,
.chat-msg__delete:focus-visible { opacity: 1; }
.chat-msg__react {
  position: absolute;
  top: 6px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s, color .15s, border-color .15s;
}
.chat-msg__react svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-msg:has(.chat-msg__delete) .chat-msg__react { right: 42px; }
.chat-msg:hover .chat-msg__react,
.chat-msg__react:focus-visible { opacity: 1; }
.chat-msg__react:hover { color: var(--text); border-color: var(--accent); }
@media (hover: none) {
  .chat-msg__react { opacity: .6; }
  .chat-msg__content { padding-right: 32px; }  /* le texte ne passe pas sous le bouton, toujours visible */
}
.chat-reactions { display: flex; flex-wrap: wrap; gap: 4px; }
.chat-reactions:not(:empty) { margin-top: 5px; }
.chat-reaction,
.chat-picker button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
}
.chat-reaction { padding: 1px 8px; font-size: .78rem; line-height: 1.5; }
.chat-reaction:hover,
.chat-picker button:hover { border-color: var(--accent); }
.chat-reaction.is-mine { border-color: var(--accent); background: var(--accent-soft); }
.chat-picker { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.chat-picker button { width: 34px; height: 30px; padding: 0; font-size: 1rem; }
.chat-msg__delete:hover { color: #fca5a5; border-color: rgba(248, 113, 113, .5); background: rgba(248, 113, 113, .12); }
@media (hover: none) {
  .chat-msg__delete { opacity: .7; }
}
.chat-msg--grouped { padding-top: 2px; }
.chat-msg--grouped .chat-msg__avatar { visibility: hidden; height: 0; }
.chat-msg--grouped .chat-msg__meta { display: none; }

.chat-msg__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin: 0 0 2px; }
.chat-msg__meta .tag { padding: 1px 8px; font-size: .68rem; }
.chat-msg__meta strong { font-size: .92rem; }
.chat-msg--mine .chat-msg__meta strong { color: var(--accent-hot); }
.chat-msg__meta time { font-size: .72rem; color: var(--muted); }
.chat-msg__body { margin: 0; color: #cfd6e2; font-size: .95rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }

.chat__composer {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, .015);
}
.chat__composer textarea {
  flex: 1;
  min-height: 44px;
  max-height: 160px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font: 400 .95rem/1.4 var(--font);
  resize: none;
  transition: border-color .15s, box-shadow .15s;
}
.chat__composer textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat__composer .chat-msg__avatar { margin-bottom: 2px; }
.chat__send { width: 44px; padding: 0; flex: none; }
.chat__send svg { width: 18px; height: 18px; fill: currentColor; }

.chat__hint { margin: 0; padding: 0 20px 12px 72px; color: #566074; font-size: .75rem; }
.chat__error { margin-left: 8px; color: #fca5a5; }

@media (max-width: 560px) {
  .chat__list { padding: 12px 14px; height: calc(100dvh - 440px); min-height: 280px; }
  .chat__composer { padding: 12px 14px; }
  .chat__composer .chat-msg__avatar { display: none; }
  .chat__hint { display: none; }
}

body:has(.chat--fullscreen) { height: 100dvh; min-height: 0; overflow: hidden; }
body:has(.chat--fullscreen) .site-footer { display: none; }
body:has(.chat--fullscreen) .site-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  max-width: none;
  padding: 0;
}

.chat--fullscreen {
  --chat-gutter: max(20px, calc((100% - 960px) / 2));
  flex: 1;
  min-height: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}
.chat--fullscreen .chat__list { flex: 1; height: auto; min-height: 0; padding: 12px var(--chat-gutter); }
.chat--fullscreen .chat__composer { padding: 14px var(--chat-gutter) 6px; background: var(--bg); }
.chat--fullscreen .chat__hint { padding: 0 var(--chat-gutter) 12px calc(var(--chat-gutter) + 52px); background: var(--bg); }

.chat__bar {
  padding: 4px var(--chat-gutter) 0;
  border-bottom: 1px solid var(--line);
}
/* Onglets : chapter local et discussion générale (verrouillée pour le moment). */
.chat__tabs { margin: 0 0 -1px -14px; border-bottom: 0; }
.chat__tabs .tabs__item { flex: none; margin-bottom: 0; }
/* Seules les bulles défilent : les onglets restent toujours visibles. */
.chat__bubbles { flex: 1 1 0; min-width: 0; display: flex; align-items: center; gap: 6px; margin-left: 8px; padding: 4px 6px 2px 2px; overflow-x: auto; scrollbar-width: none; }
.chat-bubble {
  position: relative;
  flex: none;
  display: block;
  padding: 2px;
  border: 2px solid transparent;
  border-radius: 50%;
  text-decoration: none;
  transition: border-color .15s;
}
.chat-bubble:hover { border-color: var(--line); }
.chat-bubble[aria-current="page"] { border-color: var(--accent); }
/* Pastille verte : membre connecté (sur sa bulle et à côté de ses messages). */
.chat-msg__presence { position: relative; display: block; }
.chat-bubble.is-online::after,
.chat-msg.is-online .chat-msg__presence::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  width: 11px;
  height: 11px;
  border: 2px solid var(--bg);
  border-radius: 50%;
  background: #22c55e;
}
.chat-msg--grouped .chat-msg__presence::after { display: none; }
.chat-bubble__badge { position: absolute; top: -4px; right: -3px; margin: 0; }
.chat__peer { margin: 0; padding: 6px 0; color: var(--muted); font-size: .82rem; border-top: 1px solid var(--line); }
.chat__peer strong { color: var(--text); }
/* position : garde le texte masqué dans la zone de défilement des onglets, sinon la page entière défile sur téléphone */
.tabs__item--locked { position: relative; }
.tabs__item--locked,
.tabs__item--locked:hover { color: var(--muted); opacity: .6; cursor: not-allowed; }

@media (max-width: 560px) {
  .chat--fullscreen { --chat-gutter: 14px; }
  .chat__tabs { margin-left: -8px; }
  .chat__tabs .tabs__item { padding: 10px 8px; }
  .chat__tabs .tabs__count { display: none; }
  .chat--fullscreen .chat__list { height: auto; min-height: 0; }
  .chat--fullscreen .chat__composer { padding-bottom: 12px; }
}

/* ---------- Galerie : cartes d'albums et visionneuse ---------- */

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

/* Carte d'album + bouton de suppression (auteur ou admin) posé en haut à gauche de la couverture. */
.album-item { position: relative; }
/* Cartes d'une rangée à la même hauteur, même avec un badge de sortie ; contenu calé en haut (un bouton le centrerait). */
.album-item .album { display: flex; flex-direction: column; justify-content: flex-start; height: 100%; }
.album-item .album__caption { padding-bottom: 48px; }
.album-like { position: absolute; left: 14px; bottom: 10px; margin: 0; }
.album-like__button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font: 600 .8rem var(--font);
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.album-like__button svg { width: 15px; height: 15px; fill: currentColor; }
.album-like__button:hover { color: var(--text); border-color: rgba(248, 113, 113, .6); }
.album-like__button.is-liked { color: #f87171; border-color: rgba(248, 113, 113, .6); }
.album-item__delete { position: absolute; top: 10px; left: 10px; z-index: 2; margin: 0; }
.album-item__link { position: absolute; top: 10px; left: 52px; z-index: 2; }
/* Sortie liée : au-dessus du bouton j'aime, cliquable vers le Road Planner. */
.album-item--event .album__caption { padding-bottom: 80px; }
.album-event {
  position: absolute;
  right: 14px;
  bottom: 46px;
  left: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-hot);
  font-size: .82rem;
  font-weight: 600;
  text-decoration: none;
}
.album-event:hover { text-decoration: underline; }
.album-event svg { flex: none; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.album-event span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-visibility {
  position: absolute;
  right: 14px;
  bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font: 600 .8rem var(--font);
  opacity: .7;
  cursor: not-allowed;
}
.album-visibility svg { width: 13px; height: 13px; fill: currentColor; }

.album {
  display: block;
  width: 100%;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: zoom-in;
  transition: border-color .15s, transform .15s;
}
.album:hover { border-color: rgba(59, 130, 246, .5); transform: translateY(-2px); }
.album:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(59, 130, 246, .45); }
.album__cover { position: relative; display: block; aspect-ratio: 4 / 3; overflow: hidden; background: var(--surface-2); }
.album__cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.album:hover .album__cover img { transform: scale(1.04); }
.album__count {
  position: absolute;
  top: 10px;
  right: 10px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(5, 8, 14, .7);
  backdrop-filter: blur(6px);
  font-size: .78rem;
  font-weight: 600;
}
.album__count svg { width: 14px; height: 14px; fill: currentColor; }
.album__caption { display: grid; gap: 2px; padding: 12px 14px 14px; }
.album__title { font-weight: 600; }
.album__meta { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: .8rem; }

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(5, 8, 14, .96);
  color: var(--text);
}
.lightbox[open] { display: grid; grid-template-rows: auto 1fr auto; }
.lightbox::backdrop { background: rgba(5, 8, 14, .9); }

.lightbox__bar { display: flex; align-items: center; gap: 16px; padding: 14px 20px; }
.lightbox__bar > div { flex: 1; min-width: 0; }
.lightbox__title { margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lightbox__meta { margin: 0; color: var(--muted); font-size: .82rem; }
.lightbox__counter { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
.lightbox__close,
.lightbox__nav {
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: #fff;
  cursor: pointer;
  transition: background .15s;
}
.lightbox__close { width: 40px; height: 40px; }
.lightbox__close:hover,
.lightbox__nav:hover { background: rgba(255, 255, 255, .18); }
.lightbox__close svg,
.lightbox__nav svg { width: 22px; height: 22px; fill: currentColor; }

.lightbox__stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0 72px;
  overflow: hidden;
  touch-action: pan-y;
  user-select: none;
}
/* Image posée sur toute la zone centrale et réduite pour y tenir entière. */
.lightbox__img { position: absolute; inset: 8px 72px; width: calc(100% - 144px); height: calc(100% - 16px); object-fit: contain; }
/* z-index : au-dessus de l'image, qui occupe toute la largeur sur mobile. */
.lightbox__nav { position: absolute; top: 50%; z-index: 1; width: 48px; height: 48px; transform: translateY(-50%); }
.lightbox__nav--prev { left: 16px; }
.lightbox__nav--next { right: 16px; }
.lightbox--native .lightbox__img { object-fit: scale-down; }
.lightbox--single .lightbox__nav,
.lightbox--single .lightbox__thumbs { display: none; }

.lightbox__thumbs { display: flex; justify-content: safe center; gap: 8px; padding: 14px 20px 18px; overflow-x: auto; scrollbar-width: thin; }
.lightbox__thumb {
  flex: none;
  width: 64px;
  height: 48px;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 6px;
  background: var(--surface-2);
  opacity: .5;
  cursor: pointer;
  transition: opacity .15s, border-color .15s;
}
.lightbox__thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.lightbox__thumb:hover { opacity: .85; }
.lightbox__thumb.is-active { border-color: var(--accent); opacity: 1; }

@media (max-width: 560px) {
  .lightbox__stage { padding: 0 8px; }
  .lightbox__img { inset: 8px; width: calc(100% - 16px); }
  .lightbox__nav { width: 40px; height: 40px; background: rgba(5, 8, 14, .55); }
  .lightbox__nav--prev { left: 12px; }
  .lightbox__nav--next { right: 12px; }
  .lightbox__thumb { width: 52px; height: 40px; }
}

/* ---------- Road Planner ---------- */

.road-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px; }

.road {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
/* Haut de carte : la date à gauche, les boutons du chef à droite (pas d'illustration). */
.road__top { position: relative; min-height: 70px; }
.road__date {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 52px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  background: rgba(10, 14, 22, .85);
  backdrop-filter: blur(6px);
  color: var(--accent-hot);
  line-height: 1.1;
}
.road__body { display: flex; flex: 1; flex-direction: column; padding: 4px 20px 20px; }
.road__tags { display: flex; gap: 6px; margin: 0 0 10px; }
.road__title { font-size: 1.15rem; }
/* « Je viens » : calé en bas de la carte, pour que les boutons s'alignent d'une carte à l'autre. */
.road__riders { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: auto; padding-top: 16px; }
.road__riders form { margin: 0; }
.road__riders .btn__icon { width: 15px; height: 15px; }
.road__avatars { display: inline-flex; flex: none; }
.road__avatars .avatar { box-sizing: content-box; border: 2px solid var(--surface); }
.road__avatars .avatar + .avatar { margin-left: -9px; }
.road__names { flex: 1 1 120px; min-width: 0; margin: 0; color: var(--muted); font-size: .82rem; }

/* Liste « Déjà roulé » */
/* Liste « Déjà roulé » (dans un .panel) : les lignes restent dans le cadre, survol compris. */
.event-list { list-style: none; margin: 0; padding: 8px; display: grid; gap: 4px; }

.event {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 16px;
  align-items: start;
  padding: 12px;
  border-radius: var(--radius-sm);
  transition: background .15s;
}
.event:hover { background: var(--surface-2); }
.event--editable { grid-template-columns: 56px 1fr auto; align-items: center; }
.event--editable .item-actions { position: static; }

.event__date {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 0;
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
  color: var(--accent-hot);
  line-height: 1.1;
}
.event__day { font-size: 1.35rem; font-weight: 700; color: var(--text); }
.event__month { font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }

.event__title { font-size: 1rem; font-weight: 600; letter-spacing: -.01em; }
.event__meta { margin: 2px 0 0; font-size: .85rem; color: var(--muted); }
.event__summary { margin: 8px 0 0; font-size: .925rem; color: #b6bfcd; }
.event__riders { margin: 6px 0 0; font-size: .85rem; color: #b6bfcd; }
.event__buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.event__confirm { height: auto; min-height: 34px; padding-block: 6px; line-height: 1.2; }  /* libellé sur deux lignes possible sur téléphone */
.event__no-photos { margin: 8px 0 0; color: var(--muted); font-size: .82rem; font-style: italic; }
/* Photos de la sortie : une vignette par album, ouverte dans la visionneuse. */
.event__albums { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.event-album { position: relative; flex: none; width: 72px; height: 72px; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); cursor: pointer; transition: border-color .15s, transform .15s; }
.event-album:hover { border-color: rgba(59, 130, 246, .6); transform: translateY(-1px); }
.event-album img { display: block; width: 100%; height: 100%; object-fit: cover; }
.event-album span { position: absolute; right: 4px; bottom: 4px; padding: 1px 6px; border-radius: 999px; background: rgba(10, 14, 22, .8); color: #fff; font-size: .7rem; font-weight: 600; }

/* Fenêtre « présents » : un membre par ligne, liste défilante si le chapter est grand. */
.presents-list { display: grid; max-height: min(50vh, 420px); overflow-y: auto; }


/* ---------- Goodies ---------- */

.goodies-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }

.goodie {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color .15s, transform .15s;
}
.goodie:hover { border-color: rgba(59, 130, 246, .5); transform: translateY(-2px); }
.goodie__media {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #243044, #0f172a);
}
/* Image posée sur le cadre 4:3, quelle que soit sa taille d'origine. */
.goodie__media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.goodie__flag { position: absolute; top: 12px; left: 12px; z-index: 1; }
.goodie__body { display: flex; flex-direction: column; flex: 1; padding: 18px; }
.goodie__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.goodie__name { font-size: 1rem; }
.goodie__price { font-weight: 700; color: var(--accent-hot); white-space: nowrap; }
.goodie__desc { margin: 6px 0 12px; color: var(--muted); font-size: .9rem; line-height: 1.5; flex: 1; }
.goodie__sizes { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.size {
  min-width: 34px;
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .75rem;
  text-align: center;
  color: var(--muted);
}
.goodie__stock { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .8rem; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #f87171; }
.dot--ok { background: #22c55e; }
.goodie--out .goodie__media img { opacity: .45; filter: grayscale(1); }

/* Toute la carte est cliquable (vers la fiche) ; les boutons admin restent au-dessus. */
.goodie__link { color: inherit; text-decoration: none; }
.goodie__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.goodie__link:focus-visible { outline: none; }
.goodie:has(.goodie__link:focus-visible) { box-shadow: 0 0 0 3px rgba(59, 130, 246, .45); }
.goodie .item-actions { z-index: 3; }

/* ---------- Fiche d'un goodie ---------- */

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 20px;
  color: var(--muted);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
}
.back-link svg { width: 18px; height: 18px; fill: currentColor; }
.back-link:hover { color: var(--text); }

.goodie-detail { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 48px); align-items: start; }

.carousel__stage {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: radial-gradient(circle at 50% 40%, #243044, #0f172a);
  touch-action: pan-y;
  user-select: none;
}
.carousel__slide { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.carousel__slide[hidden] { display: none; }
.carousel__stage.goodie--out .carousel__slide { opacity: .45; filter: grayscale(1); }
.carousel__empty { color: var(--muted); font-size: .9rem; }
.carousel__nav { z-index: 1; }
.carousel__counter {
  position: absolute;
  right: 12px;
  bottom: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  background: rgba(5, 8, 14, .7);
  color: var(--text);
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}
.carousel__thumbs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

.goodie-detail__name { font-size: clamp(1.6rem, 3vw, 2.2rem); font-weight: 800; letter-spacing: -.03em; }
.goodie-detail__price { margin: 8px 0 10px; color: var(--accent-hot); font-size: 1.5rem; font-weight: 700; }
.goodie-detail__block { margin-top: 24px; }
.goodie-detail__label { margin-bottom: 8px; color: var(--muted); font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.goodie-detail__desc { margin: 0; color: #cfd6e2; line-height: 1.6; }
.goodie-detail__buy { margin-top: 28px; }
.goodie-detail__hint { margin: 10px 0 0; color: var(--muted); font-size: .82rem; }

@media (max-width: 760px) {
  .goodie-detail { grid-template-columns: 1fr; }
}

/* Fiche en plein écran : elle occupe la hauteur sous le header, sans défilement de page.
   Les images prennent la place disponible ; seule la colonne d'informations défile si besoin. */
body:has(.goodie-detail) { height: 100dvh; min-height: 0; overflow: hidden; }
body:has(.goodie-detail) .site-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding-top: clamp(16px, 3vh, 32px);
  padding-bottom: clamp(16px, 3vh, 32px);
}
body:has(.goodie-detail) .back-link { flex: none; margin-bottom: clamp(10px, 2vh, 20px); }
.goodie-detail { flex: 1; min-height: 0; align-items: stretch; }
.goodie-detail .carousel { display: flex; flex-direction: column; min-height: 0; }
.goodie-detail .carousel__stage { flex: 1; min-height: 0; aspect-ratio: auto; }
.goodie-detail .carousel__thumbs { flex: none; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; }
.goodie-detail__info { min-height: 0; overflow-y: auto; padding-right: 4px; }

@media (max-width: 760px) {
  /* Images en haut (un peu moins de la moitié), informations dessous, défilables. */
  .goodie-detail { grid-template-rows: minmax(160px, 1.1fr) minmax(0, 1fr); gap: 16px; }
  .goodie-detail .carousel__thumbs { margin-top: 8px; }
  .goodie-detail .lightbox__thumb { width: 52px; height: 40px; }
}

/* ---------- Mon compte ---------- */

.account-page { max-width: 640px; margin: 0 auto; }
.account-page .page-head { margin-bottom: 24px; }

/* ---------- Membres ---------- */

.members-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.member-card {
  display: flex;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.member-card .avatar { flex: none; }
.member-card__body { min-width: 0; }
.member-card__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.status-select {
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font: 500 .78rem var(--font);
  cursor: pointer;
}
.status-select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.member-card__name { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.member-card__bio { margin: 4px 0 0; color: var(--muted); font-size: .9rem; line-height: 1.45; overflow-wrap: anywhere; }
.member-card__bike-button { display: block; width: 100%; margin: 10px 0 0; padding: 0; border: 0; border-radius: var(--radius-sm); background: none; cursor: zoom-in; }
.member-card__bike-button:focus-visible { outline: 2px solid var(--accent-hot); outline-offset: 2px; }
.member-card__bike { display: block; width: 100%; max-height: 240px; border-radius: var(--radius-sm); object-fit: cover; }
.member-card__bio--empty { font-style: italic; opacity: .7; }
.member-card__message { flex: none; width: 30px; height: 30px; margin-left: auto; }
.member-card__message svg { width: 15px; height: 15px; }
.member-card__km { margin: 4px 0 0; color: var(--accent-hot); font-size: .85rem; font-weight: 700; }
.members-empty { color: var(--muted); }

.settings-card {
  margin-bottom: 20px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.settings-card__title { font-size: 1.05rem; }
.settings-card__text { margin: 4px 0 18px; color: var(--muted); font-size: .88rem; }

.settings-form { display: grid; gap: 16px; }
.settings-form .btn { justify-self: start; }

.avatar-editor { display: flex; align-items: center; gap: 24px; }
.bike-editor { display: grid; gap: 14px; justify-items: start; }
.bike-editor label.btn svg { width: 18px; height: 18px; fill: currentColor; }
.bike-editor label.btn:focus-within { box-shadow: 0 0 0 3px rgba(59, 130, 246, .45); }
.bike-editor__photo { display: block; width: 100%; max-width: 420px; max-height: 280px; border-radius: var(--radius-sm); object-fit: cover; }
.avatar-editor__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.avatar-editor__actions .input__help,
.avatar-editor__actions .input__error { flex-basis: 100%; margin: 0; }
.avatar-editor .btn svg { width: 18px; height: 18px; fill: currentColor; }
.avatar-editor label.btn:focus-within { box-shadow: 0 0 0 3px rgba(59, 130, 246, .45); }

@media (max-width: 560px) {
  .avatar-editor { flex-direction: column; align-items: flex-start; }
  .settings-card { padding: 20px; }
}

/* ---------- Management (chef du chapter et admin) ---------- */

.tabs__count--alert { background: #ef4444; color: #fff; }
.tabs__item[aria-current="page"] .tabs__count--alert { background: #ef4444; color: #fff; }

.request-list { display: grid; gap: 14px; }
.request { padding: 18px 20px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.request__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.request__name { font-size: 1.05rem; }
.request__meta { margin: 2px 0 0; color: var(--muted); font-size: .85rem; }
.request__actions { display: flex; gap: 8px; }
.request__actions form { margin: 0; }
.request__description { margin: 12px 0 0; padding: 12px 14px; border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); color: #cfd6e2; font-size: .92rem; }

.request-history { margin-top: 36px; }
.request-history__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.request-history__list li { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: .9rem; }
.request-history__by { color: var(--muted); font-size: .82rem; }

.users-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.users-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.users-table th { padding: 12px 10px; color: var(--muted); font-size: .75rem; font-weight: 600; letter-spacing: .04em; text-align: left; text-transform: uppercase; white-space: nowrap; border-bottom: 1px solid var(--line); }
.users-table td { padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.users-table tr:last-child td { border-bottom: 0; }
.users-table td .dot { display: inline-block; margin-right: 6px; vertical-align: 1px; }
.users-table__member { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; }
.users-table__muted { color: var(--muted); }
.users-table .btn--sm { height: 30px; padding: 0 12px; font-size: .8rem; }
.management-hint { margin: 14px 0 0; color: var(--muted); font-size: .82rem; }
