/* =====================================================================
   ROBA OS design tokens — v1 · 2026-10-08
   ONE file for the marketing site, public auth, and the inner app.
   Components use ONLY the --rb-* names below.
   Switch theme with <html data-theme="classic|editorial|latimes|roba-orange">.
   Raw colour values live ONLY in this file.
   Values changed for WCAG AA are marked "AA:" with the original.
   ===================================================================== */

/* ---------------------------------------------------------------------
   Layer A — theme-independent scale (same in every theme)
   --------------------------------------------------------------------- */
:root {
  /* Type scale. App body text is 0.85–0.9rem; LP body is md. */
  --rb-text-xs: 0.75rem;   /* 12px  app labels, kickers */
  --rb-text-sm: 0.875rem;  /* 14px  app controls (button/input font) */
  --rb-text-md: 1rem;      /* 16px  LP body, auth inputs (no iOS zoom) */
  --rb-text-lg: 1.125rem;  /* 18px  lead paragraphs */
  --rb-text-xl: 1.375rem;  /* 22px  section sub-heads, price */
  --rb-text-2xl: 1.75rem;  /* 28px  section titles */
  --rb-text-3xl: clamp(2rem, 4.5vw, 2.75rem); /* LP hero H1 */

  --rb-leading-tight: 1.15;
  --rb-leading-snug: 1.3;
  --rb-leading-body: 1.6;

  --rb-weight-regular: 400;
  --rb-weight-medium: 500;
  --rb-weight-semibold: 650; /* app's "active / strong" weight */
  --rb-weight-bold: 700;

  --rb-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  /* Spacing (4px base). */
  --rb-space-1: 0.25rem;  /*  4px */
  --rb-space-2: 0.5rem;   /*  8px */
  --rb-space-3: 0.75rem;  /* 12px */
  --rb-space-4: 1rem;     /* 16px */
  --rb-space-5: 1.25rem;  /* 20px */
  --rb-space-6: 1.5rem;   /* 24px */
  --rb-space-7: 2rem;     /* 32px */
  --rb-space-8: 2.5rem;   /* 40px */
  --rb-space-9: 3.5rem;   /* 56px  LP section rhythm */
  --rb-space-10: 4rem;    /* 64px */

  --rb-radius-pill: 999px;

  /* Control heights. 44px = public/LP touch target.
     Dense = the app's existing --ctrl-h (inner app toolbars). */
  --rb-control-h: 44px;
  --rb-control-h-dense: 1.75rem;
  --rb-control-h-dense-sm: 1.5rem;

  --rb-focus-width: 2px;
  --rb-focus-offset: 2px;

  /* One open/close move for the rail and the detail. Same in every theme. */
  --rb-panel-move: 0.2s ease;
}

/* Quiet chrome. One alias, on :root and any themed element, so it
   recomputes when that element sets --rb-text-muted. A lone :root
   var() would inherit as the root color and ignore theme overrides. */
:root,
[data-theme] {
  --rb-muted: var(--rb-text-muted);
}

/* ---------------------------------------------------------------------
   Layer B — themes. Values FROM THE APP. Classic = default.
   --------------------------------------------------------------------- */

/* Classic — warm paper, ink text, beige chips, forest-green CTA. */
:root,
[data-theme="classic"] {
  color-scheme: light;
  --rb-bg: #faf9f6;
  --rb-surface: #ffffff;
  --rb-surface-2: #f4f1ea;
  --rb-text: #2c2a26;
  --rb-text-soft: #4a433c;
  --rb-text-muted: #716c64;       /* AA: app --muted #746f66 = 4.42 on surface-2; darkened same hue → 4.62 */
  --rb-text-dim: #aea89e;         /* decorative / placeholder only, never body text */
  --rb-border: #e6e1d6;
  --rb-border-strong: #cfc6b8;
  --rb-primary: #2f5d50;
  --rb-primary-hover: #274c42;
  --rb-on-primary: #ffffff;
  --rb-selected: #e8e2d6;         /* app --accent (pressed seg, chips, menu "on") */
  --rb-on-selected: #2c2a26;
  --rb-selected-border: #cfc6b8;
  --rb-link: #2c2a26;             /* app links = ink + underline */
  --rb-link-hover: #2f5d50;
  --rb-danger: #ad5246;           /* AA: app --danger #b85c50 = 4.26 on bg; darkened same hue → 4.90 */
  --rb-error: #c0392b;            /* app --err, unchanged. Not the AA danger tweak. */
  --rb-danger-soft: #fdecea;
  --rb-danger-border: #e0c4bf;
  --rb-success: #2f5d50;
  --rb-success-soft: #e4efe9;
  --rb-on-success-soft: #1e3d34;
  --rb-star: #e3b341;
  --rb-notice-bg: #fdecea;
  --rb-notice-text: #ad5246;
  --rb-notice-border: #e0c4bf;
  --rb-focus-ring: #2c2a26;
  --rb-overlay: rgba(26, 20, 18, 0.18);
  --rb-scrim: color-mix(in srgb, var(--rb-text) 35%, transparent);
  --rb-info-bg: #e7eef2;
  --rb-info-text: #1e3a4c;
  --rb-skeleton: #ebe6dc;
  --rb-theme-color: #faf9f6;
  --rb-font-sans: system-ui, -apple-system, sans-serif;
  --rb-font-display: system-ui, -apple-system, sans-serif;
  --rb-display-tracking: -0.02em;
  --rb-radius-sm: 6px;
  --rb-radius-md: 8px;
  --rb-radius-lg: 12px;
  --rb-radius-control: var(--rb-radius-pill);
  --rb-shadow-1: 0 1px 0 rgba(26, 20, 18, 0.06);
  --rb-shadow-2: 0 10px 24px rgba(26, 20, 18, 0.1);
  --rb-shadow-edge: -10px 0 28px rgba(44, 42, 38, 0.07); /* right-hand sheet, classic ink */
  /* Person dots. ≥3:1 on --rb-bg; distinct from each other and from --rb-selected (--accent). */
  --person-me: #1d4ed8;
  --person-1: #a94e08;            /* darker than #b45309 so text clears 4.5:1 on --rb-surface-2 */
  --person-2: #48730e;
  --person-3: #86198f;
  --person-4: #be185d;
}

