/* ============================================================
   ANTROP design tokens — single source of truth for chrome.
   Sourced from /ANTROP Prompts/library/design-tokens.json v2.0.
   Hard Rule: monochrome chrome by default, --accent === text-primary.
   ============================================================ */

:root {
  /* Typography families */
  --font-ui:      Inter, ui-sans-serif, system-ui, "Segoe UI", "PT Sans", sans-serif;
  --font-display: "Space Grotesk", Inter, ui-sans-serif, system-ui, sans-serif;
  --font-mono:    "JetBrains Mono", ui-monospace, "PT Mono", SFMono-Regular, Menlo, monospace;

  /* Type scale */
  --ts-micro:    10px;
  --ts-tag:      11px;
  --ts-caption:  12px;
  --ts-body-sm:  13px;
  --ts-body:     14px;
  --ts-body-lg:  15px;
  --ts-h6:       13px;
  --ts-h5:       14px;
  --ts-h4:       16px;
  --ts-h3:       20px;
  --ts-h2:       28px;
  --ts-h1:       32px;
  --ts-display:  56px;

  /* Spacing 4px base */
  --space-0:  0px;
  --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;
  --space-11: 80px;
  --space-12: 96px;

  /* Radius */
  --radius-none: 0px;
  --radius-sm:   4px;
  --radius-md:   6px;
  --radius-base: 8px;
  --radius-lg:   10px;
  --radius-xl:   12px;
  --radius-2xl:  16px;
  --radius-3xl:  20px;
  --radius-full: 9999px;

  /* Borders */
  --border-hairline: 1px;
  --border-thick:    2px;

  /* Motion */
  --motion-instant: 0ms;
  --motion-fast:    120ms;
  --motion-base:    220ms;
  --motion-slow:    360ms;
  --motion-page:    480ms;

  --ease-standard:   cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-emphasized: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-linear:     linear;

  /* Z-index */
  --z-base: 0;
  --z-raised: 1;
  --z-sticky: 80;
  --z-banner: 90;
  --z-dropdown: 100;
  --z-popover: 200;
  --z-modal: 300;
  --z-toast: 400;
  --z-max: 1000;

  /* Layout */
  --page-max:      1200px;
  --content-max:   880px;
  --header-height: 60px;
  --banner-height: 40px;

  /* Sidebar widths (BDDS = product-A defaults) */
  --sidebar-width-collapsed: 64px;
  --sidebar-width-expanded:  240px;

  /* Density-driven row height. Overridden by [data-density] below. */
  --row-h: 36px;

  /* Functional state colors — never brand. R18 forbids using these as chrome. */
  --state-success:  #4ade80;
  --state-warning:  #fbbf24;
  --state-danger:   #f87171;
  --state-critical: #ef4444;
  --state-info:     #60A5FA;

  /* Chart palette (data-viz only, never chrome) */
  --chart-purple:  #A78BFA;
  --chart-cyan:    #22D3EE;
  --chart-amber:   #F59E0B;
  --chart-emerald: #10B981;

  /* Icon stroke (BDDS uses 1.75 like Stellar) */
  --icon-stroke: 1.75;
}

/* ============================================================
   Dark theme (default)
   ============================================================ */
:root,
html[data-theme="dark"] {
  --bg-primary:     #0a0a0a;
  --bg-secondary:   #161616;
  --bg-card:        rgba(255, 255, 255, 0.035);
  --bg-card-hover:  rgba(255, 255, 255, 0.06);
  --bg-elevated:    rgba(255, 255, 255, 0.06);
  --bg-input:       rgba(255, 255, 255, 0.05);
  --bg-hover:       rgba(255, 255, 255, 0.07);
  --bg-pressed:     rgba(255, 255, 255, 0.10);
  --bg-popover:     #151515;
  --bg-navbar:      rgba(10, 10, 10, 0.85);
  --bg-rail:        #0f0f0f;

  --text-primary:   #ffffff;
  --text-heading:   #f5f5f5;
  --text-body:      #e0e0e0;
  --text-secondary: #cccccc;
  --text-muted:     #b8b8b8;
  --text-dimmed:    #8a8a8a;
  --text-inverse:   #0a0a0a;

  --border-subtle:      rgba(255, 255, 255, 0.07);
  --border-base:        rgba(255, 255, 255, 0.10);
  --border-strong:      rgba(255, 255, 255, 0.14);
  --border-hover:       rgba(255, 255, 255, 0.22);
  --border-input:       rgba(255, 255, 255, 0.14);
  --border-input-focus: rgba(255, 255, 255, 0.28);

  --icon-default:  #cccccc;
  --icon-muted:    #b8b8b8;
  --icon-disabled: #555555;

  --shadow-card:       0 8px 24px rgba(0, 0, 0, 0.5);
  --shadow-card-hover: 0 18px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.10);
  --shadow-elev:       0 16px 48px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-modal:      0 32px 80px rgba(0, 0, 0, 0.6);

  --overlay: rgba(0, 0, 0, 0.78);

  --accent:      var(--text-primary);
  --accent-soft: rgba(255, 255, 255, 0.08);
  --accent-ring: rgba(255, 255, 255, 0.36);
  --focus-ring:  var(--accent);
}

