/* ========================================
   ACCESSIBILITY STYLES
   WCAG 2.2 AA Compliant
   ======================================== */

/* Skip Link - Visible on focus */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: #000;
  color: #fff;
  padding: 8px 16px;
  text-decoration: none;
  z-index: 10000;
  font-weight: 600;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid #ED8936;
  outline-offset: 2px;
}

/* ========================================
   CONTROL PANEL - WILDERNESS THEME
   ======================================== */

.control-panel {
  position: fixed;
  top: clamp(1rem, 3vw, 1.5rem);
  right: clamp(1rem, 3vw, 2rem);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  animation: slideInRight 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s backwards;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-100px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Accessibility Controls */
.accessibility-controls {
  position: fixed;
  top: clamp(0.5rem, 2.25vw, 0.75rem);
  left: clamp(0.5rem, 2.25vw, 1rem);
  z-index: 1000;
  display: flex;
  flex-direction: row;
  gap: 0.56rem;
  background: rgba(26, 61, 46, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  border: 2px solid rgba(212, 165, 116, 0.6);
  border-radius: 0.75rem;
  padding: 0.75rem 0.94rem;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset,
    0 0 60px rgba(212, 165, 116, 0.3);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: slideInLeft 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s backwards;
}

.accessibility-controls:hover {
  background: rgba(26, 61, 46, 1);
  border-color: rgba(212, 165, 116, 0.8);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.3) inset,
    0 0 80px rgba(212, 165, 116, 0.4);
}

.controls-label {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(212, 165, 116, 1);
  margin-bottom: 0.25rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.language-label {
  font-family: var(--font-ui);
  font-size: 0.5625rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(212, 165, 116, 1);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

.controls-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.accessibility-controls button {
  min-width: 36px;
  height: 33px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.375rem 0.75rem;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 0.45rem;
  color: rgba(255, 255, 255, 1);
  font-family: var(--font-ui);
  font-size: 0.675rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.accessibility-controls button:hover {
  background: rgba(212, 165, 116, 0.5);
  border-color: rgba(212, 165, 116, 0.9);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(212, 165, 116, 0.4);
}

.accessibility-controls button:focus {
  outline: 3px solid var(--owl-gold);
  outline-offset: 2px;
}

.accessibility-controls button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(212, 165, 116, 0.3);
}

.accessibility-controls button.active {
  background: rgba(212, 165, 116, 0.6);
  border-color: var(--owl-gold);
  color: white;
  box-shadow: 0 0 20px rgba(212, 165, 116, 0.5);
}

.control-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  padding: 0;
}

.control-btn:hover {
  background: rgba(212, 165, 116, 0.3);
  border-color: rgba(212, 165, 116, 0.6);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.control-btn:focus {
  outline: 2px solid var(--owl-gold);
  outline-offset: 2px;
}

.control-btn:active {
  transform: translateY(0);
}

.control-btn.active {
  background: rgba(212, 165, 116, 0.4);
  border-color: var(--owl-gold);
  color: white;
}

.control-btn svg {
  width: 16px;
  height: 16px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* Language Selector */
.language-selector {
  position: fixed;
  top: clamp(0.5rem, 2.25vw, 0.75rem);
  right: clamp(0.5rem, 2.25vw, 1rem);
  z-index: 1000;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.56rem;
  background: rgba(26, 61, 46, 0.95);
  backdrop-filter: blur(20px) saturate(180%);
  border: 2px solid rgba(212, 165, 116, 0.6);
  border-radius: 0.75rem;
  padding: 0.75rem 0.94rem;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.2) inset,
    0 0 60px rgba(212, 165, 116, 0.3);
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: slideInRight 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s backwards;
}

.language-selector:hover {
  background: rgba(26, 61, 46, 1);
  border-color: rgba(212, 165, 116, 0.8);
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 255, 255, 0.3) inset,
    0 0 80px rgba(212, 165, 116, 0.4);
}

#google_translate_element {
  font-size: 0.675rem;
}

/* Style Google Translate dropdown */
.goog-te-gadget {
  font-family: var(--font-ui) !important;
  color: white !important;
}

.goog-te-gadget-simple {
  background: rgba(255, 255, 255, 0.15) !important;
  border: 2px solid rgba(255, 255, 255, 0.4) !important;
  border-radius: 0.45rem !important;
  padding: 0.375rem 0.75rem !important;
  font-size: 0.675rem !important;
  font-weight: 600 !important;
  color: white !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
  transition: all 0.3s ease !important;
}

.goog-te-gadget-simple:hover {
  background: rgba(255, 255, 255, 0.25) !important;
  border-color: rgba(255, 255, 255, 0.6) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.goog-te-menu-value span {
  color: white !important;
  font-weight: 600 !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5) !important;
}

.goog-te-gadget-icon {
  display: none !important;
}

.goog-te-gadget .goog-te-gadget-simple span {
  color: white !important;
  font-weight: 600 !important;
}

.goog-te-gadget .goog-te-combo {
  background: rgba(255, 255, 255, 0.15) !important;
  border: 2px solid rgba(255, 255, 255, 0.4) !important;
  border-radius: 0.45rem !important;
  padding: 0.375rem 0.75rem !important;
  font-size: 0.675rem !important;
  font-weight: 600 !important;
  color: white !important;
  font-family: var(--font-ui) !important;
}

/* ========================================
   INDIGENOUS LANGUAGES MENU
   ======================================== */

.indigenous-languages {
  position: fixed;
  top: 10px;
  left: 200px;
  z-index: 1000;
}

#indigenous-lang-toggle {
  background-color: rgba(255, 255, 255, 0.95);
  border: 1px solid #cbd5e0;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
  color: #2d3748;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: all 0.2s ease;
}

