/* ==========================================================================
   Care+ mobile responsive layer (v1, 2026-10-31)
   Loaded last on every page. Every rule is inside a max-width media query,
   so desktop (>=981px) rendering is unchanged. Layout/tap-target only:
   no copy, pricing or behaviour changes.
   `html`/`html body` prefixes raise specificity over later inline <style>
   blocks and the analytics notice styles injected by care-analytics.v1.js.
   ========================================================================== */

/* 1. Grid columns must be allowed to shrink below their min-content width
      (fixes sideways scroll on / at 360-390px caused by the hero phone mockup
      and nowrap plan-card buttons pushing the 1fr column wider than the screen). */
@media (max-width: 980px) {
  html .hero-grid,
  html .care-pillars-grid,
  html .comparison-grid,
  html .hardware-grid,
  html .loop-grid,
  html .pathways-grid,
  html .pricing-grid,
  html .impact-grid,
  html .footer-grid { grid-template-columns: minmax(0, 1fr); }
  html .hero-grid > *,
  html .pricing-grid > *,
  html .plan-card { min-width: 0; }
}

/* 2. Hero phone mockup: scale the fixed 334px device to fit narrow screens. */
@media (max-width: 480px) {
  html .hero-gradient-stage { padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 429px) { html .phone-device-shell { zoom: .9; } }
@media (max-width: 389px) { html .phone-device-shell { zoom: .85; } }
@media (max-width: 374px) { html .phone-device-shell { zoom: .8; } }

/* 3. Buttons: let long labels wrap instead of overflowing their pill. */
@media (max-width: 640px) {
  html .btn { white-space: normal; text-align: center; line-height: 1.25; min-height: 44px; }
  html .plan-card .btn { white-space: normal !important; }
  html .plan-card { padding: 28px 22px; }
  html button.btn[style*="nowrap"] { white-space: normal !important; }
}

/* 4. /corporate comparison table -> stacked cards on phones (all values kept). */
@media (max-width: 640px) {
  html .actuarial-table-wrap:has(> .actuarial-table) { overflow-x: visible; border: 0; background: transparent; box-shadow: none; border-radius: 0; }
  html .actuarial-table,
  html .actuarial-table tbody,
  html .actuarial-table tr,
  html .actuarial-table td { display: block; width: 100%; }
  html .actuarial-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  html .actuarial-table tr { background: #FFFFFF; border: 1.5px solid var(--care-border-tint, #D5E0FF); border-radius: 18px; box-shadow: var(--shadow-soft); margin: 0 0 14px; overflow: hidden; }
  html .actuarial-table td { padding: 12px 16px; border-bottom: 1px solid var(--border-subtle, #E2E8F0); }
  html .actuarial-table td:last-child { border-bottom: 0; }
  html .actuarial-table td:first-child { background: #F3F6FF; color: var(--text-primary, #0F172A); font-size: 15px; }
  html .actuarial-table td[data-label]:not(:first-child)::before {
    content: attr(data-label); display: block; margin: 0 0 4px;
    font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted, #64748B);
  }
  html .actuarial-table td.highlight-col { border-left: 3px solid var(--care-blue, #2F5DFF); border-right: 0; }
  html .actuarial-table td.highlight-col::before { color: var(--care-blue, #2F5DFF); }
}

/* 5. Guided quote confirmation: long email addresses wrap inside the card. */
@media (max-width: 640px) {
  html #cqDoneMsg, html #cqDoneEmail { overflow-wrap: anywhere; word-break: break-word; }
}

/* 6. Tap targets (~44px minimum) on phones. */
@media (max-width: 720px) {
  /* header: brand + audience pills; tighten header padding so total height stays about the same */
  html .navbar-inner { padding: 8px 0; gap: 6px; }
  html .navbar .brand { min-height: 44px; }
  html .header-audience-switcher { padding: 2px; }
  html .audience-switch-pill { min-height: 44px; padding-top: 0; padding-bottom: 0; justify-content: center; }
  /* subpage headers (programs/*, corporate/* guides, insights/*) */
  html header.nav .brand { min-height: 44px; }
  html .switch a { min-height: 44px; display: inline-flex; align-items: center; padding-top: 0; padding-bottom: 0; }
  html a.navlink { min-height: 44px; display: inline-flex; align-items: center; padding-top: 0; padding-bottom: 0; }
  /* footer */
  html .footer-topics a { min-height: 44px; display: inline-flex; align-items: center; }
  html body .care-analytics-footer button { min-height: 44px; padding: 0 6px; }
  /* analytics notice (injected by care-analytics.v1.js) */
  html body #careAnalyticsNotice button { min-height: 44px; }
  html body #careAnalyticsNotice .can-x { width: 44px; height: 44px; min-height: 44px; top: 0; right: 0; }
  /* interactive chips/options/controls */
  html .cq-chip { min-height: 44px; }
  html .finish-chip { min-height: 44px; padding-left: 14px; padding-right: 14px; }
  html .bae-opt { min-height: 44px; }
  html .bae-range { height: 44px; margin-bottom: 8px; }
  html #videoAudioToggleBtn { min-height: 44px; }
  /* buttons drawn inside the decorative phone mockups: enlarge the hit area
     invisibly so the mockup keeps its proportions */
  html .ios-coach-btn, html .ios-tab-item { position: relative; }
  html .ios-coach-btn::after { content: ""; position: absolute; top: -15px; bottom: -15px; left: 0; right: 0; }
  html .ios-tab-item::after { content: ""; position: absolute; top: -8px; bottom: -8px; left: 0; right: 0; }
}
