/* =========================================
   DATAFACE DESIGN TOKEN SYSTEM
   Single source of truth for all visual properties.
   Every CSS file references these variables — never hardcode values.
   ========================================= */

:root {
  /* ---- Brand Colours ---- */
  --color-navy-deep: #001D3D;
  --color-navy-light: #003566;
  --color-blue-medium: #0084D4;
  --color-blue-light: #5CB3FF;
  --color-blue-pale: #abd8ff;
  --color-gold: #FFC300;
  --color-yellow: #FFD60A;

  /* ---- Text Colours ---- */
  --text-primary: #000814;
  --text-secondary: #525252;
  --text-muted: #525252; /* aliased to --text-secondary; was #6c757d (4.69:1 on white, fails on tints — WCAG 1.4.3) */
  --text-inverse: #ffffff;
  --text-inverse-secondary: rgba(255, 255, 255, 0.75);
  --text-inverse-muted: rgba(255, 255, 255, 0.6);

  /* ---- Surface Colours ---- */
  --surface-white: #ffffff;
  --surface-light: #f8f9fa;
  --surface-border: #e9ecef;
  --surface-hover: #f8f9fa;

  /* ---- Shadows ---- */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 29, 61, 0.1);
  --shadow-lg: 0 12px 24px rgba(0, 29, 61, 0.08), 0 4px 8px rgba(0, 29, 61, 0.04);
  --shadow-btn-hover: 0 4px 12px rgba(0, 29, 61, 0.15);
  --shadow-hero-btn: 0 6px 20px rgba(255, 214, 10, 0.4);
  --shadow-navbar: 0 2px 12px rgba(0, 0, 0, 0.15);

  /* ---- Border Radius ---- */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-pill: 50px;

  /* ---- Transitions ---- */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.2s ease;
  --transition-smooth: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s ease;

  /* ---- Spacing (section-level) ---- */
  --section-padding-y: 5rem;
  --section-padding-y-sm: 3rem;

  /* ---- Typography ---- */
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;
  --font-weight-bold: 700;
  --font-weight-black: 900;

  /* ---- Gradient ---- */
  --gradient-brand: linear-gradient(90deg, var(--color-navy-light), var(--color-blue-medium), var(--color-blue-light));
}

/* WCAG 2.2 — 2.4.11 Focus Not Obscured: prevent fixed navbar from hiding focused elements when tabbing through page */
html {
  scroll-padding-top: 80px;
}

/* Safety net for "dark text on dark navy" cascade — keeps body{color:#525252} from leaking into navy-backgrounded sections */
.bg-navy-deep p, .bg-navy-deep li, .bg-navy-deep span:not(.text-warning):not(.text-gold):not(.text-yellow),
.bg-gradient-brand p, .bg-gradient-brand li, .bg-gradient-brand span:not(.text-warning):not(.text-gold):not(.text-yellow) {
  color: var(--text-inverse-secondary);
}

/* Override: reset dark text when content is inside a white/light card or bg-white block within a dark section.
   This fixes the "white text on white card" bug — the safety net above was cascading into nested white cards. */
.bg-navy-deep .card p, .bg-navy-deep .card li, .bg-navy-deep .card span,
.bg-navy-deep .bg-white p, .bg-navy-deep .bg-white li, .bg-navy-deep .bg-white span,
.bg-navy-deep .bg-light p, .bg-navy-deep .bg-light li, .bg-navy-deep .bg-light span,
.bg-gradient-brand .card p, .bg-gradient-brand .card li, .bg-gradient-brand .card span,
.bg-gradient-brand .bg-white p, .bg-gradient-brand .bg-white li, .bg-gradient-brand .bg-white span,
.bg-gradient-brand .bg-light p, .bg-gradient-brand .bg-light li, .bg-gradient-brand .bg-light span {
  color: var(--text-secondary);
}

/* ======================================
   FOCUS RINGS (WCAG 2.4.7, 2.4.11, 2.4.13)
   :focus-visible fires only on keyboard navigation, not mouse clicks.
   Double-ring technique: navy outline (visible on light bg) + gold halo (visible on dark bg).
   At least one ring is always visible regardless of background colour.
   ====================================== */
:focus-visible {
  outline: 3px solid var(--color-navy-deep);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--color-gold);
  border-radius: 4px;
}

/* On dark backgrounds, swap the layers — gold outline becomes the primary, navy becomes the halo */
.bg-navy-deep :focus-visible,
.bg-navy-light :focus-visible,
.bg-gradient-brand :focus-visible,
[class*="bg-dark"] :focus-visible {
  outline: 3px solid var(--color-gold);
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.3);
}

/* Remove default Bootstrap focus box-shadow on form controls so it doesn't conflict with our ring */
.form-control:focus-visible {
  box-shadow: 0 0 0 5px var(--color-gold);
}

/* Disable mouse-click focus rings (only show on keyboard) — overrides any legacy :focus styles */
:focus:not(:focus-visible) {
  outline: none;
  box-shadow: none;
}
