/* ============================================================
   SUPRAGENCY LANDING PAGE - Custom CSS
   Accessibility-focused styles for WCAG 2.1 AA compliance
   ============================================================ */

/* ============================================================
   SCREEN READER UTILITIES
   ============================================================ */

/* Screen reader only - visually hidden but accessible */
.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;
}

/* Show on focus for skip links */
.sr-only.focus\:not-sr-only:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 0.75rem 1.5rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* ============================================================
   FOCUS STYLES - WCAG 2.1 AA Compliance
   ============================================================ */

/* Default focus outline for all interactive elements */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
[tabindex]:focus {
  outline: 3px solid #F77F00; /* accent color */
  outline-offset: 2px;
}

/* Focus-visible support (modern browsers) */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid #F77F00;
  outline-offset: 2px;
}

/* Remove focus outline when not using keyboard (mouse clicks) */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
select:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible) {
  outline: none;
}

/* Enhanced focus for primary CTAs */
.btn-primary:focus,
.btn-primary:focus-visible {
  outline: 3px solid #F77F00;
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(247, 127, 0, 0.2);
}

/* Enhanced focus for navigation links */
nav a:focus,
nav button:focus {
  outline: 3px solid #F77F00;
  outline-offset: 2px;
  border-radius: 4px;
}

/* ============================================================
   SKIP LINK STYLES
   ============================================================ */

/* Skip link - positioned at top when focused */
a[href="#main-content"] {
  position: absolute;
  top: 1rem;
  left: 1rem;
  z-index: 100;
}

a[href="#main-content"]:focus {
  background-color: #F77F00;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 700;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  text-decoration: none;
}

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

/* Ensure visibility in Windows High Contrast Mode */
@media (prefers-contrast: high) {
  a:focus,
  button:focus,
  input:focus {
    outline: 4px solid currentColor;
    outline-offset: 3px;
  }
}

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

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

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

/* Ensure sufficient contrast for dark mode text */
.dark .text-neutral-300 {
  color: #e2e8f0; /* Lighter for better contrast */
}

.dark .text-neutral-400 {
  color: #cbd5e0; /* Lighter for better contrast */
}

/* Ensure link visibility */
a {
  text-decoration-skip-ink: auto;
}

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

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

/* Style for dynamically updated regions (ROI calculator results) */
[aria-live="polite"],
[aria-live="assertive"] {
  position: relative;
}

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

/* Ensure form inputs have sufficient contrast */
input[type="range"]:focus {
  outline: 3px solid #F77F00;
  outline-offset: 2px;
}

/* Visual feedback for range inputs */
input[type="range"]:focus-visible {
  outline: 3px solid #F77F00;
  outline-offset: 2px;
}

/* ============================================================
   INTERACTIVE ELEMENT ENHANCEMENTS
   ============================================================ */

/* Ensure buttons are clearly interactive */
button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

/* Ensure sufficient click/touch target size (min 44x44px) */
button,
a {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Exception for text links */
a:not([class*="btn"]):not([class*="button"]) {
  min-height: auto;
  min-width: auto;
  display: inline;
}

/* Force icon alignment in buttons - preserve flex behavior */
.inline-flex i,
.inline-flex svg {
  flex-shrink: 0;
}

/* Ensure icons don't wrap or break layout */
button i,
a i,
button svg,
a svg {
  flex-shrink: 0;
  vertical-align: middle;
}

/* Force horizontal layout for all flex buttons */
a.inline-flex,
button.inline-flex {
  flex-direction: row !important;
  align-items: center !important;
}

/* Lucide icons specific alignment - prevent line breaks */
a[class*="inline-flex"] i[data-lucide],
button[class*="inline-flex"] i[data-lucide] {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
}

/* Ensure Lucide SVG stays inline */
a[class*="inline-flex"] i[data-lucide] svg,
button[class*="inline-flex"] i[data-lucide] svg {
  display: block;
  width: 100%;
  height: 100%;
  flex-shrink: 0;
}

/* ============================================================
   DARK MODE ACCESSIBILITY
   ============================================================ */

/* Ensure dark mode maintains sufficient contrast */
.dark {
  color-scheme: dark;
}

/* Dark mode focus enhancement */
.dark a:focus,
.dark button:focus,
.dark input:focus {
  outline-color: #FF8C42; /* Lighter orange for dark backgrounds */
}

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

@media print {
  /* Ensure skip links and screen reader content don't print */
  .sr-only,
  a[href="#main-content"] {
    display: none !important;
  }

  /* Ensure focus outlines don't appear in print */
  *:focus {
    outline: none !important;
  }
}
