/*
 * WCAG 2.1 AA + PageSpeed Improvements
 * =====================================
 * Appended to css/content-design.css
 * Covers:
 *   - Skip-to-content link
 *   - focus-visible keyboard navigation
 *   - prefers-reduced-motion
 *   - content-visibility for offscreen sections
 *   - Medical disclaimer strip
 *   - Color contrast fixes
 *   - Print optimization
 */

/* ═══════════════════════════════════════════════════════
   SKIP TO CONTENT — WCAG 2.4.1
   ═══════════════════════════════════════════════════════ */

.skip-to-content {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 9999;
  background: #007AFF;
  color: #FFFFFF;
  font-size: 0.875rem;
  font-weight: 700;
  padding: 10px 18px;
  border-radius: 0 0 10px 10px;
  text-decoration: none;
  transition: top 0.2s ease;
}

.skip-to-content:focus {
  top: 0;
  outline: 3px solid #FFFFFF;
  outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════
   FOCUS-VISIBLE — WCAG 2.4.7 (replaces outline:none)
   ═══════════════════════════════════════════════════════ */

/* Remove outline only when using mouse; keep for keyboard */
:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 3px solid #007AFF;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Override existing outline:none declarations */
.form-input:focus-visible,
.liquid-count:focus-visible {
  outline: 3px solid #007AFF !important;
  outline-offset: 2px;
}

.btn-option:focus-visible,
.btn-calculate:focus-visible,
.unit-toggle button:focus-visible {
  outline: 3px solid #007AFF;
  outline-offset: 3px;
}

/* ═══════════════════════════════════════════════════════
   PREFERS-REDUCED-MOTION — WCAG 2.3.3
   ═══════════════════════════════════════════════════════ */

@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;
  }

  .water-fill,
  .glass-icon,
  .animate-in,
  #reading-progress,
  .btn-calculate,
  .result-card,
  .info-card {
    animation: none !important;
    transition: none !important;
  }
}

/* ═══════════════════════════════════════════════════════
   CONTENT-VISIBILITY — Core Web Vitals (LCP/CLS)
   Defers rendering of below-fold sections until near-viewport
   ═══════════════════════════════════════════════════════ */

.content-section,
.faq-list,
.calc-links-section {
  content-visibility: auto;
  contain-intrinsic-size: 0 600px;
}

/* Do NOT apply content-visibility to above-fold elements */
.calc-hero-section,
.hero,
.site-header,
.calc-card--hero {
  content-visibility: visible;
}

/* ═══════════════════════════════════════════════════════
   COLOR CONTRAST FIXES — WCAG 1.4.3 (4.5:1 ratio)
   Muted text at rgba(60,60,67,0.45) fails on white bg
   ═══════════════════════════════════════════════════════ */

/* Minimum contrast: upgrade muted grays to pass 4.5:1 */
.privacy-note,
.table-annotation,
.trust-chip,
.breadcrumb,
.logo-text span,
.footer-links a,
.author-credentials,
.reviewed-label {
  color: #6C6C70; /* passes 4.5:1 on white bg */
}

/* Input placeholder contrast */
.form-input::placeholder {
  color: #8E8E93; /* WCAG AA compliant */
}

/* ═══════════════════════════════════════════════════════
   MEDICAL DISCLAIMER STRIP
   ═══════════════════════════════════════════════════════ */

.calc-disclaimer {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 149, 0, 0.06);
  border: 1px solid rgba(255, 149, 0, 0.2);
  border-radius: 10px;
  padding: 8px 14px;
  margin: 0 0 16px;
  flex-wrap: wrap;
}

.disclaimer-icon {
  font-size: 14px;
  flex-shrink: 0;
}

.disclaimer-text {
  font-size: 0.8125rem;
  color: #3C3C43;
  line-height: 1.5;
  flex: 1;
  min-width: 200px;
}

.disclaimer-date {
  font-size: 0.75rem;
  font-weight: 600;
  color: #6C6C70;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.04);
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid rgba(0, 0, 0, 0.07);
}

/* ═══════════════════════════════════════════════════════
   HIGH CONTRAST MODE — WCAG 1.4.11
   ═══════════════════════════════════════════════════════ */

@media (prefers-contrast: more) {
  .btn-option {
    border-width: 2px;
    border-color: #1C1C1E;
  }

  .btn-option.active {
    border-width: 3px;
    border-color: #007AFF;
  }

  .form-input {
    border-width: 2px;
    border-color: #1C1C1E;
  }

  .result-card {
    border: 2px solid #1C1C1E;
  }
}

/* ═══════════════════════════════════════════════════════
   FONT SIZE — WCAG 1.4.4 (text resize to 200%)
   ═══════════════════════════════════════════════════════ */

html {
  font-size: 100%; /* use % not px for user font-size override */
}

/* Ensure no fixed-height containers clip text when resized */
.btn-option,
.form-input,
.result-card,
.faq-question {
  min-height: auto;
  height: auto;
}

/* ═══════════════════════════════════════════════════════
   PRINT — optimise for medical use cases
   ═══════════════════════════════════════════════════════ */

@media print {
  .calc-disclaimer { display: flex !important; }
  .author-block { display: block !important; }
  .reading-progress { display: none !important; }
}
