/* ==========================================================================
   Layout
   Breakpoints: mobile up to 600px, tablet 601px to 1024px, desktop 1025px up.
   Mobile first: base rules are mobile, then min-width 601px, then 1025px.
   ========================================================================== */

.container {
  width: min(100% - 2 * var(--gutter), var(--container));
  margin-inline: auto;
}

/* Sections ---------------------------------------------------------------- */

.section {
  padding-block: var(--space-2xl);
  background: var(--surface);
  color: var(--text);
}

.section--mist {
  --surface: var(--mist);
}

.section--tight {
  padding-block: var(--space-xl);
}

.section--flush-top {
  padding-top: 0;
}

.section-head {
  max-width: 46rem;
  margin-bottom: var(--space-xl);
}

.section-head > * + * {
  margin-top: var(--space-s);
}

.section-head p {
  color: var(--muted);
  font-size: var(--step-1);
  font-weight: 300;
  line-height: 1.5;
}

/* Pattern layer used by the hero, page headers and the CTA band */
.has-pattern {
  position: relative;
  isolation: isolate;
  overflow: hidden;
}

.has-pattern::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: url("../img/pattern.jpg");
  background-image: image-set(url("../img/pattern.webp") type("image/webp"), url("../img/pattern.jpg") type("image/jpeg"));
  background-size: cover;
  background-position: center;
  mix-blend-mode: multiply;
  opacity: var(--pattern-opacity, 0.3);
  pointer-events: none;
}

/* Site header ------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--clarity);
  box-shadow: 0 1px 0 var(--line);
}

@supports (animation-timeline: scroll()) {
  .site-header {
    animation: header-lift linear both;
    animation-timeline: scroll();
    animation-range: 0 140px;
  }

  @keyframes header-lift {
    to {
      box-shadow: 0 1px 0 var(--line), 0 10px 30px rgb(31 63 58 / 0.08);
    }
  }
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
  min-height: 4.5rem;
}

/* Home hero --------------------------------------------------------------- */

.hero {
  --surface: var(--depth);
  --pattern-opacity: 0.26;
  padding-block: var(--space-xl) var(--space-2xl);
}

.hero__grid {
  display: grid;
  gap: var(--space-xl);
  align-items: center;
}

.hero__copy {
  max-width: 40rem;
}

/* Inner page header (light, headline in --depth) -------------------------- */

.page-header {
  --surface: var(--mist);
  --pattern-opacity: 0.09;
  padding-block: var(--space-xl);
}

.page-header__grid {
  display: grid;
  gap: var(--space-l);
  align-items: end;
}

.page-header h1 {
  max-width: 18ch;
}

.page-header .lede {
  margin-top: var(--space-s);
  max-width: 44ch;
}

/* Generic grids ----------------------------------------------------------- */

.split {
  display: grid;
  gap: var(--space-l);
}

.grid-3 {
  display: grid;
  gap: var(--space-l);
}

.grid-2 {
  display: grid;
  gap: var(--space-l);
}

/* Site footer ------------------------------------------------------------- */

.site-footer {
  --surface: var(--lead);
  background: var(--surface);
  color: var(--text);
  padding-block: var(--space-xl) var(--space-l);
}

.site-footer__top {
  display: grid;
  gap: var(--space-l);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--line);
}

.site-footer__links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-l) var(--space-m);
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-s) var(--space-l);
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-l);
}

/* Tablet 601px to 1024px -------------------------------------------------- */

@media (min-width: 601px) {
  .grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero__grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: var(--space-l);
  }

  .site-footer__links {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* Desktop 1025px and above ------------------------------------------------ */

@media (min-width: 1025px) {
  .site-header__inner {
    min-height: 5.25rem;
  }

  .hero {
    padding-block: var(--space-2xl);
  }

  .hero__grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 4fr);
    gap: var(--space-2xl);
  }

  .page-header {
    padding-block: var(--space-2xl) var(--space-xl);
  }

  .page-header__grid {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: var(--space-2xl);
  }

  .split {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: var(--space-2xl);
  }

  .split--even {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .site-footer__top {
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    gap: var(--space-2xl);
  }
}
