﻿/* ============================================
   ACCESSIBILITY UTILITIES
   WCAG 2.1 AA Compliant
   ============================================ */

/* â”€â”€ Skip Navigation â”€â”€ */
.skip-nav {
  position: fixed;
  top: -100%;
  left: var(--space-4);
  z-index: var(--z-skip-nav);
  padding: var(--space-3) var(--space-6);
  background: var(--color-primary);
  color: var(--color-text-on-primary);
  font-weight: var(--font-weight-semibold);
  font-size: var(--font-size-sm);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  text-decoration: none;
  transition: top var(--transition-fast);
}

.skip-nav:focus {
  top: 0;
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
}

/* â”€â”€ Screen Reader Only â”€â”€ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Make sr-only content visible when focused (for skip links etc.) */
.sr-only-focusable:focus,
.sr-only-focusable:active {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* â”€â”€ Focus Indicators â”€â”€ */
.focus-ring:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-ring-offset);
  box-shadow: var(--shadow-focus);
}

/* High-visibility focus for dark backgrounds */
.focus-ring-light:focus-visible {
  outline: 3px solid #FFFFFF;
  outline-offset: 2px;
}

/* â”€â”€ Reduced Motion â”€â”€ */
@media (prefers-reduced-motion: reduce) {
  .animate {
    animation: none !important;
    transition: none !important;
  }
}

/* â”€â”€ ARIA Live Region (for dynamic announcements) â”€â”€ */
.aria-live-region {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* â”€â”€ Color Blind Helper Patterns â”€â”€ */
/* Used alongside colors to provide pattern-based differentiation */
.pattern-dots {
  background-image: radial-gradient(circle, currentColor 1px, transparent 1px);
  background-size: 6px 6px;
}

.pattern-lines {
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 2px,
    currentColor 2px,
    currentColor 4px
  );
}

.pattern-cross {
  background-image:
    linear-gradient(currentColor 1px, transparent 1px),
    linear-gradient(90deg, currentColor 1px, transparent 1px);
  background-size: 6px 6px;
}

/* â”€â”€ Minimum Touch/Click Target â”€â”€ */
/* Ensure all interactive elements have at least 44x44px hit area */
.touch-target {
  position: relative;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* â”€â”€ Text Spacing Override Support â”€â”€ */
/* WCAG 1.4.12 - Content should not be lost with text spacing adjustments */
body {
  word-spacing: normal;
  letter-spacing: normal;
}

/* â”€â”€ Forced Colors / Windows High Contrast Mode â”€â”€ */
@media (forced-colors: active) {
  .card,
  .stat-card,
  .nav-link,
  .btn {
    border: 1px solid ButtonText;
  }

  .btn-primary {
    background: ButtonFace;
    color: ButtonText;
    border: 2px solid ButtonText;
  }

  .nav-link--active {
    border: 2px solid Highlight;
  }

  .toggle-switch .toggle-slider {
    border: 2px solid ButtonText;
  }
}

