/**
 * accessibility.css - Accessibility-specific styles
 * 
 * These styles ensure the app is accessible to all users,
 * including those using screen readers, keyboard navigation,
 * or other assistive technologies.
 */

/* 
 * Focus Styles
 * Clear, visible focus indicators for keyboard navigation
 */
*:focus {
  outline: none;
}

*:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}

/* Skip link for keyboard users */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--color-primary);
  color: white;
  text-decoration: none;
  border-radius: var(--radius-md);
  z-index: 9999;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--spacing-md);
}

/* 
 * Screen Reader Only Content
 * Hide visually but keep accessible to screen readers
 */
.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;
}

/* 
 * Reduced Motion
 * Respect user's motion preferences
 */
@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;
  }
}

/* 
 * High Contrast Mode
 * Enhanced visibility for users who need it
 */
body.high-contrast {
  /* Ensure all interactive elements have clear borders */
  button,
  [role="button"] {
    border: 2px solid currentColor;
  }
  
  /* Remove subtle backgrounds that might reduce contrast */
  .status-indicator {
    background: black;
    border: 2px solid white;
  }
  
  /* Ensure text is always readable */
  .app-subtitle {
    color: white;
  }
}

/* 
 * Touch Target Sizes
 * Ensure buttons are large enough for touch
 */
button,
[role="button"],
input[type="checkbox"] + label,
.toggle-slider {
  min-height: var(--touch-target-min);
  min-width: var(--touch-target-min);
}

/* Large buttons mode */
body.large-buttons {
  button,
  [role="button"] {
    min-height: var(--touch-target-large);
    min-width: var(--touch-target-large);
  }
}

/* 
 * Color Contrast
 * Ensure text is readable against backgrounds
 */
.app-title {
  /* Already handled by gradient text, but ensure fallback */
  color: var(--color-primary-dark);
}

/* 
 * ARIA Live Regions
 * Styles for announcements to screen readers
 */
[aria-live="polite"],
[aria-live="assertive"] {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* 
 * Disabled State
 * Clear visual indication when controls are disabled
 */
[disabled],
[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 
 * Loading State
 * Indicate when the app is loading
 */
.loading {
  position: relative;
  pointer-events: none;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 40px;
  height: 40px;
  margin: -20px 0 0 -20px;
  border: 4px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Respect reduced motion for loading spinner */
@media (prefers-reduced-motion: reduce) {
  .loading::after {
    animation: none;
    border-top-color: var(--color-border);
  }
}

/* 
 * Print Styles
 * Ensure the app is usable when printed
 */
@media print {
  accessibility-panel,
  .completion-celebration {
    display: none !important;
  }
  
  body {
    background: white !important;
    color: black !important;
  }
  
  .app-title {
    background: none !important;
    -webkit-text-fill-color: black !important;
    color: black !important;
  }
}
