/* ══════════════════════════════════════════════════════════════════════
   Axorun V2 — jetons de design (socle commun des écrans d'équipe)
   ----------------------------------------------------------------------
   Règles :
   - Aucun composant n'écrit une couleur en dur : tout passe par ces jetons.
   - Thème : suit l'OS (prefers-color-scheme) ; le CRM peut forcer
     <html data-theme="light|dark"> (l'iframe suit alors le cadre, G-02).
   - Accent : fourni par le restaurant (--accent). composants.js calcule
     --accent-ink (texte posé SUR l'accent, noir ou blanc, ≥ 4,5:1 garanti)
     et --accent-text-light / --accent-text-dark (accent lisible comme
     texte sur les surfaces). Sans JS : replis sûrs ci-dessous.
   - Typo : une famille (pile système, CSP sans police distante),
     3 tailles, 2 graisses.
   ══════════════════════════════════════════════════════════════════════ */

:root{
  /* ── Typo ── */
  --police: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --t-petit: 14px;    /* libellés, méta, badges — jamais en dessous */
  --t-normal: 16px;   /* texte courant, boutons ; ≥ 16 px = pas de zoom iOS dans les champs */
  --t-grand: 24px;    /* numéro de commande, titres, montants clés */
  --g-normal: 400;
  --g-fort: 700;
  --interligne: 1.45;

  /* ── Espacements (base 4) ── */
  --e-1: 4px; --e-2: 8px; --e-3: 12px; --e-4: 16px; --e-5: 24px; --e-6: 32px;
  --gouttiere: 16px;

  /* ── Rayons : hiérarchie, pas un rayon unique ── */
  --r-pastille: 999px;  /* badges, onglets */
  --r-controle: 12px;   /* boutons, champs */
  --r-bon: 10px;        /* carte commande (« bon » de cuisine, coins nets) */
  --r-feuille: 20px;    /* fenêtres (fiche, réglages) */

  /* ── Cibles tactiles ── */
  --cible: 48px;         /* minimum de tout contrôle */
  --cible-principale: 56px;

  /* ── Mouvement ── */
  --d-rapide: 150ms; --d-normal: 200ms; --d-lent: 250ms;
  --courbe: cubic-bezier(.2,.7,.2,1);

  /* ── Accent du restaurant (surchargé par le tenant) ── */
  --accent: #2F6F7E;
  --accent-ink: #FFFFFF;            /* recalculé par JS */
  --accent-text-light: #22535E;     /* recalculé par JS */
  --accent-text-dark: #8CC4D1;      /* recalculé par JS */

  /* ── Thème clair (défaut) ── */
  color-scheme: light;
  --fond: #ECEEF1;        /* acier clair : le plan de travail */
  --carte: #FFFFFF;       /* le bon */
  --creux: #F4F5F7;       /* zones en retrait dans une carte */
  --ligne: #D3D8DE;
  --ligne-forte: #9AA3AD;
  --texte: #16191D;
  --texte-doux: #4F5761;
  --voile: rgba(16,19,23,.55);
  --ombre-1: 0 1px 2px rgba(16,19,23,.08), 0 1px 1px rgba(16,19,23,.04);
  --ombre-2: 0 18px 48px rgba(16,19,23,.24);
  --accent-text: var(--accent-text-light);

  /* Statuts de commande : couleurs historiques conservées (l'équipe les connaît) */
  --st-nouvelle-fond: #E2EAFB; --st-nouvelle-encre: #1E4FB8; --st-nouvelle-trait: #2F6BE0;
  --st-prepa-fond:    #FBE8D2; --st-prepa-encre:    #8A4300; --st-prepa-trait:    #E07B1F;
  --st-prete-fond:    #EEE4F8; --st-prete-encre:    #653A99; --st-prete-trait:    #8B5CC7;
  --st-livree-fond:   #DFF1E4; --st-livree-encre:   #1D6633; --st-livree-trait:   #2E9450;
  --st-fini-fond:     #E6E8EB; --st-fini-encre:     #4A525C; --st-fini-trait:     #8A929C;

  /* Tons sémantiques (paiement, bandeaux, toasts) */
  --ton-ok-fond: #DFF1E4;      --ton-ok-encre: #1D6633;
  --ton-attente-fond: #FBE8D2; --ton-attente-encre: #8A4300;
  --ton-info-fond: #E2EAFB;    --ton-info-encre: #1E4FB8;
  --ton-danger-fond: #FBE3E0;  --ton-danger-encre: #A3200F;
  --ton-neutre-fond: #E6E8EB;  --ton-neutre-encre: #4A525C;
  --danger: #B42318; --danger-ink: #FFFFFF;

  /* Papier du bon imprimé (aperçu) : identique dans les deux thèmes */
  --papier: #FFFFFF; --papier-encre: #000000; --papier-ombre: 0 2px 10px rgba(0,0,0,.25);
  --police-bon: "Courier New", monospace; /* seule exception : c'est la police du rouleau thermique */
}

