/* Keep the brand and the search position on the same header row. */
.container-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

/* Top header positions still occupy their own complete row when enabled. */
.container-header > .container-topbar,
.container-header > .container-below-top {
  flex: 0 0 100%;
}

.container-header > .grid-child:not(.container-below-top):not(.container-nav) {
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  margin-inline-end: 0;
}

.container-header > .container-nav {
  flex: 0 1 auto;
  width: auto;
  min-width: 0;
  margin-inline-start: 0;
  padding-bottom: .5em;
  align-items: center;
}

/* Preserve Cassiopeia's 1320px centered header width in static mode. */
.wrapper-static .container-header > .grid-child:not(.container-below-top):not(.container-nav) {
  margin-inline-start: max(0px, calc((100vw - 1320px) / 2));
}

.wrapper-static .container-header > .container-nav {
  margin-inline-end: max(0px, calc((100vw - 1320px) / 2));
}

.container-header > .container-nav .container-search,
.container-header > .container-nav nav {
  margin-top: 0;
}

/* Keep the footer modules top-aligned on desktop. */
.container-footer .grid-child {
  align-items: flex-start;
}

/* On mobile, align every footer module from the same left edge. */
@media (max-width: 991.98px) {
  .container-footer .grid-child > * {
    text-align: start;
  }
}
