/* ==========================================================================
   SIPI Design-Tokens
   Drei Ebenen (übertragbar nach React/CSS-in-JS oder Style Dictionary):
   1. Grundwerte (Schrift, Abstand, Radius, Schatten, Dauer)
   2. Semantische Farben, je Rolle ein Token, Hell/Dunkel per light-dark()
   3. Komponenten-Tokens (nur wo eine Komponente eigene Maße braucht)
   Namensschema: --<kategorie>-<eigenschaft>-<rolle>[-<zustand>]
   ========================================================================== */

@font-face {
  font-family: "Inter";
  src: url("../assets/inter-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light dark;

  /* ---------- 1. Grundwerte ---------- */
  --font-sans: "Inter", ui-sans-serif, system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;

  --font-size-xs: 0.75rem;    /* 12 */
  --font-size-sm: 0.8125rem;  /* 13 */
  --font-size-md: 0.875rem;   /* 14  Tabellen, dichte Listen */
  --font-size-base: 0.9375rem;/* 15  Fließtext, Formulare */
  --font-size-lg: 1.0625rem;  /* 17 */
  --font-size-xl: 1.25rem;    /* 20 */
  --font-size-2xl: 1.5rem;    /* 24  Seitentitel */
  --font-size-3xl: 1.875rem;  /* 30  Kennzahl */

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

  --line-height-tight: 1.25;
  --line-height-base: 1.5;

  --space-0: 0;
  --space-1: 0.25rem;  /* 4 */
  --space-2: 0.5rem;   /* 8 */
  --space-3: 0.75rem;  /* 12 */
  --space-4: 1rem;     /* 16 */
  --space-5: 1.25rem;  /* 20 */
  --space-6: 1.5rem;   /* 24 */
  --space-8: 2rem;     /* 32 */
  --space-10: 2.5rem;  /* 40 */
  --space-12: 3rem;    /* 48 */

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 999px;

  --size-control: 2.5rem;       /* 40 px Mindesthöhe Bedienelement */
  --size-control-sm: 2rem;      /* 32 px, nur in dichten Tabellen am Desktop */
  --size-touch: 2.75rem;        /* 44 px Touch-Ziel auf Smartphone */
  --size-sidebar: 16rem;
  --size-topbar: 3.5rem;
  --size-content-max: 76rem;
  --size-form-max: 46rem;

  --duration-fast: 120ms;
  --duration-base: 200ms;
  --easing-standard: cubic-bezier(.2, 0, 0, 1);

  /* ---------- 2. Semantische Farben ---------- */
  /* Flächen */
  --color-bg-canvas:   light-dark(#f4f5f7, #0c0f14);
  --color-bg-surface:  light-dark(#ffffff, #141820);
  --color-bg-raised:   light-dark(#ffffff, #1a1f29);
  --color-bg-subtle:   light-dark(#f0f2f5, #1a1f28);
  --color-bg-hover:    light-dark(#e9ecf1, #222935);
  --color-bg-pressed:  light-dark(#dfe3ea, #2a3240);
  --color-bg-selected: light-dark(#e9effd, #1b2847);
  --color-bg-sidebar:  light-dark(#f9fafb, #10141a);
  --color-bg-inverse:  light-dark(#1b1f27, #e8ebf0);
  --color-bg-overlay:  light-dark(rgb(15 20 30 / .36), rgb(0 0 0 / .6));

  /* Linien */
  --color-border:        light-dark(#e1e4ea, #262d38);
  --color-border-strong: light-dark(#cbd1da, #343d4b);
  --color-border-input:  light-dark(#838c9b, #6b7586);  /* ≥ 3:1 zur Fläche (WCAG 1.4.11) */

  /* Text */
  --color-text:         light-dark(#14171c, #e8ebf0);
  --color-text-muted:   light-dark(#4f5866, #a9b1bd);
  --color-text-subtle:  light-dark(#616b7a, #919aa8);
  --color-text-inverse: light-dark(#ffffff, #0c0f14);
  --color-text-link:    light-dark(#2549c7, #8eaaff);

  /* Akzent (Marke, Primäraktion) */
  --color-accent:           light-dark(#2d50d2, #8eaaff);
  --color-bg-accent:        light-dark(#2d50d2, #3d5fe0);
  --color-bg-accent-hover:  light-dark(#2442b4, #3252d0);
  --color-bg-accent-subtle: light-dark(#eaf0fe, #1b2645);
  --color-text-on-accent:   #ffffff;
  --color-focus:            light-dark(#2d50d2, #a9bfff);

  /* Status: je Rolle Text, Fläche, Rand. Nie nur Farbe: Komponenten tragen immer Symbol + Wort */
  --color-text-info:      light-dark(#1c4fb0, #9cc0ff);
  --color-bg-info:        light-dark(#e7f0fe, #15284a);
  --color-border-info:    light-dark(#b6cdf7, #27457a);

  --color-text-waiting:   light-dark(#5a31b0, #c7b3ff);
  --color-bg-waiting:     light-dark(#f1ecfd, #261d45);
  --color-border-waiting: light-dark(#d3c4f5, #43347a);

  --color-text-warning:   light-dark(#844c00, #ffc56b);
  --color-bg-warning:     light-dark(#fdf2db, #3a2a0e);
  --color-border-warning: light-dark(#f0cf8a, #6b4d17);

  --color-text-success:   light-dark(#146236, #7fdca3);
  --color-bg-success:     light-dark(#e4f5eb, #102e1f);
  --color-border-success: light-dark(#a9dcbc, #1f5537);

  --color-text-danger:    light-dark(#b0261b, #ff9d94);
  --color-bg-danger:      light-dark(#fdebea, #3a1715);
  --color-border-danger:  light-dark(#f2b8b3, #6e2722);
  --color-bg-danger-bold: light-dark(#c42b1f, #bd352b);

  --color-text-neutral:   light-dark(#4a5260, #b3bbc7);
  --color-bg-neutral:     light-dark(#eef0f3, #20262f);
  --color-border-neutral: light-dark(#d3d8df, #363e4b);

  /* Datenvisualisierung: Umsetzungsstände (geordnet von früh nach spät) */
  --color-data-1: light-dark(#b9c6e4, #3b4a6b);  /* geplant */
  --color-data-2: light-dark(#7c96d8, #5a76c4);  /* beantragt */
  --color-data-3: light-dark(#3f63cf, #8aa6f5);  /* bestellt */
  --color-data-4: light-dark(#1d3a8f, #c9d7ff);  /* abgeschlossen */
  --color-data-over: light-dark(#c42b1f, #ff8a80);

  /* Schatten */
  --shadow-sm: light-dark(0 1px 2px rgb(16 24 40 / .06), 0 1px 2px rgb(0 0 0 / .4));
  --shadow-md: light-dark(0 4px 12px -2px rgb(16 24 40 / .10), 0 4px 14px -2px rgb(0 0 0 / .55));
  --shadow-lg: light-dark(0 16px 40px -8px rgb(16 24 40 / .22), 0 18px 48px -8px rgb(0 0 0 / .7));

  /* ---------- 3. Komponenten-Tokens ---------- */
  --table-row-height: 2.75rem;
  --tag-height: 1.5rem;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"]  { color-scheme: dark; }
