/* ============================================================
   Design tokens - Ilan's default system
   Neutral prefix (--ds-) so this drops into any project.
   Palette: warm cream paper, navy ink, deep blue for actions,
   Excel green reserved for AI elements (the model, its answers).
   Swap the hex values per brand; keep the STRUCTURE and the
   contrast relationships - those are the part that took work.
   ============================================================ */

:root {
  /* === SURFACES (warm cream hierarchy) === */
  --ds-canvas: #f9f5ea;              /* default page floor */
  --ds-surface-soft: #f3eddd;        /* section dividers */
  --ds-surface-card: #fffdf8;        /* feature + content cards */
  --ds-surface-strong: #ebe3cf;
  --ds-surface-dark: #003d6b;     /* deep blue instead of black */        /* dark cards, footer */
  --ds-surface-dark-elevated: #252320;

  /* === TEXT === */
  --ds-ink: #1b2f5a;              /* engraving ink: headings share the illustrations' ink */                 /* headlines, primary */
  --ds-body-strong: #263049;         /* emphasized prose */
  --ds-body: #3a4356;                /* default running text */
  --ds-muted: #5f6677;               /* sub-headings, captions */
  --ds-muted-soft: #8e8b82;          /* fine print */
  --ds-on-dark: #faf9f5;
  --ds-on-dark-soft: #a09d96;

  /* === BORDERS === */
  --ds-hairline: #e2d9c4;
  --ds-hairline-soft: #ece4d2;

  /* === ACCENT - two-tone, WCAG 2.2 AA aligned ===
     btn-bg / btn-edge: soft surface + mid border (3:1 for UI shapes)
     accent: deep tone for links, focus rings, brand (4.5:1 for text)
     Do not collapse these into one colour. That is the bug this
     two-tone split exists to prevent. */
  --ds-btn-bg: #d6e4f0;
  --ds-btn-bg-hover: #c3d7e8;
  --ds-btn-edge: #6d9cc2;
  --ds-btn-edge-hover: #5487b0;
  --ds-accent: #005596;
  --ds-accent-hover: #003d6b;
  --ds-accent-soft: #e3edf6;
  --ds-on-accent: #ffffff;

  /* === SEMANTIC === */
  --ds-success: #5b8d6a;
  --ds-warning: #c69a17;
  --ds-error: #b34a3a;

  /* === TYPOGRAPHY === */
  --ds-font-display: "Assistant", "Heebo", -apple-system, sans-serif;
  --ds-font-body: "Heebo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ds-font-ui: "Heebo", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ds-font-code: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* === SPACING (4px base) === */
  --ds-space-xxs: 4px;
  --ds-space-xs: 8px;
  --ds-space-sm: 12px;
  --ds-space-md: 16px;
  --ds-space-lg: 24px;
  --ds-space-xl: 32px;
  --ds-space-xxl: 48px;
  --ds-space-section: 96px;

  /* === RADIUS === */
  --ds-radius-xs: 4px;
  --ds-radius-sm: 6px;
  --ds-radius-md: 8px;
  --ds-radius-lg: 12px;
  --ds-radius-xl: 16px;
  --ds-radius-pill: 9999px;

  /* === GLASS (see glass.css for the full panel recipe) === */
  --ds-glass-bg: rgba(255, 255, 255, 0.10);
  --ds-glass-border: rgba(255, 255, 255, 0.18);
  --ds-glass-blur: 16px;
  --ds-glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.24);
}

/* Explicit dark choice wins in both directions. */
:root[data-theme="dark"] {
  --ds-canvas: #181715;
  --ds-surface-soft: #1f1e1b;
  --ds-surface-card: #252320;
  --ds-surface-strong: #2a2823;
  --ds-ink: #faf9f5;
  --ds-body-strong: #ececec;
  --ds-body: #d4d2cc;
  --ds-muted: #a09d96;
  --ds-muted-soft: #76746e;
  --ds-hairline: #2a2823;
  --ds-hairline-soft: #1f1e1b;
  --ds-btn-bg: #2b4d6b;
  --ds-btn-bg-hover: #355d80;
  --ds-btn-edge: #6d9cc2;
  --ds-btn-edge-hover: #8fb4d4;
  --ds-accent: #8cc2ec;
  --ds-accent-hover: #a9d3f3;
  --ds-on-accent: #0c1a26;
  --ds-glass-bg: rgba(255, 255, 255, 0.06);
  --ds-glass-border: rgba(255, 255, 255, 0.12);
}

