/* Accessibility Enhancements for HISR Website */

/* High Contrast Focus Indicators */
*:focus {
  outline: 3px solid #f59e0b !important;
  outline-offset: 2px !important;
}

/* Skip to main content link */
.sr-only {
  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;
}

.sr-only:focus,
.focus\:not-sr-only:focus {
  position: static !important;
  width: auto !important;
  height: auto !important;
  padding: 0.5rem 1rem !important;
  margin: 0 !important;
  overflow: visible !important;
  clip: auto !important;
  white-space: normal !important;
}

/* High contrast mode support */
@media (prefers-contrast: high) {

  /* Increase contrast for text */
  .text-gray-600 {
    color: #000000 !important;
  }

  .text-gray-700 {
    color: #000000 !important;
  }

  .text-blue-100 {
    color: #ffffff !important;
  }

  .text-blue-200 {
    color: #ffffff !important;
  }

  /* Increase border contrast */
  .border-gray-200 {
    border-color: #000000 !important;
  }

  .border-gray-300 {
    border-color: #000000 !important;
  }

  /* Ensure sufficient contrast for buttons */
  .bg-amber-500 {
    background-color: #d97706 !important;
    color: #000000 !important;
  }

  .bg-blue-900 {
    background-color: #1e3a8a !important;
    color: #ffffff !important;
  }
}

/* Reduced motion 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;
  }

  /* Disable transforms that might cause motion sickness */
  .transform,
  .hover\:transform:hover,
  .group:hover .group-hover\:transform {
    transform: none !important;
  }

  .hover\:-translate-y-2:hover,
  .hover\:-translate-y-1:hover {
    transform: none !important;
  }
}

/* Ensure text remains readable at 200% zoom */
@media screen and (min-width: 1280px) {

  /* Prevent horizontal scrolling at high zoom levels */
  .max-w-7xl {
    max-width: 100% !important;
    padding-left: 1rem !important;
    padding-right: 1rem !important;
  }

  /* Ensure navigation remains usable */
  .lg\:flex {
    flex-wrap: wrap !important;
  }

  .xl\:space-x-6> :not([hidden])~ :not([hidden]) {
    margin-left: 0.5rem !important;
  }
}

/* Improve keyboard navigation visibility */
.nav-link:focus {
  background-color: rgba(245, 158, 11, 0.1) !important;
  border-radius: 0.25rem !important;
}

/* Ensure form elements are properly labeled and accessible */
input[aria-invalid="true"] {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 1px #dc2626 !important;
}

input[aria-invalid="false"]:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1) !important;
}

/* Improve visibility of required field indicators */
[aria-label*="required"]::after,
.text-red-500[aria-label*="required"] {
  font-weight: bold !important;
}

/* Improve visibility of interactive elements */
button,
[role="button"],
input[type="submit"],
input[type="button"] {
  cursor: pointer !important;
}

button:disabled,
[role="button"][aria-disabled="true"],
input:disabled {
  cursor: not-allowed !important;
  opacity: 0.6 !important;
}

/* Ensure proper heading hierarchy is visually clear */
h1 {
  font-size: 2rem !important;
  line-height: 1.2 !important;
}

h2 {
  font-size: 1.75rem !important;
  line-height: 1.3 !important;
}

h3 {
  font-size: 1.5rem !important;
  line-height: 1.4 !important;
}

h4 {
  font-size: 1.25rem !important;
  line-height: 1.4 !important;
}

/* Improve readability of body text */
p,
li,
dd {
  line-height: 1.6 !important;
}

/* Ensure tables are accessible (if any are added later) */
table {
  border-collapse: collapse !important;
}

th,
td {
  border: 1px solid #d1d5db !important;
  padding: 0.5rem !important;
}

th {
  background-color: #f3f4f6 !important;
  font-weight: bold !important;
}

/* Improve visibility of form validation messages */
[role="alert"] {
  border-left: 4px solid #dc2626 !important;
  padding-left: 1rem !important;
}

[role="status"] {
  border-left: 4px solid #059669 !important;
  padding-left: 1rem !important;
}

/* Ensure proper spacing for touch targets */
@media (max-width: 768px) {

  button,
  [role="button"],
  a,
  input,
  select,
  textarea {
    min-height: 44px !important;
    min-width: 44px !important;
  }

  /* Ensure adequate spacing between interactive elements */
  .nav-link {
    margin: 0.25rem 0 !important;
  }
}

/* Print styles for accessibility */
@media print {

  /* Ensure links are visible in print */
  a[href]:after {
    content: " (" attr(href) ")" !important;
  }

  /* Hide decorative elements */
  [aria-hidden="true"] {
    display: none !important;
  }

  /* Ensure sufficient contrast */
  * {
    color: #000000 !important;
    background: #ffffff !important;
  }
}