/* WST template — unified search experience.
 * Loaded on /tf-search/, the tour & car CPT archives and tour taxonomy
 * terms. Pairs with template-parts/search/results-experience.php and the
 * tour-card / car-card components (styled in components/card.css). */

.wst-sr {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------------------------------------------------------------------
 * Search hero
 * ------------------------------------------------------------------- */
.wst-srch-hero {
  background: var(--paper-2);
  border-bottom: 1px solid var(--rule);
  padding: 26px 0 26px;
}
.wst-srch-hero .breadcrumbs {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 16px;
}
.wst-srch-hero .breadcrumbs a:hover { color: var(--ink); }
.wst-srch-hero .breadcrumbs .sep { margin: 0 8px; opacity: .55; }

.wst-srch-hero__row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  flex-wrap: wrap;
}
.wst-srch-hero__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(36px, 5vw, 68px);
  line-height: .98;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0;
}
.wst-srch-hero__meta {
  font-size: 13px;
  color: var(--ink-2);
  max-width: 340px;
  line-height: 1.5;
  text-align: right;
  margin: 0 0 6px;
}

/* Type toggle */
.wst-srch-types {
  display: inline-flex;
  gap: 4px;
  margin-top: 20px;
  padding: 4px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 99px;
}
.wst-srch-type {
  padding: 9px 20px;
  border-radius: 99px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: background .15s ease, color .15s ease;
}
.wst-srch-type:hover { color: var(--ink); }
.wst-srch-type.is-active { background: var(--ink); color: var(--paper); }

/* Active-filter chips */
.wst-srch-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.wst-srch-chips__lbl {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.wst-srch-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 99px;
  font-size: 12.5px;
  color: var(--ink);
  transition: border-color .15s ease;
}
.wst-srch-chip:hover { border-color: var(--terra); }
.wst-srch-chip__x { color: var(--terra); font-size: 14px; line-height: 1; }
.wst-srch-chips__clear {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid transparent;
}
.wst-srch-chips__clear:hover { color: var(--terra); border-color: var(--terra); }

/* ---------------------------------------------------------------------
 * Toolbar
 * ------------------------------------------------------------------- */
.wst-srch__toolbar {
  position: sticky;
  /* Stick directly below the sticky site header nav (.nav, 78px tall on
   * desktop) so the toolbar stays visible instead of tucking behind it. */
  top: 78px;
  z-index: 30;
  background: rgba(245, 239, 230, .94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  padding: 12px 0;
}
.wst-srch__toolbar-row {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.wst-srch__count {
  font-family: var(--serif);
  font-size: 20px;
  color: var(--ink);
  margin: 0;
}
.wst-srch__count-n { font-style: italic; color: var(--terra); }
.wst-srch__count-sub {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-left: 4px;
}
.wst-srch__sort { margin-left: auto; }
.wst-srch__sort select {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 99px;
  padding: 9px 16px;
  cursor: pointer;
}
.wst-srch__views {
  display: inline-flex;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: 99px;
  padding: 3px;
  gap: 2px;
}
.wst-srch__view {
  padding: 7px 14px;
  border-radius: 99px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.wst-srch__view.is-active { background: var(--ink); color: var(--paper); }

/* Mobile "Filters" trigger — hidden on desktop, shown ≤860px. */
.wst-srch__filterbtn {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border: 1px solid var(--rule);
  border-radius: 99px;
  background: var(--white);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
}
.wst-srch__filterbtn-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--mono);
  font-size: 10px;
}

/* ---------------------------------------------------------------------
 * Body — sidebar + results
 * ------------------------------------------------------------------- */
.wst-srch__body {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  gap: clamp(28px, 3.5vw, 48px);
  align-items: start;
  padding: 38px var(--pad) 90px;
}

/* Sidebar */
.wst-srch__sidebar {
  position: sticky;
  /* Sit below the sticky header nav (78px) + sticky toolbar (~62px) so the
   * sidebar never overlaps the now-visible sticky toolbar. */
  top: 140px;
}

/* Drawer chrome — only visible when the sidebar is an off-canvas drawer
 * (≤860px). Hidden by default so desktop is untouched. */
.wst-srch__backdrop { display: none; }
.wst-srch__dhead { display: none; }
.wst-srch__dclose {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border: 1px solid var(--rule);
  border-radius: 99px;
  background: var(--white);
  color: var(--ink);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
/* The scroll wrapper is a passthrough on desktop — no box of its own. */
.wst-srch__dscroll { display: contents; }
.wst-srch__fhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}
.wst-srch__ftitle {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 24px;
  color: var(--ink);
  margin: 0;
}
.wst-srch__fcount {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--terra);
  background: var(--paper-2);
  border-radius: 99px;
  padding: 4px 10px;
}
.wst-srch__fnote { font-size: 13px; color: var(--muted); }

.wst-srch-fgroup {
  padding: 20px 0;
  border-bottom: 1px solid var(--rule);
}
.wst-srch-fgroup__h {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  margin: 0 0 14px;
}

