/* ==========================================================================
   optiqa design system — tokens
   --------------------------------------------------------------------------
   Single source of truth. Every visual decision in components.css resolves to
   a variable declared here, so re-theming never requires touching a component.

   Layer 1  primitives   raw ramps, never referenced by components directly
   Layer 2  semantic     role-based aliases — the only layer components use
   Layer 3  component    a few local aliases where a component needs a slot
   ========================================================================== */

/* ==========================================================================
   LAYER 1 — primitives
   Cool-neutral greys (slight blue cast) keep the UI calm; the accent ramp is
   reserved for focus, links and selection so it never becomes decoration.
   ========================================================================== */

:root {
  /* Neutrals — cool grey, hue ~220 */
  --oq-grey-0: #ffffff;
  --oq-grey-25: #fbfcfd;
  --oq-grey-50: #f6f8fa;
  --oq-grey-100: #eef1f5;
  --oq-grey-200: #e2e7ed;
  --oq-grey-300: #cdd5df;
  --oq-grey-400: #9aa4b2;
  --oq-grey-500: #5f6b7a;
  --oq-grey-600: #4b5565;
  --oq-grey-700: #364152;
  --oq-grey-800: #202939;
  --oq-grey-900: #121926;
  --oq-grey-950: #0a0f1a;

  /* Accent — blue */
  --oq-blue-50: #eef4ff;
  --oq-blue-100: #d9e6ff;
  --oq-blue-200: #bcd3ff;
  --oq-blue-300: #8fb6ff;
  --oq-blue-400: #5b93fb;
  --oq-blue-500: #3372f0;
  --oq-blue-600: #1f57d6;
  --oq-blue-700: #1a45ac;
  --oq-blue-800: #1a3c88;
  --oq-blue-900: #1b356e;

  /* Danger */
  --oq-red-50: #fef3f2;
  --oq-red-100: #fee4e2;
  --oq-red-200: #fecdca;
  --oq-red-300: #fda29b;
  --oq-red-400: #f97066;
  --oq-red-500: #f04438;
  --oq-red-600: #d92d20;
  --oq-red-700: #b42318;
  --oq-red-800: #912018;
  --oq-red-900: #7a271a;

  /* Success */
  --oq-green-50: #ecfdf3;
  --oq-green-100: #d1fadf;
  --oq-green-200: #a6f4c5;
  --oq-green-300: #6ce9a6;
  --oq-green-400: #32d583;
  --oq-green-500: #12b76a;
  --oq-green-600: #039855;
  --oq-green-700: #027a48;
  --oq-green-800: #05603a;
  --oq-green-900: #054f31;

  /* Warning */
  --oq-amber-50: #fffaeb;
  --oq-amber-100: #fef0c7;
  --oq-amber-200: #fedf89;
  --oq-amber-300: #fec84b;
  --oq-amber-400: #fdb022;
  --oq-amber-500: #f79009;
  --oq-amber-600: #dc6803;
  --oq-amber-700: #b54708;
  --oq-amber-800: #93370d;
  --oq-amber-900: #7a2e0e;
}

/* ==========================================================================
   Typography
   ========================================================================== */

:root {
  --oq-font-sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  --oq-font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  /* Type scale — 11 → 42px, each step paired with its line height */
  --oq-text-2xs: 0.6875rem; /* 11px */
  --oq-text-xs: 0.75rem; /* 12px */
  --oq-text-sm: 0.8125rem; /* 13px */
  --oq-text-base: 0.875rem; /* 14px */
  --oq-text-md: 1rem; /* 16px */
  --oq-text-lg: 1.125rem; /* 18px */
  --oq-text-xl: 1.375rem; /* 22px */
  --oq-text-2xl: 1.75rem; /* 28px */
  --oq-text-3xl: 2.125rem; /* 34px */
  --oq-text-4xl: 2.625rem; /* 42px */

  --oq-leading-2xs: 1rem;
  --oq-leading-xs: 1.125rem;
  --oq-leading-sm: 1.25rem;
  --oq-leading-base: 1.375rem;
  --oq-leading-md: 1.5rem;
  --oq-leading-lg: 1.75rem;
  --oq-leading-xl: 1.875rem;
  --oq-leading-2xl: 2.25rem;
  --oq-leading-3xl: 2.5rem;
  --oq-leading-4xl: 3.125rem;

  --oq-weight-regular: 400;
  --oq-weight-medium: 500;
  --oq-weight-semibold: 600;
  --oq-weight-bold: 700;

  --oq-tracking-tighter: -0.022em;
  --oq-tracking-tight: -0.011em;
  --oq-tracking-normal: 0;
  --oq-tracking-wide: 0.01em;
  --oq-tracking-wider: 0.06em; /* uppercase eyebrows */
}

