/* ==========================================================================
   Stellion — jetons de design (v1)
   Source : canevas « Stellion — refonte visuelle » (direction D : mélange A + B)
   Copie de stellion-design/tokens.css ; seules les déclarations @font-face sont adaptées
   (sous-ensembles latin et latin étendu, fichiers réels de /fonts/).
   Règles : aucune couleur, taille, arrondi ou ombre en dur ailleurs que dans ce
   fichier. Les composants n'utilisent que ces variables.
   Thème : <html data-theme="noir|blanc"> ; sans attribut = suit le système.
   ========================================================================== */

/* ---------- Polices (auto-hébergées, licence OFL — aucune ressource externe) ----------
   Fichiers dans /fonts/ (paquets Fontsource 5.3.0, licences OFL-*.txt à côté).
   Chaque police est découpée en deux sous-ensembles : latin (français compris) et latin
   étendu ; le navigateur ne télécharge le second que si le texte en a besoin. */
@font-face { font-family: "Instrument Sans"; src: url("/fonts/InstrumentSans-latin-wght.woff2") format("woff2"); font-weight: 400 700; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Instrument Sans"; src: url("/fonts/InstrumentSans-latin-ext-wght.woff2") format("woff2"); font-weight: 400 700; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/IBMPlexMono-latin-400.woff2") format("woff2"); font-weight: 400; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/IBMPlexMono-latin-ext-400.woff2") format("woff2"); font-weight: 400; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/IBMPlexMono-latin-500.woff2") format("woff2"); font-weight: 500; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "IBM Plex Mono"; src: url("/fonts/IBMPlexMono-latin-ext-500.woff2") format("woff2"); font-weight: 500; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* Typographie : 1 police texte + 1 police à chasse fixe (pseudos, heures, compteurs, libellés) */
  --font-sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --text-2xs: 11px;  /* méta mono, badges */
  --text-xs: 12px;   /* méta mono, libellés de section */
  --text-sm: 13px;
  --text-md: 14px;   /* boutons, puces */
  --text-base: 15px; /* texte courant, messages */
  --text-lg: 16px;   /* noms, titres de feuilles */
  --text-xl: 17px;
  --text-2xl: 20px;  /* titre d'en-tête mobile */
  --text-3xl: 24px;  /* titres de page mobile */
  --text-4xl: 28px;  /* titres de page ordinateur */

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  --leading-tight: 1.35;
  --leading-normal: 1.45;
  --leading-relaxed: 1.55;
  --tracking-title: -0.02em;

  /* Espacements (grille de 4) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Arrondis : 7 valeurs seulement */
  --radius-xs: 6px;    /* badges, mentions */
  --radius-sm: 10px;   /* petits boutons, puces carrées */
  --radius-md: 12px;   /* boutons, champs */
  --radius-lg: 14px;   /* champs de recherche, tuiles */
  --radius-xl: 18px;   /* cartes, menus déroulants */
  --radius-2xl: 24px;  /* feuilles, tiroirs, barre flottante */
  --radius-full: 999px;/* pastilles, avatars */

  /* Tailles fixes */
  --tap-min: 44px;            /* cible tactile minimale (WCAG) */
  --header-h: 56px;           /* en-tête mobile */
  --header-h-desktop: 72px;
  --nav-float-h: 64px;        /* barre flottante mobile */
  --nav-float-inset: 12px;
  --sidebar-w: 248px;         /* barre latérale ordinateur */
  --sidebar-w-compact: 76px;  /* dans Nexus et Messages */
  --avatar-sm: 28px;
  --avatar-md: 40px;
  --avatar-lg: 52px;
  --avatar-xl: 88px;

  /* Animations */
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --duration-fast: 200ms;
  --duration-base: 340ms;

  /* Ajout (refonte) : bille de l'interrupteur, blanche dans les deux thèmes comme sur les maquettes */
  --switch-knob: #FFFFFF;
  /* Ajout (refonte) : initiales posées sur la couleur personnelle d'un membre. Foncé dans les
     deux thèmes : c'est le seul choix lisible (4,5:1 au moins) sur les 8 couleurs proposées. */
  --on-avatar: #0B0D0C;
  /* Ajout (refonte) : boutons posés sur une photo ou une vidéo (son, flèches, compteur).
     Identiques dans les deux thèmes : le fond est le média, pas la page. Valeurs de la maquette Fil. */
  --media-scrim: rgba(0, 0, 0, 0.62);
  --on-media: #FFFFFF;
  /* Ajout (refonte) : lecteur Loops, toujours sombre (maquette Loops). Le vert et le rose sont
     ceux du thème noir, lisibles sur une vidéo dans les deux thèmes. */
  --media-bg: #000000;
  --media-accent: #3FD583;
  --media-like: #FF7A85;
  --media-fav: #F2C66D;          /* ajout (refonte) : étoile d'un GIF favori, sur --media-scrim */
  --media-track: rgba(255, 255, 255, 0.22);
  --media-fade-top: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0));
  --media-fade-bottom: linear-gradient(to top, rgba(0, 0, 0, 0.78), rgba(0, 0, 0, 0));
}

