/* Containers, section rhythm, editorial split blocks */

.container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--space-3);
}

.container--narrow {
  max-width: var(--container-narrow);
}

@media (min-width: 768px) {
  .container {
    padding-inline: var(--space-5);
  }
}

.section {
  padding-block: var(--space-6);
  background-color: var(--color-cream);
}

.section--alt {
  background-color: var(--color-sand);
}

@media (min-width: 1024px) {
  .section {
    padding-block: var(--space-7);
  }
}

/* Declared after the media query above so the tightening also wins on
   desktop (same specificity — source order decides). */
.section--tight {
  padding-block: var(--space-4);
}

.section__header {
  max-width: var(--container-narrow);
  margin-bottom: var(--space-5);
}

/* A header that is a section's only content (a standalone banner
   introducing the block that follows) doesn't need the gap meant to
   separate it from siblings inside the same section. */
.section__header:last-child {
  margin-bottom: 0;
}

/* Vertical rhythm. Zero-specificity defaults (:where), so any component
   rule still wins: title -> text, text -> list, text -> button. */
:where(h1, h2) + :where(p, ul, ol, blockquote, .dates, details) {
  margin-top: var(--space-3);
}

:where(h3, h4) + :where(p, ul, ol) {
  margin-top: var(--space-2);
}

:where(p, blockquote) + :where(ul, ol, .dates) {
  margin-top: var(--space-3);
}

:where(ul, ol, .dates) + :where(p, blockquote) {
  margin-top: var(--space-3);
}

:where(p, ul, ol, blockquote, .dates) + :where(.btn, .feature__actions, .hero__actions, form, .stack-actions) {
  margin-top: var(--space-4);
}

.section__eyebrow {
  display: inline-block;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: var(--fs-nav);
  letter-spacing: var(--tracking-nav);
  text-transform: uppercase;
  color: var(--color-sky-deep);
  margin-bottom: var(--space-2);
}

/* Alternating text/image editorial block */
.split {
  display: grid;
  gap: var(--space-4);
  align-items: center;
}

@media (min-width: 900px) {
  .split {
    grid-template-columns: 1.1fr 1fr;
    gap: var(--space-6);
  }

  .split--reverse {
    grid-template-columns: 1fr 1.1fr;
  }

  .split--reverse .split__media {
    order: 2;
  }

  .split--reverse .split__text {
    order: 1;
  }
}

.split__text {
  max-width: 46ch;
}

/* Grid items default to min-width: auto; this stops a wide child (a long
   <select> option, say) from pushing a column past the screen. */
.split > * {
  min-width: 0;
}

/* Grid utilities */
.grid {
  display: grid;
  gap: var(--space-4);
}

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

@media (min-width: 900px) {
  .grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
  .grid--4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.center-copy {
  text-align: center;
  margin-inline: auto;
}