/* Checkbox facet */
.wst-srch-cb-list { display: flex; flex-direction: column; gap: 9px; }
.wst-srch-cb {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 13.5px;
}
.wst-srch-cb input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.wst-srch-cb__box {
  flex-shrink: 0;
  width: 18px; height: 18px;
  border: 1.5px solid var(--rule);
  border-radius: 5px;
  background: var(--white);
  position: relative;
  transition: background .15s ease, border-color .15s ease;
}
.wst-srch-cb__box::after {
  content: "";
  position: absolute;
  left: 5px; top: 1px;
  width: 5px; height: 9px;
  border-right: 2px solid var(--paper);
  border-bottom: 2px solid var(--paper);
  transform: rotate(45deg);
  opacity: 0;
}
.wst-srch-cb input:checked + .wst-srch-cb__box {
  background: var(--ink);
  border-color: var(--ink);
}
.wst-srch-cb input:checked + .wst-srch-cb__box::after { opacity: 1; }
.wst-srch-cb input:focus-visible + .wst-srch-cb__box { outline: 2px solid var(--teal); outline-offset: 2px; }
.wst-srch-cb__nm { flex: 1; font-weight: 500; color: var(--ink); }
.wst-srch-cb__ct { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.wst-srch-cb:hover .wst-srch-cb__box { border-color: var(--ink); }

/* Dead-end option — would yield zero results given the current selection. */
.wst-srch-cb.is-disabled {
  opacity: .4;
  cursor: not-allowed;
}
.wst-srch-cb.is-disabled .wst-srch-cb__box,
.wst-srch-cb.is-disabled input { cursor: not-allowed; }
.wst-srch-cb.is-disabled:hover .wst-srch-cb__box { border-color: var(--rule); }

/* Range facet */
.wst-srch-range {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}
.wst-srch-range__field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.wst-srch-range__field span {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.wst-srch-range__field input {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 9px 11px;
}
.wst-srch-range__field input:focus { outline: none; border-color: var(--teal); }
.wst-srch-range__dash { color: var(--muted); padding-bottom: 9px; }

/* Sidebar actions */
.wst-srch__factions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}
.wst-srch__apply { flex: 1; justify-content: center; }
.wst-srch__reset {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 11px 8px;
}
.wst-srch__reset:hover { color: var(--terra); }

/* ---------------------------------------------------------------------
 * Results
 * ------------------------------------------------------------------- */
.wst-srch__grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.wst-srch__grid.is-list { grid-template-columns: 1fr; }
.wst-srch__grid.is-list .wst-card { flex-direction: row; }
.wst-srch__grid.is-list .wst-card__media { width: 38%; aspect-ratio: auto; }
.wst-srch__grid.is-list .wst-card__body { flex: 1; }

.wst-srch__pagination { margin-top: 44px; }

.wst-srch__empty {
  text-align: center;
  padding: clamp(40px, 7vw, 80px) 20px;
  background: var(--white);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
}
.wst-srch__empty-h {
  font-family: var(--serif);
  font-size: 26px;
  color: var(--ink);
  margin: 0 0 8px;
}
.wst-srch__empty-d {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 20px;
}

/* ---------------------------------------------------------------------
 * Responsive
 * ------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .wst-srch__body { grid-template-columns: 248px minmax(0, 1fr); }
  .wst-srch__grid { grid-template-columns: repeat(2, 1fr); }
}
/* Header nav collapses to 64px tall at ≤1000px — realign the sticky
 * toolbar and sidebar offsets to match. */
@media (max-width: 1000px) {
  .wst-srch__toolbar { top: 64px; }
  .wst-srch__sidebar { top: 126px; }
}
@media (max-width: 860px) {
  .wst-srch-hero__meta { text-align: left; max-width: none; }
  .wst-srch__body { grid-template-columns: 1fr; }
  .wst-srch__grid { grid-template-columns: repeat(2, 1fr); }
  /* Keep the toolbar sticky on mobile too so the result count and the
   * "Filters" trigger stay reachable while scrolling. It inherits the
   * top: 64px set in the ≤1000px query (header is 64px here). */

  /* Show the mobile filter trigger. */
  .wst-srch__filterbtn { display: inline-flex; }

  /* Backdrop — sits above page content, below the drawer. */
  .wst-srch__backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(20, 18, 15, .5);
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
  }
  .wst-srch__backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Sidebar becomes an off-canvas drawer, sliding in from the right. */
  .wst-srch__sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    width: min(360px, 90vw);
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-left: 1px solid var(--rule);
    box-shadow: -8px 0 32px rgba(20, 18, 15, .18);
    transform: translateX(100%);
    transition: transform .28s ease;
  }
  .wst-srch__sidebar.is-open { transform: translateX(0); }

  /* Drawer header — title + close button. */
  .wst-srch__dhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    padding: 16px 20px;
    border-bottom: 1px solid var(--rule);
  }
  .wst-srch__dtitle {
    font-family: var(--serif);
    font-weight: 400;
    font-size: 22px;
    color: var(--ink);
    margin: 0;
  }

  /* Scrollable facet area. */
  .wst-srch__dscroll {
    display: block;
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 4px 20px 20px;
  }
  .wst-srch-fgroup:last-of-type { border-bottom: 0; }

  /* Apply / Reset pinned as a sticky footer inside the drawer. */
  .wst-srch__factions {
    flex-shrink: 0;
    margin-top: 0;
    padding: 14px 20px;
    border-top: 1px solid var(--rule);
    background: var(--white);
  }
}
@media (max-width: 560px) {
  .wst-srch__grid,
  .wst-srch__grid.is-list { grid-template-columns: 1fr; }
  .wst-srch__grid.is-list .wst-card { flex-direction: column; }
  .wst-srch__grid.is-list .wst-card__media { width: 100%; aspect-ratio: 4 / 3; }
  .wst-srch__toolbar-row { gap: 10px; }
  .wst-srch__count { font-size: 17px; }
  .wst-srch__sort { margin-left: 0; }
}