/* ==========================================================================
   Spacing — 4px base unit
   ========================================================================== */

:root {
  --oq-space-0: 0;
  --oq-space-1: 0.25rem; /* 4  */
  --oq-space-2: 0.5rem; /* 8  */
  --oq-space-3: 0.75rem; /* 12 */
  --oq-space-4: 1rem; /* 16 */
  --oq-space-5: 1.25rem; /* 20 */
  --oq-space-6: 1.5rem; /* 24 */
  --oq-space-8: 2rem; /* 32 */
  --oq-space-10: 2.5rem; /* 40 */
  --oq-space-12: 3rem; /* 48 */
  --oq-space-16: 4rem; /* 64 */
  --oq-space-20: 5rem; /* 80 */
  --oq-space-24: 6rem; /* 96 */
}

/* ==========================================================================
   Radius — deliberately restrained. Large radii read as decoration, not
   product, so the scale tops out at 18px.
   ========================================================================== */

:root {
  --oq-radius-xs: 4px;
  --oq-radius-sm: 6px;
  --oq-radius-md: 8px;
  --oq-radius-lg: 10px;
  --oq-radius-xl: 14px;
  --oq-radius-2xl: 18px;
  --oq-radius-full: 9999px;
}

/* ==========================================================================
   Shadows — two-layer, tinted with the neutral hue rather than pure black so
   elevation sits on the surface instead of greying it.
   ========================================================================== */

:root {
  --oq-shadow-xs: 0 1px 2px rgba(10, 15, 26, 0.05);
  --oq-shadow-sm: 0 1px 2px rgba(10, 15, 26, 0.06),
    0 1px 3px rgba(10, 15, 26, 0.05);
  --oq-shadow-md: 0 2px 4px -1px rgba(10, 15, 26, 0.06),
    0 4px 10px -2px rgba(10, 15, 26, 0.08);
  --oq-shadow-lg: 0 4px 8px -2px rgba(10, 15, 26, 0.07),
    0 12px 24px -4px rgba(10, 15, 26, 0.1);
  --oq-shadow-xl: 0 8px 16px -4px rgba(10, 15, 26, 0.08),
    0 24px 48px -8px rgba(10, 15, 26, 0.14);
}

/* ==========================================================================
   Motion
   ========================================================================== */

:root {
  --oq-duration-instant: 80ms;
  --oq-duration-fast: 120ms;
  --oq-duration-base: 180ms;
  --oq-duration-slow: 260ms;
  --oq-ease-standard: cubic-bezier(0.2, 0, 0.2, 1);
  --oq-ease-out: cubic-bezier(0, 0.6, 0.3, 1);
}

/* ==========================================================================
   Layout + stacking
   ========================================================================== */

:root {
  --oq-container-max: 1160px;
  --oq-gutter: var(--oq-space-5);

  --oq-z-sticky: 800;
  --oq-z-dropdown: 1000;
  --oq-z-overlay: 1100;
  --oq-z-modal: 1200;
  --oq-z-toast: 1300;
  --oq-z-tooltip: 1400;
}

@media (min-width: 48rem) {
  :root {
    --oq-gutter: var(--oq-space-8);
  }
}

/* ==========================================================================
   LAYER 2 — semantic colour
   Light is the default. Dark overrides the same names, so no component ever
   branches on theme.
   ========================================================================== */

