/* ═══════════════════════════════════════════════════════════════
   Patisserie Manon — site search ("la file")
   Frosted command palette over the storefront. Results render as a
   queue of fixed-height rows positioned by transform; re-ranking a
   query GLIDES rows to their new slot (Apple-Music-queue physics),
   fresh matches rise in staggered, dropped ones fade away. All
   motion is transform/opacity only and dies under reduced motion
   via the site-wide kill-switch in site.css.
   Pairs with /assets/search.js. Tokens come from site.css.
   ═══════════════════════════════════════════════════════════════ */

/* ── nav trigger ──────────────────────────────────────────────── */
.pm-search-btn {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px;
  color: var(--mn-cocoa);
  background: none;
  border: 1px solid var(--mn-hairline);
  border-radius: var(--r-pill);
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.pm-search-btn:hover { color: var(--mn-ink); border-color: var(--mn-ink); }
.pm-search-btn:focus-visible { border-radius: var(--r-pill); }
.pm-search-btn svg { display: block; }

/* the floating corner cart keeps cart access alive on tiny screens,
   so the nav pill may yield its slot to the search button there */
@media (max-width: 400px) {
  .mn-nav .cart-pill { display: none; }
}

/* ── overlay root ─────────────────────────────────────────────── */
.pm-search { position: fixed; inset: 0; z-index: 80; display: none; }
.pm-search.is-shown { display: block; }

.pm-search-scrim {
  position: absolute; inset: 0;
  background: rgba(29, 19, 12, 0.38);
  opacity: 0;
  transition: opacity 0.32s var(--mn-ease);
}
.pm-search.is-open .pm-search-scrim { opacity: 1; }

/* ── panel (float-cart glass recipe, scaled up) ───────────────── */
.pm-search-panel {
  position: absolute; left: 50%; top: clamp(64px, 9vh, 110px);
  transform: translateX(-50%) translateY(-14px) scale(0.985);
  width: min(620px, calc(100% - 28px));
  max-height: calc(100vh - 92px);
  max-height: calc(100dvh - 92px);
  display: flex; flex-direction: column;
  color: var(--mn-ink);
  background: rgba(253, 249, 242, 0.72);
  -webkit-backdrop-filter: blur(26px) saturate(1.8);
  backdrop-filter: blur(26px) saturate(1.8);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 24px;
  box-shadow:
    0 0 0 0.5px rgba(33, 23, 16, 0.14),
    0 30px 80px rgba(33, 23, 16, 0.28),
    0 8px 24px rgba(33, 23, 16, 0.10);
  opacity: 0;
  overflow: hidden;
  transition: opacity 0.42s var(--ease-lux), transform 0.42s var(--ease-lux);
}
.pm-search.is-open .pm-search-panel {
  opacity: 1;
  transform: translateX(-50%) translateY(0) scale(1);
}
.pm-search.is-closing .pm-search-scrim { opacity: 0; transition-duration: 0.18s; }
.pm-search.is-closing .pm-search-panel {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px) scale(0.99);
  transition-duration: 0.18s;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .pm-search-panel { background: rgba(253, 249, 242, 0.97); }
}

/* ── input row ────────────────────────────────────────────────── */
.pm-search-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px 10px 22px;
  border-bottom: 1px solid var(--mn-hairline);
}
.pm-search-head > svg { flex: 0 0 auto; color: var(--mn-gold-deep); }
.pm-search-input {
  flex: 1 1 auto; min-width: 0;
  padding: 12px 0;
  font-family: var(--font-body);
  font-size: 17px; font-weight: 400; letter-spacing: 0.01em;
  color: var(--mn-ink);
  background: transparent; border: none; outline: none;
}
.pm-search-input:focus-visible { box-shadow: none; }
.pm-search-input::placeholder {
  font-family: var(--font-display);
  font-style: italic; font-size: 18px;
  color: var(--taupe); opacity: 1;
}
.pm-search-input::-webkit-search-decoration,
.pm-search-input::-webkit-search-cancel-button { display: none; }
.pm-search-clear {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  color: var(--mn-cocoa);
  background: none; border: none; border-radius: var(--r-pill);
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.pm-search-clear:hover { color: var(--mn-ink); background: rgba(33, 23, 16, 0.06); }
.pm-search-esc {
  flex: 0 0 auto;
  padding: 4px 8px;
  font-family: var(--font-body);
  font-size: 10px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--taupe);
  border: 1px solid var(--mn-hairline); border-radius: 7px;
}
@media (max-width: 700px) { .pm-search-esc { display: none; } }

/* ── section label ────────────────────────────────────────────── */
.pm-search-label {
  flex: 0 0 auto;
  padding: 14px 24px 4px;
  font-family: var(--font-body);
  font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--mn-gold-deep);
}

