:root {
  --global-search-ink: #0a0d12;
  --global-search-muted: #6b7280;
  --global-search-line: #e5e7eb;
  --global-search-paper: #f8f7f4;
  --global-search-accent: #ff4d00;
}

.header-search {
  appearance: none;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}

.header-search:focus-visible {
  outline: 2px solid var(--global-search-accent);
  outline-offset: 4px;
}

.global-search-overlay {
  position: fixed;
  z-index: 20000;
  inset: 0;
  display: block;
  overflow: visible;
  padding: 0;
  pointer-events: none;
  background: transparent;
  opacity: 0;
  visibility: hidden;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.global-search-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.global-search-dialog {
  position: fixed;
  top: var(--global-search-top, 100px);
  right: var(--global-search-right, 24px);
  width: min(540px, calc(100vw - 32px));
  max-height: min(72dvh, calc(100dvh - var(--global-search-top, 100px) - 16px));
  overflow: hidden;
  color: var(--global-search-ink);
  background: var(--global-search-paper);
  border: 1px solid rgb(255 255 255 / 60%);
  border-radius: 18px;
  box-shadow: 0 28px 100px rgb(0 0 0 / 28%);
  transform: translateY(12px) scale(.99);
  transition: transform 260ms cubic-bezier(.2, .75, .25, 1);
  pointer-events: auto;
}

.global-search-overlay.is-open .global-search-dialog {
  transform: translateY(0) scale(1);
}

.global-search-top {
  padding: 22px 25px 18px;
  border-bottom: 1px solid var(--global-search-line);
}

.global-search-heading-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 15px;
}

