/*
 * Command Center design tokens (PRD.md §8).
 * Every color, size, space and radius in the app comes from here. Don't hard-code values elsewhere.
 *
 * Contrast (WCAG 2.1 AA), checked for both themes:
 *   text, text-muted, accent-text, and each status text on its status bg and on surface  ≥ 4.5:1
 *   border-strong and focus against bg and surface                                     ≥ 3:1
 *
 * Breakpoints: custom properties can't be used in media queries, so they're written out
 * wherever they're needed. 48rem (768px): mobile < 48rem ≤ desktop (navigation, layout).
 * 64rem (1024px): the Meetings week shows all seven days; below it, one day at a time.
 */

:root {
  color-scheme: light dark;

  /* ---------- Color: light ---------- */
  --color-bg: #f6f6f4;
  --color-surface: #ffffff;
  --color-surface-sunken: #eeeeeb;
  --color-surface-hover: #f0f0ed;
  --color-text: #1b1b1a;
  --color-text-muted: #5b5b57;
  --color-border: #dcdcd7;
  --color-border-strong: #85857f;
  --color-accent: #2c56c9;
  --color-accent-hover: #2246a8;
  --color-accent-text: #2c56c9;
  --color-on-accent: #ffffff;
  --color-accent-subtle: #e8eefc;
  --color-focus: #2c56c9;
  --color-skeleton: #e6e6e2;
  --color-skeleton-shine: #f3f3f0;
  --color-overlay: rgb(20 20 19 / 0.4);

  /* Status: text color + background. Text passes AA on its own bg and on surface. */
  --color-danger-text: #b2241a;
  --color-danger-bg: #fdecea;
  --color-danger-border: #f2b8b2;
  --color-warning-text: #8a4a00;
  --color-warning-bg: #fff3df;
  --color-warning-border: #f0cf98;
  --color-success-text: #1d6a39;
  --color-success-bg: #e7f4eb;
  --color-success-border: #a9d8b8;
  --color-info-text: #24499f;
  --color-info-bg: #eaf0fd;
  --color-info-border: #b7c9f2;

  /* ---------- Type ---------- */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  --text-xs: 0.75rem;   /* 12px: badges */
  --text-sm: 0.875rem;  /* 14px: secondary, labels */
  --text-md: 1rem;      /* 16px: body, inputs (prevents iOS zoom) */
  --text-lg: 1.25rem;   /* 20px: section titles */
  --text-xl: 1.5rem;    /* 24px: view titles */
  --text-2xl: 2rem;     /* 32px: sign-in title */

  --leading-tight: 1.25;
  --leading-normal: 1.5;

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

  /* ---------- Space (4px base) ---------- */
  --space-0: 0;
  --space-1: 0.25rem;  /* 4  */
  --space-2: 0.5rem;   /* 8  */
  --space-3: 0.75rem;  /* 12 */
  --space-4: 1rem;     /* 16 */
  --space-5: 1.5rem;   /* 24 */
  --space-6: 2rem;     /* 32 */
  --space-7: 2.5rem;   /* 40 */
  --space-8: 3rem;     /* 48 */
  --space-9: 4rem;     /* 64 */

  /* ---------- Radius ---------- */
  --radius-sm: 0.25rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-full: 999px;

  /* ---------- Borders, focus, elevation ---------- */
  --border-width: 1px;
  --opacity-busy: 0.75;
  --focus-width: 2px;
  --focus-offset: 2px;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.06);
  --shadow-md: 0 4px 16px rgb(0 0 0 / 0.12);

  /* ---------- Sizes ---------- */
  --size-icon: 1.25rem;
  --size-control: 2.75rem;    /* 44px min touch target */
  --size-control-sm: 2.25rem; /* 36px, mouse only; touch screens get --size-control */
  --size-topbar: 3.5rem;
  --size-tabbar: 4rem;
  --size-content-max: 72rem;
  --size-form-max: 24rem;
  --size-menu-min: 13rem;
  --size-toast-max: 26rem;
  --size-empty-max: 28rem;
  --size-panel: 34rem;        /* meeting panel width on desktop */
  --size-modal: 30rem;
  --size-day-min: 8rem;       /* narrowest week column */
  --size-dot: 0.375rem;

  /* ---------- Motion ---------- */
  --duration-fast: 120ms;
  --duration-normal: 200ms;
  --duration-skeleton: 1.4s;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);

  /* ---------- Layers ---------- */
  --z-nav: 10;
  --z-menu: 20;
  --z-toast: 30;  /* dialogs use the browser's top layer, above all of these */
}

/* ---------- Color: dark ---------- */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #121211;
    --color-surface: #1b1b1a;
    --color-surface-sunken: #252523;
    --color-surface-hover: #262624;
    --color-text: #ededea;
    --color-text-muted: #a9a9a3;
    --color-border: #34342f;
    --color-border-strong: #75756f;
    --color-accent: #8db0ff;
    --color-accent-hover: #a9c3ff;
    --color-accent-text: #8db0ff;
    --color-on-accent: #0c1838;
    --color-accent-subtle: #1c2847;
    --color-focus: #8db0ff;
    --color-skeleton: #262624;
    --color-skeleton-shine: #30302d;
    --color-overlay: rgb(0 0 0 / 0.6);

    --color-danger-text: #ffa196;
    --color-danger-bg: #3a1714;
    --color-danger-border: #6e2b24;
    --color-warning-text: #ffc56e;
    --color-warning-bg: #36270f;
    --color-warning-border: #6b4c1a;
    --color-success-text: #7fd69c;
    --color-success-bg: #10301c;
    --color-success-border: #245a35;
    --color-info-text: #a3c0ff;
    --color-info-bg: #172646;
    --color-info-border: #2e4880;

    --shadow-sm: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-md: 0 4px 16px rgb(0 0 0 / 0.5);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration-normal: 0ms;
  }
}
