/* ==========================================================================
   Rachel Cuevas Campaign — LAYOUT UTILITIES
   Requires tokens.css and base.css to be loaded first.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Container
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container-max-width);
  margin-inline: auto;
  padding-inline: var(--container-padding-inline);
}

/* --------------------------------------------------------------------------
   Section — consistent full-width vertical rhythm
   -------------------------------------------------------------------------- */
.section {
  padding-block: var(--space-2xl);
}

@media (min-width: 768px) {
  .section {
    padding-block: var(--space-3xl);
  }
}

/* Breathing room between a section's heading and whatever follows it
   (paragraph, card grid, form, etc.) — base.css resets all heading margins
   to 0, so this restores spacing consistently across every page. */
.section > .container > h1,
.section > .container > h2 {
  margin-bottom: var(--space-lg);
}

.section--tight {
  padding-block: var(--space-xl);
}

/* --------------------------------------------------------------------------
   Section background modifiers
   Contrast rule: white/near-white text on navy or red; dark text on
   white/offwhite. Never red text on a blue/navy background.
   -------------------------------------------------------------------------- */
.section--navy {
  background-color: var(--color-navy-primary);
  color: var(--color-text-on-dark);
}

.section--navy h1,
.section--navy h2,
.section--navy h3,
.section--navy h4,
.section--navy h5,
.section--navy h6 {
  color: var(--color-white);
}

.section--navy a:not(.btn) {
  color: var(--color-link-on-dark);
}

.section--navy small,
.section--navy p {
  color: rgba(255, 255, 255, 0.85);
}

.section--white {
  background-color: var(--color-white);
  color: var(--color-text-on-light);
}

.section--offwhite {
  background-color: var(--color-offwhite);
  color: var(--color-text-on-light);
}

.section--red {
  background-color: var(--color-red);
  color: var(--color-text-on-dark);
}

.section--red h1,
.section--red h2,
.section--red h3,
.section--red h4,
.section--red h5,
.section--red h6 {
  color: var(--color-white);
}

.section--red a:not(.btn) {
  color: var(--color-white);
  text-decoration-line: underline;
}

.section--red small,
.section--red p {
  color: rgba(255, 255, 255, 0.9);
}

/* --------------------------------------------------------------------------
   Responsive grid utilities — mobile-first, no horizontal overflow at 375px
   -------------------------------------------------------------------------- */
.grid-3,
.grid-4 {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: 1fr;
}

@media (min-width: 480px) {
  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  }
}

@media (min-width: 900px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* Flex utility for simple horizontal groupings (e.g. button rows) */
.flex-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
}

.flex-row--center {
  justify-content: center;
}

.flex-row--between {
  justify-content: space-between;
}

/* --------------------------------------------------------------------------
   Visually-hidden (alias of .sr-only in base.css, provided for semantic
   naming parity with common conventions used elsewhere in the codebase)
   -------------------------------------------------------------------------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
