/*
 * NSC1501 Bioscience - ACCESSIBILITY ENHANCEMENTS
 * WCAG compliance, focus states, reduced motion, high contrast
 */

/* ============================================
   SKIP LINKS
   ============================================ */
.skip-link {
  position: absolute;
  top: -100px;
  left: 0;
  background: var(--forest, #1a3a2a);
  color: var(--gold-light, #e8c97a);
  padding: 1rem 1.5rem;
  z-index: 10000;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  text-decoration: none;
  letter-spacing: 0.05em;
  border-radius: 0 0 var(--radius-md, 8px) var(--radius-md, 8px);
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 0;
  outline: none;
}

.skip-link:hover {
  background: var(--terracotta, #c45d3e);
  color: white;
}

/* ============================================
   FOCUS STYLES
   ============================================ */
*:focus {
  outline: 2px solid var(--terracotta, #c45d3e);
  outline-offset: 3px;
}

*:focus:not(:focus-visible) {
  outline: none;
}

*:focus-visible {
  outline: 2px solid var(--terracotta, #c45d3e);
  outline-offset: 3px;
}

button:focus,
a:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
  outline: 2px solid var(--terracotta, #c45d3e);
  outline-offset: 3px;
}

/* Card focus states */
.card:focus,
.term-card:focus {
  outline: 3px solid var(--terracotta, #c45d3e);
  outline-offset: 3px;
}

/* ============================================
   TOUCH TARGETS (minimum 44x44px)
   ============================================ */
.nav-link,
.toggle-btn,
.btn,
button,
.pdf-btn,
.video-btn {
  min-height: 44px;
  min-width: 44px;
}

.close-btn,
.close-pdf-btn,
.key-term-modal-close {
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@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;
  }

  .mobile-menu-toggle span {
    transition: none !important;
  }
}

/* ============================================
   HIGH CONTRAST MODE
   ============================================ */
@media (prefers-contrast: high) {
  :root {
    --border-width: 2px;
    --border-accent: 3px;
  }

  .term-card,
  .card {
    border-width: 3px;
  }

  .feedback p.correct {
    border-left-width: 5px;
  }

  .feedback p.incorrect {
    border-left-width: 5px;
  }

  a {
    text-decoration-thickness: 2px;
  }
}

/* ============================================
   ARIA LIVE REGIONS
   ============================================ */
[aria-live="polite"],
[aria-live="assertive"] {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.announcement-region {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   PROGRESS BAR ACCESSIBILITY
   ============================================ */
[role="progressbar"] {
  transition: width 0.3s ease;
}

/* ============================================
   MODAL FOCUS TRAP INDICATORS
   ============================================ */
.modal-focus-trap-start,
.modal-focus-trap-end {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   SCREEN READER TEXT
   ============================================ */
.sr-text,
.icon-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   BUTTON ACCESSIBILITY
   ============================================ */
button[aria-pressed="true"] {
  background: var(--forest, #1a3a2a);
  color: var(--ivory, #f5f0e8);
}

button[aria-pressed="false"] {
  background: var(--bg-surface, #f8f5f0);
  color: var(--text-primary, #2c2416);
}

button[aria-disabled="true"],
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ============================================
   FORM ACCESSIBILITY
   ============================================ */
label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: var(--text-primary, #2c2416);
}

input[type="radio"],
input[type="checkbox"] {
  width: 1.25rem;
  height: 1.25rem;
  accent-color: var(--forest, #1a3a2a);
  cursor: pointer;
}

input[type="radio"]:focus,
input[type="checkbox"]:focus {
  outline: 2px solid var(--terracotta, #c45d3e);
  outline-offset: 3px;
}

/* ============================================
   VIDEO ACCESSIBILITY
   ============================================ */
video {
  max-width: 100%;
}

video:focus {
  outline: 3px solid var(--terracotta, #c45d3e);
}

/* ============================================
   IFRAME ACCESSIBILITY
   ============================================ */
iframe {
  border: var(--border-width, 1px) solid var(--border-color, #c8bfa8);
}

iframe:focus {
  outline: 3px solid var(--terracotta, #c45d3e);
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .skip-link,
  .mobile-menu-toggle,
  .video-section,
  .game-section,
  nav,
  footer {
    display: none !important;
  }

  body {
    border: none;
    font-size: 12pt;
    line-height: 1.5;
    background: white;
    color: black;
  }

  a[href]::after {
    content: " (" attr(href) ")";
  }

  .term-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .card {
    break-inside: avoid;
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #999;
  }
}
