/* Search panel (Figma "Search panel" 2017:15047): white panel over the top of the page with the logo, a close button and a
   large search box with a heavy bottom rule. */
.search-panel {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 50;
  background: var(--color-bg-canvas);
  color: var(--color-text-primary);
  /* Wipes down from the top edge and back up, with the mega menus' clip-path and timing (megamenu.css). header.js adds .is-open
     one frame after removing [hidden], and sets [hidden] again when the wipe back up has finished. */
  clip-path: inset(0 0 100% 0);
  transition: clip-path 380ms cubic-bezier(0.22, 0.61, 0.36, 1);
}
.search-panel.is-open { clip-path: inset(0 0 0 0); }
.search-panel[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  .search-panel { transition: none; }
}

/* The status row ("No matching results") always takes its space, shown or not, so the panel never changes height. The bottom
   padding gives back exactly that row, so the panel is the same height as before the row existed. */
.search-panel {
  --search-status-space: calc(var(--type-paragraph-medium-emphasis-line-height) + var(--space-gap-5xs));
}
.search-panel__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr); /* a bare grid track is min-content wide, so a long query would widen the whole panel */
  gap: var(--space-gap-2xl);
  padding: var(--space-inset-3xl) var(--gutter) calc(var(--space-inset-3xl) - var(--search-status-space));
}
.search-panel__query { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.search-panel__bar { display: flex; align-items: center; justify-content: space-between; }
.search-panel__close { display: inline-grid; place-items: center; width: var(--tap-min); height: var(--tap-min); padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.search-panel__close .icon { width: var(--close-box); height: var(--close-box); }

.search-box {
  min-width: 0; /* let the form shrink to the panel; the input inside scrolls its own text */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-gap-xs);
  /* About 30 px from the query's baseline to the heavy rule (Lance). The line box below the baseline is about 11 px at this
     size, so the 20 px inset token gives ~31 px to the baseline and ~20 px to the bottom of the descenders. */
  padding-block: var(--space-inset-xs) var(--space-inset-sm);
  border: 0;
  border-bottom: var(--border-12-pixel) solid var(--color-border-border); /* the rule is the only border: no box around the field */
}
.search-box__input {
  flex: 0 1 auto; /* sized to its text by search.js (a flex: 1 basis would ignore that width) */
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--color-text-primary);
  /* No fixed height: a 48 px input clipped the 54 px query (tops and descenders of g, j, p, q were cut off by a white
     background). The input is as tall as its line box (1.2 x the type size), and the 48 px button still sets the row. */
  height: auto;
  line-height: 1.2;
  overflow: visible;
  appearance: none;
}
.search-box__input::placeholder { color: var(--color-text-light); opacity: 1; }
/* The query field: the input is sized to its text (search.js) and the clear button follows it. The browser's own clear
   button is hidden in favour of this one. */
.search-box__field { display: flex; align-items: center; flex: 1; min-width: 0; }
.search-box__input::-webkit-search-cancel-button,
.search-box__input::-webkit-search-decoration { -webkit-appearance: none; appearance: none; display: none; }
.search-box__clear {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--tap-min);
  height: var(--tap-min);
  /* The 44 px hit area is pulled in so the visible X sits close to the word: the glyph's own margin is removed. */
  /* The visible X sits about 30 px after the word (Lance). The icon is centred in the 44 px hit area and its drawn glyph starts
     about 14 px into the 28 px box, so a 16 px (inset/xs) margin puts the glyph ~30 px after the text. The X is then moved down
     8 px (gap/4xs) so it centres on the query's text, not on the line box. */
  margin-inline-start: var(--space-inset-xs);
  margin-inline-end: calc(-1 * (var(--tap-min) - var(--close-box)) / 2);
  position: relative;
  top: var(--space-gap-4xs);
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-text-light);
  cursor: pointer;
}
.search-box__clear .icon { width: var(--close-box); height: var(--close-box); }
.search-box__clear[hidden] { display: none; }
/* Directly under the rule. Always laid out (visibility, not display), so the panel height never changes. */
.search-panel__status {
  height: var(--type-paragraph-medium-emphasis-line-height);
  margin: var(--space-gap-5xs) 0 0;
  color: var(--color-text-primary);
  visibility: hidden;
}
.search-panel__status.is-shown { visibility: visible; }
.search-box__input:focus-visible { outline: none; }
.search-box__submit {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--search-button);
  height: var(--search-button);
  padding: 0;
  border: var(--border-1-pixel) solid var(--color-border-border);
  background: var(--color-action-primary);
  color: var(--color-text-inverse);
  cursor: pointer;
}
.search-box__submit { transition: background-color 180ms ease, color 180ms ease; }
.search-box__submit:hover { background: var(--color-bg-canvas); color: var(--color-text-primary); } /* solid black on white -> outline (the border stays) */
.search-box__submit .icon { width: var(--space-inset-md); height: auto; }

