/**
 * Rahyab — shared design tokens (Phase 6).
 * Single source for color, type, space, motion, z-index, breakpoints.
 * Loaded before styles.css / consumer-layout.css.
 */
:root {
  /* Brand / surfaces */
  --af-brand: #0c4da8;
  --af-brand-dark: #083878;
  --af-brand-soft: #e8f1ff;
  --af-accent: #1a73e8;
  --af-accent-soft: #e8f0fe;
  --af-ink: #0f172a;
  --af-muted: #64748b;
  --af-line: #e2e8f0;
  --af-panel: #ffffff;
  --af-surface: #f4f7fb;
  --af-rail: #f7fafb;
  --af-ok: #059669;
  --af-dest: #dc2626;
  --af-warn: #92400e;
  --af-warn-bg: #fffbeb;
  --af-err: #b91c1c;
  --af-err-bg: #fef2f2;

  /* Legacy aliases used across existing CSS */
  --brand: var(--af-brand);
  --brand-dark: var(--af-brand-dark);
  --brand-soft: var(--af-brand-soft);
  --ink: var(--af-ink);
  --muted: var(--af-muted);
  --line: var(--af-line);
  --panel: var(--af-panel);
  --surface: var(--af-surface);
  --ok: var(--af-ok);
  --dest: var(--af-dest);
  --warn: var(--af-warn);
  --warn-bg: var(--af-warn-bg);
  --err: var(--af-err);
  --err-bg: var(--af-err-bg);
  --gm-surface: var(--af-panel);
  --gm-rail: var(--af-rail);
  --gm-text: var(--af-ink);
  --gm-muted: #5f6368;
  --gm-divider: var(--af-line);
  --gm-accent: var(--af-accent);
  --gm-accent-soft: var(--af-accent-soft);

  /* Spacing scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;

  /* Radii / elevation */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow: 0 12px 40px rgba(15, 23, 42, 0.1);
  --shadow-panel: 0 0 0 1px rgba(15, 23, 42, 0.06), 4px 0 24px rgba(15, 23, 42, 0.06);
  --shadow-panel-float: 0 10px 40px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(15, 23, 42, 0.05);
  --shadow-fab: 0 2px 8px rgba(15, 23, 42, 0.16);

  /* Type */
  --font-body: 'Yekan Bakh FaNum', Tahoma, Arial, sans-serif;
  --font-heading: 'Yekan Bakh FaNum', Tahoma, Arial, sans-serif;
  --weight-body: 400;
  --weight-heading: 600;
  --text-xs: 12px;
  --text-sm: 13px;
  --text-md: 14px;
  --text-lg: 16px;
  --text-xl: 20px;
  --line-tight: 1.35;
  --line-normal: 1.55;

  /* Controls */
  --touch-min: 44px;
  --btn-h: 44px;
  --input-h: 48px;
  --icon-sm: 18px;
  --icon-md: 22px;
  --icon-lg: 24px;
  --sidebar-width: 392px;
  --search-pill-h: 48px;
  --search-menu-size: 48px;

  /* Mobile shell — reference-matched teal system */
  --m-gutter: 12px;
  --m-gutter-lg: 16px;
  --m-search-h: 54px;
  --m-search-radius: 28px;
  --m-touch: 48px;
  --m-bottom-nav-h: 52px;
  --m-sheet-radius: 24px;
  --m-chip-h: 34px;
  --m-ctrl: 48px;
  --m-dirs-fab: 48px; /* match Locate circle */
  --m-icon: 22px;
  --m-primary: #007F87;
  --m-selected: #BDEBF0;
  --m-nav-bg: #EFF6F8;
  --m-surface: #FFFFFF;
  --m-text: #30383E;
  --m-text-secondary: #667085;
  --m-border: rgba(16, 24, 40, 0.08);
  --m-shadow-float: 0 6px 24px rgba(16, 24, 40, 0.10);
  --m-shadow-sheet: 0 -4px 24px rgba(16, 24, 40, 0.10);
  /* Floating bottom nav card: height + bottom inset (gutter / safe-area). */
  --af-bottom-chrome: calc(
    var(--m-bottom-nav-h) + max(var(--m-gutter), env(safe-area-inset-bottom, 0px))
  );

  /* Motion */
  --motion-fast: 120ms;
  --motion-normal: 220ms;
  --motion-slow: 360ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);

  /* Z-index hierarchy (map = 0) */
  --z-map: 0;
  --z-route-overlay: 1;
  --z-chrome: 5;
  --z-nav-rail: 7;
  --z-search: 8;
  --z-panel: 9;
  --z-controls: 10;
  --z-menu: 12;
  --z-dialog: 20;
  --z-toast: 30;

  /* Breakpoints (documented; media queries use literals).
     Package 07: tablet widths share the mobile sheet layout up to 900px —
     no separate 768px chrome fork (avoids conflicting panel geometry). */
  --bp-mobile-max: 900px;
  --bp-tablet: 900px;
  --bp-desktop: 901px;
  --bp-wide: 1440px;
}

html[lang='fa'] {
  --font-body: 'Yekan Bakh FaNum', Tahoma, Arial, sans-serif;
  --font-heading: 'Yekan Bakh FaNum', Tahoma, Arial, sans-serif;
  --weight-body: 400;
  --weight-heading: 600;
}

html[lang='ps'] {
  --font-body: 'IRANSans FaNum', Tahoma, Arial, sans-serif;
  --font-heading: 'IRANSans FaNum', Tahoma, Arial, sans-serif;
  --weight-body: 400;
  --weight-heading: 500;
}

html[lang='en'] {
  --font-body: 'SF UI Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-heading: 'SF UI Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --weight-body: 400;
  --weight-heading: 600;
}

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