/* Shop AI search strip (TODO 00001.5.14). FINAL design/shop/inspiration/sections/ai-search/r3/v3.png.
   Full width ai-surface band between two 1px ai hairlines (section 7 exception, no side edges), directly under the
   title band (CARRY-NOTES 9). Label AI SEARCH behind a 1px divider; the query in a white field with a 1px ai edge,
   each understood phrase underlined; the query leader (section 7) drops from each phrase (comma excluded,
   CARRY-NOTES 10) to its chip; chips name the facet in label caps over the value. Live since 00001.5.20.
   Leaders need the phrase and chip columns side by side: from 1360 only; below, the leaders are dropped and the
   chips wrap (section 7: dropped rather than bent). */
.p-shop-ai-search {
  box-sizing: border-box; margin-top: var(--wp--preset--spacing--90);
  background: var(--wp--preset--color--ai-surface);
  border-top: 1px solid var(--wp--preset--color--ai); border-bottom: 1px solid var(--wp--preset--color--ai);
  padding: var(--wp--preset--spacing--90) var(--wp--custom--gutter--desktop);
}
.p-shop-ai-search *, .p-shop-ai-search *::before, .p-shop-ai-search *::after { box-sizing: border-box; }
.p-shop-ai-search__inner {
  max-width: var(--wp--custom--layout--wide); margin-inline: auto;
  display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--wp--preset--spacing--60);
}
.p-shop-ai-search__label {
  display: flex; align-items: center; gap: var(--wp--preset--spacing--40); align-self: start;
  min-height: var(--wp--custom--control); margin: 0; padding-right: var(--wp--preset--spacing--60);
  border-right: 1px solid var(--wp--preset--color--line);
  color: var(--wp--preset--color--ai); font-size: var(--wp--preset--font-size--label);
  font-weight: var(--wp--custom--font-weight--label); letter-spacing: var(--wp--custom--letter-spacing--label);
  line-height: 1.3; text-transform: uppercase;
}
.p-shop-ai-search__label .p-icon { color: var(--wp--preset--color--ai); }
.p-shop-ai-search__q { display: flex; flex-wrap: wrap; align-items: center; gap: var(--wp--preset--spacing--40); }
.p-shop-ai-search__box { display: none; }
.p-shop-ai-search__field {
  position: relative; flex: 1 1 24rem; min-height: var(--wp--custom--control);
  padding: var(--wp--preset--spacing--40) var(--wp--preset--spacing--50);
  background: var(--wp--preset--color--white); border: 1px solid var(--wp--preset--color--ai);
  border-radius: var(--wp--custom--radius--default);
}
.p-shop-ai-search__field input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; padding: 0; border: 0;
  background: transparent; color: transparent; caret-color: transparent; font: inherit; cursor: default;
  border-radius: var(--wp--custom--radius--default);
}
.p-shop-ai-search__field input:focus-visible {
  outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--navy); outline-offset: var(--wp--custom--focus--offset);
}
.p-shop-ai-search__phrases { position: relative; pointer-events: none; color: var(--wp--preset--color--ink); font-size: var(--wp--preset--font-size--body-l); line-height: 1.5; }
.p-shop-ai-search__phrase { white-space: nowrap; }
.p-shop-ai-search__phrase + .p-shop-ai-search__phrase { margin-left: var(--wp--preset--spacing--30); }
.p-shop-ai-search__phrase u { text-decoration: underline 1px var(--wp--preset--color--ai); text-underline-offset: 6px; }
.p-shop-ai-search__leader { display: none; }
.p-shop-ai-search__chips { display: flex; flex-wrap: wrap; gap: var(--wp--preset--spacing--30); margin: 0; padding: 0; list-style: none; flex-basis: 100%; }
.p-shop-ai-search__chip {
  display: grid; grid-template-columns: auto auto; column-gap: var(--wp--preset--spacing--40); align-items: center;
  padding: var(--wp--preset--spacing--30) var(--wp--preset--spacing--40);
  background: var(--wp--preset--color--white); border: 1px solid var(--wp--preset--color--line);
  border-radius: var(--wp--custom--radius--default); white-space: nowrap;
}
.p-shop-ai-search__facet {
  grid-column: 1; color: var(--wp--preset--color--slate); font-size: var(--wp--preset--font-size--label);
  font-weight: var(--wp--custom--font-weight--label); letter-spacing: var(--wp--custom--letter-spacing--label);
  line-height: 1.3; text-transform: uppercase;
}
.p-shop-ai-search__value { grid-column: 1; color: var(--wp--preset--color--ink); font-size: var(--wp--preset--font-size--body); line-height: 1.5; }
.p-shop-ai-search__chip .p-icon { grid-column: 2; grid-row: 1 / 3; color: var(--wp--preset--color--slate); }
.p-shop-ai-search__clear {
  color: var(--wp--preset--color--ai); font-size: var(--wp--preset--font-size--body);
  text-decoration: underline 1px; text-underline-offset: 3px; cursor: default;
}
.p-shop-ai-search__find {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--wp--preset--spacing--40);
  min-height: var(--wp--custom--control); margin: 0; padding: 0 var(--wp--preset--spacing--60);
  background: var(--wp--preset--color--ai); color: var(--wp--preset--color--white); border: 0;
  border-radius: var(--wp--custom--radius--default); font-family: inherit; font-size: var(--wp--preset--font-size--button);
  font-weight: var(--wp--custom--font-weight--button); letter-spacing: var(--wp--custom--letter-spacing--button);
  line-height: 1; white-space: nowrap; cursor: default;
}
.p-shop-ai-search__find:focus-visible {
  outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--navy); outline-offset: var(--wp--custom--focus--offset);
}
.p-shop-ai-search__source {
  grid-column: 2; margin: var(--wp--preset--spacing--60) 0 0; color: var(--wp--preset--color--ai);
  font-size: var(--wp--preset--font-size--small); line-height: 1.5;
}
/* Live strip (00001.5.20): a real search field, chips as links that remove their filter, Clear all and the found
   line on one row, a short note when the AI did not run. The aligned query leaders of the FINAL are dropped: a free
   query's phrases do not sit in chip order (section 7: dropped rather than bent). The underlined words show over the
   field until it gets focus, then the field shows the plain editable text. */
