/* ==========================================================================
   layout.css — containers, section rhythm and reusable grids.
   ========================================================================== */

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

.container--narrow {
  max-width: 820px;
}

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

.section {
  padding-block: var(--section-y);
}

.section--tight {
  padding-block: calc(var(--section-y) * 0.6);
}

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

.section--blue {
  background: var(--petrol-blue);
  color: var(--white);
}

.section--ink {
  background: var(--deep-ink);
  color: var(--white);
}

/* On dark sections, headings and body invert. Text on Petrol Blue is white. */
.section--blue h1,
.section--blue h2,
.section--blue h3,
.section--ink h1,
.section--ink h2,
.section--ink h3 {
  color: var(--white);
}

.section--blue p,
.section--ink p {
  color: rgba(255, 255, 255, 0.88);
}

.section--blue a:not(.btn),
.section--ink a:not(.btn) {
  color: var(--white);
}

.section--blue .eyebrow,
.section--ink .eyebrow {
  color: var(--orange-light);
}

.section__head {
  margin-bottom: var(--space-4);
  max-width: 68ch;
}

/* --- Grids -------------------------------------------------------------- */
/* auto-fit + minmax rather than fixed column counts, so in-between widths
   (a 820px foldable, a split-screen tablet) behave without a breakpoint. */

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

.grid--2 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.grid--3 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}

.grid--4 {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
}

/* Exactly two columns from tablet up: auto-fit would squeeze a third in on
   desktop, and the 2 x 2 arrangement is the point. */
.grid--2x2 {
  grid-template-columns: 1fr;
}

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

/* One, two, then four columns: eight cards always land as 8x1, 4x2 or 2x4
   with no orphan row, which auto-fit cannot guarantee. */
.grid--4up {
  grid-template-columns: 1fr;
}

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

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

/* `min(100%, Npx)` is load-bearing: without it the track can exceed the
   viewport on a 360px phone and cause horizontal scroll. */

.stack > * + * {
  margin-top: var(--space-2);
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  min-height: 100px;
}

.site-header__logo img {
  /* 56px keeps the wordmark legible; the 188x56 attrs match the SVG's
     true 1141:340 ratio so no layout shift is reserved incorrectly. */
  height: 64px;
  width: auto;
}

/* --- Site footer -------------------------------------------------------- */
/* Compact and light: Mist ground so the logo shows in its own colours, one
   row of logo / contact / two links, then a hairline and the copyright. */

.site-footer {
  background: var(--mist);
  border-top: 3px solid var(--petrol-blue);
  color: var(--deep-ink);
  padding-block: var(--space-4) var(--space-2);
  font-size: 0.875rem;
}

.site-footer a {
  color: var(--petrol-blue);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--deep-ink);
  text-decoration: underline;
}

/* The email address is one unbreakable 42-character token; let it wrap on
   narrow phones rather than push the page sideways. */
.site-footer a[href^="mailto:"] {
  overflow-wrap: anywhere;
}

.site-footer__main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

.site-footer__logo img {
  display: block;
  height: 48px;
  width: auto;
}

/* Contact details on one line, separated by thin rules. */
.site-footer__contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 0;
  font-style: normal;
}

.site-footer__contact > * {
  padding: 0 var(--space-2);
  border-left: 1px solid var(--border);
}

.site-footer__contact > :first-child {
  padding-left: 0;
  border-left: 0;
}

.site-footer__contact > :last-child {
  padding-right: 0;
}

.site-footer__nav {
  display: flex;
  gap: var(--space-3);
  font-weight: 600;
}

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px var(--space-2);
  margin-top: var(--space-3);
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* Phones: stack, and let each contact item take its own line. */
@media (max-width: 767px) {
  .site-footer__main { flex-direction: column; align-items: flex-start; }
  .site-footer__contact { flex-direction: column; align-items: flex-start; }
  .site-footer__contact > * { padding: 0; border-left: 0; }
}
