/*
 * Design-Tokens – EINZIGE Quelle für Farben, Typografie und Abstände.
 * Werte aus den Figma-Entwürfen "4SF-App-Website" (Entwurf dunkel 1318:15486,
 * Entwurf hell 1318:15674). Komponenten verwenden ausschließlich diese Variablen.
 *
 * Theme-Steuerung:
 *   - ohne data-theme am <html>: folgt prefers-color-scheme
 *   - data-theme="light" | "dark": vom Nutzer per Schalter gewählt
 *
 * Bewusste Abweichungen von Figma (WCAG 2.1 AA, siehe README):
 *   --color-label (hell) und --color-footer-link (dunkel) sind etwas kräftiger
 *   als im Entwurf, weil die Originalwerte bei 14px bzw. 20px unter 4,5:1 liegen.
 */

/* ------------------------------------------------------------------ Basis */
:root {
  /* Schriften – lokal über @fontsource, keine externen Server */
  --font-sans: "Atkinson Hyperlegible Next", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-mono: "Roboto Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;

  /* Größenskala (px-Werte aus Figma) */
  --font-size-xs: 0.875rem; /* 14 – Grafik-Labels */
  --font-size-s: 1rem; /* 16 – Body 2, Navigation */
  --font-size-m: 1.125rem; /* 18 – Buttons Hero */
  --font-size-l: 1.25rem; /* 20 – Body 1, CTA-Button, Footer */
  --font-size-xl: 1.5rem; /* 24 – Kachel-Untertitel */
  --font-size-2xl: clamp(1.375rem, 1.2vw + 1rem, 2rem); /* 32 – Lead, Sektionstitel */
  --font-size-3xl: clamp(2rem, 2.2vw + 1.2rem, 2.75rem); /* 44 – Kachel-Kennzahl */
  --font-size-4xl: clamp(2.25rem, 3.6vw + 1rem, 4rem); /* 64 – Headlines */

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

  --line-height-display: 1.05;
  --line-height-tight: 1.2;
  --line-height-body: 1.25; /* Body 2: 16/20 */
  --line-height-body-l: 1.2; /* Body 1: 20/24 */
  --letter-spacing-display: -0.05em; /* -3.2px bei 64px */
  --letter-spacing-body-l: 0.02em; /* 0.4px bei 20px */

  /* Abstände (4px-Raster) */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-11: 2.75rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-24: 6rem;
  --space-30: 7.5rem;

  /* Form */
  --radius-s: 8px;
  --radius-m: 12px;
  --radius-l: 16px;
  --radius-xl: 24px;
  --blur-glass: 2px;

  /* Layout – Figma-Frame 1600px, Inhalt 1422px bei 98px Rand */
  --content-max: 89rem;
  --content-gutter: clamp(1rem, 6vw, 6.125rem);
  --header-height: 5.125rem; /* 82px inkl. 8px-Verlaufsleiste */

  /* Markenverläufe (beide Themes gleich) */
  --gradient-brand: linear-gradient(90deg, #0387c9 0%, #7d48a6 99%);
  --gradient-button: linear-gradient(90deg, #0485c7, #7c48a5);
  --gradient-button-l: linear-gradient(90deg, #0883c6, #7a49a5);
  --color-on-gradient: #ffffff;

  --color-accent: #378add; /* Sektionstitel, Linien */
  --color-subtitle: #0f7fc3; /* Kachel-Untertitel (24px) */
  --color-divider: #7e85cf;

  --shadow-card: 0 8px 24px rgb(0 0 0 / 4%);
  --shadow-menu: 0 4px 16px rgb(0 0 0 / 15%);
  --shadow-header: 0 4px 20px rgb(0 0 0 / 10%);
  --focus-ring: 3px solid var(--color-focus);
}

/* --------------------------------------------------------- Theme: hell */
:root {
  color-scheme: light;
  --color-bg: #e3ebfb;
  --color-bg-page: radial-gradient(120% 60% at 75% 12%, #efeffb 0%, #d9e6fb 100%);
  --hero-glow:
    radial-gradient(45% 55% at 22% 70%, rgb(55 138 221 / 20%), transparent 70%),
    radial-gradient(35% 40% at 81% 13%, rgb(122 104 181 / 20%), transparent 70%);

  --color-text: #070422;
  --color-text-muted: #363940;
  --color-heading: #070422;
  --color-hl-1: #7966b5; /* "Daten" */
  --color-hl-2: #2a74bd; /* "Struktur" – Figma #378add, für AA leicht abgedunkelt */
  --color-hl-3: #3d6bb9; /* "Skalierbarkeit" */
  --color-label: #2a6db0; /* Figma #378add – 14px braucht 4,5:1 */

  --color-surface: rgb(255 255 255 / 35%);
  --color-surface-border: rgb(255 255 255 / 50%);
  --color-button-secondary-text: #070422;
  --color-icon-card-bg: rgb(55 138 221 / 8%);
  --color-icon-card-border: rgb(55 138 221 / 50%);

  --color-header-bg: rgb(227 235 251 / 75%);
  --color-header-border: rgb(55 138 221 / 15%);
  --color-menu-bg: #ffffff;
  --color-menu-hover: rgb(55 138 221 / 10%);

  --color-section-bg: rgb(255 255 255 / 35%);
  --color-section-border: rgb(255 255 255 / 50%);

  --color-footer-bg: transparent;
  --color-footer-link: #4f5563; /* Figma #5e6574 */
  --color-link: #1f68b0;
  --color-focus: #3d6bb9;
  /* Status (Formulare) – AA auf hellem Grund */
  --color-error: #b42318;
  --color-success: #1e7b34;
}

/* ------------------------------------------------------- Theme: dunkel */
/* Zwei identische Blöcke: Systemeinstellung bzw. expliziter Schalter. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --color-bg: #000713;
    --color-bg-page: #000713;
    --hero-glow:
      radial-gradient(40% 60% at 0% 68%, rgb(11 130 197 / 25%), transparent 70%),
      radial-gradient(40% 45% at 75% 26%, rgb(121 102 181 / 25%), transparent 70%);

    --color-text: #ffffff;
    --color-text-muted: #9ca3b2;
    --color-heading: #ffffff;
    --color-hl-1: #a275cd;
    --color-hl-2: #2ca0df;
    --color-hl-3: #6086d5;
    --color-label: #378add;

    --color-surface: rgb(55 138 221 / 8%);
    --color-surface-border: rgb(55 138 221 / 25%);
    --color-button-secondary-text: #f9fafb;
    --color-icon-card-bg: rgb(55 138 221 / 8%);
    --color-icon-card-border: rgb(55 138 221 / 50%);

    --color-header-bg: rgb(4 17 34 / 80%);
    --color-header-border: rgb(55 138 221 / 15%);
    --color-menu-bg: #0b1626;
    --color-menu-hover: rgb(55 138 221 / 15%);

    --color-section-bg: rgb(55 138 221 / 5%);
    --color-section-border: rgb(55 138 221 / 20%);

    --color-footer-bg: #000713;
    --color-footer-link: #8a92a3; /* Figma #5e6574 */
    --color-link: #5aa6ea;
    --color-focus: #6fb3f0;
    --color-error: #ff8a80;
    --color-success: #6ad38a;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --color-bg: #000713;
  --color-bg-page: #000713;
  --hero-glow:
    radial-gradient(40% 60% at 0% 68%, rgb(11 130 197 / 25%), transparent 70%),
    radial-gradient(40% 45% at 75% 26%, rgb(121 102 181 / 25%), transparent 70%);

  --color-text: #ffffff;
  --color-text-muted: #9ca3b2;
  --color-heading: #ffffff;
  --color-hl-1: #a275cd;
  --color-hl-2: #2ca0df;
  --color-hl-3: #6086d5;
  --color-label: #378add;

  --color-surface: rgb(55 138 221 / 8%);
  --color-surface-border: rgb(55 138 221 / 25%);
  --color-button-secondary-text: #f9fafb;
  --color-icon-card-bg: rgb(55 138 221 / 8%);
  --color-icon-card-border: rgb(55 138 221 / 50%);

  --color-header-bg: rgb(4 17 34 / 80%);
  --color-header-border: rgb(55 138 221 / 15%);
  --color-menu-bg: #0b1626;
  --color-menu-hover: rgb(55 138 221 / 15%);

  --color-section-bg: rgb(55 138 221 / 5%);
  --color-section-border: rgb(55 138 221 / 20%);

  --color-footer-bg: #000713;
  --color-footer-link: #8a92a3;
  --color-link: #5aa6ea;
  --color-focus: #6fb3f0;
  --color-error: #ff8a80;
  --color-success: #6ad38a;
}
