/**
 * Site layout rules; shared values live in variables.css.
 * Desktop: 1024px and above; tablet: 768–1023px; mobile: below 768px.
 * Keep media-query boundaries consistent with components.css.
 */

/**
 * Page boundaries and headings.
 */
.container {
  width: calc(100% - 2 * var(--page-gutter));
  max-width: var(--container-max-width);
  margin-inline: auto;
}

.page-heading {
  margin-block: var(--section-gap);
  text-align: center;
}

.post .page-heading {
  max-width: var(--width-sm);
  margin-inline: auto;
}

.page-heading>h1 {
  margin-top: 0;
  font-size: var(--page-title-size);
}

.page-heading>h1:last-child {
  margin-bottom: 0;
}

.page-subtitle {
  max-width: var(--width-md);
  margin-inline: auto;
  font-size: var(--subtitle-size);
}

.page-subtitle> :last-child {
  margin-bottom: 0;
}

/**
 * Ordered content blocks; prose styling belongs to the boilerplate.
 */
.block {
  margin: var(--block-gap) auto;
  min-width: 0;
}

.block:first-child {
  margin-top: 0;
}

.block:last-child {
  margin-bottom: 0;
}

.block> :first-child {
  margin-top: 0;
}

.block> :last-child {
  margin-bottom: 0;
}

.width-sm {
  max-width: var(--width-sm);
}

.width-md {
  max-width: var(--width-md);
}

.width-lg {
  max-width: var(--width-lg);
}

.width-wide {
  max-width: none;
}

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

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

/**
 * Listings share layout rules regardless of their content section.
 */
.post-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr));
  gap: var(--grid-gap);
}

.post-listing+.post-listing {
  margin-top: var(--section-gap);
}

.post-list {
  max-width: var(--width-sm);
  margin-inline: auto;
}

/**
 * Responsive spacing and columns; typography stays the same.
 */
@media (width < 1024px) {
  :root {
    --page-gutter: var(--gutter-tablet);
  }

  .post-grid {
    grid-template-columns: repeat(var(--grid-columns-tablet), minmax(0, 1fr));
    gap: var(--grid-gap-tablet);
  }
}

@media (width < 768px) {
  :root {
    --page-gutter: var(--gutter-mobile);
  }

  .post-grid {
    grid-template-columns: repeat(var(--grid-columns-mobile), minmax(0, 1fr));
    gap: var(--grid-gap-mobile);
  }
}