/* =========================================================================
   meelive.fr — Design system
   CSS natif, aucune dépendance, aucune étape de build.
   Organisation en couches : l'ordre de @layer fixe la priorité, ce qui
   évite d'avoir recours à !important.
   ========================================================================= */

@layer reset, tokens, base, layout, components, utilities;

/* ---------------------------------------------------------------- Tokens */
@layer tokens {
  :root {
    /* Couleurs de marque */
    --brand-50:  #fff1f4;
    --brand-100: #ffe0e7;
    --brand-200: #ffc6d3;
    --brand-300: #ff9bb2;
    --brand-400: #ff6389;
    --brand-500: #f83b66;
    --brand-600: #e51a4c;
    --brand-700: #c1103c;
    --brand-800: #a11138;
    --brand-900: #891235;

    /* Neutres */
    --gray-0:   #ffffff;
    --gray-50:  #f8f9fb;
    --gray-100: #f1f3f7;
    --gray-200: #e3e7ee;
    --gray-300: #cbd2de;
    --gray-400: #9aa4b6;
    --gray-500: #6b7688;
    --gray-600: #4d5666;
    --gray-700: #363d4a;
    --gray-800: #232833;
    --gray-900: #151920;
    --gray-950: #0d1015;

    /* Sémantique */
    --success: #10794a;
    --warning: #a86400;
    --danger:  #c62828;
    --info:    #1565c0;

    /* Rôles (surchargés en thème sombre) */
    --bg:            var(--gray-0);
    --bg-subtle:     var(--gray-50);
    --bg-raised:     var(--gray-0);
    --border:        var(--gray-200);
    --border-strong: var(--gray-300);
    --text:          var(--gray-900);
    --text-muted:    var(--gray-500);
    --text-invert:   var(--gray-0);
    --accent:        var(--brand-600);
    --accent-hover:  var(--brand-700);
    --focus-ring:    var(--brand-500);

    /* Typographie — polices système : zéro requête réseau, zéro RGPD */
    --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
                 Arial, "Noto Sans", sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

    --text-xs:   0.75rem;
    --text-sm:   0.875rem;
    --text-base: 1rem;
    --text-lg:   1.125rem;
    --text-xl:   1.375rem;
    --text-2xl:  1.75rem;
    --text-3xl:  2.25rem;
    --text-4xl:  clamp(2.25rem, 5vw, 3.5rem);

    --leading-tight: 1.2;
    --leading-base:  1.6;

    /* Espacements — échelle de 4 px */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4rem;
    --space-9: 6rem;

    /* Rayons */
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   16px;
    --radius-xl:   24px;
    --radius-full: 999px;

    /* Ombres */
    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.06);
    --shadow-md: 0 4px 12px rgb(0 0 0 / 0.08);
    --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.12);

    /* Divers */
    --container: 1120px;
    --header-h:  64px;
    --transition: 160ms cubic-bezier(0.4, 0, 0.2, 1);
  }

  /* Thème sombre : suit le système, surchargeable via [data-theme] */
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg:            var(--gray-950);
      --bg-subtle:     var(--gray-900);
      --bg-raised:     var(--gray-800);
      --border:        var(--gray-700);
      --border-strong: var(--gray-600);
      --text:          var(--gray-50);
      --text-muted:    var(--gray-400);
      --accent:        var(--brand-400);
      --accent-hover:  var(--brand-300);

      --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
      --shadow-md: 0 4px 12px rgb(0 0 0 / 0.5);
      --shadow-lg: 0 12px 32px rgb(0 0 0 / 0.6);
    }
  }

  :root[data-theme="dark"] {
    --bg:            var(--gray-950);
    --bg-subtle:     var(--gray-900);
    --bg-raised:     var(--gray-800);
    --border:        var(--gray-700);
    --border-strong: var(--gray-600);
    --text:          var(--gray-50);
    --text-muted:    var(--gray-400);
    --accent:        var(--brand-400);
    --accent-hover:  var(--brand-300);
  }
}

/* ----------------------------------------------------------------- Reset */
@layer reset {
  *,
  *::before,
  *::after { box-sizing: border-box; }

  * { margin: 0; }

  html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
  }

  body {
    min-height: 100dvh;
    line-height: var(--leading-base);
    -webkit-font-smoothing: antialiased;
  }

  img, picture, video, canvas, svg {
    display: block;
    max-width: 100%;
    height: auto;
  }

  input, button, textarea, select { font: inherit; color: inherit; }

  p, h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }

  h1, h2, h3, h4 { line-height: var(--leading-tight); text-wrap: balance; }

  ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }

  /* Respecte le réglage système « réduire les animations » (accessibilité) */
  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
      scroll-behavior: auto !important;
    }
  }
}

/* ------------------------------------------------------------------ Base */
@layer base {
  body {
    font-family: var(--font-sans);
    font-size: var(--text-base);
    color: var(--text);
    background-color: var(--bg);
  }

  a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
  }

  a:hover { color: var(--accent-hover); }

  /* Anneau de focus visible : critère d'accessibilité non négociable */
  :focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
    border-radius: var(--radius-sm);
  }

  ::selection {
    background: var(--brand-200);
    color: var(--gray-900);
  }

  hr {
    border: 0;
    border-top: 1px solid var(--border);
    margin-block: var(--space-6);
  }

  code { font-family: var(--font-mono); font-size: 0.9em; }
}

