/* Exprezoe Marketplace design tokens (docs/design-system.md).
   Every component is built from these; no page uses a literal colour, size or duration.
   Schemes: light (default), dark (the system's, or the person's choice in the mp-theme cookie -> <html data-theme>),
   forced colours (Windows high contrast). Text pairs are >= 4.5:1 and control boundaries >= 3:1 on their surface;
   tools/contrast.py checks the pairs named in docs/design-system.md. */

:root {
  color-scheme: light dark;

  /* Neutral ramp */
  --n-0: #ffffff; --n-50: #f6f7f9; --n-100: #eef0f3; --n-200: #dfe2e7; --n-300: #c3c8d0; --n-400: #9aa1ac;
  --n-500: #6b7280; --n-600: #4b5260; --n-700: #333a46; --n-800: #1f242d; --n-900: #13161c; --n-950: #0b0d11;
  /* Brand ramp (the PluggedDesk accent family) */
  --b-50: #eaf3ff; --b-100: #d3e6ff; --b-200: #a8ccff; --b-300: #7cb1ff; --b-400: #5aa2ff; --b-500: #2f7fe6;
  --b-600: #0a62c9; --b-700: #084e9f; --b-800: #073b78; --b-900: #052a56;

  /* Semantic colour, light */
  --color-canvas: var(--n-50);
  --color-surface: var(--n-0);
  --color-surface-raised: var(--n-0);
  --color-surface-sunken: var(--n-100);
  --color-surface-hover: var(--n-100);
  --color-text: var(--n-900);
  --color-text-muted: var(--n-600);
  --color-text-subtle: var(--n-500);
  --color-border: #7d8591;
  --color-border-subtle: var(--n-200);
  --color-brand: var(--b-600);
  --color-brand-hover: var(--b-700);
  --color-brand-active: var(--b-800);
  --color-brand-subtle: var(--b-50);
  --color-brand-text: var(--b-600);
  --color-on-brand: #ffffff;
  --color-link: var(--b-600);
  --color-link-hover: var(--b-700);
  --color-success: #1a7f37;
  --color-success-text: #116329;
  --color-success-subtle: #e6f4ea;
  --color-warning: #9a6700;
  --color-warning-text: #7a5100;
  --color-warning-subtle: #fff4d6;
  --color-danger: #b42318;
  --color-danger-text: #a11d13;
  --color-danger-hover: #8f1c13;
  --color-danger-subtle: #fde8e6;
  --color-info: var(--b-600);
  --color-info-text: var(--b-600);
  --color-info-subtle: var(--b-50);
  --color-focus: var(--b-500);
  --color-selection: var(--b-100);
  --color-hero-a: var(--b-600);
  --color-hero-b: #0b1a33;

  /* Space, on a 4 px grid */
  --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;
  --gutter: clamp(16px, 4vw, 32px);
  --content-max: 1240px;
  --measure: 72ch;

  /* Type */
  --font-sans: system-ui, "Segoe UI Variable Text", "Segoe UI", -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", "Cascadia Code", Consolas, "SF Mono", Menlo, monospace;
  --text-xs: 0.75rem; --text-sm: 0.875rem; --text-md: 1rem; --text-lg: 1.125rem; --text-xl: 1.25rem;
  --text-2xl: 1.5rem; --text-3xl: 2rem; --text-4xl: 2.5rem;
  --leading-tight: 1.25; --leading: 1.5; --leading-loose: 1.65;
  --weight-regular: 400; --weight-medium: 500; --weight-semibold: 600; --weight-bold: 700;

  /* Shape and depth */
  --radius-sm: 4px; --radius: 8px; --radius-lg: 12px; --radius-xl: 16px; --radius-pill: 999px;
  --hairline: 1px solid var(--color-border-subtle);
  --shadow-1: 0 1px 2px rgb(16 24 40 / 0.06), 0 1px 1px rgb(16 24 40 / 0.04);
  --shadow-2: 0 4px 12px rgb(16 24 40 / 0.08), 0 1px 3px rgb(16 24 40 / 0.06);
  --shadow-3: 0 12px 32px rgb(16 24 40 / 0.14), 0 2px 6px rgb(16 24 40 / 0.08);

  /* Controls */
  --control-h: 36px; --control-h-sm: 30px; --control-h-lg: 42px;
  --target-min: 24px;
  --focus-ring: 0 0 0 2px var(--color-surface), 0 0 0 4px var(--color-focus);

  /* Motion */
  --dur-1: 100ms; --dur-2: 180ms; --dur-3: 280ms;
  --ease: cubic-bezier(0.2, 0, 0, 1);

  /* Layers */
  --z-bar: 20; --z-menu: 30; --z-skip: 100;
}

