/* Design tokens — NodeBook in the Radio-Actief house style (the #BEmesh tools).
   NodeBook's own token names carry the design system's ra-* values (its tokens.json; the tools'
   copy is vendor/rry/bemesh-tokens.css). Light is the first theme; dark follows the device unless
   the user picks a theme ([data-theme] on <html>). The top bar is ink (ra-balk) in both themes. */

:root {
  --font-sans: "Figtree", system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --font-display: "Orbitron", "Figtree", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";

  /* The tool-* text styles: chip 12/16, tekst 13/18, kaarttitel 14/20, cijfer 24/28; nothing under 11 px. */
  --text-xs: 11px;
  --text-sm: 12px;
  --text-md: 13px;
  --text-lg: 14px;
  --text-xl: 16px;
  --text-2xl: 24px;
  --leading: 1.385; /* tool-tekst: 18 px on 13 px */

  /* ra-s-4 … ra-s-32 (20 px sits between two steps and is kept for NodeBook's own paddings) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* ra-r-s (menu items), ra-r-m (tools: cards, buttons, fields), ra-r-pil (chips) */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 8px;
  --radius-pill: 999px;

  /* ra-duur, on colour and border only */
  --dur-fast: 150ms;
  --dur-med: 150ms;
  --ease: ease-out;

  --sidebar-w: 232px;
  --list-w: 400px;
  --topbar-h: 44px;
  --tabbar-h: 60px;
  --tap: 44px;

  /* The ink top bar (Inktbalk) and the device console: the same in both themes. */
  --ink: #1a202c; /* ra-inkt */
  --bar-bg: #1a202c; /* ra-balk */
  --bar-text: #edf2f7; /* ra-balk-tekst */
  --bar-mut: #a0aec0; /* ra-balk-mut */
  --bar-line: #2d3748; /* ra-balk-lijn */
  --bar-control: #4a5568; /* ra-balk-rand */
  --bar-accent: #ffff00; /* ra-balk-accent: the word mark and the active tool */
  --bar-open: #3a2f10; /* ra-balk-open: hover and open on the bar */
  --bar-focus: #ffff00; /* ra-balk-focus */
  --bar-ok: #3fb950; /* a connected device's dot on the bar */
  --signal: #ffff00; /* ra-signaal: only on ink, or with a 2 px ink border */
  --code-bg: #12161f; /* ra-code-bg */
  --code-text: #edf2f7; /* ra-code-tekst */
  --code-mut: #a0aec0; /* ra-code-mut */
  --code-ok: #3fb950; /* ra-ok, dark */
  --code-bad: #f85149; /* ra-bad, dark */
  --code-warn: #d29922; /* ra-warn, dark */
  --plate: #ffffff; /* ra-plaat: under QR codes and logos */
  --glass-blur: blur(14px) saturate(140%); /* ra-glas-blur */
  /* config.json "banner": the test site's red strip over every screen (clicks go through) */
  --banner-bg: rgba(210, 20, 20, 0.6);
  --banner-text: #ffffff;
  --banner-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  /* ra-node-*: data only, always with a letter, symbol or label */
  --t-companion: #2196f3;
  --t-repeater: #4caf50;
  --t-room: #9c27b0;
  --t-sensor: #0891b2;
}

