/* CoastNav – Design-Tokens (Phase 2, Owner: Fundament)
   Einzige Stelle fuer Farb-Hex-Werte der App-UI (SPEC §10). Vertrag §13.3/§13.4.
   Light auf :root; Dark auf [data-theme="dark"] und – bei data-theme="auto" –
   per prefers-color-scheme. Karten-Farben bleiben in beiden Themes gleich. */

:root {
  color-scheme: light;

  /* ── Farben (Light) ─────────────────────────────────────────────────── */
  --c-bg: #eef2f6;
  --c-surface: #ffffff;
  --c-surface-2: #f4f6f9;
  --c-surface-3: #e9eef4;
  --c-border: #dfe4ea;
  --c-border-strong: #7b8aa0;
  --c-text: #0f1f33;
  --c-text-2: #475569;
  --c-text-3: #5b6b82;
  --c-header: #0a3d62;
  --c-on-header: #ffffff;
  --c-navy: #0a3d62;
  --c-primary: #d4a24e;
  --c-on-primary: #0b1521;
  --c-primary-hover: #c8933a;
  --c-accent: #0a3d62;
  --c-on-accent: #ffffff;       /* Text/Symbole auf --c-accent (gefuellte, eingeschaltete Chips) */
  --c-teal: #3aafa9;            /* nur Dekoration */
  --c-teal-ink: #1f7a75;
  --c-logo-card: #f6f2ea;       /* helle Kompassrose hinter dem Logo (.ui-logo-card), beide Themes */
  --c-logo-card-edge: #ddd4c2;
  --c-gold-ink: #8a6118;
  --c-start: #c2410c;           /* weisse Schrift, beide Themes */
  --c-end: #15803d;             /* weisse Schrift, beide Themes */
  --c-danger: #b42318;
  --c-danger-bg: #fef3f2;
  --c-warn: #a15c07;
  --c-warn-bg: #fff7e6;
  --c-ok: #15803d;
  --c-ok-bg: #ecfdf3;
  --c-info-bg: #eef4fb;
  --c-focus: #0a3d62;
  --c-scrim: rgba(11, 21, 33, .45);

  /* ── Karte (beide Themes gleich) ────────────────────────────────────── */
  --map-route: #0a3d62;
  --map-route-casing: #ffffff;
  --map-leg-failed: #b42318;
  --map-highlight: #d4a24e;

  /* ── Abstaende ──────────────────────────────────────────────────────── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-7: 32px;
  --sp-8: 48px;

  /* ── Radien ─────────────────────────────────────────────────────────── */
  --r-sm: 6px;     /* Inputs, Chips */
  --r-md: 10px;    /* Buttons, Karten, Popups */
  --r-lg: 16px;    /* Panel, Dialog, Sheet-Oberkante */
  --r-pill: 999px;

  /* ── Typo (font-size / line-height) ─────────────────────────────────── */
  --font: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  --fs-xs: 12px;   --lh-xs: 16px;   /* Rechtliches */
  --fs-sm: 13px;   --lh-sm: 18px;   /* Meta */
  --fs-md: 15px;   --lh-md: 22px;   /* Fliesstext */
  --fs-input: 16px;
  --fs-lg: 17px;   --lh-lg: 24px;   /* Namen, Titel */
  --fs-xl: 20px;   --lh-xl: 26px;   /* Summary ≥600 */
  --fs-2xl: 24px;  --lh-2xl: 30px;  /* Dialog-Titel */
  --fw-regular: 400;
  --fw-bold: 600;

  /* ── Bewegung ───────────────────────────────────────────────────────── */
  --dur-1: 120ms;
  --dur-2: 200ms;
  --dur-3: 280ms;
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* ── Schatten ───────────────────────────────────────────────────────── */
  --sh-1: 0 1px 2px rgb(11 21 33 / .12);
  --sh-2: 0 4px 16px rgb(11 21 33 / .16);
  --sh-3: 0 12px 40px rgb(11 21 33 / .24);
  --surface-outline: 0 0 0 0 transparent; /* Dark: 1px --c-border um Flaechen */

  /* ── Layout (Vertrag §13.2; layout.js schreibt --sheet-h / --map-inset-*) ── */
  --hdr-h: calc(48px + env(safe-area-inset-top, 0px));
  --panel-w: 360px;
  --sheet-h: 0px;
  --map-inset-top: 0px;
  --map-inset-right: 0px;
  --map-inset-bottom: 0px;
  --map-inset-left: 0px;
  --tap: 32px;

  /* ── z-index-Skala (Vertrag §13.4) ──────────────────────────────────── */
  --z-map: 0;
  --z-map-ui: 10;
  --z-panel: 20;
  --z-header: 30;
  --z-popover: 40;
  --z-cookie: 55;
  --z-legacy-modal: 60;
  --z-skip: 100;
}

