/* Global search (#3048, Discover W10; D89, D109). Tokens only — no new colours. */

/* ── Triggers ─────────────────────────────────────────── */
/* The box: a pill under the header row on phone, top right on desktop. */
.gs-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  order: 3;
  flex: 1 0 100%;
  min-height: 48px;
  margin-top: var(--space-md);
  padding: 0 var(--space-lg);
  border: 1.5px solid var(--df-ink);
  border-radius: 999px;
  background: var(--df-panel);
  color: var(--df-ink-soft);
  font: inherit;
  font-size: var(--fs-lg);
  text-align: left;
  cursor: pointer;
}
.gs-trigger:hover { color: var(--df-ink); }
.gs-trigger-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-topbar:has(> .gs-trigger) { flex-wrap: wrap; }

@media (min-width: 681px) {
  .gs-trigger {
    order: 0;
    flex: 0 1 280px;
    margin: 0 var(--space-lg) 0 auto;
  }
  .home-topbar:has(> .gs-trigger) { flex-wrap: nowrap; }
}

/* Inside a trip the header is busy, so it is an icon. */
.gs-icon-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.25rem;
  cursor: pointer;
}

/* ── Overlay ──────────────────────────────────────────── */
.gs {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: flex;
  justify-content: center;
  background: rgba(9, 20, 13, 0.5);
}
.gs[hidden] { display: none; }
.gs-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  background: var(--df-ground);
  color: var(--df-ink);
}

/* G01/G02: the green header band holds a cream pill and a bold Cancel. */
.gs-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-lg);
  padding: var(--space-lg);
  background: var(--topbar-bg);
}
.gs-bar-icon {
  position: absolute;
  left: calc(var(--space-lg) + var(--space-lg));
  font-size: 1.25rem;
  color: var(--df-ink);
  pointer-events: none;
}
.gs-input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 0 44px 0 46px;
  font-size: var(--fs-lg); /* 16px: no iOS zoom on focus */
  border: 2px solid var(--df-ink);
  border-radius: 999px;
  background: var(--df-panel);
  color: var(--df-ink);
  box-shadow: 0 0 0 3px var(--df-panel);
}
.gs-input:focus { outline: none; }
.gs-input:focus-visible { box-shadow: 0 0 0 3px var(--df-panel), 0 0 0 5px var(--df-brand); }
.gs-icon-btn, .gs-cancel, .gs-clear-all {
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  border: 0;
  background: transparent;
  color: var(--df-ink);
  font: inherit;
  cursor: pointer;
}
.gs-bar .gs-icon-btn { position: absolute; right: calc(var(--tap-min) + var(--space-lg) + var(--space-lg) + 8px); }
.gs-cancel { padding: 0; font-weight: 800; color: var(--df-ground); }

.gs-card { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.gs-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-lg);
  overscroll-behavior: contain;
  background-color: var(--df-ground);
  background-image: radial-gradient(color-mix(in srgb, var(--df-ink) 10%, transparent) 1px, transparent 1.2px);
  background-size: 8px 8px;
}
.gs-hint { display: none; }
@media (min-width: 681px) {
  .gs-hint {
    display: block;
    padding: var(--space-md) var(--space-lg);
    border-top: 1px solid var(--df-hair);
    color: var(--df-ink-soft);
    font-size: 11px;
  }
}

/* ── Groups and rows ──────────────────────────────────── */
.gs-group { margin-bottom: var(--space-xl, 20px); }
/* Section labels are mono caps, as on the boards. */
.gs-group-label {
  margin: 0 0 var(--space-md);
  font-family: var(--df-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--df-ink-soft);
}
.gs-group-head { display: flex; align-items: baseline; justify-content: space-between; }
.gs-clear-all {
  padding: 0 var(--space-md);
  font-family: var(--df-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--df-brand);
}
.gs-recent { display: flex; align-items: center; border-bottom: 1px dashed var(--df-hair); }
.gs-recent .gs-row-title { font-weight: 800; }
.gs-recent .gs-row { min-height: 60px; gap: var(--space-xl, 20px); padding-left: var(--space-lg); }
.gs-recent .gs-row .ti { font-size: 1.25rem; }
.gs-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  flex: 1;
  width: 100%;
  min-height: var(--tap-min);
  padding: var(--space-sm, 6px) var(--space-md);
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--df-ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.gs-row-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.gs-row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-row-sub { color: var(--df-ink-soft); font-size: 14px; }
.gs-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.gs-avatar-init { display: inline-flex; align-items: center; justify-content: center; background: var(--df-chip-fill-hover); font-weight: 700; }
.gs-see-all {
  justify-content: center;
  min-height: 56px;
  margin-top: var(--space-lg);
  border: 2px solid var(--df-ink);
  border-radius: 999px;
  font-weight: 800;
}
.gs-see-all .gs-row-text { flex: 0 1 auto; }
.gs-see-all .ti-search, .gs-see-all .ti-arrow-right { display: none; }
.gs-row:hover, .gs-row.gs-active, .gs-post .discover-card-open.gs-active { background: var(--df-chip-fill); }
.gs-active { outline: 2px solid var(--df-brand); outline-offset: -2px; }
/* Popular cities scroll sideways; the matching city card is full width. */
.gs-city-strip { display: flex; gap: var(--space-md); overflow-x: auto; padding: 0 4px 6px 0; scroll-snap-type: x proximity; }
.gs-city-strip .gs-city-card { flex: 0 0 38%; scroll-snap-align: start; }
.gs-group > .gs-city-card { width: 100%; min-height: 150px; }
.gs-posts { margin: 0; padding: 0; }