/* ── the queue ────────────────────────────────────────────────── */
.pm-search-queue {
  flex: 1 1 auto;
  overflow-y: auto; overflow-x: hidden;
  overscroll-behavior: contain;
}
.pm-search-list {
  position: relative;
  margin: 4px 10px 10px;
  transition: height 0.38s var(--ease-lux);
}
.pm-search-row {
  position: absolute; left: 0; right: 0; top: 0;
  height: 64px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 14px;
  border-radius: 16px;
  text-decoration: none;
  will-change: transform, opacity;
  transition: transform 0.42s var(--ease-lux), opacity 0.24s ease, background-color 0.18s ease;
}
.pm-search-row.is-active { background: rgba(184, 146, 74, 0.13); }
.pm-search-row.is-enter { opacity: 0; }
.pm-search-row.is-out { opacity: 0; pointer-events: none; }

.pm-search-thumb {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  background: var(--linen);
  border: 1px solid rgba(33, 23, 16, 0.08);
  border-radius: 12px;
}
.pm-search-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pm-search-thumb i {
  font-family: var(--font-display);
  font-style: italic; font-size: 20px; font-weight: 500;
  color: var(--taupe);
}

.pm-search-text { flex: 1 1 auto; min-width: 0; }
.pm-search-name {
  display: block;
  font-family: var(--font-display);
  font-size: 17.5px; font-weight: 600; line-height: 1.15;
  color: var(--mn-ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pm-search-name mark {
  background: transparent;
  color: var(--mn-gold-deep);
}
.pm-search-meta {
  display: block; margin-top: 2px;
  font-family: var(--font-body);
  font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--mn-cocoa);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pm-search-price {
  flex: 0 0 auto;
  font-family: var(--font-body);
  font-size: 13.5px; font-weight: 600; letter-spacing: 0.02em;
  color: var(--mn-ink);
  white-space: nowrap;
}
.pm-search-price small {
  font-size: 11px; font-weight: 400; color: var(--mn-cocoa);
}

/* ── empty / error states ─────────────────────────────────────── */
.pm-search-note { padding: 26px 24px 30px; }
.pm-search-note p {
  font-family: var(--font-display);
  font-style: italic; font-weight: 500;
  font-size: 20px; line-height: 1.4;
  color: var(--cocoa);
}
.pm-search-note small {
  display: block; margin-top: 8px;
  font-family: var(--font-body);
  font-size: 12.5px; color: var(--taupe);
}
.pm-search-note button {
  margin-top: 14px;
  padding: 9px 18px;
  font-family: var(--font-body);
  font-size: 11px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--mn-ink);
  background: transparent;
  border: 1px solid var(--mn-hairline); border-radius: var(--r-pill);
  cursor: pointer;
  transition: border-color 0.2s;
}
.pm-search-note button:hover { border-color: var(--mn-ink); }

/* ── footer strip ─────────────────────────────────────────────── */
.pm-search-foot {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 22px 13px;
  border-top: 1px solid var(--mn-hairline);
  font-family: var(--font-body);
  font-size: 10px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--taupe);
}
.pm-search-count { color: var(--mn-cocoa); }
@media (max-width: 560px) { .pm-search-keys { display: none; } }

/* ── screen-reader live region ────────────────────────────────── */
.pm-search-live {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ── scroll lock while open ───────────────────────────────────── */
html.pm-search-lock { overflow: hidden; }
html.pm-search-lock body { overflow: hidden; }

/* ── deep-link spotlight (search → catalog card) ──────────────── */
/* The found card lifts exactly as if hovered — same scale, shadow
   and easing as the grid's own hover — holds a beat, then settles.
   search.js sets an edge-aware transform-origin first so cards near
   the viewport edge grow inward, mirroring site.js initCardPop. */
.pm-spot { scroll-margin-top: 96px; }
@media (prefers-reduced-motion: no-preference) {
  .pm-card.pm-spot {
    transform: scale(1.35);
    z-index: 6;
    box-shadow: 0 22px 48px rgba(33, 23, 16, 0.24), 0 6px 16px rgba(33, 23, 16, 0.12);
    transition: transform 0.9s var(--mn-ease), box-shadow 0.9s var(--mn-ease);
  }
  .fit-card.pm-spot {
    transform: translateY(-4px);
    border-color: rgba(216, 179, 102, 0.38);
    box-shadow: 0 18px 44px rgba(33, 23, 16, 0.18);
  }
}
@media (prefers-reduced-motion: reduce) {
  .pm-spot { outline: 2px solid var(--mn-gold); outline-offset: 4px; }
}

/* ── compact screens ──────────────────────────────────────────── */
@media (max-width: 560px) {
  .pm-search-panel { top: 14px; max-height: calc(100vh - 28px); max-height: calc(100dvh - 28px); }
  .pm-search-row { height: 60px; gap: 12px; padding: 0 10px; }
  .pm-search-thumb { width: 40px; height: 40px; }
  .pm-search-name { font-size: 16.5px; }
  .pm-search-head { padding-left: 18px; }
}