.global-search-eyebrow {
  margin: 0 0 8px;
  color: var(--global-search-accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.global-search-title {
  margin: 0;
  font-size: clamp(21px, 2.5vw, 25px);
  font-weight: 650;
  letter-spacing: -.045em;
  line-height: 1.2;
}

.global-search-close {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  place-items: center;
  padding: 0;
  color: var(--global-search-ink);
  background: transparent;
  border: 1px solid var(--global-search-line);
  border-radius: 50%;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.global-search-close:hover {
  color: #fff;
  background: var(--global-search-ink);
  border-color: var(--global-search-ink);
}

.global-search-close svg {
  width: 16px;
  height: 16px;
}

.global-search-input-wrap {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 52px;
  padding: 0 17px;
  background: #fff;
  border: 1px solid #d9d5ce;
  border-radius: 10px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.global-search-input-wrap:focus-within {
  border-color: var(--global-search-accent);
  box-shadow: 0 0 0 3px rgb(230 75 18 / 10%);
}

.global-search-input-wrap > svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  color: #7c7d7e;
}

.global-search-input {
  width: 100%;
  min-width: 0;
  padding: 13px 0;
  color: var(--global-search-ink);
  background: transparent;
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
  font: inherit;
  font-size: 16px;
}

.global-search-input::placeholder {
  color: #9a9a97;
}

.global-search-shortcut {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  color: #858680;
  font-size: 11px;
  white-space: nowrap;
}

.global-search-shortcut kbd {
  min-width: 22px;
  padding: 3px 5px;
  color: inherit;
  background: #f4f2ed;
  border: 1px solid #e6e2db;
  border-radius: 4px;
  font: inherit;
  text-align: center;
}

.global-search-body {
  max-height: min(42vh, 400px);
  min-height: 112px;
  overflow-y: auto;
  padding: 15px 25px 20px;
  overscroll-behavior: contain;
}

.global-search-empty {
  display: grid;
  min-height: 100px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--global-search-muted);
  text-align: center;
}

.global-search-empty strong {
  color: #4a4b4b;
  font-size: 14px;
  font-weight: 650;
}

.global-search-empty p {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
}

.global-search-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 7px;
}

.global-search-suggestion {
  padding: 7px 11px;
  color: #5d6063;
  background: #fff;
  border: 1px solid var(--global-search-line);
  border-radius: 99px;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease;
}

.global-search-suggestion:hover {
  color: var(--global-search-accent);
  background: #fff8f4;
  border-color: #efb49e;
}

.global-search-section + .global-search-section {
  margin-top: 24px;
}

.global-search-section-title {
  display: flex;
  align-items: baseline;
  gap: 9px;
  margin: 0 0 10px;
  color: #6a6d70;
  font-size: 11px;
  font-weight: 750;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.global-search-count {
  color: #9a9b98;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
}

.global-search-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.global-search-result {
  display: flex;
  min-width: 0;
  min-height: 74px;
  align-items: center;
  gap: 13px;
  padding: 10px 12px;
  color: inherit;
  background: #fff;
  border: 1px solid var(--global-search-line);
  border-radius: 9px;
  text-decoration: none;
  transition: transform 170ms ease, border-color 170ms ease, box-shadow 170ms ease;
}

.global-search-result:hover,
.global-search-result:focus-visible {
  border-color: #e7a083;
  box-shadow: 0 7px 22px rgb(44 34 25 / 8%);
  outline: 0;
  transform: translateY(-2px);
}

.global-search-result-image,
.global-search-result-mark {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  color: var(--global-search-accent);
  background: #f3f0ea;
  border-radius: 6px;
}

.global-search-result-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.global-search-result-mark {
  background: #f7eee8;
}

.global-search-result-mark svg {
  width: 21px;
  height: 21px;
}

.global-search-result-copy {
  min-width: 0;
  flex: 1 1 auto;
}

.global-search-result-copy strong,
.global-search-result-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-search-result-copy strong {
  color: #282a2c;
  font-size: 13px;
  font-weight: 680;
}

.global-search-result-copy span {
  margin-top: 5px;
  color: var(--global-search-muted);
  font-size: 11px;
}

.global-search-result-arrow {
  flex: 0 0 auto;
  color: #a0a09a;
  font-size: 18px;
  transition: color 160ms ease, transform 160ms ease;
}

.global-search-result:hover .global-search-result-arrow {
  color: var(--global-search-accent);
  transform: translate(2px, -2px);
}

.global-search-overlay [hidden] {
  display: none !important;
}

.global-search-dialog[hidden] {
  display: none !important;
}

/* The search field stays inside the header on every screen size. */
@media (min-width: 761px) {
  .global-search-dialog {
    position: relative;
    top: auto;
    left: auto;
    right: auto;
    width: clamp(150px, 18vw, 300px);
    max-width: calc(100vw - 24px);
    flex: 0 1 clamp(150px, 18vw, 300px);
    max-height: none;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none;
  }

  .header.global-search-inline .header-tools > .header-search {
    display: none !important;
  }

  .header.global-search-inline .header-tools {
    gap: clamp(8px, 1vw, 16px);
  }

  .global-search-top {
    padding: 0;
    background: transparent;
    border: 0;
  }

  .global-search-heading-row,
  .global-search-close,
  .global-search-shortcut {
    display: none;
  }

  .global-search-input-wrap {
    min-height: 40px;
    height: 40px;
    flex-direction: row-reverse;
    gap: 8px;
    padding: 0 10px;
    background: #fff;
    border: 1px solid #d8d5cf;
    border-radius: 999px;
  }

  .global-search-input-wrap:focus-within {
    border-color: var(--global-search-accent);
    box-shadow: 0 0 0 2px rgb(255 77 0 / 12%);
  }

  .global-search-input-wrap > svg {
    width: 19px;
    height: 19px;
    color: var(--global-search-accent);
  }

  .global-search-input {
    padding: 0;
    color: var(--global-search-ink);
    font-size: 13px;
  }

  .global-search-input::placeholder {
    color: #858585;
    opacity: 1;
  }

  .global-search-body,
  .global-search-dialog:not(.has-query) .global-search-body {
    display: none;
    position: absolute;
    z-index: 50;
    top: calc(100% + 7px);
    right: 0;
    left: auto;
    width: max(100%, min(380px, calc(100vw - 24px)));
    max-height: min(54dvh, 380px);
    min-height: 0;
    margin: 0;
    padding: 10px;
    overflow-y: auto;
    color: var(--global-search-ink);
    background: #fff;
    border: 1px solid var(--global-search-line);
    border-radius: 3px;
    box-shadow: 0 12px 30px rgb(10 13 18 / 12%);
  }

  .global-search-dialog.has-query:focus-within .global-search-body {
    display: block;
  }

  .global-search-empty {
    min-height: 62px;
    color: var(--global-search-muted);
  }

  .global-search-empty strong {
    color: var(--global-search-ink);
  }

  .global-search-empty p {
    color: var(--global-search-muted);
  }

  .global-search-section + .global-search-section {
    margin-top: 14px;
  }

  .global-search-section-title {
    margin-bottom: 7px;
    color: var(--global-search-muted);
  }

  .global-search-count {
    color: #9ca3af;
  }

  .global-search-results {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .global-search-result {
    min-height: 54px;
    gap: 10px;
    padding: 6px 8px;
    color: var(--global-search-ink);
    background: #fff;
    border-color: var(--global-search-line);
    border-radius: 3px;
    box-shadow: none;
  }

  .global-search-result:hover,
  .global-search-result:focus-visible {
    background: #fff8f4;
    border-color: #ffb18f;
    box-shadow: 0 4px 12px rgb(10 13 18 / 8%);
    transform: none;
  }

  .global-search-result-image,
  .global-search-result-mark {
    width: 42px;
    height: 42px;
    background: #f1f0ec;
    border-radius: 3px;
  }

  .global-search-result-mark {
    color: var(--global-search-accent);
  }

  .global-search-result-copy strong {
    color: var(--global-search-ink);
  }

  .global-search-result-copy span,
  .global-search-result-arrow {
    color: var(--global-search-muted);
  }
}

@media (min-width: 761px) and (max-width: 1100px) {
  .header.global-search-inline .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: clamp(12px, 2vw, 22px);
  }

  .header.global-search-inline .header-inner > .nav {
    display: none;
  }

  .header.global-search-inline .header-tools {
    grid-column: 2;
    gap: clamp(8px, 1.2vw, 14px);
  }

  .header.global-search-inline .header-tools .menu-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 2px;
  }

  .header.global-search-inline .mobile-nav {
    padding: 8px 26px 15px;
  }

  .header.global-search-inline .mobile-nav.open {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
  }

  .header.global-search-inline .mobile-nav a {
    display: flex;
    min-height: 44px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--global-search-line);
  }

  .header.global-search-inline .header-tools > .global-search-dialog {
    width: clamp(145px, 16vw, 180px);
    flex-basis: clamp(145px, 16vw, 180px);
  }
}

