/* The handful of arrangements every page reaches for. Keep this file
   small: anything that belongs to one component belongs in
   components/ instead. */

@layer layout {
  /* Centres content and holds the page gutter. Three widths, so a
     page can have a rhythm instead of one column: --narrow for
     text, the default for most sections, --wide for media, grids
     and anything that should feel like it uses the screen. Reach
     for the same one everywhere and the site reads as a box. */
  .container {
    --_container: var(--container);
    width: min(100% - var(--gutter) * 2, var(--_container));
    margin-inline: auto;
  }

  .container--narrow {
    --_container: var(--container-narrow);
  }

  .container--wide {
    --_container: var(--container-wide);
  }

  /* Vertical rhythm without margins on individual elements. Override
     the gap per instance with --flow. */
  .stack > * + * {
    margin-block-start: var(--flow, var(--space-s));
  }

  /* A band across the page. It spans the window, so a background,
     an image or a colour on .section reaches both edges; the
     .container inside it is what holds the content in. A
     full-bleed band is simply a section with no container in it --
     there is no negative-margin trick to remember. */
  .section {
    padding-block: var(--space-2xl);
  }

  /* The header is sticky, so an anchor has to stop below it instead of
     scrolling its own heading out of sight behind it. */
  .section[id],
  [id].hero {
    scroll-margin-block-start: 5rem;
  }
}
