/* ==========================================================================
   ByteHelpers Design Tokens — Apple-DNA macOS Developer Workbench
   Authority: 02-apple-dna.md supersedes earlier visual details.
   Zero proprietary font redistribution; native system sans + system mono.
   ========================================================================== */

:root {
  /* Core Surfaces (Graphite + Deep Editor) */
  --bh-canvas: #17191E;
  --bh-surface-1: #1D2027;
  --bh-surface-2: #242831;
  --bh-surface-hover: #2B303B;
  --bh-surface-active: #323846;
  --bh-editor: #101216;
  --bh-editor-gutter: #13161C;
  --bh-editor-active-line: rgba(119, 168, 255, 0.08);
  --bh-editor-error-line: rgba(255, 123, 123, 0.14);

  /* Translucent Floating Chrome (only for floating palette/popovers, never editors) */
  --bh-popover-bg: rgba(29, 32, 39, 0.92);
  --bh-popover-fallback: #1D2027;
  --bh-backdrop: rgba(8, 10, 14, 0.62);

  /* Crisp Hairlines & Borders */
  --bh-border: #2D323E;
  --bh-border-subtle: #242832;
  --bh-border-strong: #41495A;
  --bh-focus-ring: #77A8FF;

  /* Foreground & Typography Ink (WCAG 2.2 AA >= 4.5:1 verified) */
  --bh-text: #E9EDF3;
  --bh-text-secondary: #B4BDCC;
  --bh-text-muted: #929CAE;

  /* Brand & Semantic Accents */
  --bh-mint: #63DDB0;
  --bh-mint-hover: #7AE5BE;
  --bh-mint-active: #50C89B;
  --bh-mint-ink: #0B1D16;
  --bh-mint-subtle: rgba(99, 221, 176, 0.13);
  --bh-mint-border: rgba(99, 221, 176, 0.34);

  --bh-blue: #77A8FF;
  --bh-blue-subtle: rgba(119, 168, 255, 0.14);
  --bh-blue-border: rgba(119, 168, 255, 0.35);

  --bh-error: #FF8585;
  --bh-error-subtle: rgba(255, 133, 133, 0.13);
  --bh-error-border: rgba(255, 133, 133, 0.38);

  --bh-warning: #F5C56B;
  --bh-warning-subtle: rgba(245, 197, 107, 0.13);
  --bh-warning-border: rgba(245, 197, 107, 0.36);

  /* Semantic Syntax Highlighting (High-contrast against #101216) */
  --bh-syn-key: #77A8FF;
  --bh-syn-string: #63DDB0;
  --bh-syn-number: #F5C56B;
  --bh-syn-boolean: #D0A6FF;
  --bh-syn-null: #A9B4C6;
  --bh-syn-punct: #8F99AB;

  /* Diff Colors (Paired with +/-/~ text symbols, never color alone) */
  --bh-diff-add-bg: rgba(99, 221, 176, 0.11);
  --bh-diff-add-text: #7BE4BC;
  --bh-diff-del-bg: rgba(255, 133, 133, 0.12);
  --bh-diff-del-text: #FF9999;
  --bh-diff-mod-bg: rgba(245, 197, 107, 0.12);
  --bh-diff-mod-text: #F7CE7D;

  /* Font Stacks — Native System Sans for Chrome, Mono ONLY for code/readouts */
  --bh-font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
  --bh-font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "DejaVu Sans Mono", monospace;

  /* Type Scale */
  --bh-text-h1: 1.25rem;      /* 20px compact workbench title */
  --bh-leading-h1: 1.35;
  --bh-text-h2: 1.0625rem;    /* 17px section heading */
  --bh-text-ui: 0.8125rem;    /* 13px compact macOS UI chrome */
  --bh-text-ui-sm: 0.75rem;   /* 12px captions, status readouts */
  --bh-text-body: 0.9375rem;  /* 15px documentation prose */
  --bh-text-code: 0.875rem;   /* 14px desktop editor */
  --bh-leading-code: 1.57;    /* 22px line height */

  /* 4/8-Point Spacing Rhythm */
  --bh-space-1: 4px;
  --bh-space-2: 8px;
  --bh-space-3: 12px;
  --bh-space-4: 16px;
  --bh-space-5: 20px;
  --bh-space-6: 24px;
  --bh-space-8: 32px;

  /* Radii (Apple-DNA Finish: 8-12px controls, 12-16px shell/overlays) */
  --bh-radius-sm: 6px;
  --bh-radius-control: 8px;
  --bh-radius-panel: 12px;
  --bh-radius-overlay: 14px;
  --bh-radius-pill: 999px;

  /* Depth (Restrained: crisp borders on workbench; elevation on floating overlays only) */
  --bh-shadow-popover: 0 18px 48px rgba(0, 0, 0, 0.52), 0 0 0 1px rgba(255, 255, 255, 0.06);
  --bh-shadow-control: 0 1px 0 rgba(255, 255, 255, 0.06) inset;

  /* Motion (120-180ms controls, 180-280ms panels) */
  --bh-ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --bh-dur-control: 140ms;
  --bh-dur-panel: 220ms;

  /* Layout Dimensions */
  --bh-topbar-h: 48px;
  --bh-sidebar-w: 220px;
  --bh-gutter-desktop: 24px;
  --bh-gutter-mobile: 16px;
}

@media (prefers-reduced-transparency: reduce) {
  :root {
    --bh-popover-bg: var(--bh-popover-fallback);
    --bh-backdrop: rgba(8, 10, 14, 0.82);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --bh-dur-control: 0ms;
    --bh-dur-panel: 0ms;
  }
}
