/* BASE Designsystem – Tokens für den React-Neubau
   Stand 03.11.2026 (Landkarte 5.10), ergänzt 05.11.2026 im React-Gerüst (4.1):
   --radius-xl, --color-on-dark-track, --color-scrim, --layer-*. Quelle und Begründungen: design/README.md.

   Zwei Ebenen:
     --base-*   Markenpalette (CI). Nur hier stehen Hex-Werte.
     --color-*  Rollen. Bausteine benutzen ausschließlich diese.
   Neue Farbe: erst --base-*, dann eine Rolle darauf zeigen lassen,
   und immer einen Wert für den dunklen Modus mitliefern.

   Dunkler Modus: [data-theme="dark"] auf <html>. Ohne gespeicherte Wahl
   folgt er prefers-color-scheme (siehe unten). */

:root {
  /* --- Markenpalette --- */
  --base-navy:   #14213D;
  --base-blue:   #4F6BED;
  --base-sand:   #D6A87A;   /* Logo-Sand, auch Akzent (Giacomo, 02.11.2026) */
  --base-green:  #4FAF83;
  --base-cherry: #B0303C;   /* Fehlerfarbe „Kirsch“ (Giacomo, 03.11.2026) */
  --base-bronze: #B07A52;
  --base-silver: #A8B0BA;
  --base-gold:   #D6A84B;

  /* --- Flächen --- */
  --color-bg:           #F7F8FA;
  --color-surface:      #FFFFFF;
  --color-surface-2:    #F1F3F7;
  --color-line:         #E4E7EE;   /* nur Schmuck, keine Bedienelemente */
  --color-line-control: #8A94A6;   /* Rand von Feldern, Schaltern: 3,06 : 1 */

  /* --- Text --- */
  --color-text:       #172033;     /* 15,3 : 1 auf bg */
  --color-text-muted: #626D80;     /* 4,7 : 1 auch auf surface-2 */

  /* --- Marke --- */
  --color-brand-strong: var(--base-navy);  /* Navigation, Seitentitel */
  --color-brand:        var(--base-blue);  /* Fläche des Hauptknopfs, Fortschritt */
  --color-brand-hover:  #3D57D6;
  --color-brand-text:   #2C4A9E;           /* Links, aktiver Menüpunkt – Blau als Text erreicht nur 4,24 */
  --color-on-brand:     #FFFFFF;           /* Schrift auf Blau, Grün, Kirsch */
  --color-brand-soft:   #EAEDFD;
  --color-on-dark:      #FFFFFF;           /* Logo und Schrift auf Navy-Flächen */

  /* --- Akzent (Sand) – nur Fläche und Schmuck, nie Text auf Hell (2,16 : 1) --- */
  --color-accent:      var(--base-sand);
  --color-accent-soft: #FAF5EC;
  --color-accent-text: #8A6A33;            /* 4,61 : 1 auf accent-soft */
  --color-logo-accent: var(--base-sand);

  /* --- Erfolg – Fläche und Symbol; Schrift über success-text --- */
  --color-success:      var(--base-green);
  --color-success-soft: #E6F4EE;
  --color-success-text: #316C51;           /* 5,46 : 1 auf success-soft */

  /* --- Fehler – Schrift, Rand und Symbol; immer mit Symbol und Wort --- */
  --color-danger:      var(--base-cherry); /* 6,30 : 1 auf Weiß */
  --color-danger-soft: #FCECEE;

  /* --- Fortschritt und Fokus --- */
  --color-track: #E9EBF1;
  --color-focus: var(--base-blue);         /* 2 px Ring, 2 px Abstand: 4,51 : 1 */
  --color-on-dark-track: rgba(255, 255, 255, .18);  /* Fortschritt auf der blauen Hauptkarte */
  --color-scrim:         rgba(20, 33, 61, .45);     /* Abdunklung hinter Bogen und Dialog */

  /* --- Belohnung – immer mit Wort oder Symbol --- */
  --color-reward-bronze: var(--base-bronze);
  --color-reward-silver: var(--base-silver);
  --color-reward-gold:   var(--base-gold);

  /* --- Schrift --- */
  --font-brand: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;  /* 600, 700 */
  --font-ui:    "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;    /* 400, 500, 600, 700 */

  /* Schriftstufen, mobile-first: Handywerte hier, ab 621 px unten größer */
  --type-display-size: 36px; --type-display-line: 44px;  /* Manrope 700 */
  --type-h1-size:      28px; --type-h1-line:      36px;  /* Manrope 700, Seitentitel */
  --type-h2-size:      22px; --type-h2-line:      28px;  /* Manrope 600, Abschnitt, große Kennzahl */
  --type-h3-size:      18px; --type-h3-line:      26px;  /* Manrope 600, Kartentitel */
  --type-body-size:    16px; --type-body-line:    24px;  /* Inter 400 */
  --type-label-size:   14px; --type-label-line:   20px;  /* Inter 500/600, Knöpfe, Menü */
  --type-caption-size: 12px; --type-caption-line: 16px;  /* Inter 400, Meta */

  /* --- Abstände (4-px-Raster) --- */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --space-6: 24px; --space-7: 32px; --space-8: 40px; --space-9: 48px; --space-10: 64px;

  /* --- Radien --- */
  --radius-xs: 4px;    /* Balken, Häkchen */
  --radius-sm: 8px;    /* Button, Field */
  --radius-md: 12px;   /* Zeile, innere Kachel */
  --radius-lg: 16px;   /* Card */
  --radius-xl: 24px;   /* blaue Hauptkarte, Bogen (Landkarte 1.43, Tafel 5.1) */
  --radius-full: 999px;

  /* --- Schatten --- */
  --shadow-1: 0 1px 2px rgba(20, 33, 61, .04), 0 10px 28px -14px rgba(20, 33, 61, .16);  /* Card */
  --shadow-2: 0 8px 22px -14px rgba(20, 33, 61, .45);                                     /* Menü, Popover */
  --shadow-3: 0 30px 70px -20px rgba(20, 33, 61, .5);                                     /* Dialog */

  /* --- Bedienung --- */
  --size-target: 44px;  /* Mindesthöhe und -breite jedes bedienbaren Elements, in jeder Breite */

  /* --- Ebenen (Tafel 4.2/4.4) – Bühne, aufliegende Karten, Bogen von unten, Dialog --- */
  --layer-stage:  0;
  --layer-card:   1;
  --layer-nav:   20;    /* SideNav, BottomNav, TopBar */
  --layer-menu:  25;    /* Avatar-Menü, Popover */
  --layer-sheet: 30;    /* Bogen: Lernfeld, Raum, Note eintragen */
  --layer-dialog: 40;

  /* Breakpoints (in @media nur als Zahl, Variablen gelten dort nicht):
       bis 620 px Handy · ab 621 Tablet · ab 881 Laptop · ab 1181 Desktop */
}

