@layer layout {
  .nav {
    display: flex; align-items: center; justify-content: space-between;
    gap: 2rem; padding: 1.25rem var(--gutter);
    position: relative; z-index: 3;
  }
  .nav__brand { display: block; width: clamp(150px, 18vw, 210px); }
  .nav__links { display: flex; align-items: center; gap: clamp(.75rem, 2vw, 1.75rem); }
  .nav__link {
    font-size: .8125rem; letter-spacing: .02em;
    color: var(--ink-quiet);
    padding-block: .35rem;
    border-bottom: 1px solid transparent;
  }
  .nav__link:hover, .nav__link.is-current { color: var(--ink); border-bottom-color: var(--accent); }
  .nav__link--cta { color: var(--ink); }

  main { display: block; }

  /* .band is the padded page section; .prose is only a measure and is meant
     to nest inside one. Having .prose carry the page padding meant any use
     inside an already-padded container indented twice and gained a rhythm of
     empty space above it. */
  .band, .intro, .work, .error { padding: var(--rhythm) var(--gutter); }
  .intro__lead {
    max-width: 36ch;
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.5rem, 1rem + 2.6vw, 3.25rem);
    line-height: 1.08;
    letter-spacing: var(--display-tracking);
  }

  /* Same family as the lead, half its size, a step lighter. The clamp is the
     lead's halved, except for the floor: half of the lead's smallest would be
     13px, which is too small to read comfortably on a phone. */
  .intro__sub {
    max-width: 52ch;
    margin-top: clamp(1rem, 2vw, 1.75rem);
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(0.9375rem, 0.5rem + 1.3vw, 1.625rem);
    line-height: 1.45;
    letter-spacing: -0.01em;
    color: var(--ink-quiet);
  }

  .grid {
    display: grid; gap: clamp(1rem, 2.5vw, 2rem);
    align-items: start;     /* mixed card heights sit top-aligned, not stretched */
    min-width: 0;
    grid-template-columns: repeat(auto-fill, minmax(min(22rem, 100%), 1fr));
  }

  .footer {
    display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 2rem;
    padding: 2rem var(--gutter) 3rem;
    border-top: 1px solid var(--rule);
    color: var(--ink-quiet); font-size: .8125rem;
  }
  .footer__links { display: flex; flex-wrap: wrap; gap: 1.25rem; margin-right: auto; }
  .footer__motion { cursor: pointer; border-bottom: 1px solid var(--rule); }

  /* Below ~48rem the brand plus four links cannot share one row: the nav
     overflowed the viewport, which scrolled the whole page sideways. Wrap the
     links onto their own line rather than letting anything spill. */
  @media (max-width: 48rem) {
    .nav {
      flex-wrap: wrap;
      gap: .85rem 1rem;
      padding-inline: var(--gutter);
    }
    .nav__brand { width: clamp(128px, 38vw, 168px); }
    .nav__links {
      width: 100%;
      flex-wrap: wrap;          /* four links will not fit one 414px row */
      justify-content: flex-start;
      gap: .6rem 1.15rem;
    }
    .nav__link { font-size: .75rem; }
  }
}
