/* ============================================================
 * Conceptual Health® — accessibility + mobile baseline.
 *
 * Drop this into any page via <link rel="stylesheet" href="/_shared/a11y.css" />.
 * Provides:
 *   - Visible focus rings for keyboard navigation
 *   - Skip-to-content link (hidden until focused)
 *   - prefers-reduced-motion override
 *   - prefers-color-scheme respect
 *   - Minimum touch-target size (44x44 per WCAG 2.5.5)
 *   - Readable line lengths
 *   - Mobile viewport hardening
 *   - ARIA-friendly defaults
 *
 * Pages should still set:
 *   <meta name="viewport" content="width=device-width,initial-scale=1" />
 * and provide a single skip link as the first focusable element:
 *   <a href="#main" class="ch-skip">Skip to content</a>
 *   <main id="main">…</main>
 * ============================================================ */

/* Focus rings — visible, never disabled */
*:focus-visible {
  outline: 3px solid var(--accent-clinical, #2c5d3f);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Skip-to-content link */
.ch-skip, .a11y-skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10000;
  background: var(--accent-clinical, #2c5d3f);
  color: #fff;
  padding: 12px 20px;
  border-radius: 0 0 8px 0;
  font: 600 14px/1 system-ui, -apple-system, sans-serif;
  text-decoration: none;
}
.ch-skip:focus, .a11y-skip:focus {
  left: 0;
  top: 0;
}

/* Touch targets — WCAG 2.5.5 (Level AAA recommended 44x44, AA target 24x24) */
@media (pointer: coarse) {
  a, button, [role="button"], input[type="button"], input[type="submit"], summary {
    min-height: 44px;
    min-width: 44px;
  }
}

/* Reduced motion — respect user preference everywhere */
@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;
  }
}

/* Readable line length on body copy. Designers can override on hero text */
.ch-readable, p, li, dd {
  max-width: 72ch;
}

/* Mobile-safe — no horizontal scroll surprises */
html, body {
  overflow-x: hidden;
}

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

/* Ensure interactive elements have a hand cursor */
button, [role="button"], a {
  cursor: pointer;
}
[aria-disabled="true"], button[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
}

/* High-contrast mode support */
@media (forced-colors: active) {
  *:focus-visible {
    outline: 3px solid CanvasText;
  }
}

/* Default link contrast against light backgrounds */
a:not([class]) {
  color: var(--accent-clinical, #2c5d3f);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}
a:not([class]):hover { text-decoration-thickness: 2px; }

/* Form labels — make them obvious */
label { font-weight: 500; }
input:invalid, textarea:invalid, select:invalid {
  border-color: var(--ch-red, #c63b3b);
}

/* Mobile responsive hero — collapse multi-column hero grids on small screens */
@media (max-width: 720px) {
  .ch-split, .ch-grid-3, .ch-bignums {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }
  .ch-h1 { font-size: clamp(28px, 7vw, 44px) !important; }
  .ch-h1--md { font-size: clamp(24px, 6vw, 36px) !important; }
  .ch-h2 { font-size: clamp(22px, 5vw, 30px) !important; }
  .ch-hero { padding-left: 18px !important; padding-right: 18px !important; }
}

/* Print friendly */
@media print {
  nav, .ch-nav, .ch-footer, [data-no-print] { display: none !important; }
  body { color: #000; background: #fff; }
}