/* Editorial — salmon paper, claret, serif display. */
[data-theme="editorial"] {
  color-scheme: light;
  --rb-bg: #fff1e5;
  --rb-surface: #fffaf4;
  --rb-surface-2: #f6e6d6;
  --rb-text: #1a1412;
  --rb-text-soft: #3a2e28;
  --rb-text-muted: #5a4a42;
  --rb-text-dim: #9a8578;
  --rb-border: #e8d2c0;
  --rb-border-strong: #d4c4b0;
  --rb-primary: #990f3d;
  --rb-primary-hover: #7a0c31;
  --rb-on-primary: #fff8f1;
  --rb-selected: #990f3d;
  --rb-on-selected: #fff8f1;
  --rb-selected-border: #7a0c31;
  --rb-link: #1a1412;
  --rb-link-hover: #990f3d;
  --rb-danger: #9a2f2a;
  --rb-error: #8f1d28;            /* app --err, unchanged */
  --rb-danger-soft: #f8e4df;
  --rb-danger-border: #e4b8b0;
  --rb-success: #2f5d50;          /* app has no Editorial green; reuses the app's only green */
  --rb-success-soft: #e4efe9;
  --rb-on-success-soft: #1e3d34;
  --rb-star: #d4a017;
  --rb-notice-bg: #f8e4df;
  --rb-notice-text: #9a2f2a;
  --rb-notice-border: #e4b8b0;
  --rb-focus-ring: #1a1412;
  --rb-overlay: rgba(26, 20, 18, 0.18);
  --rb-scrim: color-mix(in srgb, var(--rb-text) 35%, transparent);
  --rb-info-bg: #e4eef2;
  --rb-info-text: #1d4e5f;
  --rb-skeleton: #edd9c8;
  --rb-theme-color: #fff1e5;
  --rb-font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  --rb-font-display: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --rb-display-tracking: -0.015em; /* h1. Phone titles stay tighter than this. */
  --rb-radius-sm: 5px;
  --rb-radius-md: 8px;
  --rb-radius-lg: 14px;
  --rb-radius-control: var(--rb-radius-pill);
  --rb-shadow-1: 0 1px 0 rgba(26, 20, 18, 0.06);
  --rb-shadow-2: 0 10px 24px rgba(26, 20, 18, 0.1);
  --rb-shadow-edge: -10px 0 28px rgba(26, 20, 18, 0.07);
  /* person-4 is cyan, not pink: pink sits on the claret accent. */
  --person-me: #1d4ed8;
  --person-1: #a94e08;
  --person-2: #48730e;
  --person-3: #86198f;
  --person-4: #155e75;
}