#indigenous-lang-toggle:hover,
#indigenous-lang-toggle:focus {
  background-color: #2B6CB0;
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.indigenous-lang-menu {
  position: absolute;
  top: 45px;
  left: 0;
  background-color: white;
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  padding: 1rem;
  min-width: 220px;
  z-index: 1001;
}

.indigenous-lang-menu h3 {
  margin: 0 0 0.75rem 0;
  font-size: 0.95rem;
  color: #2B6CB0;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 0.5rem;
}

.indigenous-lang-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.indigenous-lang-menu li {
  margin: 0.5rem 0;
}

.indigenous-lang-menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  color: #2d3748;
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.2s ease;
  font-size: 0.85rem;
}

.indigenous-lang-menu a:hover,
.indigenous-lang-menu a:focus {
  background-color: #2B6CB0;
  color: white;
  transform: translateX(4px);
  outline: 2px solid #2B6CB0;
  outline-offset: 2px;
}

/* Override Google Translate default styles for better appearance */
.goog-te-banner-frame {
  display: none !important;
}

body {
  top: 0 !important;
}

.goog-te-combo {
  padding: 6px 8px;
  border: 1px solid #CBD5E0;
  border-radius: 4px;
  font-size: 0.9rem;
  background-color: white;
}

/* ========================================
   FOCUS INDICATORS
   ======================================== */

/* Enhanced focus indicators for keyboard navigation */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 2px solid #ED8936;
  outline-offset: 2px;
}

/* Ensure focus is visible on all interactive elements */
.category-card:focus-within {
  outline: 2px solid #ED8936;
  outline-offset: 2px;
}

/* ========================================
   FONT SIZE ADJUSTMENTS
   ======================================== */

body.font-size-normal {
  font-size: 16px;
}

body.font-size-large {
  font-size: 18px;
}

body.font-size-larger {
  font-size: 20px;
}

body.font-size-largest {
  font-size: 22px;
}

/* Adjust heading sizes proportionally */
body.font-size-large h1 { font-size: 2.75rem; }
body.font-size-large h2 { font-size: 2.25rem; }
body.font-size-large h3 { font-size: 1.9rem; }

body.font-size-larger h1 { font-size: 3rem; }
body.font-size-larger h2 { font-size: 2.5rem; }
body.font-size-larger h3 { font-size: 2.1rem; }

body.font-size-largest h1 { font-size: 3.25rem; }
body.font-size-largest h2 { font-size: 2.75rem; }
body.font-size-largest h3 { font-size: 2.3rem; }

/* ========================================
   HIGH CONTRAST MODE
   ======================================== */

body.high-contrast {
  background-color: #000;
  color: #ffff00;
}

body.high-contrast a {
  color: #00ffff;
  text-decoration: underline;
}

body.high-contrast a:hover {
  color: #ffffff;
}

body.high-contrast button,
body.high-contrast .button {
  background-color: #ffff00;
  color: #000;
  border: 2px solid #ffff00;
}

body.high-contrast button:hover,
body.high-contrast .button:hover {
  background-color: #000;
  color: #ffff00;
}