:root {
  color-scheme: light;

  /* Surfaces */
  --oq-bg: var(--oq-grey-0);
  --oq-bg-subtle: var(--oq-grey-50);
  --oq-surface: var(--oq-grey-0);
  --oq-surface-raised: var(--oq-grey-0);
  --oq-surface-sunken: var(--oq-grey-50);
  --oq-surface-hover: var(--oq-grey-50);
  --oq-surface-active: var(--oq-grey-100);
  --oq-surface-inverse: var(--oq-grey-900);

  /* Lines */
  --oq-border: var(--oq-grey-200);
  --oq-border-subtle: var(--oq-grey-100);
  --oq-border-strong: var(--oq-grey-300);

  /* Text */
  --oq-text: var(--oq-grey-900);
  --oq-text-muted: var(--oq-grey-600);
  --oq-text-subtle: var(--oq-grey-500);
  --oq-text-inverse: var(--oq-grey-0);
  --oq-text-on-solid: var(--oq-grey-0);

  /* Accent — focus, links, selection */
  --oq-accent: var(--oq-blue-600);
  --oq-accent-hover: var(--oq-blue-700);
  --oq-accent-active: var(--oq-blue-800);
  --oq-accent-subtle: var(--oq-blue-50);
  --oq-accent-subtle-hover: var(--oq-blue-100);
  --oq-accent-border: var(--oq-blue-200);
  --oq-accent-text: var(--oq-blue-700);
  --oq-accent-contrast: var(--oq-grey-0);

  /* Semantic status */
  --oq-success: var(--oq-green-600);
  --oq-success-text: var(--oq-green-700);
  --oq-success-subtle: var(--oq-green-50);
  --oq-success-border: var(--oq-green-200);

  --oq-warning: var(--oq-amber-500);
  --oq-warning-text: var(--oq-amber-700);
  --oq-warning-subtle: var(--oq-amber-50);
  --oq-warning-border: var(--oq-amber-200);

  --oq-danger: var(--oq-red-600);
  --oq-danger-hover: var(--oq-red-700);
  --oq-danger-active: var(--oq-red-800);
  --oq-danger-text: var(--oq-red-700);
  --oq-danger-subtle: var(--oq-red-50);
  --oq-danger-border: var(--oq-red-200);

  /* Fill for destructive actions that carry white text. Kept separate from
     --oq-danger, which is tuned for borders, dots and progress bars where no
     text sits on top. */
  --oq-danger-solid: var(--oq-red-600);
  --oq-danger-solid-hover: var(--oq-red-700);
  --oq-danger-solid-active: var(--oq-red-800);

  --oq-info: var(--oq-blue-600);
  --oq-info-text: var(--oq-blue-700);
  --oq-info-subtle: var(--oq-blue-50);
  --oq-info-border: var(--oq-blue-200);

  /* Solid (high-contrast) action — the primary button is deliberately
     monochrome. It keeps the accent meaningful and avoids the default
     blue-button look every SaaS product ships. */
  --oq-solid-bg: var(--oq-grey-900);
  --oq-solid-bg-hover: var(--oq-grey-800);
  --oq-solid-bg-active: var(--oq-grey-950);
  --oq-solid-text: var(--oq-grey-0);

  /* Overlay scrim */
  --oq-scrim: rgba(10, 15, 26, 0.46);

  /* Focus */
  --oq-focus-ring-color: var(--oq-blue-600);
  --oq-focus-ring-halo: rgba(31, 87, 214, 0.28);
  --oq-focus-ring-width: 2px;
  --oq-focus-ring-offset: 2px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --oq-bg: #0a0f1a;
  --oq-bg-subtle: #0e141f;
  --oq-surface: #121926;
  --oq-surface-raised: #1a2333;
  --oq-surface-sunken: #0d131e;
  --oq-surface-hover: #1a2333;
  --oq-surface-active: #202939;
  --oq-surface-inverse: var(--oq-grey-50);

  --oq-border: #232f42;
  --oq-border-subtle: #1a2333;
  --oq-border-strong: #33415c;

  --oq-text: #e6eaf2;
  --oq-text-muted: #a4aec0;
  --oq-text-subtle: #8792a6;
  --oq-text-inverse: var(--oq-grey-950);
  --oq-text-on-solid: var(--oq-grey-950);

  --oq-accent: var(--oq-blue-400);
  --oq-accent-hover: var(--oq-blue-300);
  --oq-accent-active: var(--oq-blue-200);
  --oq-accent-subtle: rgba(91, 147, 251, 0.14);
  --oq-accent-subtle-hover: rgba(91, 147, 251, 0.22);
  --oq-accent-border: rgba(91, 147, 251, 0.38);
  --oq-accent-text: #93b6ff;
  --oq-accent-contrast: var(--oq-grey-950);

  --oq-success: var(--oq-green-500);
  --oq-success-text: var(--oq-green-300);
  --oq-success-subtle: rgba(18, 183, 106, 0.14);
  --oq-success-border: rgba(18, 183, 106, 0.34);

  --oq-warning: var(--oq-amber-400);
  --oq-warning-text: var(--oq-amber-300);
  --oq-warning-subtle: rgba(247, 144, 9, 0.14);
  --oq-warning-border: rgba(247, 144, 9, 0.34);

  --oq-danger: var(--oq-red-500);
  --oq-danger-hover: var(--oq-red-400);
  --oq-danger-active: var(--oq-red-300);
  --oq-danger-text: var(--oq-red-300);
  --oq-danger-subtle: rgba(240, 68, 56, 0.14);
  --oq-danger-border: rgba(240, 68, 56, 0.34);

  /* The dark danger ramp is deliberately light so it reads on a dark surface —
     which is precisely why it cannot carry white text. Destructive fills stay
     on the deeper reds; the lightest of the three still measures 4.6:1. */
  --oq-danger-solid: var(--oq-red-600);
  --oq-danger-solid-hover: #dd3226;
  --oq-danger-solid-active: var(--oq-red-700);

  --oq-info: var(--oq-blue-400);
  --oq-info-text: #93b6ff;
  --oq-info-subtle: rgba(91, 147, 251, 0.14);
  --oq-info-border: rgba(91, 147, 251, 0.34);

  --oq-solid-bg: #e6eaf2;
  --oq-solid-bg-hover: #ffffff;
  --oq-solid-bg-active: #cdd5df;
  --oq-solid-text: var(--oq-grey-950);

  --oq-scrim: rgba(2, 5, 10, 0.66);

  --oq-focus-ring-color: var(--oq-blue-400);
  --oq-focus-ring-halo: rgba(91, 147, 251, 0.34);

  /* Shadows deepen and gain a hairline highlight — pure black alone reads as
     a hole rather than elevation on a dark surface. */
  --oq-shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.4);
  --oq-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.44), 0 1px 3px rgba(0, 0, 0, 0.36);
  --oq-shadow-md: 0 2px 4px -1px rgba(0, 0, 0, 0.44),
    0 4px 10px -2px rgba(0, 0, 0, 0.5);
  --oq-shadow-lg: 0 4px 8px -2px rgba(0, 0, 0, 0.5),
    0 12px 24px -4px rgba(0, 0, 0, 0.56);
  --oq-shadow-xl: 0 8px 16px -4px rgba(0, 0, 0, 0.52),
    0 24px 48px -8px rgba(0, 0, 0, 0.62);
}

/* ==========================================================================
   LAYER 3 — component slots
   Local aliases so components read declaratively and a future dense/spacious
   product variant can retune control geometry in one place.
   ========================================================================== */

:root {
  --oq-control-height-sm: 1.75rem; /* 28 */
  --oq-control-height-md: 2.125rem; /* 34 */
  --oq-control-height-lg: 2.5rem; /* 40 */
  --oq-control-padding-x-sm: var(--oq-space-3);
  --oq-control-padding-x-md: var(--oq-space-4);
  --oq-control-gap: var(--oq-space-2);

  --oq-ring-shadow: 0 0 0 3px var(--oq-focus-ring-halo);
}
