/*
 * Relay Desk design tokens.
 *
 * This file is the only place where brand values live. Component CSS must
 * consume the custom properties below; markup must not encode them.
 * Re-theming is a matter of replacing the values in this file (and, later,
 * the component layer) without touching routes, services or markup.
 */

:root {
  color-scheme: light;

  /* Type families */
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono",
    monospace;

  /* Type scale */
  --text-2xs: 0.6875rem;
  --text-xs: 0.75rem;
  --text-sm: 0.8125rem;
  --text-base: 0.9375rem;
  --text-md: 1.0625rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 1.875rem;
  --text-3xl: 2.25rem;
  --leading-tight: 1.2;
  --leading-snug: 1.35;
  --leading-normal: 1.55;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;
  --weight-bold: 700;
  --tracking-wide: 0.04em;

  /* Spacing scale (4px base) */
  --space-0: 0;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;

  /* Shape */
  --radius-sm: 0.375rem;
  --radius-md: 0.625rem;
  --radius-lg: 0.875rem;
  --radius-pill: 999rem;
  --border-width: 1px;
  --focus-ring-width: 3px;
  --focus-ring-offset: 2px;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(20, 28, 38, 0.06);
  --shadow-md: 0 4px 12px rgba(20, 28, 38, 0.08);
  --shadow-header: 0 1px 0 rgba(20, 28, 38, 0.04);

  /* Colour roles: surfaces and text */
  --color-canvas: #f2f4f7;
  --color-surface: #ffffff;
  --color-surface-2: #f7f9fb;
  --color-surface-3: #eceff3;
  --color-header: #ffffff;
  --color-text: #171d26;
  --color-text-muted: #545e6c;
  --color-text-subtle: #5b6573;
  --color-link: #1a4fb5;
  --color-border: #d6dce4;
  --color-border-strong: #b6c0cc;
  --color-border-subtle: #e6eaef;
  --color-row-hover: #f8fafc;
  --color-scrim: rgba(15, 21, 29, 0.55);

  /* Colour roles: actions and feedback */
  --color-accent: #1e56c8;
  --color-accent-hover: #1746a6;
  --color-on-accent: #ffffff;
  --color-accent-soft: #e8effc;
  --color-focus: #0b57d0;
  --color-danger: #a1281d;
  --color-danger-soft: #fdeceb;
  --color-danger-border: #f0c2bd;
  --color-warning: #8a4a06;
  --color-warning-soft: #fdf2e0;
  --color-success: #0a6b46;
  --color-success-soft: #e6f5ee;
  --color-success-border: #b8e0cc;
  --color-info: #1c4f9c;
  --color-info-soft: #e8f0fb;
  --color-neutral: #4b5563;
  --color-neutral-soft: #eceff2;

  /* Status and priority vocabularies */
  --status-new-fg: #17439c;
  --status-new-bg: #e7efff;
  --status-assigned-fg: #3b3a9e;
  --status-assigned-bg: #ecebff;
  --status-in-progress-fg: #8a4a06;
  --status-in-progress-bg: #fdf2e0;
  --status-resolved-fg: #0a6b46;
  --status-resolved-bg: #e6f5ee;
  --status-closed-fg: #4b5563;
  --status-closed-bg: #eceff2;
  --priority-low-fg: #4b5563;
  --priority-low-bg: #eceff2;
  --priority-normal-fg: #17439c;
  --priority-normal-bg: #e7efff;
  --priority-high-fg: #8a4a06;
  --priority-high-bg: #fdf2e0;
  --priority-urgent-fg: #9d1c1c;
  --priority-urgent-bg: #fdeaea;

  /* Structure */
  --layout-max: 72rem;
  --auth-width: 27rem;
  --form-width: 40rem;
  --sidebar-width: 19rem;
  --gutter: clamp(1rem, 3vw, 2rem);
  --header-height: 4rem;
  --control-height: 2.75rem;
  --progress-height: 0.375rem;
  --row-pad-y: 0.625rem;
  --avatar-size: 2rem;
  --avatar-size-sm: 1.625rem;

  /* Motion and layering */
  --transition-fast: 120ms ease;
  --transition-slow: 320ms ease;
  --opacity-full: 1;
  --opacity-disabled: 0.55;
  --opacity-loading: 0.8;
  --z-header: 10;
  --z-progress: 100;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --color-canvas: #0f141a;
    --color-surface: #161d25;
    --color-surface-2: #1b232c;
    --color-surface-3: #222b35;
    --color-header: #161d25;
    --color-text: #e8edf3;
    --color-text-muted: #a7b2c0;
    --color-text-subtle: #8e9aa9;
    --color-link: #8fb0ff;
    --color-border: #2a3541;
    --color-border-strong: #3c4a5a;
    --color-border-subtle: #232d38;
    --color-row-hover: #1b232c;

    --color-accent: #5b8cff;
    --color-accent-hover: #7aa2ff;
    --color-on-accent: #0b1220;
    --color-accent-soft: #1a2740;
    --color-focus: #9db9ff;
    --color-danger: #ff9a90;
    --color-danger-soft: #331b1a;
    --color-danger-border: #5c2b27;
    --color-warning: #f0b26a;
    --color-warning-soft: #2f2414;
    --color-success: #6fd3a3;
    --color-success-soft: #14291f;
    --color-success-border: #244734;
    --color-info: #9dbcff;
    --color-info-soft: #17253b;
    --color-neutral: #b4becb;
    --color-neutral-soft: #232d38;
    --color-scrim: rgba(0, 0, 0, 0.65);

    --status-new-fg: #a9c3ff;
    --status-new-bg: #182743;
    --status-assigned-fg: #c3c0ff;
    --status-assigned-bg: #24234a;
    --status-in-progress-fg: #f0b26a;
    --status-in-progress-bg: #2f2414;
    --status-resolved-fg: #6fd3a3;
    --status-resolved-bg: #14291f;
    --status-closed-fg: #b4becb;
    --status-closed-bg: #232d38;
    --priority-low-fg: #b4becb;
    --priority-low-bg: #232d38;
    --priority-normal-fg: #a9c3ff;
    --priority-normal-bg: #182743;
    --priority-high-fg: #f0b26a;
    --priority-high-bg: #2f2414;
    --priority-urgent-fg: #ff9a90;
    --priority-urgent-bg: #331b1a;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 8px 20px rgba(0, 0, 0, 0.45);
    --shadow-header: 0 1px 0 rgba(0, 0, 0, 0.5);
  }
}
