/* ========================================
   Accessibility-First CSS Improvements
   ======================================== */

/* 1. COLOR CONTRAST - WCAG AA Compliant */
:root {
  /* Color palette with good contrast ratios */
  --text-primary: #1a1a1a; /* High contrast for readability */
  --text-secondary: #333333;
  --text-light: #666666;
  --bg-primary: #ffffff;
  --bg-secondary: #f5f5f5;
  --border-color: #cccccc;
  --focus-color: #0066cc;
  --focus-outline: 2px solid var(--focus-color);
  --focus-offset: 2px;
}

/* 2. VISIBLE FOCUS INDICATORS */
:focus-visible,
button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* 3. SKIP LINK - Allow keyboard navigation */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--focus-color);
  color: white;
  padding: 8px;
  text-decoration: none;
  z-index: 100;
  border-radius: 0 0 4px 0;
}

.skip-link:focus {
  top: 0;
  outline: var(--focus-outline);
  outline-offset: var(--focus-offset);
}

/* 4. HEADING HIERARCHY
   Semantic hierarchy (correct h1→h6 nesting) is a markup concern, not a
   CSS one — enforcing it in CSS via blanket font-size/line-height/margin
   on every heading fights whatever the theme already defines for that
   specific heading (hero titles, card titles, section titles all have
   their own sizing). Removed the size/line-height/margin resets; kept
   only a sane minimum weight so headings are never accidentally as thin
   as body text. */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
}

/* 5. TEXT READABILITY
   Line-height/letter-spacing are visual-design decisions the theme
   already makes per element. Forcing them globally on `body` cascades
   into every heading/component that doesn't set its own line-height,
   which is what was making spacing feel loose site-wide. Kept only the
   16px minimum body font-size (a real mobile-accessibility/no-zoom
   requirement) and let the theme control rhythm otherwise. */
body {
  font-size: 16px; /* Don't go below 16px for accessibility */
}

p {
  max-width: 80ch; /* Optimal line length — doesn't affect spacing */
}

/* 6. LINK ACCESSIBILITY
   WCAG 1.4.1 requires links not be distinguished by color ALONE — but it
   explicitly doesn't require underlines on links that are already
   distinguishable another way (buttons, nav items, cards, badges with
   their own shape/background/icon). Forcing underline on every <a>
   fights the theme's own component styling (blog cards, CTA buttons,
   nav links) and was overriding it because :not([role="button"]) has
   higher specificity than the theme's plain `a` reset. Scoped to actual
   prose links instead — this matches the pattern style.css already uses
   for its own paragraph-link hover state. */
a {
  transition:
    color 0.2s,
    text-decoration-thickness 0.2s;
}

a:focus-visible {
  color: var(--focus-color);
}

/* Prose links (inside body copy, not styled nav/button/card components)
   still get a real, non-color-dependent affordance. */
p a,
li a,
.content a {
  text-decoration: underline;
  text-underline-offset: 4px;
}

a:visited {
  color: #663399; /* Distinct visited state — only meaningful where the
                      theme doesn't already set its own link color */
}

p a:hover,
li a:hover,
.content a:hover {
  text-decoration-thickness: 2px;
}

.accordion .accordion-trigger {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  font: inherit;
  color: inherit;
  padding: 0;
}
form button,
.contact-form-area button,
.footer-content button,
.blog-details-submi-button button,
input[type="submit"],
input[type="reset"],
input[type="button"] {
  font-size: 16px;
  min-height: 48px;
  border: 2px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
  text-align: center;
}

form button:hover:not(:disabled),
.contact-form-area button:hover:not(:disabled),
.footer-content button:hover:not(:disabled),
input[type="submit"]:hover:not(:disabled) {
  opacity: 0.85;
}

form button:active:not(:disabled),
input[type="submit"]:active:not(:disabled) {
  transform: scale(0.98);
}

form button:disabled,
input[type="submit"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Nav / icon-only controls: ensure minimum tap target without breaking layout */
.hamburger-btn,
.mobile-close-btn,
.slider-next,
.slider-prev {
  min-width: 44px;
  min-height: 44px;
}

/* 8. FORM INPUT ACCESSIBILITY */
label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-primary);
}