body.high-contrast .site-header,
body.high-contrast .site-footer {
  background-color: #1a1a1a;
  border-bottom: 2px solid #ffff00;
}

body.high-contrast .category-card,
body.high-contrast article,
body.high-contrast form {
  background-color: #1a1a1a;
  border: 2px solid #ffff00;
}

body.high-contrast input,
body.high-contrast textarea,
body.high-contrast select {
  background-color: #000;
  color: #ffff00;
  border: 2px solid #ffff00;
}

body.high-contrast .site-title,
body.high-contrast h1,
body.high-contrast h2,
body.high-contrast h3,
body.high-contrast h4,
body.high-contrast h5,
body.high-contrast h6 {
  color: #ffffff;
}

/* ========================================
   SCREEN READER ONLY CONTENT
   ======================================== */

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

/* ========================================
   TEXT-TO-SPEECH HIGHLIGHT
   ======================================== */

.tts-highlight {
  background-color: #fef5e7;
  outline: 2px solid #ED8936;
  outline-offset: 2px;
  transition: all 0.3s ease;
}

/* ========================================
   REDUCED MOTION
   ======================================== */

/* Respect users' 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;
  }

  .logo-container {
    animation: none;
  }
}

/* ========================================
   KEYBOARD NAVIGATION
   ======================================== */

/* Show outline only when using keyboard (not mouse) */
.using-mouse *:focus {
  outline: none;
}

.using-keyboard *:focus {
  outline: 2px solid #ED8936;
  outline-offset: 2px;
}

/* ========================================
   ARIA LIVE REGIONS
   ======================================== */

.aria-live-polite {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Announcement for screen readers */
#announcements {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ========================================
   COLOR CONTRAST ENHANCEMENTS
   ======================================== */

/* Ensure minimum 4.5:1 contrast ratio for normal text (WCAG AA) */
/* Ensure minimum 3:1 for large text */

/* Link contrast */
a {
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

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

/* Button contrast - already meets WCAG AA in main.css */

/* ========================================
   TOUCH TARGET SIZES
   ======================================== */

/* Ensure minimum 44x44px touch targets for mobile */
@media (max-width: 768px) {
  .accessibility-controls {
    top: 0.5625rem;
    left: 0.5625rem;
    padding: 0.5625rem 0.75rem;
    gap: 0.375rem;
    flex-wrap: wrap;
    max-width: calc(100vw - 1.125rem - 135px);
  }

  .accessibility-controls button {
    min-width: 30px;
    height: 30px;
    padding: 0.3rem 0.6rem;
    font-size: 0.6rem;
  }

  .language-selector {
    top: 0.5625rem;
    right: 0.5625rem;
    padding: 0.5625rem 0.75rem;
    gap: 0.375rem;
  }

  .language-label {
    font-size: 0.525rem;
  }

  #google_translate_element {
    font-size: 0.6rem;
  }

  .goog-te-gadget-simple {
    padding: 0.3rem 0.6rem !important;
    font-size: 0.6rem !important;
  }

  button,
  .button,
  a.enter-button,
  .accessibility-controls button,
  .main-nav a {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .category-link {
    min-height: 88px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }
}

/* ========================================
   PRINT STYLES
   ======================================== */

@media print {
  /* Hide non-essential elements */
  .accessibility-controls,
  .language-selector,
  .skip-link,
  .site-header nav,
  .site-footer,
  .breadcrumb {
    display: none !important;
  }

  /* Ensure good contrast for printing */
  body {
    background: white;
    color: black;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  /* Show URLs for links */
  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    font-style: italic;
  }

  /* Avoid page breaks inside elements */
  article,
  .category-card,
  form {
    page-break-inside: avoid;
  }
}

/* ========================================
   ERROR AND SUCCESS MESSAGES
   ======================================== */

.message {
  padding: 1rem 1.5rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  border-left: 4px solid;
}

.message-success {
  background-color: #d4edda;
  border-color: #28a745;
  color: #155724;
}

.message-error {
  background-color: #f8d7da;
  border-color: #dc3545;
  color: #721c24;
}

.message-warning {
  background-color: #fff3cd;
  border-color: #ffc107;
  color: #856404;
}

.message-info {
  background-color: #d1ecf1;
  border-color: #17a2b8;
  color: #0c5460;
}

/* Ensure messages are announced to screen readers */
.message[role="alert"] {
  /* Will be automatically announced by screen readers */
}
