/* Page layout primitives — containers, sections, grids. */

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

@media (min-width: 768px) {
  .container { padding-inline: var(--space-xl); }
}

/* Vertical rhythm sections */
.section {
  padding-block: var(--space-section);
}
.section--tight { padding-block: var(--space-2xl); }

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

.section--dark {
  background: var(--color-bg-dark);
  color: #fff;
}
.section--dark h1, .section--dark h2, .section--dark h3 { color: #fff; }
.section--dark p { color: rgba(255, 255, 255, 0.85); }

/* Section header utility */
.section-header {
  text-align: center;
  max-width: 64ch;
  margin: 0 auto var(--space-2xl);
}
.section-header > p { margin-inline: auto; color: var(--color-ink-soft); }

/* Grids */
.grid {
  display: grid;
  gap: var(--space-lg);
}
.grid--2 { grid-template-columns: 1fr; }
.grid--3 { grid-template-columns: 1fr; }
.grid--4 { grid-template-columns: 1fr; }

@media (min-width: 768px) {
  .grid { gap: var(--space-xl); }
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

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

/* Stack: vertical spacing helper */
.stack > * + * { margin-top: var(--space-md); }
.stack-lg > * + * { margin-top: var(--space-lg); }
.stack-xl > * + * { margin-top: var(--space-xl); }

/* Cluster: horizontal flex with wrap */
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  align-items: center;
}

/* Center a single element */
.center { display: flex; justify-content: center; }

/* Visually hide but keep accessible */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

/* Text alignment utility */
.text-center { text-align: center; }
.text-muted { color: var(--color-muted); }
.text-soft  { color: var(--color-ink-soft); }