.p-shop-ai-search__field { display: flex; align-items: stretch; padding: 0; }
.p-shop-ai-search__field input {
  position: relative; inset: auto; flex: 1 1 auto; min-width: 0; height: auto; min-height: calc(var(--wp--custom--control) - 2px);
  padding: 0 var(--wp--preset--spacing--50); color: var(--wp--preset--color--ink); caret-color: auto; cursor: text;
  font-size: var(--wp--preset--font-size--body-l); line-height: 1.5; -webkit-appearance: none; appearance: none;
}
.p-shop-ai-search__field input::placeholder { color: var(--wp--preset--color--slate); opacity: 1; }
.p-shop-ai-search__field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.p-shop-ai-search__phrases {
  position: absolute; inset: 0; display: none; align-items: center; padding: 0 var(--wp--preset--spacing--50);
  overflow: hidden; white-space: nowrap;
}
.p-shop-ai-search__phrases > span { overflow: hidden; text-overflow: ellipsis; }
.p-shop-ai-search__phrases u { text-decoration: underline 1px var(--wp--preset--color--ai); text-underline-offset: 6px; }
.p-shop-ai-search__field.has-phrases:not(:focus-within) input { color: transparent; }
.p-shop-ai-search__field.has-phrases:not(:focus-within) .p-shop-ai-search__phrases { display: flex; }
.p-shop-ai-search__find { cursor: pointer; }
/* Hover fill (00001.5.22.13.b, the .12 rule): the ai ground and the navy hover fill are two layers UNDER the white label (z-index -1
   in the button's own isolation). The navy layer's opacity fades at the kit's hover token; the ai layer steps off only once the
   navy is whole (delay = the hover token), so the end state is one navy shape with today's corners. Press: scale .98 at once. */
