/* ═══════════════════════════════════════════════════════════════════════
 * IPRS — Design Tokens
 * ───────────────────────────────────────────────────────────────────────
 * Single source of truth for color, type, spacing, depth.
 * ═══════════════════════════════════════════════════════════════════════ */

:root {
  /* ─── Color Palette ───────────────────────────────────────────── */
  /* Surface (paper-like, archival) */
  --bg:              #F1EBDC;
  --bg-elevated:     #FAF6EC;
  --bg-deep:         #E8E0CC;
  --bg-glass:        rgba(250, 246, 236, 0.72);

  /* Ink (text, contrast) */
  --ink:             #1F1B16;
  --ink-soft:        #4A453B;
  --ink-faint:       #7B7567;
  --ink-mute:        #9A9485;

  /* Brand accents */
  --amber:           #B8541A;
  --amber-bright:    #D85A30;
  --amber-deep:      #8B3F12;
  --green:           #2D5A3F;
  --green-bright:    #4A7A5F;

  /* Data palette (chart series, status) */
  --data-1:          #B8541A;   /* amber */
  --data-2:          #2D5A3F;   /* forest */
  --data-3:          #534AB7;   /* indigo */
  --data-4:          #D85A30;   /* coral */
  --data-5:          #2C5A7A;   /* steel blue */
  --data-6:          #8B6914;   /* bronze */
  --data-7:          #6B4423;   /* umber */
  --data-8:          #993C1D;   /* burnt sienna */

  /* Borders & rules */
  --rule:            #D5C8A8;
  --rule-soft:       rgba(184, 173, 142, 0.32);
  --rule-strong:     #B8AD8E;
  --rule-amber:      rgba(184, 84, 26, 0.32);

  /* Status */
  --status-ok:       #2D5A3F;
  --status-warn:     #B8541A;
  --status-error:    #993C1D;
  --status-info:     #2C5A7A;

  /* ─── Typography Scale ────────────────────────────────────────── */
  --font-serif:      'Fraunces', Georgia, serif;
  --font-mono:       'JetBrains Mono', 'Courier New', monospace;
  --font-sans:       -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;

  /* Sizing — minimum 12px per critique */
  --fs-micro:        12px;   /* was 9-10 */
  --fs-small:        13px;   /* was 11 */
  --fs-body:         14px;
  --fs-medium:       15px;
  --fs-large:        17px;
  --fs-title:        20px;
  --fs-headline:     26px;
  --fs-display:      32px;

  /* Line heights */
  --lh-tight:        1.25;
  --lh-snug:         1.4;
  --lh-base:         1.55;
  --lh-loose:        1.7;

  /* Letter spacing */
  --ls-tight:        -0.01em;
  --ls-normal:       0;
  --ls-wide:         0.02em;
  --ls-caps:         0.08em;

  /* ─── Spacing Rhythm (8pt baseline) ───────────────────────────── */
  --sp-1:            4px;
  --sp-2:            8px;
  --sp-3:            12px;
  --sp-4:            16px;
  --sp-5:            20px;
  --sp-6:            24px;
  --sp-7:            32px;
  --sp-8:            40px;
  --sp-9:            56px;
  --sp-10:           72px;

  /* ─── Depth & Elevation ───────────────────────────────────────── */
  /* Multi-layer shadows for refined depth */
  --shadow-1: 0 1px 2px rgba(31, 27, 22, 0.04),
              0 1px 1px rgba(31, 27, 22, 0.03);
  --shadow-2: 0 2px 4px rgba(31, 27, 22, 0.05),
              0 4px 8px rgba(31, 27, 22, 0.04);
  --shadow-3: 0 4px 12px rgba(31, 27, 22, 0.06),
              0 8px 24px rgba(31, 27, 22, 0.05);
  --shadow-4: 0 8px 24px rgba(31, 27, 22, 0.08),
              0 16px 48px rgba(31, 27, 22, 0.06);
  --shadow-modal: 0 20px 60px rgba(31, 27, 22, 0.18),
                  0 8px 24px rgba(31, 27, 22, 0.10);

  /* Inset (recessed surfaces, inputs) */
  --shadow-inset: inset 0 1px 2px rgba(31, 27, 22, 0.06);

  /* ─── Radii ───────────────────────────────────────────────────── */
  --r-sharp:         2px;
  --r-soft:          4px;
  --r-rounded:       6px;
  --r-pill:          999px;

  /* ─── Transition curves ───────────────────────────────────────── */
  --ease-out:        cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:     cubic-bezier(0.65, 0, 0.35, 1);
  --t-fast:          120ms;
  --t-base:          200ms;
  --t-slow:          320ms;

  /* ─── Layout dimensions ───────────────────────────────────────── */
  --toolbar-h:       52px;       /* was 64px — compact toolbar */
  --sidebar-w:       300px;      /* was 320px */
  --statusbar-h:     26px;       /* was 28px */
}

/* ─── Reset & Base ─────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  font-family: var(--font-mono);
  font-size: var(--fs-body);
  line-height: var(--lh-base);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

input {
  font-family: inherit;
  color: inherit;
}

hr {
  border: none;
  border-top: 1px solid var(--rule-soft);
}

/* Scrollbars — refined, minimal */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--rule);
  border-radius: var(--r-pill);
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--rule-strong);
}

/* Selection */
::selection {
  background: var(--amber);
  color: var(--bg-elevated);
}