@media (pointer: coarse) {
  :root { --tap: 44px; }
}
@media (orientation: landscape) and (max-height: 500px) and (min-width: 600px) {
  :root { --hdr-h: calc(40px + env(safe-area-inset-top, 0px)); --panel-w: 320px; }
}
@media (min-width: 1280px) {
  :root { --panel-w: 400px; }
}
@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0ms; --dur-2: 0ms; --dur-3: 0ms; }
}

/* ── Dark (explizit) ──────────────────────────────────────────────────── */
:root[data-theme="dark"] {
  color-scheme: dark;
  --c-bg: #0b1521;
  --c-surface: #111d2e;
  --c-surface-2: #15243a;
  --c-surface-3: #1c2e48;
  --c-border: rgba(255, 255, 255, .10);
  --c-border-strong: #66768e;
  --c-text: #e8e2d6;
  --c-text-2: #9dabc1;
  --c-text-3: #8796ad;
  --c-header: #0e2236;
  --c-on-header: #e8e2d6;
  --c-primary-hover: #e6bb6d;
  --c-accent: #e6bb6d;
  --c-on-accent: #0b1521;
  --c-teal-ink: #5ec4be;
  --c-gold-ink: #e6bb6d;
  --c-danger: #f87171;
  --c-danger-bg: #2a1314;
  --c-warn: #e6bb6d;
  --c-warn-bg: #2a2210;
  --c-ok: #4ade80;
  --c-ok-bg: #0f2a1a;
  --c-info-bg: #15243a;
  --c-focus: #e6bb6d;
  --c-scrim: rgba(0, 0, 0, .6);
  --surface-outline: 0 0 0 1px rgba(255, 255, 255, .10);
}

/* ── Dark (System, nur bei data-theme="auto") ─────────────────────────── */
@media (prefers-color-scheme: dark) {
  :root[data-theme="auto"] {
    color-scheme: dark;
    --c-bg: #0b1521;
    --c-surface: #111d2e;
    --c-surface-2: #15243a;
    --c-surface-3: #1c2e48;
    --c-border: rgba(255, 255, 255, .10);
    --c-border-strong: #66768e;
    --c-text: #e8e2d6;
    --c-text-2: #9dabc1;
    --c-text-3: #8796ad;
    --c-header: #0e2236;
    --c-on-header: #e8e2d6;
    --c-primary-hover: #e6bb6d;
    --c-accent: #e6bb6d;
    --c-on-accent: #0b1521;
    --c-teal-ink: #5ec4be;
    --c-gold-ink: #e6bb6d;
    --c-danger: #f87171;
    --c-danger-bg: #2a1314;
    --c-warn: #e6bb6d;
    --c-warn-bg: #2a2210;
    --c-ok: #4ade80;
    --c-ok-bg: #0f2a1a;
    --c-info-bg: #15243a;
    --c-focus: #e6bb6d;
    --c-scrim: rgba(0, 0, 0, .6);
    --surface-outline: 0 0 0 1px rgba(255, 255, 255, .10);
  }
}