input,
textarea,
select {
  font-size: 16px; /* Prevent auto-zoom */
  padding: 12px;
  min-height: 48px;
  border: 2px solid var(--border-color);
  border-radius: 4px;
  font-family: inherit;
  width: 100%;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--focus-color);
  box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

input:disabled,
textarea:disabled,
select:disabled {
  background-color: var(--bg-secondary);
  cursor: not-allowed;
  opacity: 0.6;
}

/* Error states with good contrast */
input[aria-invalid="true"],
textarea[aria-invalid="true"] {
  border-color: #d32f2f;
}

.error-message {
  color: #d32f2f;
  font-size: 0.875rem;
  margin-top: 0.5rem;
  display: block;
}

/* Required field indicator */
[aria-required="true"]::after,
.required::after {
  content: " *";
  color: #d32f2f;
  font-weight: bold;
}

/* 9. IMAGE ACCESSIBILITY */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Ensure alt text is always present and meaningful.
   NOTE: alt="" is the CORRECT, deliberate way to mark an image as
   decorative for screen readers — it should never be flagged. A debug
   rule that outlined every alt="" image in red was accidentally left in
   here and shipped to production; removed. If you want a dev-only
   reminder to double-check alt text, gate it behind a build flag/class
   instead of a bare attribute selector that runs everywhere. */

figure {
  margin: 1.5rem 0;
}

figcaption {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-top: 0.5rem;
}

/* 10. LIST ACCESSIBILITY
   Scoped margin/padding to lists that aren't already part of a themed
   nav/menu/feature-list component (those have their own spacing, and a
   blanket rule here was adding extra gap on top of it). */
ul:not([class]),
ol:not([class]) {
  margin: 1rem 0;
  padding-left: 2rem;
}

li:not([class]) {
  margin-bottom: 0.5rem;
}

/* 11. TABLE ACCESSIBILITY */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1rem 0;
}

thead {
  background-color: var(--bg-secondary);
}

th,
td {
  padding: 12px;
  text-align: left;
  border: 1px solid var(--border-color);
}

th {
  font-weight: 600;
  color: var(--text-primary);
}

tbody tr:nth-child(odd) {
  background-color: var(--bg-secondary);
}

/* 12. 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;
  }
}

/* 13. HIGH CONTRAST MODE SUPPORT */
@media (prefers-contrast: more) {
  body {
    --text-primary: #000000;
    --text-secondary: #1a1a1a;
    --border-color: #000000;
    font-weight: 500;
  }

  a {
    text-decoration-thickness: 2px;
  }

  button,
  [role="button"] {
    border: 2px solid var(--text-primary);
  }
}

/* 14. DARK MODE SUPPORT */
@media (prefers-color-scheme: dark) {
  :root {
    --text-primary: #f0f0f0;
    --text-secondary: #e0e0e0;
    --text-light: #b0b0b0;
    --bg-primary: #1a1a1a;
    --bg-secondary: #2d2d2d;
    --border-color: #444444;
  }
}

/* 15. ALERT/NOTIFICATION ACCESSIBILITY */
[role="alert"],
[role="status"] {
  padding: 12px;
  margin: 1rem 0;
  border-left: 4px solid;
  border-radius: 4px;
}

[role="alert"] {
  border-color: #d32f2f;
  background-color: #ffebee;
  color: #b71c1c;
}

[role="status"] {
  border-color: #1976d2;
  background-color: #e3f2fd;
  color: #0d47a1;
}

.alert-warning {
  border-color: #f57c00;
  background-color: #fff3e0;
  color: #e65100;
}

.alert-success {
  border-color: #388e3c;
  background-color: #e8f5e9;
  color: #1b5e20;
}

/* 16. 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;
}

/* 17. TAB ORDER INDICATOR */
*:focus-visible {
  outline-width: 3px;
  outline-style: solid;
}

/* 18. PRINT STYLES */
@media print {
  a[href]::after {
    content: " (" attr(href) ")";
  }

  button,
  [role="button"] {
    display: none;
  }

  body {
    background: white;
    color: black;
  }
}
