/* ═══════════════════════════════════════════════════════════════════════════
   a11y.css — Site-wide accessibility layer for davidleewilliamson.com
   Loaded by navbar.php after global.css. Place at /css/a11y.css

   Everything here uses !important on purpose: many pages carry their own
   <style> block that loads AFTER this file, and these rules must win.
   Each block says WHICH WCAG 2.2 rule it serves.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Skip link (2.4.1 Bypass Blocks) ───────────────────────────────────────── */
.skip-link {
  position: absolute; left: .75rem; top: -4.5rem; z-index: 100000;
  background: #0d3a4a; color: #fff !important; padding: .75rem 1.2rem;
  border-radius: 0 0 8px 8px; font-weight: 700; font-size: .95rem; text-decoration: none;
  transition: top .15s ease;
}
.skip-link:focus { top: 0; outline: 3px solid #f0c060; outline-offset: 2px; }
[id="main-content"]:focus { outline: none; }

/* ── Visible keyboard focus everywhere (2.4.7 Focus Visible, 2.4.11 Focus Not Obscured) ── */
:focus-visible {
  outline: 3px solid #165f72 !important;
  outline-offset: 2px !important;
}
.site-nav :focus-visible, .site-footer :focus-visible, footer :focus-visible,
.hero :focus-visible, .cta-band :focus-visible, .cwa-modal :focus-visible {
  outline-color: #f0c060 !important;
}
/* Keep the sticky/fixed bars from hiding the focused element (2.4.11) */
html { scroll-padding-top: 5rem; }

/* ── Motion (2.3.3 / 2.2.2): respect the visitor's "reduce motion" setting ──── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; scroll-behavior: auto !important;
  }
}

/* ── Links inside body text must not rely on colour alone (1.4.1) ───────────── */
main p a:not([class]), main li a:not([class]), #main-content p a:not([class]),
#main-content li a:not([class]), .cwa-modal p a:not([class]) {
  text-decoration: underline !important; text-underline-offset: .15em;
}

/* ═══ COLOUR CONTRAST (1.4.3 — text needs 4.5:1). Each rule is limited to the
       light backgrounds where the failure was measured, so text that is already
       fine on a dark band is left alone. Replacement colours measured ≥ 4.5:1. ═══ */

