/*
 * pb-shared-search.css — shared search/browse component set
 *
 * CANONICAL COPY. This file is the source of truth and lives in pb-meal-planner.
 * It is duplicated verbatim into plantbaes-search (assets/css/pb-shared-search.css)
 * because the two plugins must NOT share an asset at runtime: plantbaes-search ships
 * through a GitHub release auto-updater, so a runtime share would let one of its
 * releases restyle the meal planner from a repo the planner never saw.
 *
 * The duplication is therefore deliberate, and it is machine-checked. Each repo's
 * suite asserts the sha256 of this file against a checked-in constant, so a drifted
 * copy fails a test rather than failing quietly on a member's screen. If you edit
 * this file you MUST copy it to the other repo and update BOTH recorded hashes.
 *
 * Skins are ported from pb-recipes-archive (tokens :1342, chips :1472, cards :1493)
 * so the picker, the site search modal and the all-recipes archive agree visually.
 *
 * Everything is scoped under .pbss. That is not tidiness: Kadence's .entry-content
 * element rules (h2 uppercase, paragraph line-height, button hover shadows) beat bare
 * component classes and will otherwise leak into both surfaces.
 */

/* ---------- tokens ---------- */
.pbss {
  --pbss-plum: #775973;
  --pbss-plum-dark: #5e4659;
  --pbss-plum-deep: #4a2f3d;
  --pbss-plum-tint: #f1ebee;
  --pbss-plum-soft: #efe8ec;
  --pbss-cream: #f7f3ee;
  --pbss-cream-line: #e5dcd2;
  --pbss-ink: #2b2b2b;
  --pbss-ink-soft: #4a4a4a;
  --pbss-ink-mute: #7a7065;
  --pbss-white: #fff;
  --pbss-serif: "Fraunces", Georgia, serif;
  --pbss-news: "Newsreader", Georgia, serif;
  --pbss-sans: "Manrope", -apple-system, BlinkMacSystemFont, sans-serif;
  --pbss-radius: 14px;
  --pbss-radius-sm: 10px;
  --pbss-radius-lg: 22px;
  --pbss-pill: 999px;
  --pbss-shadow-sm: 0 4px 12px -4px rgba(74, 47, 61, .18);
  --pbss-shadow-md: 0 8px 24px -8px rgba(74, 47, 61, .12), 0 2px 6px rgba(74, 47, 61, .04);
  font-family: var(--pbss-sans);
  color: var(--pbss-ink);
  -webkit-font-smoothing: antialiased;
}
.pbss *, .pbss *::before, .pbss *::after { box-sizing: border-box; }

/* ---------- Kadence containment ----------
   The theme styles bare elements inside .entry-content. Left alone it uppercases
   our headings, re-spaces our text and puts a lift/shadow on every button hover. */
.pbss h1, .pbss h2, .pbss h3, .pbss h4, .pbss h5, .pbss h6 {
  text-transform: none;
  letter-spacing: normal;
  line-height: 1.25;
  margin: 0;
  padding: 0;
  font-weight: 500;
}
.pbss p, .pbss ul, .pbss ol, .pbss li { margin: 0; padding: 0; line-height: 1.5; }
.pbss ul, .pbss ol { list-style: none; }
.pbss button {
  font: inherit;
  color: inherit;
  margin: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  text-transform: none;
  letter-spacing: normal;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}
.pbss button:hover, .pbss button:focus {
  transform: none;
  box-shadow: none;
  filter: none;
}
/* Kadence styles input[type="text"] / [type="search"] at (0,1,1) — square 3px
   corners, its own grey border and padding — which beats any single-class
   component rule. This normaliser ties that specificity and loads later, and
   component rules above it sit at (0,2,0), so the cascade is: component wins,
   then this, then the theme. */
.pbss input[type="text"], .pbss input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
  background: var(--pbss-white);
  border: 1px solid var(--pbss-cream-line);
  border-radius: var(--pbss-pill);
  color: var(--pbss-ink);
  font-family: var(--pbss-sans);
  font-size: 13px;
  font-weight: 500;
}
.pbss a { text-decoration: none; }

/* ---------- facet pill row ----------
   Scrolls horizontally. The row is padded and negatively margined so pills can
   bleed to the container edge, which is what half-reveals the last pill and
   signals that the row overflows. */
