﻿/**
 * Design tokens — SOURCE DE VÉRITÉ visuelle de toute l'application.
 *
 * Règle d'or : aucun composant ne code "en dur" une couleur, un arrondi, une
 * taille de police ou une ombre. Tout passe par une variable définie ICI.
 * Pour changer l'identité visuelle de l'app, on ne touche qu'à ce fichier.
 *
 * Deux niveaux :
 *  1. PRIMITIVES : la palette brute (--teal-500, --gray-200…). Ne pas utiliser
 *     directement dans les composants.
 *  2. SÉMANTIQUES : le rôle (--color-primary, --color-surface…). C'est CE QUE
 *     les composants utilisent. Le mode sombre ne redéfinit que ces rôles.
 */

:root {
  --size-workshop-control: 2.25rem;
  /* Bouton carré qui ne montre qu'une icône (BaseButton `icone`). */
  --size-icon-button: 2.25rem;
  --size-icon-button-glyph: 1.15rem;
  /* Largeur des modales (BaseOverlay) : standard, et « large » pour les
     formulaires à deux colonnes. */
  --size-modal: 34rem;
  --size-modal-large: 44rem;
  /* Intertitres de menu en capitales (« Votre espace », « Scolarité »). */
  --tracking-intertitre: 0.14em;
  /* Colonne du menu secondaire (sous-rubriques, ex. Annuaire). */
  --size-menu-secondaire: 14rem;
  /* Illustration d'un état vide (liste encore sans élément). */
  --size-illustration-vide: 4.5rem;
  /* Colonne des libellés d'une fiche en lignes (LignePropriete). */
  --size-libelle-propriete: 13rem;
  /* Barre de défilement fine, logée dans la marge des panneaux. */
  --size-scrollbar: 6px;
  --size-workshop-rail: 4.5rem;
  --size-workshop-rail-icon: 1.35rem;
  --size-workshop-print-menu: 17rem;
  --size-context-menu: 13.5rem;
  --size-workshop-narrow-panel: 14rem;
  --size-workshop-collection: 17rem;
  --size-workshop-properties: 19rem;
  --size-workshop-focus: 22rem;
  --size-workshop-identity: 3rem;
  --size-workshop-mobile-preview: 42dvh;
  --size-card-drag-border: 2px;
  --photo-mobile-width: 36rem;
  --photo-touch-size: 44px;
  --photo-mini-size: 3rem;
  --color-photo-success: #287255;
  --photo-qr-size: 12rem;
  --photo-tile-size: 10rem;
  --photo-folder-size: 14rem;
  --color-home-chrome: #f5f5f4;
  --color-launch-cards: #ff795e;
  --color-launch-cards-soft: #ffb3a1;
  --color-launch-game: #b7a7f8;
  --color-launch-ink: #26232b;
  --color-launch-white: #ffffff;
  /* ============================================================
     1. PRIMITIVES — palette brute
     ============================================================ */

  /* Marque (teal — calme, sérieux, adapté à un outil de soin/éducation) */
  --teal-50: #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-400: #2dd4bf;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;

  /* Neutres */
  --gray-0: #ffffff;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --gray-950: #020617;

  /* Marque (indigo/violet — moderne, proche du store de référence) */
  --indigo-50: #eef0ff;
  --indigo-100: #e0e3ff;
  --indigo-200: #c7ccff;
  --indigo-400: #8b7cf6;
  --indigo-500: #6c5ce7;
  --indigo-600: #5b4ee0;
  --indigo-700: #4b3fc9;
  --indigo-800: #3f34a8;

  /* Marque (bleu — épuré, style App Store) */
  --blue-50: #eff4ff;
  --blue-600: #2f6bff;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;

  /* Accents pour les dégradés (illustrations, bannières) */
  --violet-500: #a855f7;
  --pink-400: #f472b6;
  --pink-500: #ec4899;
  --orange-400: #fb923c;
  --cyan-400: #22d3ee;

  /* Fonds clairs (le conteneur d'app reste blanc) */
  --lavender-100: #eceefb;
  --lavender-200: #e4e7f6;

  /* Sémantiques d'état (mêmes en clair/sombre, ajustées si besoin) */
  --red-500: #ef4444;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --amber-500: #f59e0b;
  --amber-700: #b45309;
  --green-500: #22c55e;
  --green-700: #15803d;
  --blue-500: #3b82f6;

  /* ============================================================
     2. TYPOGRAPHIE
     ============================================================ */

  /* Stack système : rapide, net, et 100% hors-ligne (aucun CDN de police).
     On pourra embarquer une police custom plus tard en la remplaçant ici. */
  --font-sans:
    system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Segoe UI Mono", Menlo, monospace;
  --font-editorial:
    "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --font-card-pdf: Arial, Helvetica, sans-serif;
  --text-display: clamp(2.25rem, 3.6vw, 3.5rem);
  --color-ink: #53334d;
  --color-paper: #fff8ef;
  --color-accent: #c34d43;
  --color-sidebar: #fff1e9;
  --color-media: #ffebd8;
  --color-media-ortho: #f0e7ff;
  --color-confetti: #ffd879;
  --color-confetti-alt: #dac5f5;
  --color-hero: #ffe3d5;
  --color-hero-ink: #633a42;
  --color-art-paper: #fffdf8;
  --color-art-coral: #bc4641;
  --color-art-lilac: #7353a1;
  --color-on-ink: #f9f6ed;

  /* Échelle de tailles (base 16px) */
  --text-xs: 0.75rem; /* 12 */
  --text-sm: 0.875rem; /* 14 */
  --text-base: 1rem; /* 16 */
  --text-lg: 1.125rem; /* 18 */
  --text-xl: 1.375rem; /* 22 */
  --text-2xl: 1.75rem; /* 28 */
  --text-3xl: 2.25rem; /* 36 */

  /* Graisses */
  --weight-normal: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;

  /* Interlignes */
  --leading-tight: 1.2;
  --leading-normal: 1.5;
  --leading-relaxed: 1.7;

  /* ============================================================
     3. ESPACEMENT — échelle base 4px
     ============================================================ */
  --space-1: 0.25rem; /* 4 */
  --space-2: 0.5rem; /* 8 */
  --space-3: 0.75rem; /* 12 */
  --space-4: 1rem; /* 16 */
  --space-5: 1.5rem; /* 24 */
  --space-6: 2rem; /* 32 */
  --space-8: 3rem; /* 48 */
  --space-10: 4rem; /* 64 */

  /* ============================================================
     4. ARRONDIS
     ============================================================ */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* ============================================================
     5. CONTOURS ET OMBRES — néobrutalisme « doux »
     Contours d'encre francs mais en prune (pas de noir pur), ombres
     décalées SANS flou mais courtes, coins arrondis conservés.
     ============================================================ */
  --border-width-strong: 2px;
  --border-strong: var(--border-width-strong) solid var(--color-outline);
  --shadow-sm: 2px 2px 0 var(--color-shadow);
  --shadow-md: 3px 3px 0 var(--color-shadow);
  --shadow-lg: 5px 5px 0 var(--color-shadow);
  /* Survol : l'élément « se soulève » d'autant que son ombre grandit. */
  --lift-hover: translate(-1px, -1px);
  /* Appui : l'élément s'enfonce et rejoint son ombre. */
  --press-active: translate(2px, 2px);
  --shadow-focus: 0 0 0 3px var(--color-primary-subtle);
  /* Feuilles imprimables (aperçu) : ombre de papier réaliste, pas d'encre. */
  --shadow-paper: 0 10px 28px rgba(15, 23, 42, 0.14);

  /* ============================================================
     6. TRANSITIONS
     ============================================================ */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
  --transition-camera: 460ms cubic-bezier(0.22, 1, 0.36, 1);
  /* Glissement d’un curseur ou d’un panneau (onglets, pastilles). */
  --transition-glisse: 320ms cubic-bezier(0.22, 1, 0.36, 1);
  --animation-tutoriel: 7s;
  /* Célébration courte (niveau débloqué). */
  --animation-deblocage: 600ms;

  /* ============================================================
     6b. DÉGRADÉS (bannières, promos, placeholders d'illustrations)
     ============================================================ */
  --gradient-hero: linear-gradient(
    120deg,
    var(--indigo-500) 0%,
    var(--violet-500) 45%,
    var(--pink-500) 78%,
    var(--cyan-400) 120%
  );
  --gradient-promo: linear-gradient(150deg, var(--pink-400), var(--violet-500));
  --gradient-placeholder: linear-gradient(
    135deg,
    var(--indigo-400),
    var(--pink-400)
  );
  --gradient-placeholder-2: linear-gradient(
    135deg,
    var(--cyan-400),
    var(--indigo-500)
  );

  /* Placeholders "média" (vignettes d'apps, bannière — remplacent les images) */
  --gradient-media-1: linear-gradient(
    135deg,
    var(--orange-400),
    var(--gray-900)
  );
  --gradient-media-2: linear-gradient(135deg, var(--cyan-400), var(--blue-800));
  --gradient-media-3: linear-gradient(
    135deg,
    var(--violet-500),
    var(--pink-500)
  );

  /* ============================================================
     7. SÉMANTIQUES — thème CLAIR (ce que les composants utilisent)
     ============================================================ */
  --color-bg: #f4e7e0;
  --color-surface: var(--gray-0);
  --color-surface-alt: #fff8f2;
  --color-border: #ebdcd9;
  /* Encre des contours et des ombres néobrutalistes. */
  --color-outline: #4a3546;
  --color-shadow: #4a3546;
  --color-text: #493446;
  --color-text-muted: #7b6674;
  /*
   * Texte secondaire posé sur un fond TEINTÉ (--color-primary-subtle, pastels
   * d’ambiance) : --color-text-muted n’y tient pas le contraste AA (4.48:1 sur
   * le corail, 4.39:1 sur le lilas — mesuré, cf. tokens.spec.ts). Celui-ci
   * passe sur les quatre ambiances ET sur --color-surface, donc une ligne de
   * liste garde la même couleur qu’elle soit survolée ou non.
   */
  --color-text-muted-on-tint: #6f5b68;
  --color-text-on-primary: var(--gray-0);

  --color-primary: #b44348;
  --color-primary-hover: #9d343d;
  --color-primary-active: #842b35;
  --color-primary-subtle: #ffe8e2;

  --color-danger: var(--red-600);
  --color-danger-hover: var(--red-700);
  --color-warning: var(--amber-500);
  /* Texte d’avertissement lisible sur fond clair. */
  --color-warning-text: var(--amber-700);
  --color-success: var(--green-500);
  /* Réussite lisible (texte, contour) et son fond doux : niveau acquis. */
  --color-success-text: var(--green-700);
  --color-success-subtle: #dcf5e4;
  --color-info: var(--blue-500);

  /* Jeux : joueurs (ex. Morpion) — A = croix bleue, B = rond orange.
     Dégradés (from/to) pour les pions X/O. */
  --color-joueur-a: var(--blue-600);
  --color-joueur-a-from: var(--blue-500);
  --color-joueur-a-to: var(--blue-700);
  --color-joueur-b: var(--orange-400);
  --color-joueur-b-from: var(--amber-500);
  --color-joueur-b-to: var(--orange-400);

  --color-focus-ring: var(--color-primary);
  /* Pastels fixes (indépendants de l'ambiance) : tuiles d'accent, avatars. */
  --color-pastel-corail: #ffe3d5;
  --color-pastel-lilas: #eadcfb;
  --color-pastel-menthe: #d7f0e6;
  --color-pastel-soleil: #ffedb7;
  /* Couleur signature de chaque ambiance (pastilles de l'admin). */
  --color-ambiance-corail: #b44348;
  --color-ambiance-lilas: #7750a5;
  --color-ambiance-menthe: #27766a;
  --color-ambiance-soleil: #a45320;
  /* Texte sur un pastel : reste foncé, même en mode sombre. */
  --color-text-on-pastel: #3d2a3a;
  --color-card-pattern-dark: rgba(15, 23, 42, 0.18);
  --color-card-pattern-light: rgba(255, 255, 255, 0.22);
  --color-card-text-dark: #000000;
  --color-card-text-light: #ffffff;
  --color-card-sheet-ink: #53334d;
  --opacity-card-back-editing: 0.88;
  --opacity-card-dragging: 0.55;
  --size-card-editor-panel: 16rem;
  --size-card-editor-field: 7rem;
  --size-card-creator-panel: clamp(24rem, 30vw, 28rem);
  --size-card-creator-rail: 5.5rem;
  --size-card-creator-context: 21rem;
  --size-card-sheet-width: 38rem;
  --size-card-topbar: 4.5rem;
  --size-card-list: 24rem;
  --size-card-compact-panel: 36dvh;
  --size-card-image-preview: 12rem;
}