/* LA Times — newsprint white, ink, tight radii, display serif. */
[data-theme="latimes"] {
  color-scheme: light;
  --rb-bg: #ffffff;
  --rb-surface: #ffffff;
  --rb-surface-2: #f4f4f4;
  --rb-text: #111111;
  --rb-text-soft: #3d3d3d;
  --rb-text-muted: #5c5c5c;
  --rb-text-dim: #8a8a8a;
  --rb-border: #d0d0d0;
  --rb-border-strong: #cccccc;    /* LAT input border */
  --rb-primary: #111111;
  --rb-primary-hover: #000000;
  --rb-on-primary: #ffffff;
  --rb-selected: #111111;
  --rb-on-selected: #ffffff;
  --rb-selected-border: #111111;
  --rb-link: #111111;
  --rb-link-hover: #000000;
  --rb-danger: #8b1a1a;
  --rb-error: #8b1a1a;            /* app --err, same ink as danger */
  --rb-danger-soft: #f7efef;
  --rb-danger-border: #d4b4b4;
  --rb-success: #2f5d50;          /* app has no LAT green; reuses the app's only green */
  --rb-success-soft: #e4efe9;
  --rb-on-success-soft: #1e3d34;
  --rb-star: #c4a000;
  --rb-notice-bg: #f7efef;
  --rb-notice-text: #8b1a1a;
  --rb-notice-border: #d4b4b4;
  --rb-focus-ring: #111111;
  --rb-overlay: rgba(26, 20, 18, 0.18);
  --rb-scrim: color-mix(in srgb, var(--rb-text) 35%, transparent);
  --rb-info-bg: #eef2f4;
  --rb-info-text: #1f3a45;
  --rb-skeleton: #e8e8e8;
  --rb-theme-color: #ffffff;
  --rb-font-sans: system-ui, "Helvetica Neue", Helvetica, Arial, sans-serif;
  --rb-font-display: "Libre Bodoni", "Bodoni MT", Didot, "Times New Roman", serif;
  --rb-display-tracking: -0.02em;
  --rb-radius-sm: 2px;
  --rb-radius-md: 2px;
  --rb-radius-lg: 4px;
  --rb-radius-control: 2px;
  --rb-shadow-1: 0 1px 0 rgba(0, 0, 0, 0.06); /* hairline; --shadow still aliases here */
  --rb-shadow-2: 0 10px 24px rgba(0, 0, 0, 0.12); /* popover */
  --rb-shadow-edge: -10px 0 28px rgba(0, 0, 0, 0.08);
  --person-me: #1d4ed8;
  --person-1: #b45309;
  --person-2: #4d7c0f;
  --person-3: #86198f;
  --person-4: #be185d;
}

/* ROBA Orange (optional) — today's public auth look (/login, /signup)
   so nothing is lost. Slate paper + orange CTA. */
[data-theme="roba-orange"] {
  color-scheme: light;
  --rb-bg: #f8fafc;
  --rb-surface: #ffffff;
  --rb-surface-2: #fff7ed;
  --rb-text: #0f172a;
  --rb-text-soft: #334155;       /* derived: slate step between auth #0F172A and #475569 (not in auth CSS) */
  --rb-text-muted: #475569;
  --rb-text-dim: #94a3b8;         /* derived: slate placeholder tone (not in auth CSS); decorative only */
  --rb-border: #e2e8f0;
  --rb-border-strong: #d0d7e2;
  --rb-primary: #c2410c;          /* AA: auth #EA580C = 3.56 with white; auth's own hover #C2410C → 5.18 */
  --rb-primary-hover: #9a3412;
  --rb-on-primary: #ffffff;
  --rb-selected: #fff7ed;
  --rb-on-selected: #9a3412;
  --rb-selected-border: #c2410c;
  --rb-link: #c2410c;             /* AA: auth link #EA580C = 3.40 on bg → 4.95 */
  --rb-link-hover: #9a3412;
  --rb-danger: #c0392b;
  --rb-error: #c0392b;
  --rb-danger-soft: #fdecea;
  --rb-danger-border: #e0c4bf;
  --rb-success: #2f5d50;
  --rb-success-soft: #e4efe9;
  --rb-on-success-soft: #1e3d34;
  --rb-star: #e3b341;
  --rb-notice-bg: #fff7ed;
  --rb-notice-text: #9a3412;
  --rb-notice-border: #c2410c;
  --rb-focus-ring: #0f172a;
  --rb-overlay: rgba(15, 23, 42, 0.18);
  --rb-scrim: color-mix(in srgb, var(--rb-text) 35%, transparent);
  --rb-info-bg: #e8eef5;
  --rb-info-text: #1e3a5f;
  --rb-skeleton: #e2e8f0;
  --rb-theme-color: #f8fafc;
  --rb-font-sans: system-ui, -apple-system, sans-serif;   /* auth renders Classic fonts (theme.js resets to classic) */
  --rb-font-display: system-ui, -apple-system, sans-serif;
  --rb-display-tracking: -0.02em;
  --rb-radius-sm: 6px;
  --rb-radius-md: 8px;
  --rb-radius-lg: 12px;
  --rb-radius-control: var(--rb-radius-pill);
  --rb-shadow-1: 0 1px 0 rgba(15, 23, 42, 0.06);
  --rb-shadow-2: 0 10px 24px rgba(15, 23, 42, 0.1);
  --rb-shadow-edge: -10px 0 28px rgba(15, 23, 42, 0.07);
  /* person-1 is teal, not amber: amber sits on the orange primary. */
  --person-me: #1d4ed8;
  --person-1: #0f766e;
  --person-2: #4d7c0f;
  --person-3: #86198f;
  --person-4: #be185d;
}
