/* styles/layout.css — grid/flex helpers, container widths, responsive breakpoints */

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

.narrow {
  max-width: 640px;
  margin-left: auto;
  margin-right: auto;
}

.section {
  padding: var(--space-8) 0;
}

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

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

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

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

.flex {
  display: flex;
}

/* For card rows with a variable/dynamic count (e.g. Upcoming Events, committee
   event lists) — unlike .grid-3/.grid-4, a leftover card in the last row stays
   centered instead of sticking to the left edge under column 1. */
.card-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-5);
}

.card-row > * {
  flex: 0 1 320px;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.text-center {
  text-align: center;
}

.section-tinted {
  background-color: var(--color-primary-light);
}

/* Shared curtain-banner header used by every secondary page (About,
   Opportunities, Calendar, Resources, Contact, the committee pages, etc.) —
   same visual language as the Home hero (ombre-tinted photo + solid-green
   swoosh curtain with the title/subtitle over it), just at banner height
   instead of full hero height, so every page gets it with zero markup
   duplication: each page's own styles/pages/*.css sets --page-header-photo
   to its own placeholder/real image and the rest is automatic. */
/* The swoosh is the same curved shape as the Home hero's <svg>, just delivered
   as an inline-SVG background layer instead of a real element — that's what
   lets every page get the curve with zero HTML changes. CSS background layers
   paint front-to-back in listed order, so the swoosh (first) sits on top of
   the ombre tint (second), which sits on top of the photo (third, from
   --page-header-photo). */
.page-header {
  position: relative;
  /* Above styles/page-decor.css's fixed DNA/vine margins, so they start out
     hidden behind this banner until it scrolls out of view. */
  z-index: 2;
  min-height: 180px;
  display: flex;
  align-items: center;
  overflow: hidden;
  color: #fff;
  background-color: #cfd9c8;
  background-repeat: no-repeat, no-repeat, no-repeat;
  background-position: left top, center, center;
  background-size: 60% 100%, cover, cover;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cpath d='M0,0 H68 C50,35 58,68 32,100 H0 Z' fill='%23407234'/%3E%3C/svg%3E"),
    linear-gradient(
      135deg,
      rgba(var(--color-primary-rgb), 0.82) 0%,
      rgba(var(--color-primary-rgb), 0.4) 55%,
      rgba(var(--color-primary-rgb), 0.15) 100%
    ),
    var(--page-header-photo, none);
}

.page-header .container {
  position: relative;
  z-index: 1;
  text-align: left;
}

/* The only text in the banner now that the subtitle's gone -- sized up
   accordingly so it actually reads as the prominent, deliberate element it
   is instead of default h1 sizing. */
.page-header h1 {
  color: #fff;
  max-width: 480px;
  margin-bottom: 0;
  font-size: 2.75rem;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5), 0 2px 10px rgba(0, 0, 0, 0.3);
}

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

@media (max-width: 640px) {
  .container {
    padding: 0 var(--space-4);
  }
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .section {
    padding: var(--space-6) 0;
  }
  .page-header {
    min-height: 120px;
    background-size: 100% 100%, cover, cover;
  }
  .page-header .container {
    /* Extra breathing room on top of .container's own space-4 padding --
       at full width the title ran edge-to-edge with barely any margin. */
    padding-left: var(--space-6);
    padding-right: var(--space-6);
    text-align: center;
  }
  .page-header h1 {
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    font-size: 2.1rem;
  }

  /* Room for the fixed fun-fact widget (icon + bubble, ~115px tall on
     mobile — see styles/fun-fact-widget.css) at the bottom of the page.
     Its own footer-avoidance logic keeps it clear of the footer, but does
     nothing to keep it off the LAST section's own content once scrolled
     all the way down — this empty buffer is what it floats over instead. */
  main > *:last-child {
    margin-bottom: 130px;
  }
}