.pbss .pbss-facetrow-wrap { position: relative; flex: none; }
.pbss .pbss-facetrow {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 2px 16px 10px;
  margin: 0 -16px;
}
.pbss .pbss-facetrow::-webkit-scrollbar { display: none; }
.pbss .pbss-fpill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--pbss-white);
  border: 1px solid var(--pbss-cream-line);
  color: var(--pbss-ink-soft);
  padding: 9px 14px;
  border-radius: var(--pbss-pill);
  font: 600 13px var(--pbss-sans);
  cursor: pointer;
  white-space: nowrap;
}
.pbss .pbss-fpill svg { width: 14px; height: 14px; color: var(--pbss-plum); flex: none; }
/* Round 7 (shot3): an active pill is WHITE with a plum border so it stands out
   against the mauve panel. The old plum-tint fill was near-identical to the
   #EFE8EC surface both modals sit on, so a selected pill read as LESS
   prominent than an idle one. The plum count badge (.pbss-fpill-n) carries
   the accent. */
.pbss .pbss-fpill.is-active {
  border-color: rgba(119, 89, 115, .55);
  color: var(--pbss-plum-deep);
  background: var(--pbss-white);
  box-shadow: 0 2px 8px -3px rgba(74, 47, 61, .25);
}
.pbss .pbss-fpill.is-open {
  border-color: var(--pbss-plum);
  box-shadow: 0 0 0 4px rgba(138, 100, 120, .12);
  color: var(--pbss-plum-deep);
}
.pbss .pbss-fpill:focus-visible { outline: 2px solid var(--pbss-plum); outline-offset: 2px; }
.pbss .pbss-fpill-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--pbss-plum);
  color: #fff;
  font: 700 11px var(--pbss-sans);
}

/* ---------- facet dropdown ---------- */
.pbss .pbss-fdrop {
  position: absolute;
  top: calc(100% - 4px);
  width: 238px;
  max-width: calc(100vw - 32px);
  max-height: 320px;
  overflow-y: auto;
  background: var(--pbss-white);
  border: 1px solid var(--pbss-cream-line);
  border-radius: var(--pbss-radius-sm);
  box-shadow: 0 18px 44px rgba(42, 33, 39, .22);
  z-index: 40;
}
.pbss .pbss-fo {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 14px;
  font: 500 14px var(--pbss-sans);
  color: var(--pbss-ink-soft);
  cursor: pointer;
  background: none;
  border: 0;
  text-align: left;
}
.pbss .pbss-fo:hover { background: var(--pbss-plum-tint); color: var(--pbss-plum-deep); }
.pbss .pbss-fo::before {
  content: "";
  flex: 0 0 21px;
  width: 21px;
  height: 21px;
  border-radius: 7px;
  border: 1.5px solid rgba(119, 89, 115, .4);
  background: #fff center no-repeat;
  background-size: 12px;
}
.pbss .pbss-fo.is-sel { color: var(--pbss-plum-deep); font-weight: 600; }
.pbss .pbss-fo.is-sel::before {
  background-color: var(--pbss-plum);
  border-color: var(--pbss-plum);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
}
.pbss .pbss-fo-cnt { margin-left: auto; color: var(--pbss-ink-mute); font-weight: 500; font-size: 12.5px; }

/* ---------- selected chips (archive .facetwp-selections skin) ---------- */
.pbss .pbss-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 0 4px; flex: none; }
.pbss .pbss-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--pbss-plum-tint);
  color: var(--pbss-plum-deep);
  border: 1px solid rgba(119, 89, 115, .16);
  border-radius: var(--pbss-pill);
  padding: 7px 10px 7px 14px;
  font: 600 13px var(--pbss-sans);
  cursor: pointer;
}
.pbss .pbss-chip:hover { background: var(--pbss-plum-soft); }
.pbss .pbss-chip::after {
  content: "";
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(119, 89, 115, .16) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a2f3d' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") no-repeat center/9px;
}

/* An exclusion is not a weaker inclusion, it is the opposite, so it cannot share
   the inclusion fill. Same shape, different temperature: "no mushroom" has to be
   readable as a negation at a glance and not just by its label text. */
