/*
 * Design-Tokens fuer "Der Agent" — uebernommen aus der Cognia-IA-Markenidentitaet
 * (github.com/thomasbaier2/Cognia-IA_Website, src/styles/global.css + docs/design/design-tokens.md),
 * passend zur Entscheidung "eigenstaendiger Produktauftritt mit sichtbarem by-Cognia-IA-Anker".
 * Framework-agnostisch (reine CSS Custom Properties).
 *
 * Themes (Proposed, siehe ADR-016 Nachtrag): "Papier" (Default, warm/editorial, eckig) und
 * "Clear" (weisser Grund, weicheres Blau, runde Formen, Pastellflaechen). Night und Atelier
 * entfallen, ebenso der OS-Dark-Fallback. Die Themes unterscheiden sich in Farbe UND Form
 * (Radius, Schatten, Flaechentoenen); Schrift und Abstaende bleiben themenunabhaengig.
 *
 * Nachtrag 2026-09-01: Bingo-Kartenmarken sind eigene Status-Tokens (ungegesehen/Hard/Good/Learned),
 * in jedem Theme-Block gesetzt. Bronze (--agent-color-tertiary) bleibt Rail/Fortschritt in Papier.
 *
 * Kaskaden-Reihenfolge (siehe src/styleguide/theme.js fuer die Anwendung von data-theme):
 *   1. :root                      -> Papier-Werte als Basis und Default
 *   2. :root[data-theme='clear']  -> ueberschreibt Farbe, Radius, Schatten, Flaechentoene
 */

/*
 * Globaler Box-Sizing-Reset (2026-08-25, echter Fund): fehlte bisher komplett im Styleguide —
 * Padding/Border wurden zur deklarierten Breite/zu Grid-Spaltenbreiten ADDIERT statt eingerechnet,
 * sichtbar u. a. bei den 4-spaltigen Selbsteinschätzungs-Buttons auf /progress (Buttons
 * überlappten sich). tokens.css wird auf jeder Seite als erstes Stylesheet geladen, deshalb hier.
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Schriften (selbst gehostet, SIL Open Font License, Lizenztexte in styleguide/fonts/). Nur Latin,
 * Fraunces fuer Ueberschriften und Begriffe, Figtree fuer Text und Bedienelemente. */
/* Fraunces 400 (regular + italic): Lesetext der Geschichte im Auge-Modal (CE-02). */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/styleguide/fonts/fraunces-latin-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 400;
  font-display: swap;
  src: url('/styleguide/fonts/fraunces-latin-400-italic.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/styleguide/fonts/fraunces-latin-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/styleguide/fonts/fraunces-latin-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/styleguide/fonts/figtree-latin-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/styleguide/fonts/figtree-latin-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Figtree';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/styleguide/fonts/figtree-latin-700.woff2') format('woff2');
}