/* ---------- Search results pieces shared by the panel's live suggestions and the results page (search.php) ---------- */
/* Filter chip: the Expert Advice chip (advice.css .advice-chip) with a count in Geist. */
.res-chips { display: flex; flex-wrap: wrap; gap: var(--space-gap-2xs); margin: 0; padding: 0; list-style: none; }
.res-chip {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-gap-xs); box-sizing: border-box;
  min-height: var(--btn-height-md); padding: 0 calc(var(--space-inset-md) - var(--border-1-pixel));
  border: var(--border-1-pixel) solid var(--color-border-border); background: var(--color-bg-canvas); color: var(--color-text-primary);
  font: inherit; text-decoration: none; white-space: nowrap; cursor: pointer;
}
.res-chip:hover { background: var(--color-bg-subtle); }
.res-chip.is-selected { background: var(--color-bg-inverse); color: var(--color-text-inverse); }
.res-chip.is-selected:hover { background: var(--color-action-primary-hover); }
.res-chip:focus-visible { outline: var(--border-2-pixel) solid var(--color-border-border); outline-offset: var(--border-2-pixel); }
.res-chip__count { opacity: 0.7; }
/* Matched letters: bold on a light gray (the palette is black and white). */
.hl { background: var(--color-bg-subtle); color: inherit; font-weight: 700; }
/* A category the query names: one line between two rules. */
.res-cat {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "eyebrow arrow" "name arrow" "count arrow";
  align-items: center; column-gap: var(--space-gap-md); row-gap: var(--space-gap-5xs); padding: var(--space-inset-md) 0;
  border-top: var(--border-1-pixel) solid var(--color-border-border); border-bottom: var(--border-1-pixel) solid var(--color-border-border);
  color: var(--color-text-primary); text-decoration: none;
}
.res-cat:hover { background: var(--color-bg-subtle); }
.res-cat__eyebrow { grid-area: eyebrow; color: var(--color-text-subtle); }
.res-cat__name { grid-area: name; }
.res-cat__count { grid-area: count; color: var(--color-text-subtle); }
.res-cat .icon--arrow { grid-area: arrow; width: var(--tap-min); height: auto; }
@media (min-width: 768px) {
  .res-cat { grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "eyebrow name count arrow"; column-gap: var(--space-gap-xl); }
}

/* ---------- The panel's live suggestions (search.js): compact, so the panel fits the height of the Products mega menu ---------- */
/* At most as tall as the Products mega menu (search.js measures it into --search-panel-h from 1024 up), and never taller than the window. */
.search-panel { max-height: min(var(--search-panel-h, var(--search-panel-max-h)), var(--search-panel-max-h)); overflow-y: auto; overscroll-behavior: contain; }
.search-panel { --ta-thumb: calc(var(--tap-min) * 1.25); }
.ta { display: grid; gap: var(--space-gap-sm); }
/* The suggestions sit closer to the rule than the panel's own large gap. */
.search-panel__inner > .ta:not([hidden]) { margin-top: calc(var(--space-gap-md) - var(--space-gap-2xl)); }
.ta[hidden] { display: none; }
.ta .res-chip { min-height: var(--tap-min); padding-inline: calc(var(--space-inset-sm) - var(--border-1-pixel)); }
.ta .res-cat { padding-block: var(--space-gap-2xs); grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "eyebrow name count arrow"; column-gap: var(--space-gap-md); }
.ta .res-cat__eyebrow { display: none; }
.ta .res-cat { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "name count arrow"; }
.ta .res-cat .icon--arrow { width: var(--space-gap-xl); }
.ta-label { margin: 0; color: var(--color-text-subtle); }
.ta-label span { margin-inline-start: var(--space-gap-2xs); }
.ta-list { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-gap-2xs) var(--space-gap-2xl); }
@media (min-width: 768px) { .ta-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ta-row { display: grid; grid-template-columns: var(--ta-thumb) minmax(0, 1fr); align-items: center; gap: var(--space-gap-xs); color: var(--color-text-primary); text-decoration: none; }
.ta-row--text { grid-template-columns: minmax(0, 1fr); padding-block: var(--space-gap-2xs); border-bottom: var(--border-1-pixel) solid var(--color-border-border-subtle); }
.ta-row:hover .ta-row__title, .ta-row:focus-visible .ta-row__title { text-decoration: underline; text-underline-offset: var(--space-gap-5xs); }
.ta-row:focus-visible { outline: var(--border-2-pixel) solid var(--color-border-border); outline-offset: var(--border-2-pixel); }
.ta-row__media { display: block; aspect-ratio: 1; box-sizing: border-box; border: var(--border-1-pixel) solid var(--color-border-border-subtle); background: var(--color-bg-canvas); }
.ta-row__media img { display: block; width: 100%; height: 100%; object-fit: contain; }
.ta-row__text { display: grid; gap: var(--space-gap-5xs); min-width: 0; }
.ta-row__title { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.ta-row__note { color: var(--color-text-subtle); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ta-all { display: inline-flex; align-items: center; gap: var(--space-gap-xs); width: fit-content; }
.ta-all .icon--arrow { width: var(--space-gap-lg); height: auto; }
.ta-empty { margin: 0; }
@media (max-width: 767px) {
  .ta-all { position: sticky; bottom: var(--space-gap-xs); width: 100%; justify-content: center; }
}
.ta-body { display: grid; gap: var(--space-gap-sm); }
