/* Keep the injected live search centered without displacing the header actions. */
header.u-top,
header.r-top,
header.c-header {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px) minmax(0, 1fr);
  align-items: center;
  justify-content: initial;
  gap: 14px;
}

header.u-top > .u-brand,
header.r-top > .r-brand,
header.c-header > .c-brand {
  grid-column: 1;
  justify-self: start;
  min-width: 0;
}

header.u-top > .ga-tool-search,
header.r-top > .ga-tool-search,
header.c-header > .ga-tool-search {
  grid-column: 2;
  justify-self: center;
  width: min(100%, 360px);
  min-width: 0;
  margin: 0;
  order: initial;
}

header.u-top > .u-all,
header.r-top > a:not(.r-brand),
header.c-header > .c-all {
  grid-column: 3;
  justify-self: end;
  white-space: nowrap;
}

@media (max-width: 640px) {
  header.u-top,
  header.r-top,
  header.c-header {
    grid-template-columns: minmax(0, 1fr) minmax(0, 190px) auto;
    gap: 8px;
  }

  header.u-top > .ga-tool-search,
  header.r-top > .ga-tool-search,
  header.c-header > .ga-tool-search {
    width: 100%;
  }
}

@media (max-width: 420px) {
  header.u-top,
  header.r-top,
  header.c-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    padding-left: 12px !important;
    padding-right: 12px !important;
  }

  header.u-top > .ga-tool-search,
  header.r-top > .ga-tool-search,
  header.c-header > .ga-tool-search {
    width: 100%;
  }
}

/* The legacy studio tools place the brand and actions inside a .nav row. */
header.top > .nav > .ga-tool-search {
  order: 0;
}