:root {
  /* Farben — Papier (Default): warm/editorial, 1:1 aus der Cognia-IA-Markenidentitaet
   * abgeleitet, Akzent-/Tertiaerfarbe seit ADR-015 (2026-08-25) Oxblood/Bronze statt
   * Violett/Teal, Werte 2026-08-25 nach PO-Sehtest am Screenshot einmal nachgeschaerft. */
  --agent-color-bg: #f5f2eb; /* cognia-paper */
  --agent-color-surface: #fffdf8; /* cognia-surface */
  --agent-color-border: #d8d4ca; /* cognia-line */
  --agent-color-text-primary: #111722; /* cognia-ink */
  --agent-color-text-secondary: #62666d; /* cognia-muted */
  --agent-color-text-muted: #8a8d93; /* abgeleitet, aufgehellt aus cognia-muted */

  --agent-color-accent: #8a3a41; /* oxblood */
  --agent-color-accent-hover: #742f36;
  --agent-color-accent-contrast: #ffffff;
  --agent-color-accent-soft: #ecdcdb;

  --agent-color-secondary: #2457e6; /* cognia-blue */
  --agent-color-tertiary: #8a6d3f; /* bronze — Fortschritt/Erfolg */

  /* LC-CHAT-2: one set of chat tokens for the talk, the bubble and the case viewer.
   * The learner on accent-soft, the Caddie on the page colour with a border. */
  --chat-me-bg: var(--agent-color-accent-soft);
  --chat-me-line: var(--agent-color-accent-soft);
  --chat-caddie-bg: var(--agent-color-bg);
  --chat-caddie-line: var(--agent-color-border);
  --chat-radius: 12px;
  --chat-radius-tail: 4px;

  --agent-color-warning: #8a5a0f;
  --agent-color-danger: #a32d2d;

  /* Status (Admin u. a.): gedämpft, Farbe nie allein — Text/Symbol bleibt. */
  --status-ok: #3d7a52;
  --status-warn: #8a5a0f;
  --status-error: #a32d2d;
  --status-info: #3b6d8c;

  /* Status marks (Bingo cards + Today-count). Mix 18% fill / 42% line on surface/border.
   * Unseen = brand blue; Hard = danger. Good/Learned are first-class (not warning/tertiary). */
  --agent-color-status-unseen: var(--agent-color-secondary);
  --agent-color-status-hard: var(--agent-color-danger);
  --agent-color-status-good: #b89614;
  --agent-color-status-learned: #2d8a4a;

  /* Medal metals (UX-13): muted, never bright yellow. Silver = guided, gold = on your own. */
  --medal-silver: #9aa3ad;
  --medal-gold: #b39254;

  /* Typografie — 1:1 aus der Cognia-IA-Markenidentitaet, themenunabhaengig */
  --agent-font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --agent-font-ui: 'Figtree', system-ui, 'Segoe UI', Arial, Helvetica, sans-serif;
  --agent-font-mono: ui-monospace, 'SFMono-Regular', Consolas, monospace;
  /* NOTE-03: the font of the learner's notes (one of four, set per learner by coachClient.js).
   * Every place where note text stands uses it: font: var(--note-font). */
  --note-font:
    600 18px/1.12 'Caveat', 'Segoe Print', 'Bradley Hand', 'Comic Sans MS', 'Marker Felt', cursive;

  /* Typo-Skala (UX-04): nur diese 7 Groessen, nichts unter 12px. Schnitte: 400/600
   * (700 nur Fraunces-Display). Die --agent-font-size-*-Namen bleiben als Alias. */
  --fs-xs: 0.75rem; /* 12px */
  --fs-sm: 0.875rem; /* 14px */
  --fs-base: 1rem; /* 16px — Website nutzt 18px Fliesstext, hier bewusst 16px als App-Dichte-Default */
  --fs-md: 1.125rem; /* 18px */
  --fs-lg: 1.25rem; /* 20px */
  --fs-xl: 1.5rem; /* 24px */
  --fs-2xl: 2rem; /* 32px */
  --fw-regular: 400;
  --fw-strong: 600;
  --agent-font-size-xs: var(--fs-xs);
  --agent-font-size-sm: var(--fs-sm);
  --agent-font-size-base: var(--fs-base);
  --agent-font-size-md: var(--fs-md);
  --agent-font-size-lg: var(--fs-lg);
  --agent-font-size-xl: var(--fs-xl);
  --agent-font-size-2xl: var(--fs-2xl);
  --agent-line-height-base: 1.6;

  /* Spacing — 8px-Basisraster wie auf der Website (space-1 = 8px), themenunabhaengig.
   * UX-04: 4px-Halbschritt (0_5) und 12px (1_5); --agent-space-* bleiben als Alias. */
  --space-0_5: 0.25rem; /* 4px */
  --space-1: 0.5rem; /* 8px */
  --space-1_5: 0.75rem; /* 12px */
  --space-2: 1rem; /* 16px */
  --space-3: 1.5rem; /* 24px */
  --space-4: 2rem; /* 32px */
  --space-6: 3rem; /* 48px */
  --agent-space-1: var(--space-1);
  --agent-space-2: var(--space-2);
  --agent-space-3: var(--space-3);
  --agent-space-4: var(--space-4);
  --agent-space-6: var(--space-6);
  --agent-space-8: 4rem; /* 64px */

  /* Radius — Papier: bewusst zurueckhaltend, editorial/rechteckig; Clear ueberschreibt */
  --agent-radius-sm: 2px;
  --agent-radius-md: 4px;
  --agent-radius-lg: 8px;
  --agent-radius-xl: 12px;

  /* UX-05: Steuer-Tokens fuer Knopf, Chip, Reiter. Hoehe 44 = Tippflaeche, sm 32 (am Handy 44). */
  --control-h: 44px;
  --control-h-sm: 32px;
  --radius-control: 2px;
  --radius-card: 4px;
  --radius-pill: 2px;

  /* Form-Tokens. Papier: kein Schatten. Die Pastell-Tints (--agent-color-tint-1..4, Fuellung)
   * und ihre Tinten (--agent-color-tint-ink-1..4) sind absichtlich NUR in Clear gesetzt;
   * Komponenten nutzen sie mit Papier-Fallback: var(--agent-color-tint-1, <Papier-Wert>). */
  --agent-shadow-card: none;

  /* Motion — themenunabhaengig */
  --agent-transition-fast: 160ms;
  --agent-transition-base: 220ms;
}