/* ============================================================
   Thème SOMBRE — on ne redéfinit QUE les rôles sémantiques
   ============================================================ */
@media (prefers-color-scheme: dark) {
  :root {
    --color-home-chrome: #211e25;
    --color-bg: #211c25;
    --color-surface: #2b2530;
    --color-surface-alt: #352c39;
    --color-border: #554454;
    --color-outline: #9c8597;
    --color-pastel-corail: #5a3a3c;
    --color-pastel-lilas: #48395a;
    --color-pastel-menthe: #2f4a42;
    --color-pastel-soleil: #574530;
    --color-text-on-pastel: #fcf0ec;
    --color-shadow: #0d090f;
    --color-text: #fcf0ec;
    --color-text-muted: #cdb7c6;
    /* En sombre, le texte secondaire tient déjà sur les fonds teintés. */
    --color-text-muted-on-tint: #cdb7c6;
    --color-text-on-primary: #30202a;
    --color-sidebar: #302630;
    --color-media: #4a3539;
    --color-media-ortho: #44364e;
    --color-accent: #ffb5a4;

    --color-primary: #ffb3a8;
    --color-primary-hover: #ffcbc3;
    --color-primary-active: #ffe0da;
    --color-primary-subtle: #513540;
    --color-warning-text: var(--amber-500);
    --color-success-text: var(--green-500);
    --color-success-subtle: #233a2c;
  }
}