/* gold labels on white / pale blue → deep gold (≥ 5.5:1) */
.section-label, .narrative-section .section-label, .narrative-grid .section-label, .section-bg .section-label,
.form-section-label, .contact-card .cc-label, .faq-group h3 { color: #7a5e0a !important; }
/* …but on the dark gradient bands the original bright gold is correct (5:1 on dark teal) */
.cta-band .section-label, .hero .section-label, .site-footer .section-label { color: #c9a227 !important; }

/* grey helper text on white / pale blue → darker grey (≥ 5.1:1) */
.cond-desc, .contact-label { color: #5a6678 !important; }
.contact-card .cc-note { color: #4f6f7a !important; }
.paper-card .paper { color: #7a6340 !important; }
label span[style*="#888"], label span[style*="#aaa"] { color: #6b6b6b !important; }
/* small grey helper lines set inline on the support page (2.7–3.5:1) */
p[style*="#8a9aaa"], .sup-body p[style*="#888"] { color: #5a6678 !important; }

/* consent forms only: white text on the GOLD submit button (2.6:1) → dark text (7:1) */
#cwaForm button.btn-submit, #cwaForm button.btn-submit:hover,
.sup-body button.btn-submit, .sup-body button.btn-submit:hover { color: #1a1204 !important; }

/* footer: dim teal-grey on dark teal (3.5–4.1:1) → light (≥ 6.5:1) */
.footer-contact-info p, .footer-contact-info p a, .footer-bottom, .footer-bottom span,
.footer-legal a, .footer-brand p { color: #a9bcc3 !important; }
.footer-legal a:hover, .footer-contact-info p a:hover { color: #fff !important; }

/* ── Reflow at 320px / 400% zoom (1.4.10): no sideways scrolling ──────────────── */
.pp-table { display: block; max-width: 100%; overflow-x: auto; }       /* privacy tables may scroll inside themselves */
@media (max-width: 520px) {
  .contact-grid { grid-template-columns: 1fr !important; }              /* support page cards */
  .sup-body { padding-left: 1.1rem !important; padding-right: 1.1rem !important; }
  .sup-hero { padding-left: 1.1rem !important; padding-right: 1.1rem !important; }
  .hero .container, .hero-inner, .hero-copy { max-width: 100% !important; box-sizing: border-box; }
  .hero-ctas, .cta-buttons, .hero-pills { flex-wrap: wrap !important; }
  .hero-ctas .btn, .cta-buttons .btn { white-space: normal !important; max-width: 100%; }
  h1, h2, h3, p, li { overflow-wrap: anywhere; }
}

/* ── Minimum target size (2.5.8): tiny controls get a usable hit area ─────────── */
.read-link, .modal-close { min-height: 24px; min-width: 24px; }

/* ═══ Physics pages — "full text version" section (.tp-text-version) ═══════════
   These sections were first styled with pale colours for a dark page, but the
   physics pages are white, which left the text at about 2:1 (nearly invisible).
   This re-colours them dark-on-light (all ≥ 5:1) without touching the pages.   */
.tp-text-version { color: #2d3748 !important; border-top-color: rgba(196,154,46,.6) !important; }
.tp-text-version .tp-version-header h2, .tp-text-version .tp-version-header h2 * { color: #0d3a4a !important; }
.tp-text-version .tp-version-badge { color: #7a5e0a !important; background: #fff7e0 !important; border-color: #c49a2e !important; }
.tp-text-version .tp-h2 { color: #0d3a4a !important; border-bottom-color: #d0e4ec !important; }
.tp-text-version .tp-h3 { color: #165f72 !important; }
.tp-text-version .tp-p, .tp-text-version .tp-list li, .tp-text-version li, .tp-text-version p { color: #2d3748 !important; }
.tp-text-version p[style*="#7a9aaa"] { color: #4a5568 !important; }
.tp-text-version .tp-impl-label, .tp-text-version sup { color: #7a5e0a !important; }
.tp-text-version .tp-divider { border-top-color: #d0e4ec !important; }
.tp-text-version .tp-eq code { background: #f5fafc !important; color: #0d3a4a !important;
  border-color: #d0e4ec !important; border-left-color: #c49a2e !important; }
.tp-text-version .tp-quote { background: #f5fafc !important; color: #2d3748 !important; border-left-color: #c49a2e !important; }
.tp-text-version .tp-table th, .tp-table th { background: #fff1c9 !important; color: #3d2f05 !important; border-color: #e6d8a8 !important; }
.tp-text-version .tp-table td, .tp-table td { color: #2d3748 !important; border-color: #e2e8f0 !important; }
.tp-text-version .tp-table tr:nth-child(even) td, .tp-table tr:nth-child(even) td { background: #f7fafc !important; }

/* ── More measured leftovers ───────────────────────────────────────────────── */
/* physics "Download PDF" buttons: near-black text on dark teal (1.6:1) → white (12:1) */
a.btn-download, a.btn-download:visited, a.btn-download:hover { color: #ffffff !important; }
/* footer disclaimer box and the LLC line in contact cards */
.site-footer div[style*="rgba(255,255,255,.05)"], .site-footer div[style*="rgba(255,255,255,.05)"] p { color: #b8c7cc !important; }
.contact-value span[style*="clr-text-lite"], .contact-item span[style*="clr-text-lite"] { color: #5a6678 !important; }
.paper-card .paper-type { color: #7a6340 !important; }
main p[style*="color:#888"] { color: #5a6678 !important; }