/* ---------------------------------------------------------------- Layout */
@layer layout {
  .container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--space-4);
  }

  .container--narrow { max-width: 720px; }

  .section { padding-block: var(--space-8); }

  .stack > * + * { margin-top: var(--flow, var(--space-4)); }

  .cluster {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
  }

  .grid {
    display: grid;
    gap: var(--space-5);
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  }

  .site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--header-h);
    display: flex;
    align-items: center;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
  }

  .site-header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
  }

  .site-header nav {
    flex: 1 1 auto;
  }

  .site-header__toggle {
    display: none;
  }

  .site-main { min-height: calc(100dvh - var(--header-h) - 200px); }

  .site-footer {
    margin-top: var(--space-8);
    padding-block: var(--space-6);
    border-top: 1px solid var(--border);
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: var(--text-sm);
  }

  .site-footer nav {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-4);
  }

  @media (max-width: 760px) {
    .site-header {
      height: auto;
      padding-block: .55rem;
    }

    .site-header .container {
      flex-direction: row;
      flex-wrap: wrap;
      align-items: stretch;
      gap: .55rem .6rem;
    }

    .site-header .logo {
      flex: 1 1 auto;
      min-width: 0;
    }

    .site-header__toggle {
      display: inline-flex;
      align-self: center;
      margin-left: auto;
      min-height: 36px;
    }

    .site-header__toggle.is-active {
      background: var(--bg-subtle);
      border-color: var(--border-strong);
    }

    .site-header__nav {
      display: grid;
      gap: .45rem;
      width: 100%;
      max-height: 0;
      overflow: hidden;
      opacity: 0;
      transform: translateY(-6px);
      padding: 0 .5rem;
      border: 1px solid transparent;
      border-radius: var(--radius-lg);
      background: transparent;
      transition: max-height var(--transition), opacity var(--transition), transform var(--transition), padding var(--transition), background var(--transition), border-color var(--transition);
    }

    .site-header__nav.is-open {
      max-height: 420px;
      opacity: 1;
      transform: translateY(0);
      padding: .5rem;
      border-color: var(--border);
      background: var(--bg-raised);
    }

    .site-header__nav[hidden] {
      display: none;
    }

    .site-header__nav > * {
      width: 100%;
      justify-content: space-between;
    }

    .site-header__nav .btn,
    .site-header__nav form {
      white-space: nowrap;
    }

    .site-header__nav form {
      margin: 0;
    }

    .site-header__nav .btn {
      min-height: 40px;
      padding-inline: .9rem;
      font-size: .9rem;
      width: 100%;
    }
  }

  @media (min-width: 761px) {
    .site-header__toggle {
      display: none;
    }
  }
}

/* ------------------------------------------------------------ Composants */
@layer components {

  /* Logo */
  .logo {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 700;
    font-size: var(--text-xl);
    color: var(--text);
    text-decoration: none;
    letter-spacing: -0.02em;
  }

  .logo__mark { color: var(--accent); }

  /* Boutons */
  .btn {
    --btn-bg: var(--accent);
    --btn-fg: var(--text-invert);

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    min-height: 44px;               /* cible tactile minimale */
    border: 1px solid transparent;
    border-radius: var(--radius-full);
    background: var(--btn-bg);
    color: var(--btn-fg);
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--transition), transform var(--transition),
                box-shadow var(--transition);
  }

  .btn:hover { background: var(--accent-hover); color: var(--btn-fg); }
  .btn:active { transform: translateY(1px); }

  .btn:disabled,
  .btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
  }

  .btn--lg { padding: var(--space-4) var(--space-6); font-size: var(--text-lg); }
  .btn--sm { padding: var(--space-2) var(--space-4); min-height: 36px; font-size: var(--text-sm); }
  .btn--block { width: 100%; }

  .btn--ghost {
    --btn-bg: transparent;
    --btn-fg: var(--text);
    border-color: var(--border-strong);
  }

  .btn--ghost:hover {
    background: var(--bg-subtle);
    color: var(--text);
  }

  .btn--with-indicator {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: .45rem;
  }

  .nav-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.2rem;
    height: 1.2rem;
    padding: 0 .32rem;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--text-invert);
    font-size: .68rem;
    line-height: 1;
    font-weight: 700;
    border: 1px solid color-mix(in srgb, var(--accent) 65%, black 35%);
  }

  /* Bouton accolé à un champ (afficher/masquer le mot de passe) : discret,
     de la même hauteur que l'input auquel il est adossé. */
  .btn--icon {
    --btn-bg: transparent;
    --btn-fg: var(--text-muted);
    border-color: var(--border-strong);
    padding-inline: var(--space-4);
    font-size: var(--text-sm);
    white-space: nowrap;
  }

  .btn--icon:hover {
    background: var(--bg-subtle);
    color: var(--text);
  }

  /* Cartes */
  .card {
    padding: var(--space-5);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
  }

  .card__title {
    font-size: var(--text-lg);
    margin-bottom: var(--space-2);
  }

  /* Badges */
  .badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
    padding: var(--space-1) var(--space-3);
    border-radius: var(--radius-full);
    background: var(--brand-100);
    color: var(--brand-800);
    font-size: var(--text-sm);
    font-weight: 600;
  }

  .badge--free {
    background: color-mix(in srgb, var(--success) 15%, transparent);
    color: var(--success);
  }

  /* Hero de la landing page */
  .hero {
    padding-block: var(--space-9) var(--space-8);
    text-align: center;
    background:
      radial-gradient(ellipse 70% 60% at 50% -10%,
        color-mix(in srgb, var(--brand-400) 22%, transparent), transparent);
  }

  .hero__title {
    font-size: var(--text-4xl);
    letter-spacing: -0.03em;
    margin-bottom: var(--space-4);
  }

  .hero__subtitle {
    font-size: var(--text-lg);
    color: var(--text-muted);
    max-width: 56ch;
    margin-inline: auto;
    margin-bottom: var(--space-6);
    text-wrap: pretty;
  }

  /* Compteur fondateurs — la valeur vient TOUJOURS du serveur */
  .counter {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-6);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-raised);
  }

  .counter__value {
    font-size: var(--text-3xl);
    font-weight: 800;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
  }

  .counter__label { font-size: var(--text-sm); color: var(--text-muted); }

  .counter__bar {
    -webkit-appearance: none;
    appearance: none;
    display: block;
    width: min(320px, 70vw);
    height: 8px;
    border: 0;
    border-radius: var(--radius-full);
    background: var(--border);
    overflow: hidden;
  }

  /* Piste et remplissage : les deux moteurs exposent des pseudo-éléments
     différents, il faut donc dupliquer les règles. */
  .counter__bar::-webkit-progress-bar {
    background: var(--border);
    border-radius: var(--radius-full);
  }

  .counter__bar::-webkit-progress-value {
    background: linear-gradient(90deg, var(--brand-500), var(--brand-700));
    border-radius: var(--radius-full);
  }

  .counter__bar::-moz-progress-bar {
    background: linear-gradient(90deg, var(--brand-500), var(--brand-700));
    border-radius: var(--radius-full);
  }

  /* Formulaires */
  .field { margin-bottom: var(--space-4); }

  .field__label {
    display: block;
    margin-bottom: var(--space-2);
    font-weight: 600;
    font-size: var(--text-sm);
  }

  .field__hint {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--text-xs);
    color: var(--text-muted);
  }

  .field__error {
    display: block;
    margin-top: var(--space-1);
    font-size: var(--text-sm);
    color: var(--danger);
  }

  .input,
  .select,
  .textarea {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    min-height: 44px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    background: var(--bg-raised);
    color: var(--text);
    transition: border-color var(--transition), box-shadow var(--transition);
  }

  .input:focus,
  .select:focus,
  .textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
    outline: none;
  }

  .input[aria-invalid="true"],
  .select[aria-invalid="true"],
  .textarea[aria-invalid="true"] { border-color: var(--danger); }

  .textarea { min-height: 140px; resize: vertical; }

  /* Alertes */
  .alert {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid;
    font-size: var(--text-sm);
  }

  .alert--info    { border-color: var(--info);    background: color-mix(in srgb, var(--info) 10%, transparent); }
  .alert--success { border-color: var(--success); background: color-mix(in srgb, var(--success) 10%, transparent); }
  .alert--warning { border-color: var(--warning); background: color-mix(in srgb, var(--warning) 10%, transparent); }
  .alert--danger  { border-color: var(--danger);  background: color-mix(in srgb, var(--danger) 10%, transparent); }

  /* Page d'erreur */
  .error-page {
    display: grid;
    place-content: center;
    gap: var(--space-4);
    min-height: 70dvh;
    text-align: center;
  }

  .error-page__code {
    font-size: var(--text-4xl);
    font-weight: 800;
    color: var(--accent);
  }
}

