/**
 * Accessibility Fixes for PageSpeed Insights
 * Switch & Save EPOS Theme
 */

/* ========================================
   CONTRAST IMPROVEMENTS
======================================== */

/* Ensure all text has sufficient contrast ratio (4.5:1 for normal text, 3:1 for large text) */
body {
  color: #0F172A; /* Dark enough for good contrast on white */
}

/* Improve link contrast */
a {
  color: #0E5FCE; /* Darker blue for better contrast */
}

a:hover,
a:focus {
  color: #0A1929; /* Even darker on hover/focus */
}

/* Secondary text with better contrast */
.text-secondary,
.brand-text-secondary {
  color: #334155; /* Darker gray for better readability */
}

/* Light text improvements */
.text-light {
  color: #475569; /* Darker for better contrast */
}

/* Button text contrast */
.btn-outline {
  color: #0E5FCE; /* Darker blue */
  border-color: #0E5FCE;
}

/* Form labels */
.form-label {
  color: #0F172A; /* Dark for maximum contrast */
}

/* Card text */
.card-text {
  color: #334155; /* Better contrast */
}

/* ========================================
   LINK ACCESSIBILITY
======================================== */

/* Ensure all links have discernible names */
a[aria-label=""],
a:not([aria-label]):empty {
  display: inline-block;
  min-width: 44px;
  min-height: 44px;
}

/* Add underline to links in content for better visibility */
.entry-content a,
.post-content a,
article a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.entry-content a:hover,
.post-content a:hover,
article a:hover {
  text-decoration-thickness: 2px;
}

/* Skip to main content link for screen readers */
.skip-to-main {
  position: absolute;
  left: -9999px;
  z-index: 999999;
  padding: 1rem 1.5rem;
  background: #0E5FCE;
  color: white;
  text-decoration: none;
  font-weight: 600;
}

.skip-to-main:focus {
  left: 0;
  top: 0;
}

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

/* Enhanced focus styles for keyboard navigation */
*:focus-visible {
  outline: 3px solid #0E5FCE;
  outline-offset: 3px;
  border-radius: 2px;
}

button:focus-visible,
.btn:focus-visible,
a:focus-visible {
  outline: 3px solid #0E5FCE;
  outline-offset: 3px;
}

input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 3px solid #0E5FCE;
  outline-offset: 2px;
  border-color: #0E5FCE;
}

/* ========================================
   TOUCH TARGETS
======================================== */

/* Ensure all interactive elements are at least 44x44px */
button,
.btn,
a.button,
input[type="submit"],
input[type="button"],
.woocommerce-button {
  min-height: 44px;
  min-width: 44px;
  padding: 0.75rem 1.5rem;
}

/* Mobile touch targets */
@media (max-width: 768px) {
  button,
  .btn,
  a.button,
  input[type="submit"],
  input[type="button"] {
    min-height: 48px;
    padding: 1rem 1.5rem;
  }
  
  /* Ensure form inputs are large enough */
  input[type="text"],
  input[type="email"],
  input[type="tel"],
  input[type="number"],
  input[type="password"],
  textarea,
  select {
    min-height: 48px;
    font-size: 16px; /* Prevent zoom on iOS */
  }
}

/* ========================================
   HEADING HIERARCHY
======================================== */

/* Ensure proper heading order - these are utility classes to help maintain hierarchy */
.h1-style {
  font-size: var(--text-5xl);
  font-weight: 900;
  line-height: 1.1;
  color: var(--brand-primary);
}

.h2-style {
  font-size: var(--text-4xl);
  font-weight: 800;
  line-height: 1.15;
  color: var(--brand-accent);
}

.h3-style {
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: 1.25;
  color: var(--brand-primary);
}

/* Mobile heading sizes for better readability */
@media (max-width: 768px) {
  .h1-style {
    font-size: var(--text-3xl);
  }
  
  .h2-style {
    font-size: var(--text-2xl);
  }
  
  .h3-style {
    font-size: var(--text-xl);
  }
}

/* ========================================
   ARIA LABELS AND SCREEN READER TEXT
======================================== */

/* Screen reader only text */
.sr-only,
.screen-reader-text {
  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:focus,
.screen-reader-text:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 1rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ========================================
   IMAGE ALT TEXT
======================================== */

/* Decorative images should have empty alt text */
img[alt=""],
img:not([alt]) {
  /* These should be marked as decorative with role="presentation" */
}

/* ========================================
   FORM ACCESSIBILITY
======================================== */

/* Ensure form labels are associated with inputs */
label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  color: #0F172A;
}

/* Required field indicator */
.required,
.required-indicator {
  color: #DC2626;
  font-weight: 700;
}

/* Error messages */
.error-message,
.woocommerce-error,
.woocommerce-message {
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.error-message,
.woocommerce-error {
  background: #FEE2E2;
  color: #991B1B;
  border-left: 4px solid #DC2626;
}

.woocommerce-message {
  background: #D1FAE5;
  color: #065F46;
  border-left: 4px solid #10B981;
}

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

@media (prefers-contrast: high) {
  * {
    border-color: currentColor !important;
  }
  
  a {
    text-decoration: underline;
  }
  
  button,
  .btn {
    border: 2px solid currentColor;
  }
}

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

/* ========================================
   DARK MODE SUPPORT (Optional)
======================================== */

@media (prefers-color-scheme: dark) {
  /* Add dark mode styles if needed */
}
