/* Mesh site — responsive layer.
   The pages were designed at a fixed 1280px and lay everything out with inline styles,
   so these rules need !important to win. Grid collapse keys off the g2/g3/g4 classes
   that _tools/flatten.mjs adds to any all-fr grid. */

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

body {
  margin: 0;
  overflow-x: hidden;
}

img,
video {
  max-width: 100%;
  height: auto;
}

*::selection {
  background: #c2e6e3;
  color: #0e2444;
}

:focus-visible {
  outline: 2px solid #119188;
  outline-offset: 2px;
}

/* Long tables / code blocks scroll rather than pushing the page sideways. */
table,
pre {
  max-width: 100%;
  overflow-x: auto;
}

/* ---------- Tablet ---------- */
@media (max-width: 1024px) {
  .g3,
  .g4 {
    grid-template-columns: repeat(2, 1fr) !important;
  }

  .padx {
    padding-left: 28px !important;
    padding-right: 28px !important;
  }
}

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  .g2,
  .g3,
  .g4 {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
  }

  /* Breathing room shrinks with the viewport. */
  .padx {
    padding-left: 20px !important;
    padding-right: 20px !important;
  }

  section {
    padding-top: 56px !important;
    padding-bottom: 56px !important;
  }

  /* Nav wraps onto its own centred rows instead of squeezing into vertical text. */
  header nav {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 12px !important;
  }

  header nav > div {
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 16px !important;
    row-gap: 10px !important;
  }

  header nav a,
  header nav button {
    white-space: nowrap;
  }

  /* Display type at desktop sizes is unreadable on a 375px screen. */
  h1 {
    font-size: 34px !important;
    line-height: 1.2 !important;
    letter-spacing: -0.015em !important;
  }

  h2 {
    font-size: 26px !important;
    line-height: 1.25 !important;
  }

  h3 {
    font-size: 19px !important;
  }

  p {
    font-size: 16px !important;
  }

}

/* ---------- Small phone ---------- */
@media (max-width: 400px) {
  h1 {
    font-size: 29px !important;
  }

  h2 {
    font-size: 23px !important;
  }

  header nav > div {
    gap: 12px !important;
  }
}

/* Respect reduced-motion preferences for the autoplaying product clip. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
