/*
 * Design tokens and base styles. Loaded before every other stylesheet.
 * Every component stylesheet (style.css, netzplan-lab.css, er-lab.css) uses ONLY these
 * variables for colors, fonts, radii and shadows, so light and dark mode stay consistent.
 *
 * Theme: follows the OS setting; the header toggle stores an explicit choice as
 * <html data-theme="light|dark">, which wins over the OS setting.
 */

@font-face {
  font-family: 'Geist';
  src: url('fonts/geist.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Geist Mono';
  src: url('fonts/geist-mono.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Surfaces */
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f1f1ee;
  --surface-3: #e8e8e4;
  --border: #e3e3de;
  --border-strong: #cfcfc8;

  /* Text */
  --text: #1b1b19;
  --text-2: #4d4d48;
  --text-3: #7c7c75;

  /* Brand accent */
  --accent: #3f51d8;
  --accent-hover: #3242c0;
  --accent-soft: #eceefd;
  --accent-text: #3243c4;
  --on-accent: #ffffff;

  /* Semantic / categorical colors: base (lines, fills), -soft (tinted backgrounds),
     -text (readable text on --surface) */
  --green: #1d8a4e;
  --green-soft: #e6f4ec;
  --green-text: #16703f;
  --red: #d23b33;
  --red-soft: #fcebea;
  --red-text: #b3291f;
  --amber: #c27a0e;
  --amber-soft: #fbf1df;
  --amber-text: #955c04;
  --blue: #2f74d0;
  --blue-soft: #e7f0fb;
  --blue-text: #1f5fb4;
  --violet: #7a4fd6;
  --violet-soft: #f1ebfc;
  --violet-text: #6338bd;
  --cyan: #0e8a9c;
  --cyan-soft: #e2f4f6;
  --cyan-text: #0a6f7e;

  /* Type */
  --font-sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Shape */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 15, 0.06);
  --shadow: 0 1px 3px rgba(20, 20, 15, 0.06), 0 4px 16px rgba(20, 20, 15, 0.05);
  --shadow-lg: 0 8px 32px rgba(20, 20, 15, 0.12);
  --focus-ring: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent);

  /* Layout */
  --sidebar-w: 264px;
  --content-max: 1040px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1012;
    --surface: #17181b;
    --surface-2: #1e1f23;
    --surface-3: #26282c;
    --border: #2a2c31;
    --border-strong: #3a3d43;
    --text: #ececea;
    --text-2: #a9a9a4;
    --text-3: #75756f;
    --accent: #7d8cff;
    --accent-hover: #95a1ff;
    --accent-soft: #1f2340;
    --accent-text: #a2acff;
    --on-accent: #0f1012;
    --green: #3fbf78;
    --green-soft: #15291e;
    --green-text: #6fd69d;
    --red: #ef5b52;
    --red-soft: #33191a;
    --red-text: #ff8a82;
    --amber: #e3a23b;
    --amber-soft: #302412;
    --amber-text: #f2bd66;
    --blue: #5b9cf0;
    --blue-soft: #16243a;
    --blue-text: #8bbaf7;
    --violet: #a584f0;
    --violet-soft: #251c3a;
    --violet-text: #c2a8f7;
    --cyan: #3cc2d4;
    --cyan-soft: #112c31;
    --cyan-text: #71d8e5;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1012;
  --surface: #17181b;
  --surface-2: #1e1f23;
  --surface-3: #26282c;
  --border: #2a2c31;
  --border-strong: #3a3d43;
  --text: #ececea;
  --text-2: #a9a9a4;
  --text-3: #75756f;
  --accent: #7d8cff;
  --accent-hover: #95a1ff;
  --accent-soft: #1f2340;
  --accent-text: #a2acff;
  --on-accent: #0f1012;
  --green: #3fbf78;
  --green-soft: #15291e;
  --green-text: #6fd69d;
  --red: #ef5b52;
  --red-soft: #33191a;
  --red-text: #ff8a82;
  --amber: #e3a23b;
  --amber-soft: #302412;
  --amber-text: #f2bd66;
  --blue: #5b9cf0;
  --blue-soft: #16243a;
  --blue-text: #8bbaf7;
  --violet: #a584f0;
  --violet-soft: #251c3a;
  --violet-text: #c2a8f7;
  --cyan: #3cc2d4;
  --cyan-soft: #112c31;
  --cyan-text: #71d8e5;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'ss01', 'cv11';
}

code, pre, kbd, .mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

::selection {
  background: color-mix(in srgb, var(--accent) 25%, transparent);
}