/* Light: the first theme. */
:root {
  color-scheme: light;
  --bg: #ffffff; /* ra-page */
  --bg-elev: #f7fafc; /* ra-bar: sidebar, list pane */
  --surface: #ffffff; /* ra-panel */
  --surface-2: #f7fafc; /* ra-bar */
  --surface-3: #f7fafc; /* ra-bar: tracks, neutral badges */
  --border: #e2e8f0; /* ra-lijn */
  --border-strong: #64748b; /* ra-veld-rand: fields and controls */
  --text: #1a202c; /* ra-tekst */
  --text-2: #64748b; /* ra-mut */
  --text-3: #64748b; /* ra-mut */
  --text-on-tint: #4a5568; /* ra-glas-mut: muted text on ra-accent-bg / ra-info-bg, where ra-mut is 4.3:1 */
  --link: #1159af; /* ra-link */
  --link-hover: #0d3c74; /* ra-link-hover */
  --accent: #d4a017; /* ra-accent: fills, borders, progress; never text on light */
  --accent-hover: #b8890f; /* ra-accent-hover */
  --accent-strong: #7a5c00; /* ra-accent-tekst: the accent as text */
  --accent-ink: #1f1600; /* ra-op-accent: text on gold */
  --accent-soft: #fbf4dc; /* ra-accent-bg: hover, the active item */
  --focus: #1159af; /* ra-focus */
  --ok: #1a7f37; /* ra-ok */
  --ok-soft: rgba(26, 127, 55, 0.05);
  --warn: #9a5b00; /* ra-warn */
  --warn-soft: #fbf4dc; /* ra-accent-bg: the let-op notice */
  --danger: #c62828; /* ra-bad */
  --danger-ink: #ffffff; /* ra-op-bad */
  --danger-soft: rgba(198, 40, 40, 0.08);
  --info: #1159af; /* ra-link */
  --info-soft: #e8f0fe; /* ra-info-bg */
  --node-rim: #1a202c; /* ra-node-rand */
  --glass: rgba(255, 255, 255, 0.82); /* ra-glas */
  --glass-line: rgba(26, 32, 44, 0.12); /* ra-glas-rand */
  --glass-mut: #4a5568; /* ra-glas-mut */
  --glass-link: #0d3c74; /* ra-glas-link */
  --shadow-1: none; /* borders do the work */
  --shadow-float: 0 2px 8px rgba(0, 0, 0, 0.12); /* ra-schaduw-laag: panels over the map */
  --shadow-2: 0 6px 20px rgba(0, 0, 0, 0.12); /* ra-schaduw-menu: menus, popovers, toasts */
  --shadow-glass: 0 8px 24px rgba(26, 32, 44, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.6); /* ra-schaduw-glas */
  --scrim: rgba(15, 20, 25, 0.4);
  --map-filter: none;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='%2364748b'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E");
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #12161f;
    --bg-elev: #12161f;
    --surface: #1a202c;
    --surface-2: #12161f;
    --surface-3: #12161f;
    --border: #2d3748;
    --border-strong: #a0aec0;
    --text: #edf2f7;
    --text-2: #a0aec0;
    --text-3: #a0aec0;
    --text-on-tint: #cbd5e0;
    --link: #63b3ed;
    --link-hover: #90cdf4;
    --accent: #d4a017;
    --accent-hover: #b8890f;
    --accent-strong: #d4a017;
    --accent-ink: #1f1600;
    --accent-soft: #3a2f10;
    --focus: #ffff00;
    --ok: #3fb950;
    --ok-soft: rgba(63, 185, 80, 0.08);
    --warn: #d29922;
    --warn-soft: #3a2f10;
    --danger: #f85149;
    --danger-ink: #12161f;
    --danger-soft: rgba(248, 81, 73, 0.06);
    --info: #63b3ed;
    --info-soft: #132a46;
    --node-rim: #edf2f7;
    --glass: rgba(26, 32, 44, 0.82);
    --glass-line: rgba(237, 242, 247, 0.14);
    --glass-mut: #cbd5e0;
    --glass-link: #90cdf4;
    --shadow-1: none;
    --shadow-float: 0 2px 8px rgba(0, 0, 0, 0.5);
    --shadow-2: 0 6px 20px rgba(0, 0, 0, 0.5);
    --shadow-glass: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(237, 242, 247, 0.08);
    --scrim: rgba(0, 0, 0, 0.6);
    --map-filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9) saturate(0.7);
    --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='%23a0aec0'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E");
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12161f;
  --bg-elev: #12161f;
  --surface: #1a202c;
  --surface-2: #12161f;
  --surface-3: #12161f;
  --border: #2d3748;
  --border-strong: #a0aec0;
  --text: #edf2f7;
  --text-2: #a0aec0;
  --text-3: #a0aec0;
  --text-on-tint: #cbd5e0;
  --link: #63b3ed;
  --link-hover: #90cdf4;
  --accent: #d4a017;
  --accent-hover: #b8890f;
  --accent-strong: #d4a017;
  --accent-ink: #1f1600;
  --accent-soft: #3a2f10;
  --focus: #ffff00;
  --ok: #3fb950;
  --ok-soft: rgba(63, 185, 80, 0.08);
  --warn: #d29922;
  --warn-soft: #3a2f10;
  --danger: #f85149;
  --danger-ink: #12161f;
  --danger-soft: rgba(248, 81, 73, 0.06);
  --info: #63b3ed;
  --info-soft: #132a46;
  --node-rim: #edf2f7;
  --glass: rgba(26, 32, 44, 0.82);
  --glass-line: rgba(237, 242, 247, 0.14);
  --glass-mut: #cbd5e0;
  --glass-link: #90cdf4;
  --shadow-1: none;
  --shadow-float: 0 2px 8px rgba(0, 0, 0, 0.5);
  --shadow-2: 0 6px 20px rgba(0, 0, 0, 0.5);
  --shadow-glass: 0 8px 24px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(237, 242, 247, 0.08);
  --scrim: rgba(0, 0, 0, 0.6);
  --map-filter: invert(1) hue-rotate(180deg) brightness(0.95) contrast(0.9) saturate(0.7);
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='%23a0aec0'%3E%3Cpath d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708'/%3E%3C/svg%3E");
}