@media (min-width: 621px) {
  :root {
    --type-display-size: 48px; --type-display-line: 56px;
    --type-h1-size:      32px; --type-h1-line:      40px;
    --type-h2-size:      24px; --type-h2-line:      32px;
  }
}

/* Dunkler Modus – gleiche Rollen, andere Werte */
:root[data-theme="dark"] {
  --base-blue:   #6C83F7;
  --base-green:  #5FC194;
  --base-cherry: #F3868F;

  --color-bg:           #101522;
  --color-surface:      #181F2E;
  --color-surface-2:    #1F2739;
  --color-line:         #283043;
  --color-line-control: #646E85;   /* 3,23 : 1 */

  --color-text:       #F4F6F8;
  --color-text-muted: #8A94A6;

  --color-brand-strong: #A9B8FB;   /* Navy hätte auf Dunkel 1,14 : 1 */
  --color-brand-hover:  #8296F9;
  --color-brand-text:   #A9B8FB;
  --color-on-brand:     #0E1220;   /* Weiß auf hellem Blau nur 3,37 : 1 */
  --color-brand-soft:   #1E2540;
  --color-on-dark:      #F4F6F8;

  --color-accent-soft: #272115;
  --color-accent-text: #D6A87A;

  --color-success-soft: #14261F;
  --color-success-text: #7CCBA5;

  --color-danger-soft: #2B1719;

  --color-track: #232B3D;
  --color-on-dark-track: rgba(14, 18, 32, .22);
  --color-scrim:         rgba(0, 0, 0, .55);

  /* Belohnungsfarben dunkel: noch offen, bis dahin wie hell */

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .3), 0 12px 30px -16px rgba(0, 0, 0, .6);
  --shadow-2: 0 8px 22px -12px rgba(0, 0, 0, .7);
  --shadow-3: 0 30px 70px -20px rgba(0, 0, 0, .8);
}

/* Fokus einheitlich für alles Bedienbare */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}
