/* =============================================
   ACCESSIBILITY LAYER — WCAG 2.1 / 2.2 AA
   Loaded last on every page. Fixes contrast, focus visibility,
   keyboard access to menus, and reduced-motion support without
   changing the visual direction of the site.
   ============================================= */

:root {
  /* Was #7a6d63 (4.2:1 on --bg-alt). Now ≥ 5.1:1 on every light surface. */
  --text-muted: #6b5f56;
  /* Accent for small text on light surfaces (≥ 4.9:1 on --bg-alt). */
  --accent-text: #b23c0b;
  /* Accent for small text on dark surfaces (≥ 4.5:1 on --dark-3). */
  --accent-on-dark: #ea580c;
}

/* ---------- Utilities ---------- */
.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Keep focused elements clear of the fixed nav pill (2.4.11) */
html { scroll-padding-top: 110px; }

/* Skip-link target receives focus programmatically — no ring needed */
main:focus { outline: none; }

/* ---------- Focus visibility (2.4.7, 1.4.11) ---------- */
/* On orange surfaces the orange ring would be invisible — use white. */
.cta-section :focus-visible,
.svc-cta-section :focus-visible,
.skip-link:focus-visible {
  outline-color: #fff;
}

/* Form fields: a clear 2px ring instead of a faint border change */
.form-group input:focus-visible,
.form-group select:focus-visible,
.form-group textarea:focus-visible {
  outline: 2px solid var(--accent-on-dark);
  outline-offset: 2px;
  border-color: var(--accent-on-dark);
}
.form-group input::placeholder,
.form-group textarea::placeholder { color: rgba(255, 255, 255, 0.5); }

/* Hidden-until-hover "Explore" pills must show when focused by keyboard */
.hero-panel-link:focus-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  outline-color: #fff;
}

/* ---------- Services mega-menu: keyboard + Escape support ---------- */
.nav-dropdown-btn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-left: -10px;
  border-radius: var(--r-pill);
  color: rgba(255, 255, 255, 0.85);
}
.nav.light .nav-dropdown-btn { color: var(--text-muted); }
.nav-dropdown-btn:hover { background: rgba(255, 255, 255, 0.08); }
.nav.light .nav-dropdown-btn:hover { background: rgba(0, 0, 0, 0.05); }
.nav-dropdown-btn .nav-chevron { opacity: 1; }

.nav-dropdown-wrap.open .nav-mega {
  opacity: 1;
  visibility: visible;
  transform: translateX(-55%) translateY(0);
  pointer-events: auto;
}
.nav-dropdown-wrap.open .nav-chevron { transform: rotate(180deg); }

/* Escape dismisses hover-opened content (1.4.13) */
.nav-dropdown-wrap.dismissed .nav-mega,
.nav-dropdown-wrap.dismissed .nav-mega:hover {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (max-width: 768px) {
  .nav-dropdown-btn { display: none; }
}

/* ---------- Mobile menu: hidden means hidden (2.4.3, 4.1.2) ---------- */
.nav-mobile-overlay {
  visibility: hidden;
  transition: opacity 0.35s var(--smooth), visibility 0s linear 0.35s;
}
.nav-mobile-overlay.open {
  visibility: visible;
  transition: opacity 0.35s var(--smooth), visibility 0s;
}

/* ---------- Text contrast (1.4.3) ---------- */
.nav-links a { color: rgba(255, 255, 255, 0.85); }
.nav.light .nav-links a.active { color: var(--accent-text); }

.hero-eyebrow { color: rgba(255, 255, 255, 0.78); }
.hero-sub { color: rgba(248, 247, 244, 0.85); }
.hero-panel-num { color: var(--accent-on-dark); }

.eyebrow { color: var(--accent-text); }
.eyebrow-inv { color: #fff; }

.div-card-label,
.card-learn-more,
.tcard-stars,
.service-div-badge span { color: var(--accent-text); }

.proj-cat,
.svc-breadcrumb a,
.mega-div-num,
.nav-mobile-div-title,
.more-svc-div { color: var(--accent-on-dark); }

.tcard-role,
.partners-label,
.area-box p:first-child { color: var(--text-muted); }

.about-chip-text { opacity: 1; }
.more-svc-arrow { color: rgba(248, 247, 244, 0.72); }

/* Text on the orange CTA bands */
.cta-left p,
.cta-check,
.svc-cta-left p,
.svc-cta-checks li { color: #fff; }
.svc-cta-left .eyebrow { background: rgba(15, 13, 11, 0.22); }

/* Footer: remove the opacity that dropped text to ~2.2:1 */
.footer-col h3,
.footer-bottom p,
.footer-legal a,
.form-note { opacity: 1; }
.footer-legal a:hover { color: var(--text-inv); }

/* Buttons that had no styles and inherited dark text on dark/orange bands */
.btn-ghost { color: inherit; padding-left: 4px; padding-right: 4px; }
.btn-ghost:hover { text-decoration: underline; text-underline-offset: 4px; }
.more-services-section .btn-ghost { color: var(--text-inv); }
.btn-outline-light {
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: transparent;
}
.btn-outline-light:hover { background: rgba(255, 255, 255, 0.12); border-color: #fff; }

/* ---------- Contact form instructions (3.3.2) ---------- */
.req { color: var(--accent-on-dark); }
.form-required-note {
  font-size: 0.78rem;
  color: var(--text-inv-muted);
  margin: -16px 0 20px;
}
.form-success:focus { outline: none; }

/* ---------- Accessibility statement page ---------- */
.a11y-statement { padding: 80px 0 100px; }
.a11y-statement-body { max-width: 760px; }
.a11y-statement-body h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.8rem);
  margin: 44px 0 14px;
}
.a11y-statement-body h2:first-child { margin-top: 0; }
.a11y-statement-body p,
.a11y-statement-body li { color: var(--text-muted); line-height: 1.7; }
.a11y-statement-body ul { list-style: disc; padding-left: 22px; display: grid; gap: 8px; margin: 12px 0; }
.a11y-statement-body a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 3px; }
.a11y-statement-date { margin-top: 44px; font-size: 0.85rem; }

/* ---------- Partner logo marquee: pause control (2.2.2) ---------- */
.partners-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 28px auto 0;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
}
.partners-toggle:hover { color: var(--text); border-color: var(--text-muted); }
.partners-toggle svg { width: 12px; height: 12px; }
.partners.is-paused .partners-track { animation-play-state: paused !important; }

/* ---------- Reduced motion (2.3.3 + comfort for 2.2.2) ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
  .reveal, .reveal-left, .reveal-right { opacity: 1; transform: none; }
  .partners-track { animation: none !important; flex-wrap: wrap; justify-content: center; width: auto; row-gap: 20px; }
  .partner-logo:nth-child(n + 11) { display: none; } /* second half only exists for the loop */
  .partners-toggle { display: none; }
}
