/* Phone and small-screen refinements. Loaded last so it can adjust the base and theme styles.
   Everything outside the media queries is a no-op on the desktop layout. */

html{-webkit-text-size-adjust:100%;text-size-adjust:100%}

/* Media never grows wider than its container. */
img,video,canvas,svg,iframe,embed,object{max-width:100%}
img,video{height:auto}
iframe,embed,object{border:0}
.embed{position:relative;width:100%;aspect-ratio:16/9}
.embed>iframe,.embed>video,.embed>embed,.embed>object{position:absolute;inset:0;width:100%;height:100%}

/* Long words and email addresses wrap instead of pushing the page sideways. */
h1,h2,h3,p,summary,a{overflow-wrap:break-word}

@media(max-width:680px){
  html,body{overflow-x:clip}

  /* Header: keep the logo and menu button on one line at narrow widths. */
  .bar{gap:12px}
  .brand{width:clamp(140px,46vw,182px);height:auto}
  #menu{display:inline-flex;min-height:44px;min-width:44px;padding:10px 18px;font-size:1rem;flex-shrink:0;cursor:pointer;color:inherit}

  /* Collapsed navigation menu. */
  nav{font-size:1rem;gap:4px;padding:12px 5% 20px;max-height:calc(100vh - 68px);overflow-y:auto;box-shadow:0 12px 24px #101a3814}
  nav>a{display:flex;align-items:center;min-height:48px;padding:0 4px}
  nav>a+a:not(.button){border-top:1px solid var(--line)}
  nav>.button{justify-content:center;margin-top:10px}

  /* Readable text sizes. */
  body,.cards p,.steps p,.questions p,.contact p{font-size:1rem}
  .lead{font-size:1.1rem}

  /* Comfortable tap targets (44px minimum). */
  .button,.secondary{min-height:44px}
  .actions a{padding:12px 20px}
  summary{display:list-item;padding-block:10px;min-height:44px}
  details{padding:8px 0}
  footer a{display:inline-flex;align-items:center;min-height:44px}
  .white{white-space:normal;text-align:center}

  /* Color-scheme switcher. */
  .palette #palette-toggle{min-width:44px;min-height:44px;font-size:1.2rem}
  .palette #palette-panel{max-width:calc(100vw - 60px)}
  .palette strong{font-size:1rem}
  #colors button{min-height:44px;padding:8px 10px;font-size:1rem}

  /* Fluid headings that can't outgrow a 320px screen. */
  h2{font-size:clamp(2rem,9vw,2.6rem)}
  .hero h1{font-size:clamp(3rem,13.8vw,5rem)}
  .cards h3{margin-inline:22px}
  .cards p{margin-inline:22px}
}
