/* ============================================================
   LAYOUT - containers, section rhythm, nav + footer structure,
   reusable grid scaffolds. Visual chrome of individual pieces
   lives in components.css.
   ============================================================ */

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide { max-width: var(--maxw-wide); }
.container--narrow { max-width: 820px; }

/* Vertical section rhythm */
.section { padding-block: var(--section-y); position: relative; }
.section--tight { padding-block: clamp(2.5rem, 6vw, 5rem); }
.section--cream { background: var(--color-surface-cream); }
/* Deliberate loud-quiet-loud cadence: the services climax gets extra air,
   the FAQ strip tightens. */
#services { padding-block: clamp(6rem, 13vw, 12rem); }
#faq { padding-block: clamp(3.5rem, 7vw, 6rem); }

/* ---- Paper section: one sheet printed from the dark set --------
   The proof section renders as a physical drawing sheet: bone paper,
   asphalt ink, orange darkened to its printed weight (5:1 on paper).
   Every component inside re-themes through the scoped tokens. */
.section--paper {
  --color-bg: #f4f1e9;             /* the sheet */
  --color-surface: #fbf9f3;        /* raised tiles on paper */
  --color-surface-cream: #ece8dd;
  --color-ink: #211e1a;            /* asphalt ink */
  --color-ink-soft: #57524a;       /* printed grey (6.9:1) */
  --color-line: rgb(22 20 18 / 0.14);
  --color-line-strong: rgb(22 20 18 / 0.36);
  --color-accent: #b83d00;         /* hi-vis, as it prints (5:1) */
  --color-accent-2-ink: #a83800;
  --text-on-dark-soft: #57524a;
  /* Semantic aliases resolve at :root and inherit RESOLVED - they must be
     re-declared here or they keep their dark-theme values. */
  --bg: var(--color-bg);
  --surface: var(--color-surface);
  --text: var(--color-ink);
  --text-muted: var(--color-ink-soft);
  --brand: var(--color-accent);
  background: var(--color-bg);
  color: var(--color-ink);
}
.section--paper .dash { box-shadow: 0 14px 40px rgb(22 20 18 / 0.18); }

/* Section header block (eyebrow + title + lead).
   Left-aligned by default; --center is reserved for AT MOST one opener
   on the whole page (the FAQ). Most sections open left and vary treatment. */
.section-head { max-width: 760px; }
.section-head--center { margin-inline: auto; text-align: center; }
.section-head .lead { margin-top: var(--space-5); color: var(--text-muted); font-size: var(--fs-lead); max-width: var(--maxw-text); }
.section-head--center .lead { margin-inline: auto; }
/* Bleed one section to the viewport edge (the lower-page climax) */
.section--bleed .container { max-width: var(--maxw-wide); }

/* ---- Navigation -------------------------------------------- */
.nav {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: saturate(1.2) blur(14px);
  -webkit-backdrop-filter: saturate(1.2) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.nav.is-scrolled { border-bottom-color: var(--color-line); }
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-6);
  height: 76px;
}
.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.nav__cta { margin-left: var(--space-4); }

/* Mobile nav toggle hidden on desktop.
   Scoped under .nav so it outranks the .btn{display:inline-flex} rule
   in components.css (which loads later at equal specificity). */
.nav .nav__toggle { display: none; }

/* ---- Footer ------------------------------------------------- */
.footer {
  background: var(--color-surface-cream);
  color: var(--color-ink);
  padding-block: var(--space-20) var(--space-10);
  border-top: 1px solid var(--color-line);
}
.footer__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-8);
  flex-wrap: wrap;
}
.footer__links { display: flex; gap: var(--space-8); flex-wrap: wrap; }
.footer__col { display: flex; flex-direction: column; gap: var(--space-3); }
.footer__col a { padding-block: var(--space-2); }   /* 44px-ish stacked targets, no touching */
.footer__bottom {
  margin-top: var(--space-16);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-line);   /* warm bone hairline, not cold white */
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-size: var(--fs-small);
  color: var(--text-on-dark-soft);
}

/* ---- Generic grids ----------------------------------------- */
.grid { display: grid; gap: var(--space-6); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

/* Split layout (text beside media) */
.split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: clamp(2rem, 5vw, 5rem);
  align-items: center;
}

/* About: asymmetric tall split - narrow text column, schematic bleeds
   past the gutter toward the right viewport edge. Not centered-balanced. */
.split--about {
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  align-items: start;
  gap: clamp(2rem, 6vw, 6rem);
}
.split--about .about__portrait {
  margin-right: calc(-1 * var(--gutter));   /* push schematic toward the edge */
}
@media (max-width: 960px) {
  .split--about { grid-template-columns: 1fr; }
  .split--about .about__portrait { margin-right: 0; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 960px) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .split { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  /* Phones: solid nav, no per-frame backdrop re-blur (scroll smoothness). */
  .nav { background: var(--bg); backdrop-filter: none; -webkit-backdrop-filter: none; }
  /* Collapse desktop nav links into the mobile drawer */
  .nav__links {
    position: fixed;
    inset: 76px 0 auto 0;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    background: var(--bg);
    border-bottom: 1px solid var(--color-line);
    padding: var(--space-6) var(--gutter) var(--space-8);
    transform: translateY(-12px);
    opacity: 0;
    pointer-events: none;
    /* Closed drawer leaves the AT tree entirely (5 invisible links otherwise) */
    visibility: hidden;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease),
                visibility 0s linear var(--dur);
  }
  .nav__links.is-open {
    opacity: 1;
    transform: none;
    pointer-events: auto;
    visibility: visible;
    transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease),
                visibility 0s;
  }
  .nav__cta { margin-left: 0; }
  .nav .nav__toggle { display: inline-flex; }

  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
}
