/*
 * AI Bistro — Sál v1 · design tokens
 * ------------------------------------------------------------------
 * Single source of truth for colour, type, spacing, radii, shadows,
 * z-index and motion. Component CSS lives in css/app.css and must
 * reference these tokens instead of literal values. The isometric
 * renderer (js/iso/renderer.js) reads the --iso-* group at runtime via
 * getComputedStyle(document.documentElement).
 *
 * Token group            → docs/DESIGN.md section
 * --brand-*              → a) taken over from the website of the business, b) palette
 * --bg, --surface-x, --line → b) surfaces (derived, not brand colours)
 * --text*                → b) text roles + contrast table
 * --state-*              → b) functional table states (5 + conflict)
 * --kpi-*, --toast-*     → b) KPI / toasts
 * --btn-*, --nav-*       → g) self-check rows 3–4 (gold button, bar nav)
 * --timeline-*           → g) self-check row 9 (flat timeline)
 * --fs/--lh/--fw/--ls    → c) typography scale (Switzer only)
 * --space-*              → d) layout (4-based)
 * --radius-*             → g) self-check row 7
 * --shadow-*             → g) self-check row 2 (floating layers only)
 * --z-*                  → d) layout stacking
 * --dur-x, --ease-x       → h) motion policy (+ reduced-motion override)
 * --focus-ring           → g) self-check row 8
 * --iso-*                → f) the hall
 * --bp-*                 → d) breakpoints (informative; @media cannot read
 *                           custom properties, keep numbers in sync by hand)
 */

@import url("../assets/fonts/switzer.css");