/* ── Thème sombre : OS sombre, sauf si le CRM force le clair ── */
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    color-scheme: dark;
    --fond: #141619; --carte: #1E2125; --creux: #272B30;
    --ligne: #363B42; --ligne-forte: #5D6570;
    --texte: #ECEEF1; --texte-doux: #A7AEB7;
    --voile: rgba(0,0,0,.62);
    --ombre-1: 0 1px 0 rgba(255,255,255,.03), 0 1px 3px rgba(0,0,0,.5);
    --ombre-2: 0 18px 48px rgba(0,0,0,.6);
    --accent-text: var(--accent-text-dark);
    --st-nouvelle-fond: #1D2B47; --st-nouvelle-encre: #A9C3F7; --st-nouvelle-trait: #5B8DEF;
    --st-prepa-fond:    #3A2814; --st-prepa-encre:    #F6BE84; --st-prepa-trait:    #E8913F;
    --st-prete-fond:    #2E2240; --st-prete-encre:    #D2B6F2; --st-prete-trait:    #A47DDB;
    --st-livree-fond:   #16301F; --st-livree-encre:   #93D6A6; --st-livree-trait:   #46B06A;
    --st-fini-fond:     #2A2E33; --st-fini-encre:     #B4BAC2; --st-fini-trait:     #6E7680;
    --ton-ok-fond: #16301F;      --ton-ok-encre: #93D6A6;
    --ton-attente-fond: #3A2814; --ton-attente-encre: #F6BE84;
    --ton-info-fond: #1D2B47;    --ton-info-encre: #A9C3F7;
    --ton-danger-fond: #41201C;  --ton-danger-encre: #F5A79C;
    --ton-neutre-fond: #2A2E33;  --ton-neutre-encre: #B4BAC2;
    --danger: #E5484D; --danger-ink: #000000;
  }
}
/* ── Sombre forcé par le CRM (mêmes valeurs) ── */
:root[data-theme="dark"]{
  color-scheme: dark;
  --fond: #141619; --carte: #1E2125; --creux: #272B30;
  --ligne: #363B42; --ligne-forte: #5D6570;
  --texte: #ECEEF1; --texte-doux: #A7AEB7;
  --voile: rgba(0,0,0,.62);
  --ombre-1: 0 1px 0 rgba(255,255,255,.03), 0 1px 3px rgba(0,0,0,.5);
  --ombre-2: 0 18px 48px rgba(0,0,0,.6);
  --accent-text: var(--accent-text-dark);
  --st-nouvelle-fond: #1D2B47; --st-nouvelle-encre: #A9C3F7; --st-nouvelle-trait: #5B8DEF;
  --st-prepa-fond:    #3A2814; --st-prepa-encre:    #F6BE84; --st-prepa-trait:    #E8913F;
  --st-prete-fond:    #2E2240; --st-prete-encre:    #D2B6F2; --st-prete-trait:    #A47DDB;
  --st-livree-fond:   #16301F; --st-livree-encre:   #93D6A6; --st-livree-trait:   #46B06A;
  --st-fini-fond:     #2A2E33; --st-fini-encre:     #B4BAC2; --st-fini-trait:     #6E7680;
  --ton-ok-fond: #16301F;      --ton-ok-encre: #93D6A6;
  --ton-attente-fond: #3A2814; --ton-attente-encre: #F6BE84;
  --ton-info-fond: #1D2B47;    --ton-info-encre: #A9C3F7;
  --ton-danger-fond: #41201C;  --ton-danger-encre: #F5A79C;
  --ton-neutre-fond: #2A2E33;  --ton-neutre-encre: #B4BAC2;
  --danger: #E5484D; --danger-ink: #000000;
}

/* Mouvement réduit : les fondus restent (un écran figé paraît en panne),
   les déplacements et rebonds disparaissent — voir composants.css. */
:root{ --deplacement: 1; }
@media (prefers-reduced-motion: reduce){ :root{ --deplacement: 0; } }
