/* ==========================================================================
   Tokens
   Every staff design token: the brand ramp, neutrals, semantic and status
   colours, and the scales. Loaded first on every staff page.
   bootstrap-theme.css maps Bootstrap's --bs-* variables onto these.
   ========================================================================== */

:root {
  /* Brand */
  --color-brand: #F97316;          /* Orange - CTAs, highlights */
  --color-brand-light: #FFF7ED;    /* Orange tint - icon bg, chip bg */
  --color-brand-ring: #FED7AA;     /* Orange border - chips */
  --color-brand-glow: rgba(249, 115, 22, 0.25);
  /* Text on a solid brand surface: 6.9:1 on the brand, 5.5:1 on its hover
     step. White is 2.8:1. High contrast swaps it back to white below. */
  --color-on-brand: var(--color-gray-900);

  --color-primary: var(--color-brand);
  --color-primary-dark: #EA580C;   /* Orange-600 */
  --color-primary-light: var(--color-brand-light);
  --color-primary-50: #FFF7ED;
  --color-primary-100: #FFEDD5;
  --color-primary-400: #FB923C;
  --color-primary-500: #F97316;
  --color-primary-600: #EA580C;
  --color-primary-700: #C2410C;
  --color-primary-800: #9A3412;

  /* Text */
  --color-text-primary: #0B0D0F;   /* Headings, bold labels */
  --color-text-secondary: #4B5563; /* Body copy, descriptions (AA+ on light) */
  --color-text-muted: #6B7280;     /* Footer, low-emphasis */
  --color-text-nav: #4B5563;       /* Navigation links */

  /* Neutrals */
  --color-white: #ffffff;
  --color-gray-50: #F8FAFC;
  --color-gray-100: #F1F5F9;
  --color-gray-200: #E5E7EB;
  --color-gray-300: #D1D5DB;
  --color-gray-400: #9CA3AF;
  --color-gray-500: #6B7280;
  --color-gray-600: #4B5563;
  --color-gray-700: #374151;
  --color-gray-800: #1F2937;
  --color-gray-900: #0B0D0F;

  /* Semantic colours */
  --color-success: #10B981;
  --color-success-light: #D1FAE5;
  --color-success-dark: #059669;
  --color-warning: #F59E0B;
  --color-warning-light: #FEF3C7;
  --color-warning-dark: #D97706;
  --color-danger: #EF4444;
  --color-danger-light: #FEE2E2;
  --color-danger-dark: #DC2626;
  --color-info: #3B82F6;
  --color-info-light: #DBEAFE;
  --color-info-dark: #1E40AF;

  /* Status pairs (background + text) */
  --color-status-success-bg: #D1FAE5;
  --color-status-success-text: #065F46;
  --color-status-danger-bg: #FEE2E2;
  --color-status-danger-text: #991B1B;
  --color-status-warning-bg: #FEF3C7;
  --color-status-warning-text: #92400E;
  --color-status-info-bg: #DBEAFE;
  --color-status-info-text: #1E40AF;
  --color-status-neutral-bg: #F3F4F6;
  --color-status-neutral-text: #1F2937;

  /* Outside the ramp on purpose. The ramp stops at --color-primary-700
     (#C2410C), which washes out on the 20%-orange is-active-appointment fill,
     so this Orange-900 pins AA-strong contrast. */
  --schedule-active-accent: #7c2d12;

  /* Surfaces */
  --bg-primary: var(--color-white);
  --bg-secondary: #F8FAFC;         /* the page background */
  --bg-tertiary: var(--color-gray-100);
  --bg-accent: var(--color-brand-light);
  /* The unfilled part of a progress track: pips, timeline rail and dots.
     A fill, not a border, so high contrast leaves it alone. */
  --bg-track: var(--color-gray-200);

  /* Text roles */
  --text-primary: var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --text-tertiary: var(--color-text-muted);
  --text-inverse: var(--color-white);
  --text-nav: var(--color-text-nav);
  /* Brand-coloured text on a brand tint (--color-brand-light, --bg-accent). */
  --text-brand: var(--color-primary-700);

  /* Borders */
  --border-color: #E5E7EB;
  --border-color-light: #F1F5F9;
  --border-color-dark: #D1D5DB;

  /* Shadows */
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: var(--shadow-card);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);

  /* Spacing */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-12: 3rem;     /* 48px */
  --space-20: 5rem;     /* 80px */

  /* Radii */
  --radius-sm: 8px;    /* Chips, badges */
  --radius-md: 12px;   /* Cards, buttons, inputs: Bootstrap's --bs-border-radius* */
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-full: 9999px;

  /* Font weights */
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-extrabold: 800; /* Card Title / Label */
  --font-weight-black: 900;      /* Headings */

  /* Type scale */
  --font-size-xs: 0.75rem;   /* 12px */
  --font-size-meta: 0.8125rem; /* 13px - secondary metadata floor */
  --font-size-sm: 0.875rem;  /* 14px */
  --font-size-md: 0.9375rem; /* 15px - primary row titles */
  --font-size-base: 1rem;    /* 16px */
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;   /* 20px - Step Number */
  --font-size-2xl: 1.5rem;   /* 24px - Section H2 mobile */
  --font-size-3xl: 1.875rem; /* 30px - Section H2 desktop */
  --font-size-4xl: 2.25rem;  /* 36px - Hero H1 mobile */
  --font-size-5xl: 3.75rem;  /* 60px - Hero H1 desktop */

  /* Line heights */
  --line-height-tight: 1.25;
  --line-height-normal: 1.5;
  --line-height-relaxed: 1.625;

  /* Transitions */
  --transition-fast: 150ms ease-in-out;
  --transition-normal: 250ms ease-in-out;
  --transition-slow: 350ms ease-in-out;

  /* Font families (Inter is loaded from vendor/inter-font/*.css) */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