:root {
  /* ---- Brand (5) ------------------------------------------------ */
  --brand-ink: #0a0a0a;         /* web --black  */
  --brand-gold: #edba37;        /* web --gold   — logo leaf, primary button surface only */
  --brand-gold-deep: #a87b12;   /* derived from gold: active-tab bar, primary hover (3.56:1) */
  --brand-cream: #f9f7f2;       /* web --white  — app background */
  --brand-ash: #6b6860;         /* web --muted #888 darkened for AA (5.20:1) */

  /* ---- Surfaces ------------------------------------------------- */
  --bg: var(--brand-cream);
  --surface: #ffffff;           /* panel, KPI band, inputs on bg */
  --surface-2: #efefea;         /* web --off-white — insets, timeline track, disabled */
  --line: #e2dfd6;              /* 1px hairlines; never carries meaning */
  --line-strong: #cbc6bb;       /* table borders in calibration, hovered hairline */

  /* ---- Text ------------------------------------------------------ */
  --text-strong: var(--brand-ink);  /* 18.49:1 on bg */
  --text: #2b2a26;                  /* 13.42:1 on bg */
  --text-muted: var(--brand-ash);   /*  5.20:1 on bg */
  --text-on-ink: var(--brand-cream);
  --text-on-gold: var(--brand-ink); /* 11.01:1 */
  --icon: currentColor;             /* icons never get their own colour */

  /* ---- Table states (shape + colour, see DESIGN §b/§f) ------------ */
  --state-free: #a9a79f;            /* legend only; free tables draw no marker */
  --state-waiting: #d9622b;         /* seated_no_order — the only warm saturated state */
  --state-ordered: #3b6fb6;         /* seated_ordered */
  --state-paid: #1e9a6e;            /* paid_seated */
  --state-clean: #7d6ba8;           /* to_clean */
  --state-conflict: #c2352b;        /* TableState.conflict != null */
  /* AA text variants for the panel / legend */
  --state-free-text: #6b6860;
  --state-waiting-text: #b24e1e;
  --state-ordered-text: #2f5c99;
  --state-paid-text: #177a56;
  --state-clean-text: #65548f;
  --state-conflict-text: #a12a22;
  --state-marker-fg: #ffffff;       /* the dot/notch inside a marker */

  /* ---- KPI (polarity, not direction) ------------------------------ */
  --kpi-up: #177a56;                /* good */
  --kpi-down: #a12a22;              /* bad  */
  --kpi-neutral: var(--brand-ash);  /* no comparison / n < 3 */

  /* ---- Toasts (3px left bar; body is --surface / --text) ---------- */
  --toast-info: var(--state-ordered);
  --toast-success: var(--state-paid);
  --toast-warning: var(--state-waiting);
  --toast-danger: var(--state-conflict);

  /* ---- Buttons & navigation -------------------------------------- */
  --btn-primary-bg: var(--brand-gold);
  --btn-primary-fg: var(--brand-ink);
  --btn-primary-bg-hover: var(--brand-gold-deep);
  --btn-primary-fg-hover: var(--brand-cream);
  --btn-secondary-bg: transparent;
  --btn-secondary-fg: var(--brand-ink);
  --btn-secondary-border: var(--brand-ink);
  --nav-bg: var(--surface);
  --nav-fg: var(--brand-ash);
  --nav-fg-active: var(--brand-ink);
  --nav-active-bg: transparent;     /* no filled pill */
  --nav-active-bar: var(--brand-gold-deep);
  --nav-active-bar-w: 3px;

  /* ---- Timeline (flat, monochrome) -------------------------------- */
  --timeline-track: var(--surface-2);
  --timeline-bar: #b9b5aa;
  --timeline-bar-staff: #d6d2c8;    /* hatched over --timeline-bar */
  --timeline-bar-now: var(--brand-ink);
  --timeline-cursor: var(--brand-ink);
  --timeline-closed: rgba(10, 10, 10, 0.04);  /* outside opening hours */
  --timeline-axis: var(--brand-ash);

  /* ---- Typography (Switzer variable) ----------------------------- */
  --font-sans: "Switzer", system-ui, -apple-system, "Segoe UI", sans-serif;
  --fs-12: 12px;  --lh-12: 16px;
  --fs-13: 13px;  --lh-13: 18px;
  --fs-14: 14px;  --lh-14: 20px;
  --fs-16: 16px;  --lh-16: 24px;
  --fs-20: 20px;  --lh-20: 28px;
  --fs-28: 28px;  --lh-28: 34px;
  --fs-40: 40px;  --lh-40: 44px;
  --fw-400: 400;  /* body */
  --fw-500: 500;  /* labels, nav */
  --fw-600: 600;  /* headings, numbers */
  --fw-700: 700;  /* wordmark only */
  --ls-tight: -0.015em;   /* 28/40 px */
  --ls-heading: -0.01em;  /* 20 px */
  --ls-label: 0;          /* labels are sentence case, never tracked */
  --numeric: tabular-nums; /* font-variant-numeric for KPI & clocks */

  /* ---- Spacing (4-based) ----------------------------------------- */
  --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;

  /* ---- Layout dimensions ----------------------------------------- */
  --sidebar-w: 200px;
  --sidebar-w-compact: 64px;
  --header-h: 56px;
  --header-h-compact: 48px;
  --panel-w: 360px;
  --panel-w-compact: 300px;
  --kpi-h: 112px;
  --kpi-h-compact: 84px;
  --timeline-h: 88px;
  --timeline-h-compact: 64px;
  --gutter: var(--space-4);
  --gutter-compact: var(--space-3);
  --bp-compact: 1440px;   /* informative: sidebar → icon rail, compact heights */
  --bp-stack: 1200px;     /* informative: panel stacks under the hall */

  /* ---- Radii ----------------------------------------------------- */
  --radius-1: 4px;        /* inputs, chips, hall labels */
  --radius-2: 6px;        /* buttons */
  --radius-3: 8px;        /* max for controls, camera thumbs */
  --radius-panel: 12px;   /* #table-panel only */
  --radius-kpi: 0;        /* KPI is a band, not cards */

  /* ---- Shadows (floating layers only: toasts, popover, expanded camera) */
  --shadow-1: 0 1px 2px rgba(10, 10, 10, 0.06), 0 2px 8px rgba(10, 10, 10, 0.05);
  --shadow-2: 0 4px 16px rgba(10, 10, 10, 0.08), 0 1px 3px rgba(10, 10, 10, 0.06);

  /* ---- Z-index --------------------------------------------------- */
  --z-base: 0;
  --z-scene-overlay: 10;  /* HTML labels/hit layer above canvas */
  --z-sticky: 100;        /* header, sidebar */
  --z-panel: 200;         /* #table-panel, expanded camera */
  --z-popover: 500;
  --z-toast: 1000;        /* #toasts */
  --z-modal: 1100;

  /* ---- Motion (response to user action only; hall people separate) */
  --dur-fast: 120ms;      /* tab switch, hover colour */
  --dur-base: 200ms;      /* panel open, expand */
  --dur-slow: 320ms;      /* toast in/out */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-exit: cubic-bezier(0.4, 0, 1, 1);
  --iso-motion: 1;        /* 1 = interpolate people, 0 = jump (reduced motion) */
  --iso-walk-bob-px: 2;   /* head bob amplitude while walking */
  --iso-walk-bob-s: 0.6;  /* head bob period */

  /* ---- Focus ----------------------------------------------------- */
  --focus-ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--brand-ink);
  --focus-ring-on-ink: 0 0 0 2px var(--brand-ink), 0 0 0 4px var(--brand-cream);

  /* ---- Hall (isometric renderer palette) ------------------------- */
  --iso-floor: #ddd9d0;
  --iso-floor-alt: #d3cfc4;
  --iso-grid: #cbc6bb;
  --iso-grid-alpha: 0.7;          /* live view; calibration uses 1 */
  --iso-wall: #f1eee6;
  --iso-wall-side: #d9d5cc;
  --iso-wall-height-m: 0.4;       /* drawn height of solid walls (real 3.2 m would hide the hall) */
  --iso-wood: #d9b27e;
  --iso-wood-side: #b98f5b;
  --iso-wood-dark: #8f6a3e;
  --iso-bar: #1c1b19;
  --iso-bar-top: #2e2c29;
  --iso-planter: #5f7f4a;
  --iso-planter-light: #7c9a5e;
  --iso-planter-box: #2e2c29;
  --iso-glass: #dcebf0;
  --iso-glass-alpha: 0.7;
  --iso-glass-frame: #4a4a48;
  --iso-exterior: #cfdcc6;
  --iso-exterior-sky: #e9f0f3;
  --iso-shadow: rgba(10, 10, 10, 0.14);
  --iso-shadow-soft: rgba(10, 10, 10, 0.08);
  --iso-shade-left: 0.08;         /* left face darkening factor */
  --iso-shade-right: 0.16;        /* right face darkening factor */
  /* selection & labels */
  --iso-select: #0a0a0a;
  --iso-select-w: 2;              /* px */
  --iso-hover: rgba(10, 10, 10, 0.45);
  --iso-hover-w: 1.5;             /* px */
  --iso-state-outline-w: 1.5;     /* px, table top outline in state colour */
  --iso-marker-d: 10;             /* px at 1920; renderer scales to 8 when canvas < 1100 px */
  --iso-marker-d-late: 12;        /* px, waitingSince > 10 min */
  --iso-label-bg: #ffffff;
  --iso-label-text: #2b2a26;
  --iso-label-bg-selected: #0a0a0a;
  --iso-label-text-selected: #f9f7f2;
  --iso-label-font: 500 12px/16px "Switzer", system-ui, sans-serif;
  --iso-label-ls: 0.02em;
  --iso-label-radius: 3;          /* px */
  /* people */
  --iso-guest-1: #7a93b5;   /* dusty blue   */
  --iso-guest-2: #8fa58a;   /* sage         */
  --iso-guest-3: #c2876b;   /* terracotta   */
  --iso-guest-4: #a98ba6;   /* mauve        */
  --iso-guest-5: #b3a26a;   /* mustard      */
  --iso-guest-6: #6f9ea3;   /* slate teal   */
  --iso-guest-7: #8c6b84;   /* plum         */
  --iso-guest-8: #a08c7d;   /* warm grey    */
  --iso-staff: #0a0a0a;
  --iso-staff-apron: #f9f7f2;
  --iso-skin: #e6c3a1;
  --iso-child-scale: 0.68;
  --iso-person-radius-m: 0.22;
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-base: 0ms;
    --dur-slow: 0ms;
    --iso-motion: 0;
    --iso-walk-bob-px: 0;
  }
}

body {
  font-family: var(--font-sans);
}
