/* ==========================================================================
   Landgrave design tokens — single source of truth
   Light (default): Heritage — oxblood on cream.
   Dark: Signal — vermilion on warm ink.
   Switch with <html data-theme="dark">. Components must only use these
   variables, never raw hex values.
   ========================================================================== */

:root {
  /* ---- Brand constants (theme-independent) ---------------------------- */
  --lg-oxblood: #6E1E1E;
  --lg-signal: #FF6B3D;
  --lg-ink: #1A1715;
  --lg-cream: #F4EFE3;
  --lg-paper: #FBF8F1;

  /* ---- Typography ------------------------------------------------------ */
  --font-display: "Space Grotesk", ui-sans-serif, system-ui, sans-serif; /* wordmark, headings, big numbers */
  --font-sans: "Geist", ui-sans-serif, system-ui, sans-serif;            /* all UI text */
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;  /* data, IDs, metadata, overlines */

  --text-display: 56px;  --lh-display: 1.0;   --ls-display: -0.035em;
  --text-h1: 40px;       --lh-h1: 1.05;       --ls-h1: -0.035em;
  --text-h2: 28px;       --lh-h2: 1.1;        --ls-h2: -0.03em;
  --text-h3: 20px;       --lh-h3: 1.2;        --ls-h3: -0.02em;
  --text-title: 16px;    --lh-title: 1.3;     /* section titles, Geist 600 */
  --text-body-lg: 16px;  --lh-body-lg: 1.55;
  --text-body: 14px;     --lh-body: 1.5;
  --text-small: 13px;    --lh-small: 1.4;
  --text-caption: 12px;  --lh-caption: 1.35;
  --text-mono: 12px;
  --text-overline: 11px; --ls-overline: 0.12em; /* Geist Mono, uppercase */

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;

  /* ---- Space (4px base) ----------------------------------------------- */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 20px; --space-6: 24px; --space-8: 32px; --space-10: 40px;
  --space-12: 48px; --space-16: 64px;

  /* ---- Radius ---------------------------------------------------------- */
  --radius-xs: 4px;   /* kbd, meter segments */
  --radius-sm: 6px;   /* chips, tags */
  --radius-md: 8px;   /* buttons, inputs, nav items */
  --radius-lg: 10px;  /* cards, list panels */
  --radius-xl: 14px;  /* kanban columns, large containers */
  --radius-pill: 999px;

  /* ---- Layout ---------------------------------------------------------- */
  --sidebar-w: 232px;
  --topbar-h: 52px;
  --inspector-w: 420px;
  --statusbar-h: 28px;

  /* ---- Density: comfortable (default) --------------------------------- */
  /* Control sizes follow Blueprint's 4px scale. Switch the whole UI to the
     dense, Palantir-style sizes with <html data-density="compact">.        */
  --control-h-xs: 22px;   /* inline table actions, tag buttons */
  --control-h-sm: 28px;   /* toolbars, map controls, filters */
  --control-h: 34px;      /* default buttons and inputs */
  --control-h-lg: 42px;   /* the primary action in a panel or dialog */
  --row-h: 56px;          /* two-line list rows (results, inbox) */
  --table-row-h: 40px;    /* single-line data-table rows */
  --cell-px: 12px;        /* table cell horizontal padding */
  --panel-p: 16px;        /* panel / inspector padding */
  --icon: 16px;

  /* ---- Motion ---------------------------------------------------------- */
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --dur-fast: 120ms;
  --dur: 200ms;

  /* ---- Light theme (Heritage) ----------------------------------------- */
  color-scheme: light;
  --bg: #F4EFE3;            /* app canvas */
  --surface: #FBF8F1;       /* cards, main content, inputs */
  --surface-2: #EFE8DA;     /* chips, subtle fills, sidebar hover */
  --surface-3: #E6DECF;     /* selected nav, pressed */
  --sidebar: #F1EBDF;
  --border: #E3DACA;
  --border-strong: #D6CCBA;
  --text: #1A1715;
  --text-2: #4A433A;
  --text-3: #6F665A;        /* muted: metadata, captions (≥4.5:1 on --bg) */
  --text-4: #8A7F72;        /* placeholders, disabled — never body copy */

  --accent: #6E1E1E;        /* oxblood */
  --accent-hover: #591717;
  --accent-fg: #FFFFFF;     /* text/icons on --accent */
  --accent-text: #6E1E1E;   /* accent used as text/links on --bg/--surface */
  --accent-soft: rgba(110, 30, 30, 0.10);
  --accent-ring: rgba(110, 30, 30, 0.35);
  --mark: #6E1E1E;          /* logo mark colour in this theme */

  --success: #2F6B47;  --success-soft: rgba(47, 107, 71, 0.12);
  --warning: #8A5A00;  --warning-soft: rgba(138, 90, 0, 0.12);
  --danger:  #B42318;  --danger-soft: rgba(180, 35, 24, 0.10);
  --info:    #2D4E8A;  --info-soft: rgba(45, 78, 138, 0.10);

  /* Map */
  --map-bg: #EDE6D8;
  --map-parcel: #F7F3EA;
  --map-parcel-stroke: #DDD3C1;
  --map-water: #D9E2E1;
  --map-road: #E5DDCD;
  --map-selected-stroke: #1A1715;
  --map-node: #1A1715;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(26, 23, 21, 0.06);
  --shadow-md: 0 8px 24px rgba(26, 23, 21, 0.10);
  --shadow-lg: 0 18px 48px rgba(26, 23, 21, 0.18);
}

/* ---- Density: compact (Palantir / Blueprint sizes) -------------------- */
[data-density="compact"] {
  --control-h-xs: 20px;
  --control-h-sm: 24px;
  --control-h: 30px;
  --control-h-lg: 40px;
  --row-h: 44px;
  --table-row-h: 30px;
  --cell-px: 10px;
  --panel-p: 12px;
  --topbar-h: 48px;
}

/* ---- Dark theme (Signal) ---------------------------------------------- */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141110;
  --surface: #1A1614;
  --surface-2: #221C19;
  --surface-3: #2B2420;
  --sidebar: #181412;
  --border: #2B2420;
  --border-strong: #3A312B;
  --text: #EDE6DA;
  --text-2: #B5AA9C;
  --text-3: #9B9083;
  --text-4: #6B6157;

  --accent: #FF6B3D;        /* signal */
  --accent-hover: #FF8560;
  --accent-fg: #141110;     /* dark text on signal — white fails contrast */
  --accent-text: #FF8A66;
  --accent-soft: rgba(255, 107, 61, 0.14);
  --accent-ring: rgba(255, 107, 61, 0.45);
  --mark: #FF6B3D;

  --success: #4CC38A;  --success-soft: rgba(76, 195, 138, 0.14);
  --warning: #E8A93B;  --warning-soft: rgba(232, 169, 59, 0.14);
  --danger:  #F2555A;  --danger-soft: rgba(242, 85, 90, 0.14);
  --info:    #7FA7F5;  --info-soft: rgba(127, 167, 245, 0.14);

  --map-bg: #171311;
  --map-parcel: #221C19;
  --map-parcel-stroke: #2E2622;
  --map-water: #1E272A;
  --map-road: #1D1816;
  --map-selected-stroke: #F4EFE3;
  --map-node: #F4EFE3;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.55);
}