/*
 * Shell — klein / mittel / groß (product-wide). Same integers as Bingo FE-0.
 * CSS custom properties cannot drive @media — copy these numbers in every query:
 *   phone  (klein)  max-width: 879px
 *   laptop (mittel) min-width: 880px and max-width: 1179px
 *   desk   (groß)   min-width: 1180px
 * Check widths: 390 · 880 · 1440. See docs/ARCHITEKTUR.md.
 */

/* Theme "Clear" — weisser Grund, weicheres Blau als Primaerfarbe, runde Formen. Pastell-Tints
 * unterscheiden Bereiche (Kern/verwandt, Bingo-Zaehler), kraeftige Farbe nur fuer Aktion und Status. */
:root[data-theme='clear'] {
  --agent-color-bg: #ffffff;
  --agent-color-surface: #ffffff;
  --agent-color-border: #e8ecf3;
  --agent-color-text-primary: #1d2740;
  --agent-color-text-secondary: #647089;
  --agent-color-text-muted: #8a93a8;

  --agent-color-accent: #4a72d4;
  --agent-color-accent-hover: #3b62c0;
  --agent-color-accent-contrast: #ffffff;
  --agent-color-accent-soft: #eaf0fc;

  --agent-color-secondary: #4a72d4;
  --agent-color-tertiary: #2a9d68;

  --chat-me-bg: var(--agent-color-accent-soft);
  --chat-me-line: var(--agent-color-accent-soft);
  --chat-caddie-bg: var(--agent-color-bg);
  --chat-caddie-line: var(--agent-color-border);
  --chat-radius: 12px;
  --chat-radius-tail: 4px;

  --agent-color-warning: #b86e00;
  --agent-color-danger: #c23b3b;

  --status-ok: #2a9d68;
  --status-warn: #b86e00;
  --status-error: #c23b3b;
  --status-info: #4a72d4;

  --agent-color-status-unseen: var(--agent-color-secondary);
  --agent-color-status-hard: var(--agent-color-danger);
  --agent-color-status-good: #d38a0c;
  --agent-color-status-learned: #2a9d68;

  --medal-silver: #a3b0c8;
  --medal-gold: #d2a95c;

  --agent-radius-sm: 10px;
  --agent-radius-md: 16px;
  --agent-radius-lg: 20px;
  --agent-radius-xl: 24px;
  --radius-control: 10px;
  --radius-card: 20px;
  --radius-pill: 999px;

  --agent-shadow-card: 0 4px 18px rgba(23, 32, 51, 0.05);
  --agent-color-tint-1: #eaf1fd;
  --agent-color-tint-2: #fff3d6;
  --agent-color-tint-3: #e4f6ec;
  --agent-color-tint-4: #fde8e3;
  --agent-color-tint-ink-1: #4a72d4;
  --agent-color-tint-ink-2: #d38a0c;
  --agent-color-tint-ink-3: #2a9d68;
  --agent-color-tint-ink-4: #e0644d;

  /* Chat: Nutzer-Blase in Akzentfarbe (Papier: Surface mit Rand, siehe learn.css) */
  /* Vollbild-Buehne (Bingo): gruener Spieltisch statt Schwarz. Papier setzt das Token nicht (Schwarz). */
  --agent-stage-bg:
    repeating-linear-gradient(45deg, rgb(255 255 255 / 0.035) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(-45deg, rgb(0 0 0 / 0.05) 0 1px, transparent 1px 4px),
    radial-gradient(120% 80% at 50% 28%, #2f8a5d 0%, #1f6c49 52%, #134d33 100%);

  --agent-bubble-user-bg: var(--agent-color-accent);
  --agent-bubble-user-ink: var(--agent-color-accent-contrast);
}
/* Gemeinsame body-Basis (UX-04): Schrift, Groesse, Zeilenhoehe, Farben. Module setzen am body
 * nur noch Layout (Hoehe, Flex), keine eigene Schrift (Account fiel sonst auf Times zurueck). */
body {
  font-family: var(--agent-font-ui);
  font-size: var(--fs-base);
  line-height: var(--agent-line-height-base);
  color: var(--agent-color-text-primary);
  background: var(--agent-color-bg);
}
