/*
 * RB design tokens — the theming contract (spec §6.3).
 *
 * The CitrusPop palette primitives (CitrusPop/palette.md) are FIXED in both
 * themes; the semantic layer flips, so dark mode is a pure token flip —
 * every token is defined on BOTH body[data-theme="light"] and
 * body[data-theme="dark"], and no token exists in only one theme.
 *
 * Custom properties inherit into every shadow root: components theme
 * themselves by consuming these tokens and never hardcode theme colors.
 * Documented exception: rb-console keeps a fixed dark set ("the terminal
 * intentionally stays dark in both themes").
 */

body[data-theme="light"] {
  color-scheme: light;

  /* CitrusPop palette primitives (theme-independent) */
  --rb-paper: #fffdf8;
  --rb-ink: #101215;
  --rb-charcoal: #14161b;
  --rb-tangerine: #ff6b1a;
  --rb-lime: #c6f200;
  --rb-peach: #ffe6d8;

  /* Semantic layer — light values */
  --rb-surface: var(--rb-paper);
  --rb-surface-raised: #ffffff;
  --rb-surface-tint: var(--rb-peach);
  --rb-text: var(--rb-ink);
  --rb-text-muted: #52575e;
  --rb-text-soft: #4f5658;
  --rb-border: #dcded7;
  --rb-border-control: #c4c8c0;
  --rb-accent-text: #a63f00;
  --rb-shadow: 12px 12px 0 rgba(16, 18, 21, 0.22);

  /* v3 page rhythm: alternate section surface + dark closing band */
  --rb-surface-alt: #f5f2ea;
  --rb-band-bg: #101215;
  --rb-band-text: #f2f0e9;
  --rb-band-muted: #b9c0c7;

  /* Field chrome */
  --rb-field-bg: #ffffff;
  --rb-field-border: var(--rb-border);

  /* Button chrome */
  --rb-primary: var(--rb-ink);
  --rb-primary-text: #ffffff;
  --rb-border-strong: var(--rb-ink);
  --rb-border-strong-hover: var(--rb-ink);

  /* Stage/panel content chrome */
  --rb-surface-grid: rgba(16, 18, 21, 0.035);
  --rb-text-breadcrumb: #545b56;
  --rb-text-eyebrow: #5c6165;
  --rb-border-eyebrow: #b8bcb5;
  --rb-text-lead: #3c4246;
  --rb-text-note: #4e5550;
  --rb-text-body: #443f3b;
  --rb-text-legal: #3b4245;
  --rb-text-prompt: #625247;
  --rb-border-system: #101215;
  --rb-shadow-pop: 10px 10px 0 #101215;
  --rb-shadow-pop-small: 9px 9px 0 #101215;
  --rb-surface-address: #faf5f0;
  --rb-text-address: #353c3f;
  --rb-text-address-strong: #1f2427;

  /* Card + tag chrome */
  --rb-text-card: #41484c;
  --rb-text-example: #343c37;
  --rb-border-example: #d5d8d1;
  --rb-surface-raised-hover: #ffffff;
  --rb-shadow-card-hover: 0 22px 44px -26px rgba(16, 18, 21, 0.45);
  --rb-shadow-soft: 0 30px 70px -35px rgba(16, 18, 21, 0.55);
  --rb-tag-bg: rgba(255, 253, 248, 0.76);
  --rb-tag-border: #c9cdc5;
  --rb-tag-text: var(--rb-ink);

  /* Group C panel + agent demo chrome */
  --rb-text-mail-body: #474d51;
  --rb-text-mail-meta: #52595d;
  --rb-text-agent-copy: #3f4649;
  --rb-text-demo-label: #52595d;
  --rb-text-run-status: #4e5650;
  --rb-text-demo-hint: #555b56;
  --rb-text-fact-label: #525754;
  --rb-text-trial: #484f4a;
  --rb-text-facts: #444c48;
  --rb-text-status-running: #9a460e;
  --rb-text-status-done: #587000;
  --rb-text-step: #4e5550;
  --rb-text-step-done: #354000;
  --rb-text-step-check: #587000;
  --rb-text-draft: #3d4637;
  --rb-text-context-copy: var(--rb-ink);
  --rb-text-badge: var(--rb-ink);
  --rb-text-community: #41484c;
  --rb-text-speakers: #343a3d;
  --rb-text-process: #43494d;
  --rb-surface-demo: #ffffff;
  --rb-surface-agent-context: #f7f7f2;
  --rb-surface-step: #ffffff;
  --rb-surface-step-done: #f3f9df;
  --rb-surface-draft: #f1f5e7;
  --rb-surface-badge: rgba(255, 253, 248, 0.7);
  --rb-surface-process-hover: var(--rb-peach);
  --rb-watermark-rq: #e5e7df;
  --rb-border-step: #d9ddd5;
  --rb-border-step-done: #a8c634;
  --rb-chip-bg: #ffffff;
  --rb-chip-border: #cdd1c9;
  --rb-chip-text: var(--rb-ink);
  --rb-shadow-context: 7px 7px 0 var(--rb-lime);
  --rb-shadow-process-hover: none;

  /* Typography + motion (identical in both themes; tokens so shadow roots inherit) */
  --rb-font-sans: Space, system-ui, sans-serif;
  --rb-font-mono: "Ubuntu Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --rb-ease: cubic-bezier(0.22, 1, 0.36, 1);
  /* the intro's slow in-out curve for calm, larger movements */
  --rb-ease-calm: cubic-bezier(0.45, 0, 0.25, 1);
  --rb-radius: 14px;
}

