/*
 * SotoComing UI contract.
 * Fonts are loaded once by the document, not imported by this file.
 * Keep raw design values in the primitive section. Components use roles.
 */
:root {
  /* Primitives: palette */
  --soto-p-ink-950: #110e19;
  --soto-p-ink-900: #1b1524;
  --soto-p-ink-850: #251c30;
  --soto-p-ink-800: #30243d;
  --soto-p-ink-750: #3b2c49;
  --soto-p-plum-700: #493650;
  --soto-p-plum-500: #80618f;
  --soto-p-plum-300: #b9a7c6;
  --soto-p-plum-200: #d0c0da;
  --soto-p-plum-100: #ddb6ec;
  --soto-p-plum-50: #f6eff9;
  --soto-p-violet-600: #83469b;
  --soto-p-violet-500: #9655af;
  --soto-p-violet-700: #713b87;
  --soto-p-white: #ffffff;
  --soto-p-green-200: #a9d6b4;
  --soto-p-green-950: #1a3027;
  --soto-p-amber-200: #efd39a;
  --soto-p-amber-950: #342b1c;
  --soto-p-red-200: #ffb4b4;
  --soto-p-red-950: #382129;
  --soto-p-blue-200: #adcdf0;
  --soto-p-blue-950: #1d2a3a;
  --soto-p-map-land: #141c14;
  --soto-p-overlay: rgb(9 6 15 / 76%);

  /* Primitives: type */
  --soto-p-font-sans: Manrope, system-ui, sans-serif;
  --soto-p-font-mono: "IBM Plex Mono", Consolas, ui-monospace, monospace;
  --soto-p-text-xs: 0.75rem;
  --soto-p-text-sm: 0.875rem;
  --soto-p-text-base: 1rem;
  --soto-p-text-lg: 1.125rem;
  --soto-p-text-xl: 1.25rem;
  --soto-p-text-2xl: 1.5rem;
  --soto-p-text-3xl: 1.875rem;
  --soto-p-text-4xl: 2.25rem;
  --soto-p-leading-xs: 1rem;
  --soto-p-leading-sm: 1.25rem;
  --soto-p-leading-base: 1.5rem;
  --soto-p-leading-lg: 1.75rem;
  --soto-p-leading-2xl: 2rem;
  --soto-p-leading-3xl: 2.25rem;
  --soto-p-leading-4xl: 2.5rem;
  --soto-p-weight-normal: 400;
  --soto-p-weight-medium: 500;
  --soto-p-weight-semibold: 600;
  --soto-p-weight-bold: 700;

  /* Primitives: 4px spacing rhythm */
  --soto-p-space-0: 0;
  --soto-p-space-half: 0.125rem;
  --soto-p-space-1: 0.25rem;
  --soto-p-space-2: 0.5rem;
  --soto-p-space-3: 0.75rem;
  --soto-p-space-4: 1rem;
  --soto-p-space-6: 1.5rem;
  --soto-p-space-8: 2rem;
  --soto-p-space-10: 2.5rem;
  --soto-p-space-11: 2.75rem;
  --soto-p-space-12: 3rem;
  --soto-p-space-16: 4rem;
  --soto-p-space-20: 5rem;
  --soto-p-space-24: 6rem;
  --soto-p-radius-sm: 0.5rem;
  --soto-p-radius-md: 0.75rem;
  --soto-p-radius-lg: 1rem;
  --soto-p-radius-pill: 999px;
  --soto-p-duration-fast: 220ms;
  --soto-p-duration-normal: 320ms;
  --soto-p-duration-slow: 600ms;
  --soto-p-ease-out: cubic-bezier(0.22, 1, 0.36, 1);

  --soto-p-content-width: 1200px;
  --soto-p-reading-width: 68ch;
  --soto-p-border-width: 1px;
  --soto-p-focus-width: 2px;
  --soto-p-focus-offset: 3px;

  /* Semantic roles: surfaces and content */
  --soto-bg: var(--soto-p-ink-950);
  --soto-surface: var(--soto-p-ink-900);
  --soto-surface-raised: var(--soto-p-ink-850);
  --soto-surface-hover: var(--soto-p-ink-800);
  --soto-surface-active: var(--soto-p-ink-750);
  --soto-text: var(--soto-p-plum-50);
  --soto-text-secondary: var(--soto-p-plum-200);
  --soto-text-muted: var(--soto-p-plum-300);
  --soto-border: var(--soto-p-plum-700);
  --soto-border-strong: var(--soto-p-plum-500);
  --soto-accent: var(--soto-p-plum-100);
  --soto-action: var(--soto-p-violet-600);
  --soto-action-hover: var(--soto-p-violet-500);
  --soto-action-active: var(--soto-p-violet-700);
  --soto-on-action: var(--soto-p-white);
  --soto-success: var(--soto-p-green-200);
  --soto-success-bg: var(--soto-p-green-950);
  --soto-warning: var(--soto-p-amber-200);
  --soto-warning-bg: var(--soto-p-amber-950);
  --soto-danger: var(--soto-p-red-200);
  --soto-danger-bg: var(--soto-p-red-950);
  --soto-info: var(--soto-p-blue-200);
  --soto-info-bg: var(--soto-p-blue-950);
  --soto-map-land: var(--soto-p-map-land);
  --soto-overlay: var(--soto-p-overlay);
  --soto-focus: var(--soto-accent);
  --soto-selection-bg: var(--soto-action);
  --soto-selection-text: var(--soto-on-action);

  /* Semantic roles: typography, spacing, shape, motion */
  --soto-font: var(--soto-p-font-sans);
  --soto-font-mono: var(--soto-p-font-mono);
  --soto-text-xs: var(--soto-p-text-xs);
  --soto-text-sm: var(--soto-p-text-sm);
  --soto-text-base: var(--soto-p-text-base);
  --soto-text-lg: var(--soto-p-text-lg);
  --soto-text-xl: var(--soto-p-text-xl);
  --soto-text-2xl: var(--soto-p-text-2xl);
  --soto-text-3xl: var(--soto-p-text-3xl);
  --soto-text-4xl: var(--soto-p-text-4xl);
  --soto-leading-xs: var(--soto-p-leading-xs);
  --soto-leading-sm: var(--soto-p-leading-sm);
  --soto-leading-base: var(--soto-p-leading-base);
  --soto-leading-lg: var(--soto-p-leading-lg);
  --soto-leading-2xl: var(--soto-p-leading-2xl);
  --soto-leading-3xl: var(--soto-p-leading-3xl);
  --soto-leading-4xl: var(--soto-p-leading-4xl);
  --soto-weight-normal: var(--soto-p-weight-normal);
  --soto-weight-medium: var(--soto-p-weight-medium);
  --soto-weight-semibold: var(--soto-p-weight-semibold);
  --soto-weight-bold: var(--soto-p-weight-bold);
  --soto-border-width: var(--soto-p-border-width);
  --soto-space-0: var(--soto-p-space-0);
  --soto-space-half: var(--soto-p-space-half);
  --soto-space-1: var(--soto-p-space-1);
  --soto-space-2: var(--soto-p-space-2);
  --soto-space-3: var(--soto-p-space-3);
  --soto-space-4: var(--soto-p-space-4);
  --soto-space-6: var(--soto-p-space-6);
  --soto-space-8: var(--soto-p-space-8);
  --soto-space-10: var(--soto-p-space-10);
  --soto-space-11: var(--soto-p-space-11);
  --soto-space-12: var(--soto-p-space-12);
  --soto-space-16: var(--soto-p-space-16);
  --soto-space-20: var(--soto-p-space-20);
  --soto-space-24: var(--soto-p-space-24);
  --soto-radius-sm: var(--soto-p-radius-sm);
  --soto-radius-md: var(--soto-p-radius-md);
  --soto-radius-lg: var(--soto-p-radius-lg);
  --soto-radius-pill: var(--soto-p-radius-pill);
  --soto-duration-fast: var(--soto-p-duration-fast);
  --soto-duration-normal: var(--soto-p-duration-normal);
  --soto-duration-slow: var(--soto-p-duration-slow);
  --soto-ease: var(--soto-p-ease-out);

  /* Component roles: use overrides on a surface instead of new primitives. */
  --soto-header-height: var(--soto-space-16);
  --soto-control-height: var(--soto-space-11);
  --soto-control-padding-x: var(--soto-space-4);
  --soto-control-radius: var(--soto-radius-sm);
  --soto-control-bg: var(--soto-bg);
  --soto-control-border: var(--soto-border-strong);
  --soto-control-font-size: var(--soto-text-sm);
  --soto-panel-padding: var(--soto-space-6);
  --soto-panel-radius: var(--soto-radius-md);
  --soto-table-row-height: var(--soto-space-12);
  --soto-content-width: var(--soto-p-content-width);
  --soto-reading-width: var(--soto-p-reading-width);
  --soto-gutter: var(--soto-space-8);
  --soto-focus-width: var(--soto-p-focus-width);
  --soto-focus-offset: var(--soto-p-focus-offset);

  /* Compatibility boundary for existing modules; do not add new aliases. */
  --bg-0: var(--soto-bg);
  --bg-1: var(--soto-surface);
  --bg-2: var(--soto-surface-raised);
  --bg-3: var(--soto-surface-hover);
  --bg-4: var(--soto-surface-active);
  --txt-0: var(--soto-text);
  --txt-1: var(--soto-text-secondary);
  --txt-2: var(--soto-text-muted);
  --line: var(--soto-border);
  --line-2: var(--soto-border-strong);
  --accent: var(--soto-accent);
  --ok: var(--soto-success);
  --ok-bg: var(--soto-success-bg);
  --warn: var(--soto-warning);
  --warn-bg: var(--soto-warning-bg);
  --bad: var(--soto-danger);
  --bad-bg: var(--soto-danger-bg);
  --info: var(--soto-info);
  --info-bg: var(--soto-info-bg);
  --amber: var(--soto-warning);
  --violet: var(--soto-accent);
  --ui: var(--soto-font);
  --mono: var(--soto-font-mono);
  --r-sm: var(--soto-radius-sm);
  --r: var(--soto-radius-md);
  --r-lg: var(--soto-radius-lg);
  --shadow: none;
}

[data-ui-density="compact"] {
  --soto-control-height: var(--soto-space-10);
  --soto-control-padding-x: var(--soto-space-3);
  --soto-panel-padding: var(--soto-space-4);
  --soto-table-row-height: var(--soto-space-10);
}

@media (max-width: 700px) {
  :root {
    --soto-gutter: var(--soto-space-4);
  }
}

@media (pointer: coarse) {
  [data-ui-density="compact"] {
    --soto-control-height: var(--soto-space-11);
    --soto-table-row-height: var(--soto-space-11);
  }
}
