/*
 * Sago Two-Editions Canonical Design Tokens (V3 Locked Direction - 26 Nov 2026)
 * Source of truth for sago-prepared (apps/portal, apps/accounts) and sago-bot (src/web).
 *
 * Usage:
 *   <html data-edition="public">                       -> Daylight Intelligence (default light)
 *   <html data-edition="bunker">                       -> Swiss Vault (locked Bunker light crimson)
 *   <html data-edition="bunker" data-theme="dark">     -> Soft Graphite Dark (preserved for future dark mode)
 */

:root {
  /* Typography */
  --sago-font-serif: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --sago-font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --sago-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Type Scale */
  --sago-text-xs: 0.6875rem;      /* 11px - eyebrows, pills, timestamps */
  --sago-text-sm: 0.78125rem;     /* 12.5px - metadata, captions, buttons */
  --sago-text-base: 0.84375rem;   /* 13.5px - body copy, cards, nav links */
  --sago-text-md: 0.96875rem;     /* 15.5px - card headings */
  --sago-text-lg: 1.25rem;        /* 20px - section headings, stat values */
  --sago-text-display: clamp(1.75rem, 3vw, 2.375rem); /* 28px-38px serif H1 */

  /* Spacing Scale */
  --sago-space-1: 4px;
  --sago-space-2: 8px;
  --sago-space-3: 12px;
  --sago-space-4: 16px;
  --sago-space-5: 20px;
  --sago-space-6: 24px;
  --sago-space-7: 28px;
  --sago-space-8: 32px;

  /* Layout Dimensions */
  --sago-max-width: 1440px;
  --sago-top-ribbon-h: 32px;
  --sago-top-nav-h: 60px;
  --sago-aside-w: 350px;
  --sago-col-gap: 28px;

  /* Radii */
  --sago-radius-xs: 5px;
  --sago-radius-sm: 8px;
  --sago-radius-input: 10px;
  --sago-radius-md: 12px;
  --sago-radius-lg: 15px;
  --sago-radius-modal: 16px;
  --sago-radius-xl: 20px;
  --sago-radius-pill: 999px;

  /* Overlays */
  --sago-backdrop: rgba(15, 10, 12, 0.45);

  /* Z-index Layers */
  --sago-z-sticky: 20;
  --sago-z-nav: 30;
  --sago-z-ribbon: 40;
  --sago-z-dropdown: 50;
  --sago-z-modal: 60;

  /* Brand Node Colors (Public Sago Emblem) */
  --sago-brand-orange: #ff6432;
  --sago-brand-yellow: #ffc81e;
  --sago-brand-green: #8db92f;
  --sago-brand-forest: #143223;

  /* Semantic Status Colors (Shared Light Baseline) */
  --sago-status-public-bg: #ecfdf3;
  --sago-status-public-border: #bbf7d0;
  --sago-status-public-text: #166534;

  --sago-status-review-bg: #fef3c7;
  --sago-status-review-border: #fde68a;
  --sago-status-review-accent: #d97706;
  --sago-status-review-text: #92400e;

  --sago-status-person-bg: #f4f4f5;
  --sago-status-person-border: #e4e4e7;
  --sago-status-person-text: #27272a;

  --sago-status-indigo-bg: #eef2ff;
  --sago-status-indigo-text: #3730a3;

  --sago-person-card-wash: linear-gradient(180deg, #fffdf8 0%, #ffffff 38%);
  --sago-person-card-border: #f0da9f;
  --sago-person-card-edge: #d97706;

  --sago-error-bg: #fef2f2;
  --sago-error-border: #fecaca;
  --sago-error-text: #b91c1c;

  --sago-diff-del-bg: #fee2e2;
  --sago-diff-del-text: #991b1b;
  --sago-diff-add-bg: #dcfce7;
  --sago-diff-add-text: #166534;

  /* Touch Targets */
  --sago-touch-min-mobile: 44px;
}

/* ==========================================================================
 * 1. PUBLIC EDITION - "Daylight Intelligence"
 * ========================================================================== */
:root,
[data-edition='public'] {
  --sago-bg-canvas: #faf9f5;
  --sago-bg-surface: #ffffff;
  --sago-bg-subtle: #f5f3ec;
  --sago-bg-muted: #f3f1ea;
  --sago-bg-hover: #eeece4;

  --sago-border: #e7e3d9;
  --sago-border-strong: #dedad0;
  --sago-border-subtle: #f1efe8;

  --sago-text: #13221a;
  --sago-text-secondary: #3e4f45;
  --sago-text-muted: #516359;
  --sago-text-subtle: #58695f;

  --sago-accent: #143223;
  --sago-accent-hover: #1d4531;
  --sago-accent-text: #ffffff;
  --sago-accent-soft-bg: #ecfdf3;
  --sago-accent-soft-border: #bbf7d0;
  --sago-accent-soft-text: #166534;

  --sago-nav-active: #0f2419;
  --sago-nav-indicator: #143223;

  --sago-card-shadow: 0 2px 8px rgba(17, 34, 25, 0.03);
  --sago-elevated-shadow: 0 12px 32px rgba(17, 34, 25, 0.08);
  /* Solid layers: a surface gap, then the accent, so the ring passes 3:1 on surfaces and on accent buttons (section 7). */
  --sago-focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #143223;

  --sago-chat-user-bg: #143223;
  --sago-chat-user-text: #ffffff;
}

/* ==========================================================================
 * 2. BUNKER EDITION - "Swiss Vault" (Locked Light Crimson Direction)
 * ========================================================================== */
[data-edition='bunker'] {
  --sago-bg-canvas: #f7f4f4;
  --sago-bg-surface: #ffffff;
  --sago-bg-subtle: #f9f7f7;
  --sago-bg-muted: #f3f0f0;
  --sago-bg-hover: #f5ecee;

  --sago-border: #e8dadc;
  --sago-border-strong: #e3cfd3;
  --sago-border-subtle: #f3eaeb;

  --sago-text: #1f1215;
  --sago-text-secondary: #4a383d;
  --sago-text-muted: #675056;
  --sago-text-subtle: #70585f;

  --sago-accent: #9f1239;
  --sago-accent-hover: #881337;
  --sago-accent-text: #ffffff;
  --sago-accent-soft-bg: #fff1f2;
  --sago-accent-soft-border: #fecdd3;
  --sago-accent-soft-text: #9f1239;

  --sago-nav-active: #881337;
  --sago-nav-indicator: #9f1239;

  /* Bunker Perimeter & MNPI Surface Tokens */
  --sago-bunker-ribbon-start: #7f102b;
  --sago-bunker-ribbon-mid: #9f1239;
  --sago-bunker-ribbon-text: #ffffff;
  --sago-bunker-beacon: #fda4af;
  --sago-bunker-frame-border: #9f1239;

  --sago-mnpi-badge-bg: #9f1239;
  --sago-mnpi-badge-text: #ffffff;
  --sago-mnpi-soft-bg: #ffe4e6;
  --sago-mnpi-soft-text: #9f1239;
  --sago-mnpi-card-wash: linear-gradient(180deg, #fff9fa 0%, #ffffff 38%);
  --sago-mnpi-card-border: #f0bdc8;
  --sago-mnpi-card-edge: #9f1239;

  /* Daylight Public Pulse Card inside Sago Bunker */
  --sago-pulse-inside-bunker-bg: #faf9f4;
  --sago-pulse-inside-bunker-border: #dcd8cc;
  --sago-pulse-inside-bunker-edge: #16a34a;
  --sago-pulse-inside-bunker-text: #13221a;

  --sago-card-shadow: 0 2px 8px rgba(31, 18, 21, 0.025);
  --sago-elevated-shadow: 0 8px 24px rgba(159, 18, 57, 0.09);
  --sago-focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #9f1239;

  --sago-chat-user-bg: #881337;
  --sago-chat-user-text: #ffffff;
}

/* ==========================================================================
 * 3. BUNKER DARK MODE (Preserved - "Soft Graphite & Oxblood")
 *    Kept ready for a future user dark-mode switch; not active by default.
 * ========================================================================== */
[data-edition='bunker'][data-theme='dark'] {
  --sago-bg-canvas: #1d1b1f;
  --sago-bg-surface: #262328;
  --sago-bg-subtle: #221f24;
  --sago-bg-muted: #2e2931;
  --sago-bg-hover: #352e38;

  --sago-border: #3a333d;
  --sago-border-strong: #4a3f4d;
  --sago-border-subtle: #322c35;

  --sago-text: #f3eeef;
  --sago-text-secondary: #d7cbd0;
  --sago-text-muted: #b4a3aa;
  --sago-text-subtle: #a899a1;

  --sago-accent: #e11d48;
  --sago-accent-hover: #be123c;
  --sago-accent-text: #ffffff;
  --sago-accent-soft-bg: rgba(225, 29, 72, 0.18);
  --sago-accent-soft-border: rgba(251, 113, 133, 0.35);
  --sago-accent-soft-text: #fda4af;

  --sago-nav-active: #ffffff;
  --sago-nav-indicator: #e11d48;

  --sago-bunker-ribbon-start: #4c1120;
  --sago-bunker-ribbon-mid: #78172e;
  --sago-bunker-ribbon-text: #ffe4e6;
  --sago-bunker-beacon: #fda4af;
  --sago-bunker-frame-border: rgba(225, 29, 72, 0.5);

  --sago-mnpi-badge-bg: #e11d48;
  --sago-mnpi-badge-text: #ffffff;
  --sago-mnpi-soft-bg: rgba(225, 29, 72, 0.22);
  --sago-mnpi-soft-text: #fda4af;
  --sago-mnpi-card-wash: linear-gradient(180deg, #312127 0%, #262328 50%);
  --sago-mnpi-card-border: #7f243b;
  --sago-mnpi-card-edge: #e11d48;

  --sago-status-public-bg: rgba(16, 185, 129, 0.16);
  --sago-status-public-border: rgba(16, 185, 129, 0.3);
  --sago-status-public-text: #6ee7b7;

  --sago-status-review-bg: rgba(245, 158, 11, 0.18);
  --sago-status-review-border: rgba(245, 158, 11, 0.4);
  --sago-status-review-text: #fcd34d;

  --sago-status-person-bg: #3a343e;
  --sago-status-person-border: #4e4654;
  --sago-status-person-text: #ffffff;

  --sago-status-indigo-bg: rgba(99, 102, 241, 0.2);
  --sago-status-indigo-text: #c7d2fe;

  --sago-person-card-wash: linear-gradient(180deg, rgba(245, 158, 11, 0.12) 0%, #262328 45%);
  --sago-person-card-border: #57442a;
  --sago-person-card-edge: #f59e0b;

  --sago-error-bg: rgba(239, 68, 68, 0.16);
  --sago-error-border: rgba(248, 113, 113, 0.35);
  --sago-error-text: #fca5a5;

  --sago-diff-del-bg: rgba(239, 68, 68, 0.22);
  --sago-diff-del-text: #fca5a5;
  --sago-diff-add-bg: rgba(16, 185, 129, 0.22);
  --sago-diff-add-text: #6ee7b7;

  --sago-card-shadow: 0 4px 16px rgba(0, 0, 0, 0.28);
  --sago-elevated-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  /* Lighter than the accent: the accent ring reaches only 2.3:1 to 2.8:1 on hover rows, person cards, and the ribbon. */
  --sago-focus-ring: 0 0 0 2px #262328, 0 0 0 4px #fb7185;

  --sago-chat-user-bg: #4c1626;
  --sago-chat-user-text: #fff1f2;
}
