/**
 * Layout: containers, page shell, regions, section rhythm, grids.
 *
 * The 2016 site put everything inside one fixed 1170px box. Here the page is
 * a stack of full-bleed bands; only the text inside them is constrained.
 */

.layout-container { display: flow-root; min-height: 100vh; }

/* ---- Containers -------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--wide   { max-width: var(--container-wide); }
.container--narrow { max-width: var(--container-narrow); }
.container--flush  { padding-inline: 0; }

/* ---- Section bands ----------------------------------------------------- */
.section { padding-block: var(--section-y); }
.section--tight { padding-block: var(--section-y-tight); }
.section--flush-top { padding-top: 0; }
.section--flush-bottom { padding-bottom: 0; }

.section--surface { background: var(--bg-surface); }
.section--warm    { background: var(--bg-warm); }
.section--tint    { background: var(--bg-tint); }
.section--invert  { background: var(--bg-invert); color: var(--fg-invert); }

.section--invert h1, .section--invert h2,
.section--invert h3, .section--invert h4 { color: var(--fg-invert); }
.section--invert h5, .section--invert h6 { color: var(--c-slate-300); }
.section--invert p  { color: var(--fg-invert-muted); }
.section--invert a:not(.btn) { color: var(--accent-on-dark); }

/* Hairline between two same-coloured bands. */
.section + .section.section--surface,
.section--surface + .section--surface { border-top: 1px solid var(--c-rule-2); }

/* ---- Page shell -------------------------------------------------------- */
.page-main { display: block; }

/* Interior pages: content with an optional sticky rail. The 2016 site put a
   rail on every page; here it is opt-in and only carries conversion content. */
.page-body { padding-block: var(--section-y-tight) var(--section-y); }
.page-body__inner { display: grid; gap: var(--s-9); align-items: start; }

@media (min-width: 62em) {
  .page-body__inner--with-rail {
    grid-template-columns: minmax(0, 1fr) 21rem;
    gap: var(--s-9) var(--s-10);
  }
  .page-rail { position: sticky; top: calc(var(--header-h-compact) + var(--s-5)); }
}

/* ---- Generic grids ----------------------------------------------------- */
.grid { display: grid; gap: var(--s-5); }
.grid--2 { grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.grid--3 { grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); }
.grid--4 { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }

/* Split: media beside text. */
.split { display: grid; gap: var(--s-7); align-items: center; }
@media (min-width: 56em) {
  .split { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-10); }
  .split--media-right > .split__media { order: 2; }
  .split--wide-text { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
}

/* ---- Utilities --------------------------------------------------------- */
.stack > * + * { margin-top: var(--s-4); }
.stack-lg > * + * { margin-top: var(--s-6); }
.measure { max-width: var(--measure); }
.center { margin-inline: auto; text-align: center; }
.center .measure, .center.measure { margin-inline: auto; }
.table-wrap { overflow-x: auto; }
.u-tabular { font-variant-numeric: tabular-nums; }

/* ---- Category grid ----------------------------------------------------- */
/* Four procedure groupings; the grid is fixed at four so the row always
   fills rather than leaving one card stranded. */
.category-grid { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
@media (min-width: 62em) { .category-grid { grid-template-columns: repeat(4, 1fr); } }
.category-grid .card__body { justify-content: flex-end; }
.category-grid .card__title { font-size: var(--fs-xl); }

/* A media split with no image is a plain measure-width text block. */
.media-split--no-media { grid-template-columns: minmax(0, 1fr); }
.media-split--no-media .media-split__body { max-width: var(--measure); }

/* ---- Procedure page ---------------------------------------------------- */
.procedure > * + * { margin-top: var(--s-8); }
.procedure__intro {
  font-size: var(--fs-md);
  line-height: var(--lh-relaxed);
  color: var(--fg-muted);
  font-weight: 300;
}
.procedure__facts {
  padding: var(--s-6) 0;
  border-block: 1px solid var(--border);
}
.procedure__section-title {
  font-size: var(--fs-xl);
  margin-bottom: var(--s-5);
  padding-bottom: var(--s-3);
  border-bottom: 2px solid var(--border);
  position: relative;
}
/* The short accent segment under section titles, carried over from 2016. */
.procedure__section-title::after {
  content: '';
  position: absolute;
  inset-block-end: -2px;
  inset-inline-start: 0;
  width: 5rem;
  height: 2px;
  background: var(--accent);
}
.procedure__gallery .field__item,
.procedure__gallery .field--items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: var(--s-3);
}
.procedure__gallery img { border-radius: var(--radius-sm); }

/* ---- Conversion rail --------------------------------------------------- */
.page-rail .block {
  background: var(--bg-warm);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--s-6);
}
.page-rail .block + .block { margin-top: var(--s-5); }
.page-rail h2 {
  font-size: var(--fs-lg);
  margin-bottom: var(--s-3);
}
.page-rail p { font-size: var(--fs-sm); color: var(--fg-muted); }
.page-rail .btn { margin-top: var(--s-3); }

/* ---- Taxonomy term (category) page ------------------------------------- */
.term__description { margin-bottom: var(--s-8); }

/* The core taxonomy term view renders one row per procedure; lay those rows
   out as a card grid rather than a stacked list. */
/* Core's taxonomy term view carries no distinguishing class, and its rows sit
   directly inside the generated js-view-dom-id wrapper, so the grid is scoped
   to the term page body and applied to that wrapper. */
.term-page .views-element-container > div {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: var(--s-5);
}
.term-page .views-row { display: contents; }
/* The view emits an empty <header> and an RSS link; neither should occupy a
   grid cell. */
.term-page .views-element-container > div > header { display: none; }
.feed-icon { display: none; }

/* ---- First band after a page-header ------------------------------------ */
/* A landing page that opens with a title band does not need a full section's
   rhythm beneath it as well; the header already supplies the space. The
   homepage is exempt because its first band is the hero, which sets its own. */
.hero-region + .page-main .field--name-field-sections > .field__item:first-child > .section {
  padding-top: var(--section-y-tight);
}

/* ---- Embedded listings -------------------------------------------------- */
.listing .views-element-container > div > header { display: none; }
.listing__actions { margin-top: var(--s-7); }

/* ---- Procedure hero image ---------------------------------------------- */
.procedure__hero { margin: 0 0 var(--s-7); }
.procedure__hero :is(img, picture) {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: var(--radius-lg);
}
