/* =============================================
   TIVRONEX — Accessibility (tv-accessibility.css)
   ============================================= */

/* ---- Base Accessibility Overrides ---- */

/* Large font base */
body.tv-font-lg {
  --tv-font-size-base: 20px;
}

body.tv-font-xl {
  --tv-font-size-base: 22px;
}

/* ---- High Contrast ---- */
body.tv-high-contrast {
  --tv-blue-deep:    #000000;
  --tv-blue-mid:     #0040b0;
  --tv-blue-light:   #e8f0ff;
  --tv-sage:         #005520;
  --tv-sage-light:   #e6f5ec;
  --tv-warm-cream:   #ffffff;
  --tv-warm-sand:    #f0f0f0;
  --tv-text-dark:    #000000;
  --tv-text-mid:     #111111;
  --tv-text-muted:   #333333;
  --tv-border:       #000000;
  --tv-warm-tan:     #7a4a00;
  --tv-accent:       #8b0000;
  --tv-accent-light: #ffeeee;
}

body.tv-high-contrast a {
  text-decoration: underline;
}

body.tv-high-contrast .tv-btn {
  border-width: 3px;
}

body.tv-high-contrast .tv-service-card,
body.tv-high-contrast .tv-testimonial-card,
body.tv-high-contrast .tv-team-card,
body.tv-high-contrast .tv-article-card {
  border: 2px solid var(--tv-text-dark);
}

body.tv-high-contrast .tv-navbar {
  border-bottom: 2px solid #000;
}

body.tv-high-contrast .tv-nav-link:hover,
body.tv-high-contrast .tv-nav-link.active {
  outline: 2px solid var(--tv-blue-mid);
}

/* ---- Motion Reduced ---- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

body.tv-reduce-motion *,
body.tv-reduce-motion *::before,
body.tv-reduce-motion *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

/* ---- Focus styles (enhanced) ---- */
body.tv-high-contrast :focus-visible {
  outline: 4px solid #000000;
  outline-offset: 3px;
}

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

/* ---- Accessible link styling ---- */
body.tv-high-contrast a:not(.tv-btn) {
  color: #0000cc;
  text-decoration: underline;
}

body.tv-high-contrast a:not(.tv-btn):visited {
  color: #660099;
}

/* ---- Accessible form focus ---- */
body.tv-high-contrast .tv-form-control:focus,
body.tv-high-contrast .tv-captcha-input:focus {
  outline: 3px solid #000;
  border-color: #000;
}

/* ---- ARIA live regions ---- */
[aria-live="polite"],
[aria-live="assertive"] {
  position: relative;
}

/* ---- Color Blind Adjustments ---- */
/* Uses shapes/patterns in addition to color for important info */
.tv-form-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.tv-form-error::before {
  content: '⚠';
  flex-shrink: 0;
}

/* ---- Touch Targets ---- */
@media (pointer: coarse) {
  .tv-btn {
    min-height: 48px;
    padding-top: 14px;
    padding-bottom: 14px;
  }

  .tv-nav-link {
    padding: 12px 14px !important;
  }

  .tv-answer-btn {
    min-height: 56px;
  }

  .tv-faq-question {
    min-height: 56px;
  }

  .tv-access-btn {
    min-height: 44px;
    padding: 10px 16px;
  }
}

/* ---- Print Styles ---- */
@media print {
  .tv-navbar,
  .tv-accessibility-bar,
  .tv-cookie-banner,
  .tv-back-to-top,
  .tv-hero-shapes,
  .tv-footer {
    display: none !important;
  }

  body {
    font-size: 12pt;
    color: #000;
  }

  a[href]:after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    color: #555;
  }

  h1, h2, h3 {
    page-break-after: avoid;
  }

  p, li {
    orphans: 3;
    widows: 3;
  }

  .tv-section {
    padding: 24pt 0;
  }
}

/* ---- Dyslexia-Friendly (optional class) ---- */
body.tv-dyslexia {
  font-family: 'Comic Sans MS', 'OpenDyslexic', cursive, sans-serif;
  line-height: 2;
  letter-spacing: 0.05em;
  word-spacing: 0.1em;
}

/* ---- Language & Reading ---- */
:lang(en) {
  quotes: "\201C" "\201D" "\2018" "\2019";
}

/* ---- Accessible Tooltip ---- */
[data-tv-tooltip] {
  position: relative;
}

[data-tv-tooltip]:hover::after,
[data-tv-tooltip]:focus::after {
  content: attr(data-tv-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--tv-text-dark);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  white-space: nowrap;
  z-index: 100;
  pointer-events: none;
  margin-bottom: 6px;
  font-family: var(--tv-font-body);
  font-weight: 400;
}

/* ---- Visible Focus Indicator ---- */
.tv-btn:focus-visible {
  outline: 3px solid var(--tv-warm-tan);
  outline-offset: 3px;
}

.tv-faq-question:focus-visible {
  outline: 3px solid var(--tv-blue-mid);
  outline-offset: 0;
}

/* ---- Error State ---- */
.tv-form-control[aria-invalid="true"] {
  border-color: #c0392b;
  background: #fff8f8;
}

/* ---- Success State ---- */
.tv-form-control[aria-invalid="false"] {
  border-color: var(--tv-sage);
}

/* ---- Tab indicator ---- */
.tv-tab-indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--tv-blue-mid);
  transition: width 0.3s ease, left 0.3s ease;
}