body[data-theme="dark"] {
  color-scheme: dark;

  /* CitrusPop palette primitives (theme-independent) */
  --rb-paper: #fffdf8;
  --rb-ink: #101215;
  --rb-charcoal: #14161b;
  --rb-tangerine: #ff6b1a;
  --rb-lime: #c6f200;
  --rb-peach: #ffe6d8;

  /* Semantic layer — dark values */
  --rb-surface: var(--rb-charcoal);
  --rb-surface-raised: #1b1e23;
  --rb-surface-tint: #33251f;
  --rb-text: #f2f0e9;
  --rb-text-muted: #c2c8cf;
  --rb-text-soft: #b2bac2;
  --rb-border: #353a41;
  --rb-border-control: #4a5058;
  --rb-accent-text: #ffb17a;
  --rb-shadow: 12px 12px 0 rgba(0, 0, 0, 0.45);

  /* v3 page rhythm: alternate section surface + dark closing band */
  --rb-surface-alt: #181b20;
  --rb-band-bg: #0b0d10;
  --rb-band-text: #f2f0e9;
  --rb-band-muted: #b9c0c7;

  /* Field chrome */
  --rb-field-bg: #1d2025;
  --rb-field-border: #4a5058;

  /* Button chrome */
  --rb-primary: var(--rb-lime);
  --rb-primary-text: var(--rb-ink);
  --rb-border-strong: #69717a;
  --rb-border-strong-hover: var(--rb-tangerine);

  /* Stage/panel content chrome */
  --rb-surface-grid: rgba(255, 255, 255, 0.04);
  --rb-text-breadcrumb: #b2bac2;
  --rb-text-eyebrow: #b2bac2;
  --rb-border-eyebrow: #69717a;
  --rb-text-lead: #cbd1d8;
  --rb-text-note: #b4bcc4;
  --rb-text-body: #cbd1d8;
  --rb-text-legal: #cbd1d8;
  --rb-text-prompt: #c9baad;
  --rb-border-system: #4a5058;
  --rb-shadow-pop: 9px 9px 0 #000000;
  --rb-shadow-pop-small: 9px 9px 0 #000000;
  --rb-surface-address: #1d2026;
  --rb-text-address: #d0d6dc;
  --rb-text-address-strong: #f2f0e9;

  /* Card + tag chrome */
  --rb-text-card: #c8cfd6;
  --rb-text-example: #d4dce2;
  --rb-border-example: #363c44;
  --rb-surface-raised-hover: #20242a;
  --rb-shadow-card-hover: 0 22px 44px -22px rgba(0, 0, 0, 0.9);
  --rb-shadow-soft: 0 30px 70px -30px rgba(0, 0, 0, 0.85);
  --rb-tag-bg: #20242a;
  --rb-tag-border: #4a5058;
  --rb-tag-text: #d6dbe0;

  /* Group C panel + agent demo chrome */
  --rb-text-mail-body: #c2c8cf;
  --rb-text-mail-meta: #b2bac2;
  --rb-text-agent-copy: #c2c8cf;
  --rb-text-demo-label: #b2bac2;
  --rb-text-run-status: #b2bac2;
  --rb-text-demo-hint: #b2bac2;
  --rb-text-fact-label: #b2bac2;
  --rb-text-trial: #bec5cc;
  --rb-text-facts: #bec5cc;
  --rb-text-status-running: #ffad7a;
  --rb-text-status-done: var(--rb-lime);
  --rb-text-step: #ced4d9;
  --rb-text-step-done: #e0ead5;
  --rb-text-step-check: var(--rb-lime);
  --rb-text-draft: #e0ead5;
  --rb-text-context-copy: #cbd1d8;
  --rb-text-badge: #dce0e2;
  --rb-text-community: #c8cfd6;
  --rb-text-speakers: #f2f0e9;
  --rb-text-process: #c8cfd6;
  --rb-surface-demo: #181b20;
  --rb-surface-agent-context: #20242a;
  --rb-surface-step: #1d2025;
  --rb-surface-step-done: #26311a;
  --rb-surface-draft: #26311a;
  --rb-surface-badge: #1d2025;
  --rb-surface-process-hover: #20242a;
  --rb-watermark-rq: #2a2f38;
  --rb-border-step: #383e47;
  --rb-border-step-done: #7ea016;
  --rb-chip-bg: #20242a;
  --rb-chip-border: #4a5058;
  --rb-chip-text: #d6dbe0;
  --rb-shadow-context: 9px 9px 0 #000000;
  --rb-shadow-process-hover: 5px 5px 0 #000000;

  /* Typography + motion (identical in both themes) */
  --rb-font-sans: Space, system-ui, sans-serif;
  --rb-font-mono: "Ubuntu Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --rb-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --rb-ease-calm: cubic-bezier(0.45, 0, 0.25, 1);
  --rb-radius: 14px;
}