/* Ambiances du cabinet, également utilisées dans les aperçus isolés. */
[data-ambiance="corail"],
.ambiance--corail {
  --color-primary: #b44348;
  --color-primary-hover: #9d343d;
  --color-primary-active: #842b35;
  --color-primary-subtle: #ffe8e2;
  --color-sidebar: #fff1e9;
  --color-media-ortho: #f0e7ff;
  --color-hero: #ffe3d5;
  --color-hero-ink: #633a42;
  --color-confetti: #ffd879;
  --color-confetti-alt: #dac5f5;
}
[data-ambiance="lilas"],
.ambiance--lilas {
  --color-launch-cards: #ad93ee;
  --color-launch-cards-soft: #dfd2ff;
  --color-launch-game: #a9cf95;
  --color-primary: #7750a5;
  --color-primary-hover: #64418e;
  --color-primary-active: #553475;
  --color-primary-subtle: #f0e7fc;
  --color-sidebar: #f4edfc;
  --color-media-ortho: #eee1fb;
  --color-hero: #eadcfb;
  --color-hero-ink: #513467;
  --color-confetti: #ffc7a3;
  --color-confetti-alt: #c8dfbb;
}
[data-ambiance="soleil"],
.ambiance--soleil {
  --color-launch-cards: #f7bc46;
  --color-launch-cards-soft: #ffdfa2;
  --color-launch-game: #f18c78;
  --color-primary: #a45320;
  --color-primary-hover: #8c4218;
  --color-primary-active: #753512;
  --color-primary-subtle: #fff0cf;
  --color-sidebar: #fff5dc;
  --color-media-ortho: #fff0cc;
  --color-hero: #ffedb7;
  --color-hero-ink: #6a431e;
  --color-confetti: #f6b6a9;
  --color-confetti-alt: #d8c4f1;
}
[data-ambiance="menthe"],
.ambiance--menthe {
  --color-launch-cards: #77cbb2;
  --color-launch-cards-soft: #c3eee0;
  --color-launch-game: #aec2fa;
  --color-primary: #27766a;
  --color-primary-hover: #1e6359;
  --color-primary-active: #174f47;
  --color-primary-subtle: #e0f4eb;
  --color-sidebar: #ecf7ef;
  --color-media-ortho: #ddf2e7;
  --color-hero: #d7f0e6;
  --color-hero-ink: #27594f;
  --color-confetti: #ffe099;
  --color-confetti-alt: #ffc8b9;
}
@media (prefers-color-scheme: dark) {
  [data-ambiance="corail"],
  .ambiance--corail {
    --color-primary: #ffb3a8;
    --color-primary-hover: #ffcbc3;
    --color-primary-active: #ffe0da;
    --color-primary-subtle: #513540;
    --color-sidebar: #302630;
    --color-media-ortho: #44364e;
  }
  [data-ambiance="lilas"],
  .ambiance--lilas {
    --color-primary: #d4b5fa;
    --color-primary-hover: #e2cafa;
    --color-primary-active: #eddefc;
    --color-primary-subtle: #473655;
    --color-sidebar: #302735;
    --color-media-ortho: #44364e;
  }
  [data-ambiance="soleil"],
  .ambiance--soleil {
    --color-primary: #ffd294;
    --color-primary-hover: #ffdfb0;
    --color-primary-active: #ffe9cc;
    --color-primary-subtle: #503d2c;
    --color-sidebar: #322a28;
    --color-media-ortho: #4c3c2f;
  }
  [data-ambiance="menthe"],
  .ambiance--menthe {
    --color-primary: #a6e2cc;
    --color-primary-hover: #bfecdc;
    --color-primary-active: #d8f3e8;
    --color-primary-subtle: #2d4941;
    --color-sidebar: #25312d;
    --color-media-ortho: #31463e;
  }
}
/* File explorer palette and dimensions. */
:root {
  --photo-drive-bg: #f8fafd;
  --photo-drive-surface: #fff;
  --photo-drive-search: #e9eef6;
  --photo-drive-selected: #c2e7ff;
  --photo-drive-text: #1f1f1f;
  --photo-drive-muted: #444746;
  --photo-drive-border: #dadce0;
  --photo-drive-blue: #0b57d0;
  --photo-drive-row: 3rem;
  --photo-drive-date-width: 9rem;
  --photo-drive-type-width: 6rem;
  --photo-drive-menu-width: 15rem;
}
:root {
  --photo-file-icon: #ff7769;
}
:root {
  --drive-nav-width: 11rem;
}
:root {
  --photo-patient-list-height: 20rem;
}
