/* ============================================================================
   Burton v7 — Layout
   ----------------------------------------------------------------------------
   Containers, grids, and utility classes used across templates.
   ========================================================================= */

/* ── Containers ──────────────────────────────────────────────────────────── */

.container {
  width: 100%;
  max-width: var(--container-default);
  margin-inline: auto;
  padding-inline: var(--space-4);    /* 16px on mobile — breathing room without wasting width */
}

@media (min-width: 720px) {
  .container {
    padding-inline: var(--container-pad);  /* 24px */
  }
}

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

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

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

/* ── Section rhythm ──────────────────────────────────────────────────────── */

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

.section--tight { padding-block: var(--space-12); }
.section--loose { padding-block: var(--space-24); }

@media (min-width: 900px) {
  .section         { padding-block: var(--space-20); }
  .section--tight  { padding-block: var(--space-16); }
  .section--loose  { padding-block: var(--space-32); }
}

/* ── 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); }

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

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

/* Auto-fit responsive grid — use for card lists that should pack density-first */
.grid--auto {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* ── Flex utilities (use sparingly) ──────────────────────────────────────── */

.flex          { display: flex; }
.flex--center  { align-items: center; justify-content: center; }
.flex--between { align-items: center; justify-content: space-between; }
.flex--wrap    { flex-wrap: wrap; }
.flex--col     { flex-direction: column; }
.gap-2 { gap: var(--space-2); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

/* ── Stack (vertical rhythm) ─────────────────────────────────────────────── */

.stack > * + * { margin-top: var(--space-4); }
.stack--sm > * + * { margin-top: var(--space-2); }
.stack--lg > * + * { margin-top: var(--space-6); }
.stack--xl > * + * { margin-top: var(--space-10); }

/* ── Spacing utilities (small, principled set — resist the urge to add more) */

.mt-0 { margin-top: 0; }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-8 { margin-bottom: var(--space-8); }

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

/* ── Visibility ──────────────────────────────────────────────────────────────
   Responsive display utilities. Class specificity (0,1,0) is enough to
   beat every rule in this theme that sets `display` on the elements
   these classes are applied to (checked: search-trigger label/kbd, nav
   toggle, nav-links). If a future rule legitimately needs to override
   one of these utilities, bump that rule's specificity — don't reach
   for `!important` here. */

@media (max-width: 900px) {
  .hide-mobile { display: none; }
}

@media (min-width: 901px) {
  .show-mobile { display: none; }
}
