/* tokens.css — unica fonte dei token visivi, caricata dal pannello e dalle pagine di auth.
   I tre colori brand arrivano dalle impostazioni (App.Color*): Template e le viste di auth
   li riscrivono in un <style> inline dopo questo file. Valori consolidati in
   docs/design-system/foundations.md. */
:root {
  color-scheme: light;
  --accent:          #603fff;
  --accent-dark:     #4a2cdb;
  --accent-light:    #f0edff;
  /* Gradiente (scuro → primario) e testo accentato derivano solo dai colori delle impostazioni */
  --accent-gradient: linear-gradient(135deg, var(--accent-dark), var(--accent));
  --accent-text:     var(--accent-dark);

  /* Pagina e superfici distinte, nei due temi consolidati. */
  --color-bg:      #f2f3f9;
  --color-surface: #ffffff;
  --color-border:  #cfd3e2;
  --color-tint:    #eef0f7;
  --color-control-border: #818aa5;
  --color-backdrop: rgba(17,19,46,.25);

  /* testo: contrasto >= 4.5:1 su bianco e su --color-tint */
  --color-text-1: #11132e;
  --color-text-2: #11132e;
  --color-text-3: #555b79;
  --color-text-4: #555b79;

  --color-success: #08764d;  --color-success-bg: #e3f8ef;
  --color-danger:  #b22c44;  --color-danger-bg:  #fdeef1;
  --color-warning: #99610d;  --color-warning-bg: #fff3dc;
  --color-info:    #27bcfd;  --color-info-bg:    #d0f2ff;
  /* Errore dei campi (ui.md «Accordi», da Konnecta): distinto dal rosso delle azioni distruttive */
  --color-error:   #9a3412;

  /* Colori dei progetti (D-066): projects.color = numero della tinta, 1-10, scelto per progetto.
     Testo bianco sul pieno >= 4.5:1; testo sulla tinta al 15% >= 4.5:1 (tests/js/theme_contrast.mjs).
     --proj-none e' l'impegno (blocco senza task): solo tinta, mai pieno. */
  --proj-1: #4f46e5;  --proj-2: #0f766e;  --proj-3: #c2410c;  --proj-4: #be123c;
  --proj-5: #0369a1;  --proj-6: #7e22ce;  --proj-7: #4d7c0f;  --proj-8: #854d0e;
  --proj-9: #a21caf;  --proj-10: #6b6b0f;
  --proj-none: #8a8fa8;

  /* Scala tipografica (spec redesign §2): 16 px per testo e input */
  --fs-h1: 36px;  --fs-h1-mobile: 30px;
  --fs-h2: 23px;  --fs-h2-mobile: 20px;
  --fs-body: 16px;
  --fs-small: 14px;
  --fs-meta: 14px;

  /* Motion (docs/design-system/ux.md): feedback e controlli 150 ms, pannelli 200 ms */
  --motion-fast: 150ms;
  --motion-panel: 200ms;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-pill: 160px;
  --radius-card: 16px;

  --shadow-sm:   0 2px 4px rgba(0,0,0,.04);
  --shadow-card: 0 4px 14px rgba(17,19,46,.06);

  --font-body: 'Inter', system-ui, sans-serif;
  --font-head: 'Space Grotesk', 'Inter', system-ui, sans-serif;

  /* Bootstrap segue i token senza riscrivere componenti */
  --bs-body-font-family: var(--font-body);
  --bs-body-color:       var(--color-text-2);
  --bs-body-bg:          var(--color-bg);
  --bs-border-radius:    var(--radius-md);
  --bs-border-radius-sm: var(--radius-sm);
  --bs-border-radius-lg: var(--radius-lg);
  --bs-primary:          var(--accent);
  /* Utility Bootstrap .text-danger/.bg-danger/.text-success/.bg-success sulla palette (terna RGB fissa).
     Il giallo resta Bootstrap: .bg-warning si usa con testo scuro. */
  --bs-danger: #b22c44;  --bs-danger-rgb: 178, 44, 68;
  --bs-success: #08764d; --bs-success-rgb: 8, 118, 77;
  --bs-link-color:       var(--accent-text);
  --bs-border-color:     var(--color-border);
}

:root[data-bs-theme="dark"] {
  color-scheme: dark;
  --color-bg: #101225;
  --color-surface: #191d35;
  --color-tint: #24203d;
  --color-border: #414a69;
  --color-text-1: #f3f2ff;
  --color-text-2: #d6d8e8;
  --color-text-3: #b5bbd3;
  --color-text-4: #b5bbd3;
  --accent-text: #c0afff;
  --accent-light: #2b2547;
  --color-success: #71ddb1;
  --color-success-bg: #163a33;
  --color-danger: #ff9daf;
  --color-danger-bg: #432637;
  --color-warning: #f3cb7a;
  --color-warning-bg: #3d321f;
  --color-info: #8bd7ff;
  --color-info-bg: #19364a;
  --color-error: #fdba74;
  /* Progetti: piu' chiari, il bordo resta >= 3:1 sulla superficie scura e il bianco sul pieno >= 4.5:1 */
  --proj-1: #6962e9;  --proj-2: #25827b;  --proj-3: #c64e1d;  --proj-4: #cb4163;
  --proj-5: #247cad;  --proj-6: #9950d8;  --proj-7: #548119;  --proj-8: #9a6b37;
  --proj-9: #b043bd;  --proj-10: #7a7a20;
  --shadow-card: 0 4px 16px rgba(0,0,0,.18);
  --color-control-border: #697594;
  --color-backdrop: rgba(5,7,20,.65);
  --bs-body-color: var(--color-text-2);
  --bs-body-bg: var(--color-bg);
  --bs-emphasis-color: var(--color-text-1);
  --bs-secondary-color: var(--color-text-3);
  --bs-border-color: var(--color-border);
  --bs-link-color: var(--accent-text);
  --bs-link-color-rgb: 192,175,255;
  --bs-link-hover-color: #d5c9ff;
  --bs-form-valid-color: var(--color-success);
  --bs-form-invalid-color: var(--color-danger);
}

h1, h2, h3, h4, h5, h6 { font-family: var(--font-head); color: var(--color-text-1); }
h1 { font-weight: 600; }
h2, h3, h4, h5, h6 { font-weight: 500; }

/* Le dichiarazioni storiche più specifiche restano nei fogli dei componenti,
   caricati dopo questo file: Space Grotesk evidenzia titoli, riepiloghi e iniziali;
   Inter conserva la lettura operativa, senza duplicare i token nei moduli. */
html body,
html body button,
html body input,
html body select,
html body textarea { font-family: var(--font-body); }
html body h1,
html body h2,
html body h3,
html body h4,
html body h5,
html body h6,
html body .g-page-title,
html body .g-notify-dropdown-header,
html body .avatar-display,
html body .dt-avatar,
html body .dt-card-avatar,
html body .card-header .mb-0,
html body .modal-title,

/* Link: non sottolineati in liste, card e navigazione; sottolineati nei paragrafi (spec redesign §2) */
a { text-decoration: none; }
p a, li p a, .prose a { text-decoration: underline; text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 3px; }
/* prefers-reduced-motion: regola unica in components.css */
