/**
 * GOD'S PRICELESS JEWELS (GPJ) & GPJ KIDS
 * WCAG 2.2 AAA ACCESSIBILITY ENGINE & FOCUS ARCHITECTURE
 * 
 * Standard: ISO/IEC/IEEE 12207 SDLC · WCAG 2.2 Level AA & AAA Compliance
 * Authority: GPJ Master Development Playbook (Micro-Step 08)
 * Target File: css/accessibility.css
 */

/* ==========================================================================
   1. GLOBAL HIGH-VISIBILITY FOCUS-VISIBLE RINGS (WCAG 2.2 AAA)
   Enforces a 3px Sovereign Gold focus halo with 2px offset.
   RED FLAG ENFORCEMENT: Never allows naked outline:none!
   ========================================================================== */
:focus-visible {
  outline: 3px solid var(--gpj-gold, #C5A059) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 4px rgba(74, 21, 37, 0.25) !important;
  border-radius: 4px;
  transition: outline-offset 120ms ease;
}

/* Enhanced Focus for Buttons, Floating Pills, and Interactive CTAs */
button:focus-visible,
a.btn:focus-visible,
a[role="button"]:focus-visible,
.floating-pill-nav button:focus-visible,
.floating-pill-nav a:focus-visible,
.nav-give-btn:focus-visible,
.floating-pill-give-btn:focus-visible,
.hero-cta-btn:focus-visible {
  outline: 3px solid var(--gpj-gold, #C5A059) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 14px rgba(197, 160, 89, 0.65) !important;
}

/* Kids Wing High-Visibility Tactile Focus */
.gpj-kids :focus-visible,
body.kids-body :focus-visible,
[data-wing="kids"] :focus-visible {
  outline: 3.5px solid var(--kids-stroke, #18181B) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 4px var(--kids-amber, #FFB703) !important;
  border-radius: 8px;
}

/* Form Controls Focus (Inputs, Textareas, Selects) */
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid var(--gpj-gold, #C5A059) !important;
  outline-offset: 2px !important;
  border-color: var(--gpj-burgundy, #4A1525) !important;
  box-shadow: 0 0 0 4px rgba(197, 160, 89, 0.25) !important;
}

/* Clean Mouse Click State: Suppress default outline ONLY when not keyboard-focused */
:focus:not(:focus-visible) {
  outline: none;
}

/* ==========================================================================
   2. ACCESSIBLE SKIP-TO-MAIN-CONTENT LINK
   Off-screen by default; smoothly slides down on first keyboard Tab press.
   ========================================================================== */
.skip-link {
  position: fixed;
  top: -120px;
  left: 1.5rem;
  background: var(--gpj-burgundy, #4A1525);
  color: #FFFFFF !important;
  padding: 0.85rem 1.6rem;
  font-family: var(--font-sans-ui, 'Inter', sans-serif);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  border: 2px solid var(--gpj-gold, #C5A059);
  border-radius: 0 0 10px 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  z-index: 100000;
  transition: top 180ms cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 0;
  outline: 3px solid var(--gpj-gold, #C5A059) !important;
  outline-offset: 2px !important;
}

/* ==========================================================================
   3. SCREEN READER ONLY ACCESSIBILITY UTILITIES
   Allows assistive technologies to read content hidden from visual display.
   ========================================================================== */
.sr-only,
.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Allows screen-reader utilities to become visible when tabbed into */
.sr-only-focusable:focus,
.sr-only-focusable:focus-visible {
  position: static !important;
  width: auto !important;
  height: auto !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
}

/* ==========================================================================
   4. TOUCH TARGET SIZE HYGIENE (WCAG 2.5.5 / 2.5.8)
   Guarantees minimum 44px x 44px interactive area for finger tap accuracy.
   ========================================================================== */
button,
a[role="button"],
.nav-link-item,
.floating-pill-brand,
.floating-pill-kids-btn,
.floating-pill-give-btn,
.floating-pill-menu-btn,
.kids-nav-item {
  min-height: 44px;
  min-width: 44px;
}

/* ==========================================================================
   5. OPERATING SYSTEM ACCESSIBILITY PREFERENCES
   Supports Windows High-Contrast Mode & User Motion Preferences
   ========================================================================== */
/* Respect User Motion Preferences (Vestibular Disorder Support) */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Windows High Contrast Mode / Forced Colors */
@media (forced-colors: active) {
  :focus-visible {
    outline: 3px solid Highlight !important;
    outline-offset: 2px !important;
    box-shadow: none !important;
  }

  .skip-link {
    border: 2px solid Highlight !important;
    background: Canvas !important;
    color: CanvasText !important;
  }

  button,
  .btn {
    border: 1px solid ButtonText !important;
  }
}