/* ---------- Thème noir (par défaut) ---------- */
:root,
:root[data-theme="noir"] {
  color-scheme: dark;
  --bg: #0B0D0C;
  --surface: #141816;
  --surface-2: #1C211E;     /* champs, bulles reçues, tuiles */
  --selected: #1F2622;      /* élément actif d'une liste */
  --border: #262C29;
  --hairline: #1F2421;
  --border-strong: #323A36; /* contour des puces et boutons secondaires */

  --text: #EEF2EF;
  --text-muted: #9BA59F;    /* 7:1 sur --surface */
  --icon: #C5CEC8;

  --accent: #3FD583;        /* vert « menthe », provisoire tant que le vert du lézard n'est pas fixé */
  --accent-text: #3FD583;
  --on-accent: #06210F;
  --accent-soft: #173A26;   /* badge « Auteur », mention */
  --mention-bg: #10241A;

  --like: #FF7A85;
  --danger: #FF7A85;
  --online: #3FD583;
  --offline: #5E6862;
  --switch-off: #3A433E;

  --bubble-mine: var(--accent);
  --on-bubble-mine: var(--on-accent);
  --bubble-theirs: var(--surface-2);

  --scrim: rgba(0, 0, 0, 0.55);
  --shadow-float: 0 10px 30px rgba(0, 0, 0, 0.5);
  --shadow-menu: 0 16px 40px rgba(0, 0, 0, 0.6);

  /* Chat : survol, info-bulles, dépôt de fichiers (section O) */
  --hover-row: #121614;            /* message survolé */
  --react-on: var(--accent-soft);  /* réaction que j'ai mise (+ contour --accent) */
  --on-danger: #2A0A0D;            /* texte sur pastille --danger (« Nouveaux ») */
  --tooltip-bg: #EEF2EF;
  --tooltip-text: #0B0D0C;
  --drop-scrim: rgba(11, 13, 12, 0.82);
  --float-bg: #1C211E;             /* ajout (refonte) : fond de la barre flottante, maquette Nav */
}

/* ---------- Thème blanc ---------- */
:root[data-theme="blanc"] {
  color-scheme: light;
  --bg: #F6F7F6;
  --surface: #FFFFFF;
  --surface-2: #EEF0EE;
  --selected: #E6F2EA;
  --border: #DFE3E0;
  --hairline: #E7EAE7;
  --border-strong: #CED3CF;

  --text: #121513;
  --text-muted: #5A625D;    /* 6,3:1 sur blanc */
  --icon: #3E4541;

  --accent: #12703F;        /* 6,1:1 sur blanc, texte blanc dessus */
  --accent-text: #12703F;
  --on-accent: #FFFFFF;
  --accent-soft: #E3F1E8;
  --mention-bg: #EEF7F1;

  --like: #C4282F;
  --danger: #C4282F;
  --online: #1E9E55;
  --offline: #9AA19C;
  --switch-off: #B9C0BB;

  --bubble-mine: var(--accent);
  --on-bubble-mine: var(--on-accent);
  --bubble-theirs: var(--surface-2);

  --scrim: rgba(18, 21, 19, 0.25);
  --shadow-float: 0 8px 24px rgba(18, 21, 19, 0.14);
  --shadow-menu: 0 16px 40px rgba(18, 21, 19, 0.18);

  --hover-row: #F1F3F1;
  --react-on: var(--accent-soft);
  --on-danger: #FFFFFF;
  --tooltip-bg: #121513;
  --tooltip-text: #FFFFFF;
  --drop-scrim: rgba(255, 255, 255, 0.86);
  --float-bg: #FFFFFF;
}

/* Sans choix explicite : suivre le système */
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) {
    color-scheme: light;
    --bg: #F6F7F6; --surface: #FFFFFF; --surface-2: #EEF0EE; --selected: #E6F2EA;
    --border: #DFE3E0; --hairline: #E7EAE7; --border-strong: #CED3CF;
    --text: #121513; --text-muted: #5A625D; --icon: #3E4541;
    --accent: #12703F; --accent-text: #12703F; --on-accent: #FFFFFF; --accent-soft: #E3F1E8; --mention-bg: #EEF7F1;
    --like: #C4282F; --danger: #C4282F; --online: #1E9E55; --offline: #9AA19C; --switch-off: #B9C0BB;
    --scrim: rgba(18, 21, 19, 0.25);
    --shadow-float: 0 8px 24px rgba(18, 21, 19, 0.14);
    --shadow-menu: 0 16px 40px rgba(18, 21, 19, 0.18);
    --hover-row: #F1F3F1;
    --on-danger: #FFFFFF;
    --tooltip-bg: #121513;
    --tooltip-text: #FFFFFF;
    --drop-scrim: rgba(255, 255, 255, 0.86);
    --float-bg: #FFFFFF;
  }
}

/* ---------- Bases ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-family: var(--font-sans); font-size: var(--text-base); line-height: var(--leading-normal); background: var(--bg); color: var(--text); -webkit-text-size-adjust: 100%; }
body { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