@media (max-width: 760px) {
  .header.global-search-inline .header-tools > .global-search-dialog {
    display: none;
  }

  .header.global-search-inline.global-search-mobile-search-open .global-search-dialog:not([hidden]) {
    display: block;
  }

  .header.global-search-inline .header-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 7px;
    padding-top: 8px;
    padding-bottom: 10px;
    overflow: visible;
  }

  .global-search-dialog {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    grid-column: 1 / -1;
    width: 100%;
    max-width: none;
    flex: 0 0 100%;
    max-height: none;
    overflow: visible;
    margin: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    transform: none;
  }

  .global-search-top {
    padding: 0;
    background: transparent;
    border: 0;
  }

  .global-search-heading-row,
  .global-search-close,
  .global-search-shortcut {
    display: none;
  }

  .global-search-input-wrap {
    min-height: 40px;
    height: 40px;
    flex-direction: row-reverse;
    gap: 9px;
    padding: 0 11px;
    background: #fff;
    border: 1px solid #d8d5cf;
    border-radius: 999px;
  }

  .global-search-input-wrap:focus-within {
    border-color: var(--global-search-accent);
    box-shadow: 0 0 0 2px rgb(255 77 0 / 12%);
  }

  .global-search-input-wrap > svg {
    width: 19px;
    height: 19px;
    color: var(--global-search-accent);
  }

  .global-search-input {
    padding: 0;
    font-size: 14px;
  }

  .global-search-body,
  .global-search-dialog:not(.has-query) .global-search-body {
    display: none;
    position: absolute;
    z-index: 50;
    top: calc(100% + 7px);
    right: 0;
    left: 0;
    width: 100%;
    max-height: min(50dvh, 400px);
    min-height: 0;
    margin: 0;
    padding: 10px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--global-search-line);
    border-radius: 3px;
    box-shadow: 0 12px 30px rgb(10 13 18 / 12%);
  }

  .global-search-dialog.has-query:focus-within .global-search-body {
    display: block;
  }

  .global-search-results {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .global-search-result-image,
  .global-search-result-mark {
    width: 42px;
    height: 42px;
  }
}

/* Keep the desktop navigation centered in the full header, not in the
   remaining space between the brand and the wider search controls. */
@media (min-width: 1101px) {
  .header.global-search-inline .header-inner {
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: clamp(8px, 1.6vw, 24px);
  }

  .header.global-search-inline .header-inner > .brand {
    grid-column: 1;
    justify-self: start;
  }

  .header.global-search-inline .header-inner > .nav {
    grid-column: 2;
    justify-self: center;
    gap: clamp(8px, .75vw, 12px);
  }

  .header.global-search-inline .header-inner > .nav > a {
    min-width: 0;
    min-height: 44px;
    align-items: center;
  }

  .header.global-search-inline .header-inner > .header-tools {
    grid-column: 3;
    justify-self: end;
    gap: clamp(6px, .8vw, 14px);
  }

  .header.global-search-inline .header-tools > .global-search-dialog {
    width: clamp(140px, 14vw, 250px);
    flex-basis: clamp(140px, 14vw, 250px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .global-search-overlay,
  .global-search-dialog,
  .global-search-result,
  .global-search-close,
  .global-search-result-arrow {
    transition-duration: .01ms !important;
  }
}