/* Dark: the person's choice, or the system's when no choice was made. */
[data-theme="dark"] { color-scheme: dark; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { color-scheme: dark; } }

[data-theme="dark"] {
  --color-canvas: #0f1115;
  --color-surface: #171a20;
  --color-surface-raised: #1d2129;
  --color-surface-sunken: #0b0d11;
  --color-surface-hover: #232833;
  --color-text: #e9ecf1;
  --color-text-muted: #aab2bf;
  --color-text-subtle: #8a93a2;
  --color-border: #697180;
  --color-border-subtle: #2a2f38;
  --color-brand: #5aa2ff;
  --color-brand-hover: #7cb1ff;
  --color-brand-active: #a8ccff;
  --color-brand-subtle: #15253d;
  --color-brand-text: #7cb1ff;
  --color-on-brand: #0b1220;
  --color-link: #7cb1ff;
  --color-link-hover: #a8ccff;
  --color-success: #3fb950;
  --color-success-text: #3fb950;
  --color-success-subtle: #12261a;
  --color-warning: #e3b341;
  --color-warning-text: #e3b341;
  --color-warning-subtle: #2b2410;
  --color-danger: #ff7b72;
  --color-danger-text: #ff7b72;
  --color-danger-hover: #ff9c95;
  --color-danger-subtle: #3a1a18;
  --color-info: #7cb1ff;
  --color-info-text: #7cb1ff;
  --color-info-subtle: #15253d;
  --color-focus: #7cb1ff;
  --color-selection: #1d3a63;
  --color-hero-a: #0a62c9;
  --color-hero-b: #0b0d11;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-2: 0 4px 12px rgb(0 0 0 / 0.45), 0 1px 3px rgb(0 0 0 / 0.4);
  --shadow-3: 0 12px 32px rgb(0 0 0 / 0.55), 0 2px 6px rgb(0 0 0 / 0.4);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-canvas: #0f1115;
    --color-surface: #171a20;
    --color-surface-raised: #1d2129;
    --color-surface-sunken: #0b0d11;
    --color-surface-hover: #232833;
    --color-text: #e9ecf1;
    --color-text-muted: #aab2bf;
    --color-text-subtle: #8a93a2;
    --color-border: #697180;
    --color-border-subtle: #2a2f38;
    --color-brand: #5aa2ff;
    --color-brand-hover: #7cb1ff;
    --color-brand-active: #a8ccff;
    --color-brand-subtle: #15253d;
    --color-brand-text: #7cb1ff;
    --color-on-brand: #0b1220;
    --color-link: #7cb1ff;
    --color-link-hover: #a8ccff;
    --color-success: #3fb950;
    --color-success-text: #3fb950;
    --color-success-subtle: #12261a;
    --color-warning: #e3b341;
    --color-warning-text: #e3b341;
    --color-warning-subtle: #2b2410;
    --color-danger: #ff7b72;
    --color-danger-text: #ff7b72;
    --color-danger-hover: #ff9c95;
    --color-danger-subtle: #3a1a18;
    --color-info: #7cb1ff;
    --color-info-text: #7cb1ff;
    --color-info-subtle: #15253d;
    --color-focus: #7cb1ff;
    --color-selection: #1d3a63;
    --color-hero-a: #0a62c9;
    --color-hero-b: #0b0d11;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 4px 12px rgb(0 0 0 / 0.45), 0 1px 3px rgb(0 0 0 / 0.4);
    --shadow-3: 0 12px 32px rgb(0 0 0 / 0.55), 0 2px 6px rgb(0 0 0 / 0.4);
  }
}

/* Windows high contrast and the like: system colours, and every boundary drawn. */
@media (forced-colors: active) {
  :root {
    --color-border: CanvasText;
    --color-border-subtle: CanvasText;
    --color-focus: Highlight;
    --focus-ring: 0 0 0 3px Highlight;
    --shadow-1: none; --shadow-2: none; --shadow-3: none;
  }
}

/* Motion is a courtesy, never a requirement. */
@media (prefers-reduced-motion: reduce) {
  :root { --dur-1: 0ms; --dur-2: 0ms; --dur-3: 0ms; }
}