/* System default: no data-theme attribute is set at all, so guard
   against an explicit light choice rather than keying on [data-theme="system"]. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ds-canvas: #181715;
    --ds-surface-soft: #1f1e1b;
    --ds-surface-card: #252320;
    --ds-surface-strong: #2a2823;
    --ds-ink: #faf9f5;
    --ds-body-strong: #ececec;
    --ds-body: #d4d2cc;
    --ds-muted: #a09d96;
    --ds-muted-soft: #76746e;
    --ds-hairline: #2a2823;
    --ds-hairline-soft: #1f1e1b;
    --ds-btn-bg: #2b4d6b;
    --ds-btn-bg-hover: #355d80;
    --ds-btn-edge: #6d9cc2;
    --ds-btn-edge-hover: #8fb4d4;
    --ds-accent: #8cc2ec;
    --ds-accent-hover: #a9d3f3;
    --ds-on-accent: #0c1a26;
    --ds-glass-bg: rgba(255, 255, 255, 0.06);
    --ds-glass-border: rgba(255, 255, 255, 0.12);
  }
}

/* RTL: logical properties only. In RTL, w:jc-style "right" alignment
   flips wrong - use start/end everywhere. */
[dir="rtl"] { direction: rtl; }
.ds-text-start { text-align: start; }
.ds-text-end { text-align: end; }

/* === BRAND EXTRAS (project-specific, same --ds- prefix) === */
:root {
  --ds-ai: #2a4d3a;            /* Excel green, AI elements only */
  --ds-ai-soft: #e3ede6;
  --ds-ai-edge: #8fb39b;
  --ds-cat-metabolic: #347f75;  
  --ds-cat-neurological: #803b91;
  --ds-cat-neuromuscular: #913b5b;
  --ds-cat-lysosomal: #ae8932;  
  --ds-cat-connective: #577e44;
  --ds-cat-respiratory: #3b6591;
  --ds-cat-hematologic: #8a2e31;   /* deep red */
  --ds-cat-endocrine: #787f39;     /* amber, 4.5:1 on cream */
  --ds-cat-developmental: #38788a; /* blue-teal */
  --ds-cat-inflammatory: #b26538;  /* burnt orange */
  --ds-cat-sensory: #4451a7;       /* violet */

  /* text shades of the category colours: darker where the colour carries text (tags, labels), so every one is at least 4.6:1 even on the darkest cream. The plain colours stay for discs and fills. */
  --ds-cat-metabolic-text: #2d6d64;
  --ds-cat-neurological-text: #803b91;
  --ds-cat-neuromuscular-text: #913b5b;
  --ds-cat-lysosomal-text: #7a6023;
  --ds-cat-connective-text: #4c6d3b;
  --ds-cat-respiratory-text: #3b6591;
  --ds-cat-hematologic-text: #8a2e31;
  --ds-cat-endocrine-text: #62682f;
  --ds-cat-developmental-text: #326b7b;
  --ds-cat-inflammatory-text: #93532e;
  --ds-cat-sensory-text: #4451a7;
  --ds-danger-soft: #fbe7e4;
  --ds-shadow-sm: 0 1px 2px rgba(22,22,22,.06), 0 2px 8px rgba(22,22,22,.05);
  --ds-shadow-md: 0 8px 30px rgba(22,22,22,.10);
}
:root[data-theme="dark"] { --ds-ai: #9bc7a6; --ds-ai-soft: #1f2e24; --ds-ai-edge: #4f7a5e; --ds-danger-soft: #3a1f1c; --ds-surface-card: #1f1e1b; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --ds-ai: #9bc7a6; --ds-ai-soft: #1f2e24; --ds-ai-edge: #4f7a5e; --ds-danger-soft: #3a1f1c; --ds-surface-card: #1f1e1b; }
}
