/* Live-site additions on top of the design styles: phone and tablet layout, focus, small helpers. */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
*, *::before, *::after { box-sizing: border-box; }
img, svg, canvas { max-width: 100%; }
a:focus-visible, button:focus-visible, textarea:focus-visible, input:focus-visible {
  outline: 2px solid #1E4A40; outline-offset: 3px; border-radius: 8px;
}
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.qc-note { font-size: 14px; color: #686C66; }
.qc-err { font-size: 14px; color: #9B2C2C; }
.qc-input { font: inherit; font-size: 16px; min-height: 48px; padding: 0 16px; border: 1px solid #DDD8CC; border-radius: 14px; background: #FFFFFF; color: #171A18; width: 100%; }
.qc-input:focus { outline: none; border-color: #1E4A40; box-shadow: 0 0 0 4px rgba(30,74,64,.08); }
.qc-spin { display: inline-block; width: 18px; height: 18px; border: 2px solid #DDD8CC; border-top-color: #1E4A40; border-radius: 50%; animation: qcSpin .9s linear infinite; vertical-align: -3px; }
@keyframes qcSpin { to { transform: rotate(360deg); } }
.fab { z-index: 40; }

/* ---------- tablet ---------- */
@media (max-width: 1100px) {
  [style*="grid-template-columns: repeat(5"] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  [style*="grid-template-columns: repeat(4"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  h1[style*="font-size: 72px"] { font-size: 60px !important; }
}

/* ---------- phone ---------- */
@media (max-width: 760px) {
  body { font-size: 16px; }
  header { padding: 18px 20px !important; gap: 10px !important; }
  header nav { gap: 14px !important; font-size: 14px !important; }
  header nav .navlink { display: none; }
  main { padding-left: 20px !important; padding-right: 20px !important; padding-top: 12px !important; gap: 32px !important; }
  footer { padding: 24px 20px calc(96px + env(safe-area-inset-bottom)) !important; flex-direction: column; align-items: flex-start !important; }
  footer > span:last-child { flex-wrap: wrap; gap: 12px 18px !important; }
  section { width: calc(100% - 20px) !important; padding-left: 20px !important; padding-right: 20px !important; border-radius: 26px !important; }
  section[style*="padding: 64px"], section[style*="padding: 72px"], section[style*="padding: 56px"] { padding-top: 40px !important; padding-bottom: 40px !important; }

  /* every multi-column grid becomes one or two columns */
  [style*="grid-template-columns: repeat(5"], [style*="grid-template-columns: repeat(4"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  [style*="grid-template-columns: repeat(3"], [style*="grid-template-columns: repeat(2"],
  [style*="grid-template-columns: minmax(0, 1.25fr)"], [style*="grid-template-columns: minmax(0, 1.1fr)"], [style*="grid-template-columns: minmax(0, 0.9fr)"],
  [style*="grid-template-columns: 48px"] { grid-template-columns: minmax(0, 1fr) !important; }
  [style*="grid-template-columns: 48px"] > span[aria-hidden] { display: none; }
  /* comparison table rows: label on top, two answers below */
  [style*="grid-template-columns: 220px"] { grid-template-columns: minmax(0, 1fr) !important; gap: 6px !important; padding: 16px 18px !important; }
  [role="table"] [role="row"] > span:first-child { display: none; }
  /* steps strip */
  [style*="border-left: 1px solid"] { border-left: 0 !important; padding: 18px 0 0 !important; border-top: 1px solid #E8E4DB; margin-top: 18px; }

  /* type scale */
  h1 { font-size: 42px !important; line-height: 1.04 !important; }
  h1[style*="font-size: 46px"] { font-size: 34px !important; }
  h2[style*="font-size: 52px"], h2[style*="font-size: 44px"] { font-size: 34px !important; }
  h3[style*="font-size: 28px"] { font-size: 24px !important; }
  [style*="font-size: 26px; line-height: 1.25"] { font-size: 22px !important; }
  h2[style*="font-size: 30px"] { font-size: 26px !important; }
  [style*="font-size: 28px; line-height: 1.15"] { font-size: 24px !important; }
  p[style*="font-size: 19px"], p[style*="font-size: 18px"] { font-size: 17px !important; }

  /* cards and panels a little tighter */
  [style*="padding: 32px; border: 1px solid"], [style*="padding: 28px; border: 1px solid"], [style*="padding: 26px; border: 1px solid"] { padding: 20px !important; }
  a.tile[style*="min-height: 150px"] { min-height: 124px !important; padding: 18px !important; }
  form[style*="padding: 12px 12px 12px 22px"] { padding: 12px !important; border-radius: 20px !important; }
  form[style*="padding: 12px 12px 12px 22px"] .btnp { width: 100%; }
  figure { flex-basis: 100% !important; }
  aside { padding-top: 0 !important; }

  /* floating WhatsApp button: compact, out of the way */
  .fab { right: 14px !important; bottom: calc(14px + env(safe-area-inset-bottom)) !important; min-height: 48px !important; padding: 0 16px 0 14px !important; font-size: 14px !important; }

  header { flex-wrap: nowrap !important; }
  header > a:first-child { font-size: 20px !important; white-space: nowrap; }
  header > a:first-child svg { width: 21px; height: 21px; }
  header .btno, header .btnp { white-space: nowrap; padding: 0 14px !important; }
  a.btno[href="/find"][style*="align-self: flex-start"] { align-self: stretch !important; justify-content: center; text-align: center; white-space: normal; padding: 10px 16px !important; }
  div[aria-hidden="true"][style*="margin: 0 56px"] { margin: 0 20px !important; }
  a.tile[href="/check-quote"][style*="align-items: center; gap: 16px"] { flex-direction: column; align-items: flex-start !important; gap: 10px !important; }
  [role="table"] [role="row"] { display: none !important; }
  [role="table"] [style*="grid-template-columns: 220px"] > span:nth-child(2)::before { content: "An AI chat: "; font-weight: 500; color: #3D403D; }
  [role="table"] [style*="grid-template-columns: 220px"] > span:nth-child(3) { padding-top: 4px; }
  /* video path buttons stack */
  [role="group"][aria-label="The three paths"] { grid-template-columns: minmax(0, 1fr) !important; }
}

@media (max-width: 380px) {
  h1 { font-size: 36px !important; }
  [style*="grid-template-columns: repeat(5"], [style*="grid-template-columns: repeat(4"] { grid-template-columns: minmax(0, 1fr) !important; }
}
