/**
 * @file
 * Structural layout — page shell, containers and the content/sidebar grid.
 */

.layout-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Centered content container, reused everywhere. */
.container {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--container-pad);
  max-width: var(--container-max);
}

/* Full-bleed wrapper variant (edge to edge band with centered inner). */
.container--wide {
  max-width: none;
}

/*
 * Cap content width on internal pages. Homepage + search stay full-bleed
 * (hero / filters+map need the viewport); cards still size themselves.
 */
body:not(.path-frontpage):not(.path-search) main > .container {
  max-width: var(--container-max);
}

main {
  flex: 1 0 auto;
  padding-block: var(--space-4) var(--space-16);
}

/* Breadcrumb spacing owned by elements.css (.page-breadcrumbs). */

.page-highlighted,
.page-help {
  margin-block: var(--space-4);
}

/* ==========================================================================
   Content + sidebar grid
   Sidebars collapse gracefully when their region is empty (see :has rules).
   ========================================================================== */
.layout-content-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  align-items: start;
}

.layout-content {
  min-width: 0; /* prevents grid blowout from wide children (maps, tables) */
}

@media (min-width: 64rem) {
  .layout-content-wrapper.has-sidebar-first {
    grid-template-columns: 300px minmax(0, 1fr);
  }
  .layout-content-wrapper.has-sidebar-second {
    grid-template-columns: minmax(0, 1fr) 340px;
  }
  .layout-content-wrapper.has-both-sidebars {
    grid-template-columns: 280px minmax(0, 1fr) 320px;
  }
}

/* Collapse layout when a sidebar region rendered but is visually empty.
   The region markup contains only whitespace/comments, so we target the
   wrapper aside that has no element children. */
.layout-sidebar-first:not(:has(*)),
.layout-sidebar-second:not(:has(*)) {
  display: none;
}

@media (min-width: 64rem) {
  .layout-content-wrapper.has-sidebar-first:not(:has(.layout-sidebar-first > *)),
  .layout-content-wrapper.has-sidebar-second:not(:has(.layout-sidebar-second > *)),
  .layout-content-wrapper.has-both-sidebars:not(:has(.layout-sidebar-first > *)):not(:has(.layout-sidebar-second > *)) {
    grid-template-columns: minmax(0, 1fr);
  }
}



.region-content .block {
  margin-bottom: var(--space-8);
}