/* ------------------------------------------------------------------
   Design tokens — all theming derives from these custom properties.
   ------------------------------------------------------------------ */

:root {
  /* Brand (overridable via JS from APP_CONFIG.ui.theme) */
  --brand-primary: #e63946;
  --brand-primary-dark: #c1272d;
  --brand-primary-light: #ff6b74;
  --brand-accent: #f1faee;

  /* Semantic */
  --color-veg: #16a34a;
  --color-nonveg: #dc2626;
  --color-bestseller: #f59e0b;
  --color-spicy: #ef4444;

  /* Feedback */
  --color-success: #16a34a;
  --color-warning: #f59e0b;
  --color-danger: #dc2626;
  --color-info: #2563eb;

  /* Neutrals (light theme) */
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-muted: #f7f7f8;
  --bg-sunken: #f0f0f2;

  --text: #0f172a;
  --text-muted: #64748b;
  --text-inverse: #ffffff;

  --border: #e5e7eb;
  --border-strong: #d1d5db;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, .14);

  /* Radii */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Spacing scale (4px base) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-8: 32px;
  --s-10: 40px;
  --s-12: 48px;
  --s-16: 64px;

  /* Typography */
  --font-sans: Inter, system-ui, -apple-system, BlinkMacSystemFont,
               "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
               "Liberation Mono", monospace;

  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 20px;
  --fs-2xl: 24px;
  --fs-3xl: 30px;
  --fs-4xl: 38px;

  --lh-tight: 1.2;
  --lh-normal: 1.5;
  --lh-relaxed: 1.7;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;

  /* Layout */
  --container-max: 1200px;
  --header-h: 60px;
  --bottom-nav-h: 60px;
  --cart-bar-h: 64px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Motion */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.4, 0, .2, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 320ms;

  /* Z-index */
  --z-base: 1;
  --z-sticky: 100;
  --z-cart-bar: 200;
  --z-bottom-nav: 300;
  --z-drawer: 400;
  --z-modal: 500;
  --z-toast: 600;
  --z-install-prompt: 700;

  color-scheme: light;
}

/* ---------------- Dark theme ---------------- */
:root[data-theme="dark"] {
  --bg: #0b0f14;
  --bg-elevated: #121821;
  --bg-muted: #17202b;
  --bg-sunken: #0a0e13;

  --text: #e6edf3;
  --text-muted: #8b98a5;
  --text-inverse: #0b0f14;

  --border: #1f2933;
  --border-strong: #2b3742;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.5);
  --shadow-md: 0 4px 12px rgba(0,0,0,.55);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.6);

  --brand-accent: #1b2430;

  color-scheme: dark;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0ms;
    --dur-base: 0ms;
    --dur-slow: 0ms;
  }
}