/* Dark mode. base.html's head script sets data-bs-theme="dark" whenever the
   dark theme is in effect, chosen by the user or followed from the OS, so
   this one block covers both. The raw palette (--color-white, --color-gray-*,
   --color-text-*, the -light / -dark semantic colours) keeps its light
   values: a surface, border or text that must follow the theme reads the
   role tokens below (--bg-*, --border-color*, --text-*, the status pairs). */
[data-bs-theme="dark"] {
  /* Surfaces, three levels of depth */
  --bg-primary: #0B0D0F;
  --bg-secondary: #101723;
  --bg-tertiary: #1B2635;
  --bg-accent: #1B2635;
  /* Opaque: a timeline dot sits on its rail. */
  --bg-track: #334155;

  /* Text */
  --text-primary: #F8FAFC;
  --text-secondary: rgba(255, 255, 255, 0.88);
  --text-tertiary: rgba(255, 255, 255, 0.72);
  --text-nav: rgba(255, 255, 255, 0.82);
  /* Text on a primary button: dark on orange, for contrast. */
  --text-inverse: #0B0D0F;
  /* -700 on the dark, translucent brand tint is about 3:1; -400 is 6.5:1 or more. */
  --text-brand: var(--color-primary-400);

  /* Borders */
  --border-color: rgba(255, 255, 255, 0.16);
  --border-color-light: rgba(255, 255, 255, 0.10);
  --border-color-dark: rgba(255, 255, 255, 0.22);

  /* Brand tints on dark surfaces */
  --color-brand-glow: rgba(249, 115, 22, 0.30);
  --color-brand-light: rgba(249, 115, 22, 0.15);
  --color-primary-light: rgba(249, 115, 22, 0.15);
  --color-primary-50: rgba(249, 115, 22, 0.10);
  --color-primary-100: rgba(249, 115, 22, 0.25);

  /* Status pairs: a translucent tint of the hue under a light tint of it,
     6:1 or more on every dark surface. They feed Bootstrap's *-subtle /
     *-emphasis pairs, so the {% status_badge %} chips and the alerts too. */
  --color-status-success-bg: color-mix(in srgb, var(--color-success) 15%, transparent);
  --color-status-success-text: #6EE7B7;
  --color-status-danger-bg: color-mix(in srgb, var(--color-danger) 15%, transparent);
  --color-status-danger-text: #FCA5A5;
  --color-status-warning-bg: color-mix(in srgb, var(--color-warning) 15%, transparent);
  --color-status-warning-text: #FCD34D;
  --color-status-info-bg: color-mix(in srgb, var(--color-info) 15%, transparent);
  --color-status-info-text: #93C5FD;
  --color-status-neutral-bg: rgba(255, 255, 255, 0.10);
  --color-status-neutral-text: var(--color-gray-200);
}

/* High contrast darkens the brand, warning and border colours on light
   backgrounds only: on dark ones these values would lower the contrast.
   On the 700 step white is 5.2:1 and dark text only 3.8:1, so text on the
   brand turns white; hover goes one step darker still.
   --color-primary follows --color-brand. */
@media (prefers-contrast: more) {
  :root:not([data-bs-theme="dark"]) {
    --color-brand: var(--color-primary-700);
    --color-primary-dark: var(--color-primary-800);
    --color-on-brand: var(--color-white);
    --color-warning: #8B6F00;
    --border-color: var(--color-gray-900);
    --border-color-light: var(--color-gray-700);
    --border-color-dark: var(--color-gray-900);
  }
}