.gs-empty { padding: var(--space-lg) 0; }
.gs-empty-title { margin: 0; font-weight: 800; font-size: 20px; }
.gs-empty-sub { margin: var(--space-sm, 6px) 0 0; color: var(--df-ink-soft); }

.gs-skeleton-row { display: flex; align-items: center; gap: var(--space-lg); padding: var(--space-md) 0; }
.gs-skeleton-lines { display: flex; flex-direction: column; gap: var(--space-sm, 6px); flex: 1; }

@media (prefers-reduced-motion: reduce) {
  .gs-row, .gs-trigger { transition: none; }
}

/* The approved results screens (G02, G05) carry no City/Posts headings; the
   group keeps its label for a screen reader. */
.gs-group-quiet > .gs-group-label {
  position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

/* One clear control: ours. */
.gs-input::-webkit-search-cancel-button { display: none; }
.gs-post-actions { margin-inline: 0; }
.gs-empty-title { font-family: var(--df-title); font-size: 24px; }
.gs-empty-sub { color: var(--df-ink); font-size: var(--fs-lg); }

/* G05/H02 (D109): on desktop the pill replaces the header's own box, top right,
   and the results drop down beneath it as a card. No dimming, the page stays. */
@media (min-width: 681px) {
  .gs { background: transparent; align-items: flex-start; justify-content: flex-start; }
  .gs-panel { position: absolute; top: 0; left: var(--gs-card-l, calc(100vw - 710px)); width: 560px; height: auto; background: transparent; }
  .gs-bar {
    position: fixed; top: var(--gs-t, 10px); left: var(--gs-l, calc(100vw - 500px));
    width: var(--gs-w, 340px); height: var(--gs-h, 48px);
    padding: 0; background: transparent;
  }
  .gs-bar .gs-input { min-height: 100%; height: 100%; }
  .gs-bar .gs-cancel { display: none; }
  .gs-bar-icon { left: 16px; }
  .gs-bar .gs-icon-btn { right: 8px; }
  .gs-open .gs-trigger { visibility: hidden; }
  .gs-body {
    max-height: calc(100dvh - 120px);
    border-radius: 16px 16px 0 0;
  }
  /* G05: one outline and one offset shadow around the results and the hint. */
  .gs-card {
    flex: none;
    margin-top: calc(var(--gs-t, 10px) + var(--gs-h, 48px) + 8px);
    border: 1.5px solid var(--df-ink);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--df-press-large);
  }
  .gs-hint {
    background: var(--df-panel);
    border-radius: 0 0 16px 16px;
    text-align: center;
    font-family: var(--df-mono);
  }
  .discover-grid.gs-posts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* The report dialog opens from a result, over the overlay. */
body:has(.gs:not([hidden])) #reportModal { z-index: 9100; }

/* The box on the city page (/discover/city/:slug): first thing in the column,
   top right on desktop. */
.dcity-pad > .gs-trigger { order: 0; flex: 0 0 auto; margin: 0; width: 100%; }
@media (min-width: 681px) {
  .dcity-pad > .gs-trigger { width: 280px; align-self: flex-end; }
}

/* Discover link in the home and trip headers (#3486, M10-R1). Text on desktop,
   icon only on phone where the header is busy. */
.discover-header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs, 4px);
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}
.discover-header-link .ti { font-size: 1.25rem; }
@media (max-width: 680px) {
  .discover-header-link span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