.pbss .pbss-chip--ex {
  background: #f6eaea;
  border-color: rgba(141, 79, 79, .22);
  color: #7a3b3b;
}
.pbss .pbss-chip--ex:hover { background: #f0dede; }
.pbss .pbss-chip--ex::after {
  background: rgba(141, 79, 79, .18) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237a3b3b' stroke-width='2.6' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6L6 18'/%3E%3C/svg%3E") no-repeat center/9px;
}

/* ---------- facet dropdown search (round 7, item 13) ----------
   The two ingredient lists run to dozens of terms, so each of those dropdowns
   carries a filter box pinned at its top. Sticky, so it stays put while the
   option list scrolls under it. */
.pbss .pbss-fdrop-searchwrap {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 8px;
  background: var(--pbss-white);
  border-bottom: 1px solid var(--pbss-cream-line);
}
.pbss .pbss-fdrop-search {
  width: 100%;
  padding: 7px 12px;
  font-size: 13px;
}
.pbss .pbss-fdrop-search:focus {
  outline: 2px solid var(--pbss-plum);
  outline-offset: 1px;
}
/* Options hidden by the filter box. [hidden] on a flex-displayed button needs
   the explicit rule or display:flex wins over the attribute. */
.pbss .pbss-fo[hidden] { display: none; }

/* ---------- sort control on the count row (round 7, items 4 and 9) ----------
   The sort pill lives on the "Showing X of Y" row, right-aligned, on BOTH
   surfaces. The wrap is the dropdown's anchor; the dropdown hangs from its
   right edge so it cannot run off-screen. */
.pbss .pbss-sortwrap { position: relative; flex: none; }
.pbss .pbss-sortwrap .pbss-fdrop {
  left: auto;
  right: 0;
  top: calc(100% + 4px);
}

/* ---------- infinite scroll loader row (round 8, items 3 and 5) ----------
   The sentinel the IntersectionObserver watches, now a VISIBLE labelled row
   ("Loading more recipes" + spinner) so a member can see that scrolling loads
   more. It renders only while more pages remain, on both picker surfaces and
   the search modal alike; its height also keeps it inside intersection range,
   which the old invisible 2px strip needed a rule for. */
.pbss .pbss-sentinel {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 22px 0 26px;
  font: 600 13px var(--pbss-sans);
  color: var(--pbss-ink-mute);
}
.pbss .pbss-sentinel[hidden] { display: none; }
.pbss .pbss-spin {
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 50%;
  border: 2.5px solid rgba(119, 89, 115, .22);
  border-top-color: var(--pbss-plum);
  animation: pbss-spin .8s linear infinite;
}
@keyframes pbss-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .pbss .pbss-spin { animation: none; }
}

