/* ============================================
   ACCESSIBILITY STYLES - WCAG 2.1 Compliance
   ============================================ */

/* 1. FOCUS MANAGEMENT - Visible keyboard navigation */
:focus-visible,
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
  outline: 3px solid #0066cc;
  outline-offset: 2px;
}

/* High contrast focus for better visibility */
body.keyboard-nav a:focus,
body.keyboard-nav button:focus,
body.keyboard-nav input:focus {
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.3);
}

/* 2. SKIP LINKS - For keyboard users */
.skip-to-content {
  position: absolute;
  top: -40px;
  left: 0;
  background: #0066cc;
  color: white;
  padding: 8px 16px;
  z-index: 1000;
  text-decoration: none;
  border-radius: 0 0 4px 0;
}

.skip-to-content:focus {
  top: 0;
}

/* 3. SCREEN READER ONLY TEXT */
.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;
}

.sr-only-focusable:active,
.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* 4. COLOR CONTRAST - Ensure 4.5:1 ratio */
body {
  background-color: #ffffff;
  color: #333333; /* High contrast text */
}

a {
  color: #0056b3;
  text-decoration: underline;
}

a:visited {
  color: #663399;
}

/* Ensure links are not distinguished by color alone */
a:hover,
a:active,
a:focus {
  text-decoration: underline;
  font-weight: 500;
}

/* 5. REDUCED MOTION for users with vestibular disorders */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* 6. HIGH CONTRAST MODE */
@media (prefers-contrast: more) {
  body {
    font-weight: 600;
  }
  
  a {
    text-decoration: underline;
  }
  
  button {
    border: 2px solid currentColor;
  }
}

/* 7. DARK MODE SUPPORT */
@media (prefers-color-scheme: dark) {
  body {
    background-color: #1a1a1a;
    color: #ffffff;
  }
  
  a {
    color: #66ccff;
  }
  
  a:visited {
    color: #cc99ff;
  }
}

/* 8. FORM ACCESSIBILITY */
label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
}

input[type="text"],
input[type="email"],
input[type="tel"],
textarea,
select {
  border: 2px solid #cccccc;
  padding: 8px;
  font-size: 1rem;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="tel"]:focus,
textarea:focus,
select:focus {
  border-color: #0066cc;
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* 9. BUTTON ACCESSIBILITY */
button,
.btn {
  padding: 10px 16px;
  font-size: 1rem;
  border: 2px solid transparent;
  cursor: pointer;
  border-radius: 4px;
}

button:hover,
.btn:hover {
  opacity: 0.8;
  text-decoration: none;
}

button:focus,
.btn:focus {
  outline: none;
  box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.3);
}

/* 10. TABLES - Better readability */
table {
  border-collapse: collapse;
  width: 100%;
}

th {
  text-align: left;
  font-weight: 700;
  background-color: #f5f5f5;
  padding: 12px;
  border-bottom: 2px solid #333;
}

td {
  padding: 12px;
  border-bottom: 1px solid #ddd;
}

/* 11. IMAGES - Alt text support */
img {
  max-width: 100%;
  height: auto;
}

figure {
  margin: 1em 0;
}

figcaption {
  font-size: 0.9rem;
  font-style: italic;
  margin-top: 0.5em;
}

/* 12. HEADINGS - Proper hierarchy */
h1, h2, h3, h4, h5, h6 {
  margin-top: 1.5em;
  margin-bottom: 0.5em;
  line-height: 1.2;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

/* 13. LISTS - Proper spacing */
ul, ol {
  margin-left: 2em;
  margin-bottom: 1em;
}

li {
  margin-bottom: 0.5em;
}

/* 14. CODE AND PRE BLOCKS */
code {
  background-color: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: monospace;
}

pre {
  background-color: #f5f5f5;
  padding: 1em;
  border-left: 4px solid #0066cc;
  overflow-x: auto;
}

/* 15. ICON ACCESSIBILITY */
.icon-only {
  position: relative;
}

.icon-only::before {
  content: attr(data-icon-label);
  position: absolute;
  left: -9999px;
}