/* ------------------------------------------------------------ Utilitaires */
@layer utilities {
  .visually-hidden {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .skip-link {
    position: absolute;
    top: var(--space-2);
    left: var(--space-2);
    z-index: 100;
    padding: var(--space-2) var(--space-4);
    background: var(--accent);
    color: var(--text-invert);
    border-radius: var(--radius-md);
    transform: translateY(-200%);
    transition: transform var(--transition);
  }

  .skip-link:focus { transform: translateY(0); }

  .text-center { text-align: center; }
  .text-muted  { color: var(--text-muted); }
  .text-sm     { font-size: var(--text-sm); }
  .text-lg     { font-size: var(--text-lg); }

  .mt-4 { margin-top: var(--space-4); }
  .mt-6 { margin-top: var(--space-6); }
  .mb-4 { margin-bottom: var(--space-4); }
  .mb-6 { margin-bottom: var(--space-6); }

  .hidden { display: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   Formulaire d'inscription (§10) — ajouté au Lot 2
   ═══════════════════════════════════════════════════════════════════════════ */

@layer components {

  /* ---- Conteneur ------------------------------------------------------- */

  .register {
    display: grid;
    gap: var(--space-6);
    padding: var(--space-6);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
  }

  .register__actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    align-items: center;
    justify-content: flex-end;
  }

  .register__legal {
    margin: 0;
    font-size: var(--text-sm);
    color: var(--text-muted);
    text-align: center;
  }

  .register-wrap {
    max-width: 46rem;
    margin-inline: auto;
    padding-inline: var(--space-4);
  }

  .account-wrap {
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--space-4);
  }

  /* Le champ leurre est sorti du flux plutôt que masqué : un robot qui
     inspecte « display: none » le remplit quand même, ce qui est le but. */
  .form-guard {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
  }

  /* ---- Étapes ---------------------------------------------------------- */

  .step {
    display: grid;
    gap: var(--space-5);
    padding: 0;
    margin: 0;
    border: 0;
  }

  .step__title {
    padding: 0;
    font-size: var(--text-xl);
    font-weight: 650;
  }

  /* Sans JavaScript, toutes les étapes restent visibles à la suite. */
  html.js .step:not(.is-active) { display: none; }

  .stepper {
    display: flex;
    gap: var(--space-2);
    padding: 0;
    margin: 0;
    list-style: none;
    counter-reset: step;
  }

  .stepper__item {
    flex: 1;
    padding-top: var(--space-2);
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-align: center;
    border-top: 3px solid var(--border);
    counter-increment: step;
  }

  .stepper__item::before { content: counter(step) ". "; }
  .stepper__item.is-done    { color: var(--text); border-top-color: var(--accent); }
  .stepper__item.is-current { color: var(--accent); font-weight: 650; border-top-color: var(--accent); }

  /* ---- Champs ---------------------------------------------------------- */

  .field { display: grid; gap: var(--space-2); }

  .field__label {
    font-size: var(--text-sm);
    font-weight: 600;
  }

  .field__label small { font-weight: 400; color: var(--text-muted); }

  .field__hint {
    margin: 0;
    font-size: var(--text-xs);
    color: var(--text-muted);
  }

  .field__hint.is-short { color: var(--warning); }

  .field__error {
    margin: 0;
    font-size: var(--text-sm);
    font-weight: 550;
    color: var(--danger);
  }

  .field__status { margin: 0; font-size: var(--text-xs); min-height: 1em; }
  .field__status.is-ok { color: var(--success); }
  .field__status.is-ko { color: var(--danger); }

  .field__row {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
  }

  .field__row > .input { flex: 1 1 8rem; }

  .field--split {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  }

  .input-group { display: flex; gap: var(--space-2); }
  .input-group > .input { flex: 1; }

  .input--textarea { resize: vertical; min-height: 9rem; font-family: inherit; }

  input[type="range"] { width: 100%; accent-color: var(--accent); }

  output[data-range-output] { font-weight: 650; color: var(--accent); }

  /* ---- Choix multiples ------------------------------------------------- */

  .choice-grid {
    display: grid;
    gap: var(--space-2);
    grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  }

  .choice {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    padding: var(--space-3);
    cursor: pointer;
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color var(--transition), background var(--transition);
  }

  .choice:hover { border-color: var(--border-strong); }

  .choice input { accent-color: var(--accent); }

  /* :has() permet de styler l'étiquette entière depuis l'état de l'input,
     sans la moindre ligne de JavaScript. */
  .choice:has(input:checked) {
    background: var(--brand-50);
    border-color: var(--accent);
  }

  :root[data-theme="dark"] .choice:has(input:checked) {
    background: color-mix(in srgb, var(--accent) 22%, transparent);
    border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
    color: var(--text);
  }

  .choice:has(input:focus-visible) {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
  }

  /* ---- Photo ----------------------------------------------------------- */

  .dropzone {
    position: relative;
    display: grid;
    place-items: center;
    gap: var(--space-3);
    padding: var(--space-8) var(--space-4);
    text-align: center;
    background: var(--bg-subtle);
    border: 2px dashed var(--border-strong);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition), background var(--transition);
  }

  .dropzone.is-hover,
  .dropzone.has-file { border-color: var(--accent); background: var(--brand-50); }

  .dropzone__input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
  }

  .dropzone__hint { margin: 0; font-size: var(--text-sm); color: var(--text-muted); }

  .dropzone__preview {
    max-width: 12rem;
    max-height: 12rem;
    border-radius: var(--radius-md);
    object-fit: cover;
  }

  .cropper {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: var(--space-4);
  }

  .cropper__backdrop {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--text) 75%, transparent);
  }

  .cropper__dialog {
    position: relative;
    z-index: 1;
    width: min(52rem, 96vw);
    max-height: 92vh;
    overflow: auto;
    padding: var(--space-6);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
  }

  .cropper__close {
    position: absolute;
    top: .5rem;
    right: .5rem;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: var(--radius-full);
    background: transparent;
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
  }

  .cropper__close:hover { color: var(--text); }

  .cropper__title {
    margin: 0;
    font-size: var(--text-lg);
  }

  .cropper__hint {
    margin: .35rem 0;
    color: var(--text-muted);
    font-size: var(--text-sm);
  }

  .cropper__canvas-wrap {
    margin-top: var(--space-4);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
  }

  .cropper__canvas {
    display: block;
    width: 100%;
    height: auto;
    touch-action: none;
    cursor: grab;
  }

  .cropper__canvas.is-dragging { cursor: grabbing; }

  .cropper__controls {
    display: grid;
    gap: var(--space-3);
    margin-top: var(--space-4);
  }

  .cropper__control {
    display: grid;
    gap: .35rem;
    color: var(--text-sm);
  }

  .cropper__control input[type="range"] { width: 100%; }

  .cropper__actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-top: var(--space-4);
  }

  .cropper[hidden] { display: none !important; }

  .account-photo-primary {
    margin: .35rem 0 .75rem;
  }

  .account-photo-primary__img {
    width: 220px;
    height: 220px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid var(--border);
  }

  .account-photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
    gap: .6rem;
    margin-top: .45rem;
  }

  .account-photo-thumb {
    margin: 0;
    display: grid;
    gap: .35rem;
    padding: .35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--bg-raised);
    cursor: grab;
  }

  .account-photo-thumb:active {
    cursor: grabbing;
  }

  .account-photo-thumb.is-dragging {
    opacity: .55;
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  }

  .account-photo-thumb__img {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: .65rem;
    object-fit: cover;
    border: 1px solid var(--border);
  }

  .account-photo-thumb__meta {
    text-align: center;
    margin: 0;
  }

  .account-photo-thumb__actions {
    gap: .3rem;
    justify-content: center;
  }

  .account-photo-thumb__actions .btn {
    min-height: 30px;
    padding: .2rem .55rem;
    font-size: .72rem;
  }

  .account-shell {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: minmax(220px, 250px) minmax(0, 1fr);
    align-items: start;
  }

  .account-menu {
    position: sticky;
    top: calc(var(--header-h) + .85rem);
    padding: var(--space-4);
  }

  .account-menu__title {
    margin-bottom: .75rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    font-size: .72rem;
    font-weight: 700;
  }

  .account-menu__nav {
    display: grid;
    gap: .45rem;
  }

  .account-menu__link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    padding: .7rem .85rem;
    border-radius: .85rem;
    border: 1px solid transparent;
    color: var(--text);
    text-decoration: none;
    background: transparent;
    font-weight: 600;
  }

  .account-menu__icon {
    display: inline-grid;
    place-items: center;
    inline-size: 1.85rem;
    block-size: 1.85rem;
    flex: 0 0 1.85rem;
    border-radius: 999px;
    background: var(--bg-subtle);
    color: var(--text-muted);
    font-size: .95rem;
    line-height: 1;
  }

  .account-menu__label {
    flex: 1;
    min-width: 0;
  }

  .account-menu__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.7rem;
    padding: .15rem .4rem;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 12%, var(--bg-raised));
    border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--border));
    color: var(--accent);
    font-size: .75rem;
    font-weight: 700;
    line-height: 1;
  }

  .account-menu__link:hover {
    background: var(--bg-subtle);
    border-color: var(--border);
    color: var(--accent);
  }

  .account-menu__link:hover .account-menu__icon {
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-subtle));
    color: var(--accent);
  }

  .account-menu__link.is-active {
    background: color-mix(in srgb, var(--accent) 12%, var(--bg-raised));
    border-color: color-mix(in srgb, var(--accent) 30%, var(--border));
    color: var(--accent);
  }

  .account-menu__link.is-active .account-menu__icon {
    background: color-mix(in srgb, var(--accent) 18%, var(--bg-raised));
    color: var(--accent);
  }

  .account-menu__link.is-active .account-menu__badge {
    background: color-mix(in srgb, var(--accent) 18%, var(--bg-raised));
    border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
  }

  .account-menu__link--danger {
    color: var(--danger);
  }

  .account-menu__link--danger:hover {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 30%, var(--border));
    background: color-mix(in srgb, var(--danger) 8%, var(--bg-raised));
  }

  .account-panels {
    min-width: 0;
  }

  .account-panel[hidden] {
    display: none !important;
  }

  .account-panel {
    scroll-margin-top: calc(var(--header-h) + 1rem);
  }

  .account-panel + .account-panel {
    margin-top: 0;
  }

  .account-panel .register {
    margin-top: 1rem;
  }

  .icon-btn {
    min-width: 30px;
    min-height: 30px;
    width: 30px;
    height: 30px;
    padding: 0;
    border-radius: 50%;
    font-size: .95rem;
    line-height: 1;
  }

  .icon-btn--danger {
    color: var(--danger);
    border-color: color-mix(in srgb, var(--danger) 35%, var(--border-strong));
  }

  .icon-btn--danger:hover {
    background: color-mix(in srgb, var(--danger) 10%, var(--bg-subtle));
    color: color-mix(in srgb, var(--danger) 85%, black 15%);
  }

  /* ---- Consentements --------------------------------------------------- */

  .consents {
    gap: var(--space-4);
    padding: var(--space-4);
    background: var(--bg-subtle);
    border-radius: var(--radius-md);
  }

  .consent {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--space-3);
    align-items: start;
    font-size: var(--text-sm);
    line-height: 1.5;
    cursor: pointer;
  }

  .consent input { margin-top: 0.2em; accent-color: var(--accent); }

  /* ---- Pages annexes --------------------------------------------------- */

  .page-head {
    padding: var(--space-8) var(--space-4) var(--space-4);
    text-align: center;
  }

  .page-head__lead { max-width: 34rem; margin-inline: auto; color: var(--text-muted); }

  @media (max-width: 980px) {
    .account-shell {
      grid-template-columns: 1fr;
    }

    .account-menu {
      position: static;
    }
  }

  .section__title { text-align: center; }
  .section__lead  { max-width: 34rem; margin-inline: auto; text-align: center; }

  .notice {
    max-width: 38rem;
    margin: var(--space-8) auto;
    padding: var(--space-6);
    text-align: center;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
  }

  .notice__lead { color: var(--text-muted); }

  .notice__list {
    display: grid;
    gap: var(--space-2);
    text-align: left;
    font-size: var(--text-sm);
    color: var(--text-muted);
  }

  .notice__actions { margin-top: var(--space-6); }

  .badge--founder {
    display: inline-block;
    padding: var(--space-2) var(--space-4);
    font-weight: 700;
    color: var(--text-invert);
    background: var(--accent);
    border-radius: var(--radius-full);
  }

  /* ---- Decouverte ------------------------------------------------------ */

  .discovery-page {
    --flow: 1.2rem;
    padding-block: var(--space-5) var(--space-7);
  }

  .discovery-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
  }

  .discovery-head h1 {
    font-size: clamp(1.6rem, 2.4vw, 2.05rem);
    letter-spacing: -0.02em;
  }

  .discovery-head__lead {
    margin-top: .35rem;
    color: var(--text-muted);
    max-width: 44rem;
  }

  .discovery-head__stats {
    display: flex;
    align-items: center;
    gap: .5rem;
  }

  .discovery-pill {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: .2rem .75rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    font-size: var(--text-sm);
    background: var(--bg-raised);
    color: var(--text-muted);
  }

  .discovery-pill--accent {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-raised));
  }

  .discovery-layout {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
    align-items: start;
  }

  .discovery-filters-toggle {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: .6rem;
    inline-size: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: .68rem .82rem;
    background: var(--bg-raised);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
  }

  .discovery-filters {
    position: sticky;
    top: calc(var(--header-h) + .85rem);
    max-height: calc(100dvh - var(--header-h) - 1.4rem);
    overflow: auto;
    overscroll-behavior: contain;
  }

  .discovery-filters-mobile-head {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-bottom: .65rem;
  }

  .discovery-filters-mobile-title {
    margin: 0;
    font-size: var(--text-base);
    font-weight: 700;
  }

  .discovery-filters-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 18, .45);
    z-index: 30;
  }

  .discovery-filters__title {
    margin: 0;
    font-size: var(--text-lg);
  }

  .discovery-fieldset {
    margin: 0;
    padding: 0;
    border: 0;
    display: grid;
    gap: .55rem;
  }

  .discovery-group {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: .55rem .65rem .75rem;
    background: color-mix(in srgb, var(--bg-subtle) 45%, var(--bg-raised));
  }

  .discovery-group > summary {
    cursor: pointer;
    font-weight: 700;
    font-size: var(--text-sm);
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
  }

  .discovery-group > summary::-webkit-details-marker {
    display: none;
  }

  .discovery-group > summary::after {
    content: '+';
    color: var(--text-muted);
  }

  .discovery-group[open] > summary::after {
    content: '-';
  }

  .discovery-group > .stack,
  .discovery-group > .discovery-range-grid {
    margin-top: .75rem;
  }

  .discovery-fieldset legend {
    font-size: var(--text-sm);
    font-weight: 700;
    margin-bottom: .35rem;
  }

  .discovery-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
  }

  .discovery-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
  }

  .discovery-chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
  }

  .discovery-chip span {
    border-radius: var(--radius-full);
    border: 1px solid var(--border-strong);
    background: var(--bg-subtle);
    color: var(--text-muted);
    padding: .35rem .78rem;
    font-size: var(--text-sm);
    transition: border-color var(--transition), background var(--transition), color var(--transition);
  }

  .discovery-chip:has(input:checked) span {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    background: color-mix(in srgb, var(--accent) 12%, var(--bg-raised));
    color: var(--text);
  }

  .discovery-toggle {
    display: flex;
    gap: .6rem;
    align-items: center;
    font-size: var(--text-sm);
    color: var(--text-muted);
  }

  .discovery-toggle input {
    accent-color: var(--accent);
    inline-size: 1.05rem;
    block-size: 1.05rem;
  }

  .discovery-range-grid {
    display: grid;
    gap: .75rem;
    grid-template-columns: 1fr 1fr;
  }

  .discovery-age-slider {
    position: relative;
    block-size: 1.6rem;
  }

  .discovery-age-slider__track {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    block-size: .35rem;
    border-radius: var(--radius-full);
    background:
      linear-gradient(
        to right,
        var(--border) var(--age-left, 0%),
        color-mix(in srgb, var(--accent) 45%, var(--bg-raised)) var(--age-left, 0%),
        color-mix(in srgb, var(--accent) 45%, var(--bg-raised)) var(--age-right, 100%),
        var(--border) var(--age-right, 100%)
      );
  }

  .discovery-age-slider input[type="range"] {
    position: absolute;
    left: 0;
    top: 0;
    inline-size: 100%;
    block-size: 100%;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
  }

  .discovery-age-slider input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    inline-size: 1rem;
    block-size: 1rem;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid color-mix(in srgb, var(--accent) 30%, white 70%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
    cursor: pointer;
    pointer-events: auto;
  }

  .discovery-age-slider input[type="range"]::-moz-range-thumb {
    inline-size: 1rem;
    block-size: 1rem;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid color-mix(in srgb, var(--accent) 30%, white 70%);
    box-shadow: 0 2px 6px rgba(0, 0, 0, .2);
    cursor: pointer;
    pointer-events: auto;
  }

  .discovery-age-values {
    margin-top: .35rem;
    margin-bottom: 0;
  }

  .discovery-results {
    display: grid;
    gap: var(--space-4);
  }

  .discovery-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .85rem;
    padding: .7rem .85rem;
  }

  .discovery-active-filters {
    display: grid;
    gap: .6rem;
    padding: .75rem .85rem;
  }

  .discovery-active-filters__list {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
  }

  .discovery-active-filter {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    text-decoration: none;
    font-size: var(--text-sm);
    color: var(--text);
    border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--border));
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-raised));
    border-radius: var(--radius-full);
    padding: .28rem .62rem;
  }

  .discovery-active-filter:hover {
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 48%, var(--border));
  }

  .discovery-toolbar__presets {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .45rem;
  }

  .discovery-shortcut {
    text-decoration: none;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    padding: .26rem .62rem;
    font-size: var(--text-sm);
    background: var(--bg);
  }

  .discovery-shortcut:hover {
    border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
    color: var(--accent);
  }

  .discovery-shortcut.is-active {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 12%, var(--bg-raised));
  }

  .discovery-toolbar__view-switch {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
  }

  .discovery-grid {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .discovery-grid--compact {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: .85rem;
  }

  .discovery-grid--compact .discovery-card__media {
    aspect-ratio: 1 / 1;
  }

  .discovery-grid--compact .discovery-card__body {
    padding: .65rem .65rem .75rem;
  }

  .discovery-grid--compact .discovery-card__headline,
  .discovery-grid--compact .discovery-card__links {
    display: none;
  }

  .discovery-grid--compact .discovery-card__meta {
    font-size: var(--text-xs);
  }

  .discovery-card {
    display: flex;
    flex-direction: column;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-raised);
    overflow: clip;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  }

  .discovery-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--border-strong);
  }

  .discovery-card__media {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    background: var(--bg-subtle);
    text-decoration: none;
  }

  .discovery-card__media img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
  }

  .discovery-card__placeholder {
    display: grid;
    place-items: center;
    inline-size: 100%;
    block-size: 100%;
    color: var(--text-muted);
    font-size: var(--text-sm);
  }

  .discovery-card__status {
    position: absolute;
    right: .55rem;
    top: .55rem;
    border-radius: var(--radius-full);
    padding: .2rem .5rem;
    font-size: .75rem;
    font-weight: 700;
    color: #ecfff5;
    background: color-mix(in srgb, var(--success) 88%, black 12%);
  }

  .discovery-card__body {
    padding: .85rem .85rem 1rem;
  }

  .discovery-card__title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.25;
  }

  .discovery-card__title a {
    color: inherit;
    text-decoration: none;
  }

  .discovery-card__title a:hover {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 2px;
  }

  .discovery-card__meta {
    margin-top: .4rem;
    font-size: var(--text-sm);
  }

  .discovery-card__headline {
    margin-top: .45rem;
    font-size: var(--text-sm);
    color: var(--text-muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .discovery-card__links {
    margin-top: .4rem;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    font-size: var(--text-xs);
  }

  .discovery-card__links a {
    color: var(--text-muted);
    text-decoration: underline;
    text-underline-offset: 2px;
  }

  .discovery-card__links a:hover {
    color: var(--accent);
  }

  @media (max-width: 980px) {
    .discovery-layout {
      grid-template-columns: 1fr;
    }

    .discovery-filters-toggle {
      display: inline-flex;
    }

    .discovery-filters {
      position: fixed;
      inset: 0;
      z-index: 40;
      border-radius: 0;
      border: 0;
      max-height: 100dvh;
      overflow: auto;
      overscroll-behavior: contain;
      padding: .9rem .9rem calc(.9rem + env(safe-area-inset-bottom));
    }

    .discovery-filters.is-collapsible {
      display: none;
    }

    .discovery-filters.is-collapsible.is-open {
      display: block;
    }

    .discovery-filters-mobile-head {
      display: flex;
      position: sticky;
      top: 0;
      z-index: 1;
      background: var(--bg-raised);
      padding-bottom: .45rem;
      border-bottom: 1px solid var(--border);
    }

    .discovery-filters-backdrop {
      display: block;
    }

    body.has-discovery-drawer-open {
      overflow: hidden;
    }
  }

  @media (max-width: 680px) {
    .discovery-range-grid {
      grid-template-columns: 1fr;
    }

    .discovery-toolbar {
      flex-direction: column;
      align-items: stretch;
    }

    .discovery-toolbar__view-switch {
      justify-content: flex-end;
    }

    .discovery-head__stats {
      width: 100%;
      justify-content: flex-start;
      flex-wrap: wrap;
    }

    .discovery-grid {
      grid-template-columns: 1fr;
    }
  }

  /* ---- Profil public --------------------------------------------------- */

  .profile-page {
    --flow: 1rem;
    padding-block: var(--space-5) var(--space-7);
  }

  .profile-hero {
    display: grid;
    gap: 0;
    overflow: clip;
    grid-template-columns: minmax(0, 430px) minmax(0, 1fr);
  }

  .profile-hero__media {
    position: relative;
    min-height: 320px;
    background: var(--bg-subtle);
  }

  .profile-hero__media img {
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    cursor: zoom-in;
  }

  .profile-hero__placeholder {
    display: grid;
    place-items: center;
    inline-size: 100%;
    block-size: 100%;
    color: var(--text-muted);
  }

  .profile-hero__status {
    position: absolute;
    left: .75rem;
    bottom: .75rem;
    font-size: .78rem;
    font-weight: 700;
    border-radius: var(--radius-full);
    padding: .2rem .55rem;
    color: #f6f8fb;
    background: #3f4755;
  }

  .profile-hero__status.is-online {
    background: color-mix(in srgb, var(--success) 88%, black 12%);
  }

  .profile-hero__content {
    padding: 1rem 1.1rem 1.1rem;
  }

  .profile-hero__name {
    margin: 0;
    font-size: clamp(1.5rem, 2.4vw, 2rem);
    letter-spacing: -0.015em;
  }

  .profile-hero__meta {
    margin: 0;
    font-size: var(--text-sm);
  }

  .profile-hero__headline {
    margin: .15rem 0 0;
    font-size: var(--text-lg);
    line-height: 1.35;
  }

  .profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .55rem;
    margin-top: .25rem;
  }

  .profile-actions form {
    margin: 0;
  }

  .profile-gallery {
    display: grid;
    gap: .55rem;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  }

  .profile-gallery__item {
    display: block;
    border-radius: .7rem;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  }

  .profile-gallery__item:hover {
    border-color: color-mix(in srgb, var(--accent) 52%, var(--border));
    transform: translateY(-1px);
  }

  .profile-gallery__item.is-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent);
  }

  .profile-gallery__item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
  }

  .profile-lightbox {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: .6rem;
    padding: 1rem;
    background: rgb(10 12 18 / 0.88);
  }

  .profile-lightbox[hidden] {
    display: none;
  }

  .profile-lightbox__figure {
    margin: 0;
    display: grid;
    place-items: center;
    gap: .65rem;
    touch-action: pan-y;
  }

  .profile-lightbox__figure img {
    max-width: min(92vw, 980px);
    max-height: 86vh;
    object-fit: contain;
    border-radius: .7rem;
    box-shadow: var(--shadow-lg);
    opacity: 1;
    transition: opacity 140ms ease;
  }

  .profile-lightbox__figure img.is-changing {
    opacity: .35;
  }

  .profile-lightbox__counter {
    margin: 0;
    color: rgb(240 246 255 / 0.92);
    font-size: .86rem;
    font-weight: 600;
    letter-spacing: .01em;
  }

  .profile-lightbox__close,
  .profile-lightbox__nav {
    appearance: none;
    border: 1px solid rgb(255 255 255 / 0.28);
    color: #f8fbff;
    background: rgb(25 30 40 / 0.62);
    border-radius: var(--radius-full);
    cursor: pointer;
  }

  .profile-lightbox__close {
    position: fixed;
    right: 1rem;
    top: 1rem;
    width: 2.4rem;
    height: 2.4rem;
    font-size: 1.35rem;
    line-height: 1;
  }

  .profile-lightbox__nav {
    width: 2.8rem;
    height: 2.8rem;
    font-size: 2rem;
    line-height: .9;
    display: grid;
    place-items: center;
  }

  @media (max-width: 760px) {
    .profile-lightbox {
      grid-template-columns: 1fr;
      padding: .8rem;
    }

    .profile-lightbox__nav {
      position: fixed;
      bottom: 1rem;
      z-index: 1;
    }

    .profile-lightbox__nav[data-profile-lightbox-prev] {
      left: 1rem;
    }

    .profile-lightbox__nav[data-profile-lightbox-next] {
      right: 1rem;
    }
  }

  .profile-layout {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .profile-layout > :last-child {
    grid-column: 1 / -1;
  }

  .profile-specs {
    margin: 0;
    display: grid;
    gap: .55rem;
  }

  .profile-specs > div {
    display: flex;
    justify-content: space-between;
    gap: .9rem;
    border-bottom: 1px dashed var(--border);
    padding-bottom: .45rem;
  }

  .profile-specs dt {
    color: var(--text-muted);
    font-size: var(--text-sm);
  }

  .profile-specs dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
  }

  @media (max-width: 980px) {
    .profile-hero {
      grid-template-columns: 1fr;
    }

    .profile-hero__media {
      min-height: 280px;
    }

    .profile-layout {
      grid-template-columns: 1fr;
    }
  }

  /* ---- Messagerie ------------------------------------------------------ */

  .messages-page {
    --flow: 1rem;
    padding-block: var(--space-4) var(--space-7);
  }

  .messages-layout {
    display: grid;
    gap: var(--space-4);
    grid-template-columns: minmax(250px, 320px) minmax(0, 1fr);
    align-items: start;
  }

  .messages-list {
    position: sticky;
    top: calc(var(--header-h) + .85rem);
    max-height: calc(100dvh - var(--header-h) - 1.4rem);
    overflow: auto;
  }

  .messages-list__items {
    list-style: none;
    margin: .8rem 0 0;
    padding: 0;
    display: grid;
    gap: .45rem;
  }

  .messages-mailbox-switch {
    margin: .4rem 0 0;
    display: flex;
    gap: .45rem;
    flex-wrap: wrap;
  }

  .messages-list__item {
    display: grid;
    grid-template-columns: 46px 1fr auto;
    align-items: center;
    gap: .6rem;
    padding: .5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--bg-subtle);
    color: inherit;
    text-decoration: none;
  }

  .messages-list__item.is-active {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    background: color-mix(in srgb, var(--accent) 10%, var(--bg-raised));
  }

  .messages-list__item img,
  .messages-list__avatar {
    inline-size: 46px;
    block-size: 46px;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-raised);
    display: grid;
    place-items: center;
  }

  .messages-list__item span {
    display: grid;
    gap: .15rem;
    min-width: 0;
  }

  .messages-list__item strong {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .messages-list__unread {
    display: inline-grid;
    place-items: center;
    min-width: 1.4rem;
    height: 1.4rem;
    padding: 0 .3rem;
    border-radius: var(--radius-full);
    background: var(--accent);
    color: var(--text-invert);
    font-size: .72rem;
    font-style: normal;
    font-weight: 700;
  }

  .messages-thread {
    display: grid;
    gap: var(--space-3);
  }

  .messages-thread__head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: .75rem;
  }

  .messages-thread__actions {
    display: flex;
    gap: .45rem;
    flex-wrap: wrap;
    align-items: center;
  }

  .messages-thread__actions form {
    margin: 0;
  }

  .messages-thread__head h2 {
    margin: 0;
  }

  .messages-thread__body {
    min-height: 260px;
    max-height: 58dvh;
    overflow: auto;
    padding: .45rem;
    border-radius: var(--radius-md);
    background: var(--bg-subtle);
    border: 1px solid var(--border);
    display: grid;
    gap: .55rem;
  }

  .messages-bubble {
    justify-self: start;
    max-width: min(75ch, 92%);
    padding: .55rem .7rem;
    border: 1px solid var(--border);
    border-radius: .9rem .9rem .9rem .25rem;
    background: var(--bg-raised);
  }

  .messages-bubble.is-me {
    justify-self: end;
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
    background: color-mix(in srgb, var(--accent) 9%, var(--bg-raised));
    border-radius: .9rem .9rem .25rem .9rem;
  }

  .messages-bubble p {
    margin: 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
  }

  .messages-bubble small {
    margin-top: .2rem;
    display: inline-block;
    color: var(--text-muted);
    font-size: .72rem;
  }

  .messages-form {
    display: grid;
    gap: .5rem;
  }

  .messages-form__actions {
    margin: 0;
    display: flex;
    justify-content: flex-end;
  }

  @media (max-width: 980px) {
    .messages-layout {
      grid-template-columns: 1fr;
    }

    .messages-list {
      position: static;
      max-height: none;
    }

    .messages-thread__body {
      max-height: 46dvh;
    }
  }
}

@media (prefers-color-scheme: dark) {
  @layer components {
    .choice:has(input:checked),
    .dropzone.is-hover,
    .dropzone.has-file { background: color-mix(in srgb, var(--accent) 18%, transparent); }

    .cropper__backdrop { background: color-mix(in srgb, #090b12 80%, transparent); }
  }
}

@layer utilities {
  /* L'attribut `hidden` doit l'emporter sur les `display` des composants.
     Sans cette règle, `.btn { display: inline-flex }` (couche components)
     l'emporte sur `[hidden]` (couche reset) et masquer un bouton par
     JavaScript n'a aucun effet visible. */
  [hidden] { display: none !important; }

  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }
}