/* ---------- count row ---------- */
.pbss .pbss-countrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0 10px;
  flex: none;
}
.pbss .pbss-countrow[hidden] { display: none; }
.pbss .pbss-cnt { font-size: 12.5px; color: var(--pbss-ink-mute); }
.pbss .pbss-cnt b { color: var(--pbss-ink); font-weight: 700; }
.pbss .pbss-clear {
  font: 600 12.5px var(--pbss-sans);
  color: var(--pbss-plum-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

/* ---------- result grid and cards (archive .pb-rx-card skin) ----------
   Round 6: archive PARITY, not an archive-inspired miniature. The grid and the
   card values below are the archive's own (grid :1491/:1507, card :1493-1516),
   so the modal, the picker and /category/recipes/ render the same loop item.
   Surfaces that need a different column count (the picker's 4-across drawer)
   override with a THREE-class rule so the override outranks this base in both
   copies of this file, never ties it. */
.pbss .pbss-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (min-width: 1041px) {
.pbss .pbss-grid { grid-template-columns: repeat(3, 1fr); gap: 22px; }
}
.pbss .pbss-card {
  display: flex;
  flex-direction: column;
  background: var(--pbss-white);
  border: 1px solid var(--pbss-cream-line);
  border-radius: var(--pbss-radius-lg);
  overflow: hidden;
  box-shadow: var(--pbss-shadow-sm);
  cursor: pointer;
  padding: 0;
  text-align: left;
  width: 100%;
}
/* An <img> is natively draggable and a native image drag fires pointercancel,
   which tears down a custom pointer drag before it can activate. Both halves of
   this guard are load-bearing on the picker; see pb-meal-planner-drag-engine. */
.pbss .pbss-card, .pbss .pbss-card * { -webkit-user-drag: none; user-select: none; }
.pbss .pbss-card:focus-visible { outline: 2px solid var(--pbss-plum); outline-offset: 2px; }
/* Hover, ported whole from the archive. The (hover:none) guard travels with it:
   without it a touch device holds the zoomed image after a tap, because :hover
   sticks there. Extracting the rule without its media query is how that guard
   gets silently dropped. */
.pbss .pbss-card:hover { box-shadow: var(--pbss-shadow-md); }
.pbss .pbss-card:hover .pbss-card-media img { transform: scale(1.05); }
.pbss .pbss-card:hover .pbss-card-title { color: var(--pbss-plum); }
.pbss .pbss-card-media img { transition: transform .45s ease; }
@media (hover: none) {
.pbss .pbss-card:hover .pbss-card-media img { transform: none; }
}
.pbss .pbss-card-media { aspect-ratio: 1; background: var(--pbss-cream); overflow: hidden; }
.pbss .pbss-card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pbss .pbss-card-body { padding: 15px 16px 17px; display: flex; flex-direction: column; gap: 6px; }
.pbss .pbss-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.pbss .pbss-card-cat {
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--pbss-plum);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pbss .pbss-card-rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
  font: 600 12px var(--pbss-sans);
  color: var(--pbss-ink-soft);
}
.pbss .pbss-card-rating svg { width: 13px; height: 13px; fill: #e8a33d; flex: none; }
.pbss .pbss-card-rating b { color: var(--pbss-ink); font-weight: 700; }
.pbss .pbss-card-rcount { color: var(--pbss-ink-mute); font-weight: 500; }
.pbss .pbss-card-title {
  font-family: var(--pbss-news);
  font-weight: 500;
  font-size: 16.5px;
  line-height: 1.28;
  letter-spacing: -.005em;
  color: var(--pbss-plum-deep);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  /* Reserves the second line so a one-line title does not shorten its card.
     The grid is align-items:start, so without this the row goes ragged. Safe
     here only because nothing renders beneath the title; add anything below
     and this becomes a visible gap. */
  min-height: 2.56em;
}
/* The archive gives narrow screens a third title line (:1508); parity keeps it. */
@media (max-width: 560px) {
.pbss .pbss-card-title { -webkit-line-clamp: 3; min-height: 3.84em; }
}

/* ---------- the stretched hit control ----------
   The card is a div so its chips can be real buttons. This empty control is what
   the member actually presses.

   It is an ELEMENT, not `.pbss-card::after`. pb-cook-mode adds its tap feedback
   as an ::after on the activating link, and one element has one ::after: a
   stretched ::after here gets replaced by the feedback mid-press, pointer-events
   flip, the click retargets to the common ancestor, and the card silently does
   nothing with no console error. An empty element owns its own ::after. */
.pbss-card { position: relative; }
.pbss-card-hit {
  position: absolute;
  inset: 0;
  z-index: 1;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.pbss-card-hit:focus-visible { outline: 2px solid var(--pbss-plum); outline-offset: 2px; }
/* The hover styling belonged to the card element itself; it now has to follow the
   control, or hovering the card does nothing while hovering a chip lifts it. */
.pbss-card:hover .pbss-card-media img { transform: scale(1.05); }
.pbss-card:hover .pbss-card-title { color: var(--pbss-plum); }

/* ---------- allergen / dietary chips ----------
   The chips themselves are styled by pb-recipes-archive, which prints its CSS on
   wp_head site-wide, so this only carries what is surface-specific.

   Its base rule is margin-top:1px, tuned for the archive card where the codes sit
   directly under a title with no gap of its own. Our card body is a flex column
   with its own 5px gap, so the 1px stacks on top of that and reads as a hair too
   tight against the title. Zero it and let the body gap do the spacing. */
.pbss-card .pbss-card-codes {
  margin-top: 0;
  /* Above .pbss-card-hit, or the stretched control swallows every chip tap.
     pb-recipes-archive already sets position:relative;z-index:2 here for the same
     reason on its own card; restating it means this surface does not depend on
     that rule continuing to exist. */
  position: relative;
  z-index: 2;
}
.pbss .pb-rx-code {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: 700 10px/1.1 var(--pbss-sans);
  letter-spacing: .06em;
  background: #efe8ec;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition: background .15s, color .15s;
  color: #6c645e !important;
  border: 0 !important;
  border-radius: 5px !important;
  padding: 3px 6px !important;
  margin: 0 !important;
  min-height: 0 !important;
  box-shadow: none !important;
  text-transform: none !important;
}
.pbss .pb-rx-code:hover,
.pbss .pb-rx-code:focus-visible,
.pbss .pb-rx-code.is-open {
  outline: none;
  background: #775973 !important;
  color: #fff !important;
  box-shadow: none !important;
  transform: none !important;
}

/* ---------- shared bottom sheet ----------
   Snap points are expressed as a top offset. Drag is applied as a transform on
   top of the snapped position so a gesture never has to write layout. */
.pbss-scrim {
  position: fixed;
  inset: 0;
  background: rgba(40, 24, 34, .45);
  z-index: 9998;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
.pbss-scrim.is-open { opacity: 1; pointer-events: auto; }
.pbss.pbss-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: 100%;
  z-index: 9999;
  background: #fff;
  border-radius: 22px 22px 0 0;
  box-shadow: 0 -14px 50px rgba(42, 33, 39, .30);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: top .26s cubic-bezier(.32, .72, 0, 1);
}
.pbss.pbss-sheet.is-half { top: 26%; }
.pbss.pbss-sheet.is-full { top: 8px; }
/* While a finger is down the sheet must track it exactly, so the snap
   transition is suppressed for the duration of the drag only. */
.pbss.pbss-sheet.is-dragging { transition: none; }
.pbss .pbss-grab {
  width: 44px;
  height: 4px;
  border-radius: 999px;
  background: #dcd0d8;
  margin: 9px auto 0;
  flex: none;
}
.pbss .pbss-grabzone { flex: none; padding-bottom: 4px; touch-action: none; cursor: grab; }
.pbss .pbss-grabzone:active { cursor: grabbing; }

@media (prefers-reduced-motion: reduce) {
  .pbss.pbss-sheet, .pbss-scrim { transition: none; }
}