.p-shop-ai-search__find { position: relative; isolation: isolate; background: transparent; }
.p-shop-ai-search__find::before, .p-shop-ai-search__find::after { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: inherit; pointer-events: none; }
.p-shop-ai-search__find::before { background: var(--wp--preset--color--ai); }
.p-shop-ai-search__find::after { opacity: 0; background: var(--wp--preset--color--navy); transition: opacity var(--mo-hover) var(--mo-ease); }
.p-shop-ai-search__find:hover::before { opacity: 0; transition: opacity 0s linear var(--mo-hover); }
.p-shop-ai-search__find:hover::after { opacity: 1; }
.p-shop-ai-search__find:active { transform: scale(.98); }
.p-shop-ai-search__chips li { display: flex; }
a.p-shop-ai-search__chip { text-decoration: none; color: inherit; cursor: pointer; }
a.p-shop-ai-search__chip:hover { border-color: var(--wp--preset--color--ai); }
a.p-shop-ai-search__chip:focus-visible, .p-shop-ai-search__clear:focus-visible, .p-shop-ai-search__found a:focus-visible {
  outline: var(--wp--custom--focus--width) solid var(--wp--preset--color--navy); outline-offset: var(--wp--custom--focus--offset);
}
.p-shop-ai-search__result {
  display: flex; flex-wrap: wrap; align-items: center; column-gap: var(--wp--preset--spacing--60); row-gap: var(--wp--preset--spacing--30);
  flex-basis: 100%; margin: var(--wp--preset--spacing--30) 0 0; color: var(--wp--preset--color--ink);
  font-size: var(--wp--preset--font-size--body); line-height: 1.5;
}
.p-shop-ai-search__clear { cursor: pointer; }
.p-shop-ai-search__found { padding-left: var(--wp--preset--spacing--60); border-left: 1px solid var(--wp--preset--color--line); }
.p-shop-ai-search__found b { color: var(--wp--preset--color--ai); font-weight: 600; }
.p-shop-ai-search__found a { color: var(--wp--preset--color--ai); text-decoration: underline 1px; text-underline-offset: 3px; }
.p-shop-ai-search__note { flex-basis: 100%; margin: var(--wp--preset--spacing--30) 0 0; color: var(--wp--preset--color--ink); font-size: var(--wp--preset--font-size--body); line-height: 1.5; }
@media (max-width: 991.98px) {
  .p-shop-ai-search { padding: var(--wp--preset--spacing--90) var(--wp--custom--gutter--tablet); }
  .p-shop-ai-search__inner { grid-template-columns: minmax(0, 1fr); row-gap: var(--wp--preset--spacing--40); }
  .p-shop-ai-search__label { min-height: 0; padding-right: 0; border-right: 0; }
  .p-shop-ai-search__source { grid-column: 1; margin-top: var(--wp--preset--spacing--30); }
}
@media (max-width: 599.98px) {
  .p-shop-ai-search { margin-top: var(--wp--preset--spacing--80); padding: var(--wp--preset--spacing--80) var(--wp--custom--gutter--phone); }
  .p-shop-ai-search__find { flex: 1 1 100%; }
  .p-shop-ai-search__field { flex-basis: 100%; }
}
@media (max-width: 599.98px) {
  .p-shop-ai-search__found { padding-left: 0; border-left: 0; }
}
/* Motion (stage 10, 00001.5.22.8.a; design/FINDINGS.md "Motion inventory: shop-ai-search"). inc/motion.php sets data-mo
   on the section root only (hook, no delay). Start states live under html.mo and only until the root's .mo-in, so JS off,
   reduced motion and print show the approved look. Story move: the top rule draws across from the left, then, on an
   applied search, the chips the AI read from your words settle 8 px into place one by one. Transform only: every element
   here is AI text, an AI disclosure or the AI action, so nothing takes an opacity start.
   The rule draw is a mask wipe: a white cover over the real 1 px border-top (and 1 px of the white ground above it,
   GO-045) scales away from the right, so the approved rule is painted the whole time. The cover and the root's position
   live only until the kit's .mo-done (the cover's own transitionend, about 1.4 s); nothing positioned stays at rest
   (GO-041). */
.mo .p-shop-ai-search[data-mo]:not(.mo-done) { position: relative; }
.mo .p-shop-ai-search[data-mo]:not(.mo-done)::before {
  content: ""; position: absolute; top: -2px; left: 0; right: 0; height: 2px; pointer-events: none;
  background: var(--wp--preset--color--white); transform-origin: 100% 50%;
  transition: transform 1.4s var(--mo-ease) var(--mo-delay, 0ms);
}
.mo .p-shop-ai-search[data-mo].mo-in::before { transform: scaleX(0); }
/* Chips (applied search only) hang on the rule: from 450 ms, 120 ms apart, capped at 5 steps. The li carry no class, so
   they are reached from the root and inherit its --mo-delay. Their transition is NOT scoped to :not(.mo-done): the root's
   .mo-done arrives at the cover's end (about 1.4 s) while the last chips still run (GO-043). */
.mo .p-shop-ai-search[data-mo] .p-shop-ai-search__chips li {
  transition: transform 0.9s var(--mo-ease-settle);
  transition-delay: calc(var(--mo-delay, 0ms) + 450ms + var(--nv-chip, 0) * 120ms);
}
.mo .p-shop-ai-search[data-mo] .p-shop-ai-search__chips li:nth-child(2) { --nv-chip: 1; }
.mo .p-shop-ai-search[data-mo] .p-shop-ai-search__chips li:nth-child(3) { --nv-chip: 2; }
.mo .p-shop-ai-search[data-mo] .p-shop-ai-search__chips li:nth-child(4) { --nv-chip: 3; }
.mo .p-shop-ai-search[data-mo] .p-shop-ai-search__chips li:nth-child(5) { --nv-chip: 4; }
.mo .p-shop-ai-search[data-mo] .p-shop-ai-search__chips li:nth-child(n+6) { --nv-chip: 5; }
.mo .p-shop-ai-search[data-mo]:not(.mo-in) .p-shop-ai-search__chips li { transform: translate3d(0, -8px, 0); }