/* ============================================================
   Light theme — HIGH CONTRAST per R179/R180.
   Pure white bg, almost-black text + icons.
   ============================================================ */
html[data-theme="light"] {
  --bg-primary:     #ffffff;
  --bg-secondary:   #f5f5f7;
  --bg-card:        #ffffff;
  --bg-card-hover:  #fafafa;
  --bg-elevated:    #ffffff;
  --bg-input:       #ffffff;
  --bg-hover:       rgba(0, 0, 0, 0.05);
  --bg-pressed:     rgba(0, 0, 0, 0.09);
  --bg-popover:     #ffffff;
  --bg-navbar:      rgba(255, 255, 255, 0.85);
  --bg-rail:        #ebebed;

  --text-primary:   #0a0a0a;
  --text-heading:   #0a0a0a;
  --text-body:      #1f1f1f;
  --text-secondary: #3a3a3a;
  --text-muted:     #555555;
  --text-dimmed:    #8a8a8a;
  --text-inverse:   #ffffff;

  --border-subtle:      rgba(0, 0, 0, 0.08);
  --border-base:        rgba(0, 0, 0, 0.12);
  --border-strong:      rgba(0, 0, 0, 0.18);
  --border-hover:       rgba(0, 0, 0, 0.28);
  --border-input:       rgba(0, 0, 0, 0.18);
  --border-input-focus: rgba(0, 0, 0, 0.40);

  --icon-default:  #1a1a1a;
  --icon-muted:    #4a4a4a;
  --icon-disabled: #a8a8a8;

  --shadow-card:       0 1px 3px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.05);
  --shadow-card-hover: 0 12px 28px rgba(0, 0, 0, 0.10), 0 0 0 1px rgba(0, 0, 0, 0.08);
  --shadow-elev:       0 16px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.06);
  --shadow-modal:      0 32px 80px rgba(0, 0, 0, 0.22);

  --overlay: rgba(0, 0, 0, 0.50);

  --accent:      var(--text-primary);
  --accent-soft: rgba(10, 10, 10, 0.06);
  --accent-ring: rgba(10, 10, 10, 0.30);
  --focus-ring:  var(--accent);
}

/* ============================================================
   Density — drives --row-h, table cell padding, control gaps.
   R162: changing this in Settings must visibly change the page.
   ============================================================ */
html[data-density="compact"]     { --row-h: 28px; --density-pad: 8px;  --density-gap: 6px;  }
html[data-density="comfortable"] { --row-h: 36px; --density-pad: 12px; --density-gap: 8px;  }
html[data-density="spacious"]    { --row-h: 44px; --density-pad: 16px; --density-gap: 10px; }
html:not([data-density]) { --density-pad: 12px; --density-gap: 8px; }

/* ============================================================
   Font scale — applies to ALL --ts-* tokens.
   ============================================================ */
html[data-font-scale="compact"]     { font-size: 13px; }
html[data-font-scale="default"]     { font-size: 14px; }
html[data-font-scale="comfortable"] { font-size: 15px; }
html[data-font-scale="large"]       { font-size: 16px; }

/* ============================================================
   Font family override.
   ============================================================ */
html[data-font="system"] body { font-family: var(--font-ui); }
html[data-font="serif"]  body { font-family: Georgia, "Times New Roman", "PT Serif", serif; }
html[data-font="mono"]   body { font-family: var(--font-mono); }

/* ============================================================
   Line height.
   ============================================================ */
html[data-line-height="tight"]   body { line-height: 1.35; }
html[data-line-height="default"] body { line-height: 1.5;  }
html[data-line-height="loose"]   body { line-height: 1.7;  }

/* ============================================================
   Motion — reduced / off cuts transitions.
   ============================================================ */
html[data-motion="reduced"] *,
html[data-motion="reduced"] *::before,
html[data-motion="reduced"] *::after {
  animation-duration: 0.01ms !important;
  transition-duration: 0.01ms !important;
}
html[data-motion="off"] *,
html[data-motion="off"] *::before,
html[data-motion="off"] *::after {
  animation: none !important;
  transition: none !important;
}
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) *,
  html:not([data-motion="full"]) *::before,
  html:not([data-motion="full"]) *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
