/* Design-Tokens: Ruhige Schweizer Typografie, hohe Kontraste (WCAG AA/AAA), Light & Dark Mode */
:root {
  color-scheme: light;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "SFMono-Regular", Menlo, Consolas, monospace;
  --font-math: "Cambria Math", "STIX Two Math", "Latin Modern Math", "Times New Roman", serif;

  /* Helles Thema (Standard) */
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-alt: #eef1f6;
  --surface-elevated: #ffffff;
  --border: #d5dce6;
  --border-strong: #9aa7b8;
  --control-border: #768394;

  --text: #111827;
  --text-muted: #4b5563;
  --text-subtle: #4b5563;

  --primary: #1d4ed8;
  --primary-hover: #1e40af;
  --primary-soft: #e0ecff;
  --primary-ink: #ffffff;

  --success: #15803d;
  --success-soft: #dcfce7;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --danger: #b91c1c;
  --danger-soft: #fee2e2;

  /* 4 Fächer-Akzente (kontrastreich im hellen Modus) */
  --subj-aundd: #1d4ed8;
  --subj-aundd-soft: #dbeafe;
  --subj-discmath: #7c3aed;
  --subj-discmath-soft: #ede9fe;
  --subj-linalg: #0f766e;
  --subj-linalg-soft: #ccfbf1;
  --subj-eprog: #c2410c;
  --subj-eprog-soft: #ffedd5;

  /* Code-Highlighting (Light) */
  --code-bg: #f1f5f9;
  --code-border: #cbd5e1;
  --code-ln: #475569;
  --tok-kw: #1d4ed8;
  --tok-type: #0f766e;
  --tok-string: #15803d;
  --tok-num: #b45309;
  --tok-comment: #475569;
  --tok-anno: #7c3aed;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 6px 18px rgba(15, 23, 42, 0.08);
  --focus-ring: 0 0 0 3px rgba(29, 78, 216, 0.35);

  --sidebar-w: 248px;
  --bottom-nav-h: 64px;
  --header-h: 56px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b1120;
    --surface: #131c31;
    --surface-alt: #1b2640;
    --surface-elevated: #1e2b47;
    --border: #2a3959;
    --border-strong: #475b82;
    --control-border: #6278a0;

    --text: #f1f5f9;
    --text-muted: #cbd5e1;
    --text-subtle: #94a3b8;

    --primary: #60a5fa;
    --primary-hover: #93c5fd;
    --primary-soft: #172a4f;
    --primary-ink: #081226;

    --success: #4ade80;
    --success-soft: #103322;
    --warning: #fbbf24;
    --warning-soft: #3a2609;
    --danger: #f87171;
    --danger-soft: #3f1419;

    --subj-aundd: #60a5fa;
    --subj-aundd-soft: #172a4f;
    --subj-discmath: #c084fc;
    --subj-discmath-soft: #2e1a4a;
    --subj-linalg: #2dd4bf;
    --subj-linalg-soft: #103736;
    --subj-eprog: #fb923c;
    --subj-eprog-soft: #43220d;

    --code-bg: #0f172a;
    --code-border: #2a3959;
    --code-ln: #94a3b8;
    --tok-kw: #93c5fd;
    --tok-type: #5eead4;
    --tok-string: #86efac;
    --tok-num: #fcd34d;
    --tok-comment: #94a3b8;
    --tok-anno: #d8b4fe;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
    --focus-ring: 0 0 0 3px rgba(96, 165, 250, 0.45);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --surface: #131c31;
  --surface-alt: #1b2640;
  --surface-elevated: #1e2b47;
  --border: #2a3959;
  --border-strong: #475b82;
  --control-border: #6278a0;

  --text: #f1f5f9;
  --text-muted: #cbd5e1;
  --text-subtle: #94a3b8;

  --primary: #60a5fa;
  --primary-hover: #93c5fd;
  --primary-soft: #172a4f;
  --primary-ink: #081226;

  --success: #4ade80;
  --success-soft: #103322;
  --warning: #fbbf24;
  --warning-soft: #3a2609;
  --danger: #f87171;
  --danger-soft: #3f1419;

  --subj-aundd: #60a5fa;
  --subj-aundd-soft: #172a4f;
  --subj-discmath: #c084fc;
  --subj-discmath-soft: #2e1a4a;
  --subj-linalg: #2dd4bf;
  --subj-linalg-soft: #103736;
  --subj-eprog: #fb923c;
  --subj-eprog-soft: #43220d;

  --code-bg: #0f172a;
  --code-border: #2a3959;
  --code-ln: #94a3b8;
  --tok-kw: #93c5fd;
  --tok-type: #5eead4;
  --tok-string: #86efac;
  --tok-num: #fcd34d;
  --tok-comment: #94a3b8;
  --tok-anno: #d8b4fe;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);
  --focus-ring: 0 0 0 3px rgba(96, 165, 250, 0.45);
}
