/* Discover home (#/discover): the slim banner, the category chip row, the one-row result controls, Discover's own cards, the
   recent-prices strip and the wide-window grid. Phone first (js/browse-places-map.js renderBrowseScreen, js/browse-filters.js
   categoryChipRowHtml / discoverSortSelectHtml, js/browse-discover.js viewMenuHtml). Prefix: dc- (and .discover-grid).
   Classifieds keeps the older rail, sort row and card; nothing here targets it. Linked before mobile-sizing.css, which still
   has the last word on tap targets and text size under 860 px. Existing tokens only. */

/* ---------- Banner: one slim line ---------- */
.discover-banner.discover-banner-slim {
  display: block;
  min-height: 0;
  margin: 0 0 8px;
  padding: 8px; /* 8 px at the sides so the signed-out line fits on one line at 360 px */
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--banner-title);
}
.discover-banner-slim a { color: var(--banner-title); text-decoration: underline; text-underline-offset: 2px; }
.discover-banner-slim a:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- Category chip row (phone) ---------- */
.dc-chips-wrap { display: flex; align-items: flex-start; gap: 8px; }
.category-rail.category-rail-chips {
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px;
  margin: 0 0 4px;
  scrollbar-width: none;
}
.category-rail-chips::-webkit-scrollbar { display: none; }

.category-rail-chips .dc-chip {
  flex-direction: row;
  align-items: center;
  width: auto;
  min-height: 44px;
  padding: 0 14px 0 8px;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.category-rail-chips .dc-chip:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; }
.category-rail-chips .dc-chip .category-icon-box { width: 28px; height: 28px; border-radius: 50%; }
.category-rail-chips .dc-chip .category-icon-box svg { width: 16px; height: 16px; }
.category-rail-chips .dc-chip .category-tile-label { overflow: visible; text-overflow: clip; font-size: 14px; }
/* The three-dot button sits beside the rail, not in it, so it stays in reach; the chips scroll up to its edge */
.dc-chips-wrap > .dc-chip-more {
  flex: none;
  align-items: center;
  justify-content: center;
  width: 44px;
  min-width: 44px;
  height: 44px;
  margin-top: 4px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
}
.dc-chips-wrap > .dc-chip-more:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }

/* ---------- Result controls: count, kind, sort and layout in one row ---------- */
.result-row.dc-result-row { flex-wrap: nowrap; justify-content: flex-start; gap: 6px; margin: 0 0 8px; }
.dc-result-row .dc-count { flex: 0 0 auto; margin-right: auto; font-size: 12px; white-space: nowrap; } /* never cut off: the selects give up width first */
.dc-result-row .dc-select, .dc-result-row .kind-select {
  flex: 0 1 auto;
  min-width: 0;
  margin: 0;
  padding: 0 6px;
  min-height: 44px;
  font-size: 14px;
  text-overflow: ellipsis;
}

/* Sort "i": a 44 px button that opens the sort's note. The bubble spans the result row (its positioning parent), so it cannot leave the screen. */
.result-row.dc-result-row { position: relative; }
.sort-info { flex: none; }
.sort-info summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  color: var(--text-muted);
  cursor: pointer;
}
.sort-info summary::-webkit-details-marker { display: none; }
.sort-info summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; border-radius: var(--radius-sm); }
.sort-info[open] summary { color: var(--brand-text); }
.sort-info-bubble {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  max-width: 360px;
  margin: 0;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.4;
  color: var(--text);
}

/* From 560 px the bubble hangs from the "i" itself (right edges aligned), not the whole row */
@media (min-width: 560px) {
  .sort-info { position: relative; }
  .sort-info-bubble { left: auto; right: 0; width: 320px; }
}

/* Layout: the one-button menu on a phone, the inline toggle from 560 px */
.view-menu { position: relative; flex: none; display: none; }
.view-menu summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.view-menu summary::-webkit-details-marker { display: none; }
.view-menu summary:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.view-menu[open] summary { background: var(--brand-tint); color: var(--brand-text); }
.view-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 20;
  min-width: 180px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.view-menu-list .view-btn {
  width: 100%;
  height: 44px;
  justify-content: flex-start;
  gap: 10px;
  padding: 0 12px;
  border-right: none;
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: 14px;
  color: var(--text);
}
.view-menu-list .view-btn.active { color: var(--brand-text); }
@media (max-width: 559px) {
  .view-menu { display: block; }
  .dc-result-row > .view-toggle { display: none; }
}
@media (max-width: 339px) {
  .result-row.dc-result-row { flex-wrap: wrap; }
}

/* ---------- Discover's cards (markets, vendors, places) ---------- */
.card.dc-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 52px 12px 12px;
}
.card.dc-card.has-ribbon { padding-top: 34px; }
.dc-thumb {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
}
.dc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dc-name { margin: 0; font-size: 16px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.dc-where { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 14px; line-height: 1.35; color: var(--text-muted); }
.dc-dist { font-weight: 500; color: var(--brand-text); }
.dc-boosted { font-weight: 600; color: var(--brand-text); }
.dc-body .tag-row { margin: 0; }
.dc-tags .tag { font-size: 12px; }
.dc-tags .dc-tag-more { background: var(--surface-2); color: var(--text-muted); }
.dc-rating { margin: 0; font-size: 14px; }
.dc-desc {
  margin: 0;
  font-size: 14px;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Recent prices strip: above the list from 860 px, after the list's second card under it ---------- */
.dc-prices { margin: 0 0 12px; min-width: 0; }
.dc-prices-wide { display: none; }
.dc-prices-inline { margin-top: 12px; grid-column: 1 / -1; } /* full width of a 3-column grid */
/* Phones: the count is the number only; the noun stays for screen readers (same technique as .sr-only) */
@media (max-width: 419px) {
  .dc-count-noun { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
}
.dc-prices-title { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.dc-prices-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; }
.dc-price {
  flex: none;
  width: 184px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.dc-price:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.dc-price-amount { font-size: 16px; font-weight: 600; }
.dc-price-name, .dc-price-store { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-price-store { color: var(--text-muted); }

/* ---------- Phone: a tighter header on Discover only, and room for the tabs' full labels ---------- */
@media (max-width: 859px) {
  /* #searchModes is visible on Discover only, so no other page's header changes */
  .topbar:has(#searchModes:not([hidden])) { padding-bottom: 8px; }
  .topbar:has(#searchModes:not([hidden])) .topbar-row1 { margin-bottom: 6px; }
  main#app:has(.discover-banner-slim) { padding-top: 8px; }
}
@media (max-width: 419px) {
  .mode-btn svg { display: none; } /* the icons cost the width the labels need */
  .mode-btn span { overflow: visible; text-overflow: clip; }
}

/* ---------- Wide windows: a real grid of cards ---------- */
@media (min-width: 860px) {
  .dc-prices-wide { display: block; }
  .dc-prices-inline { display: none; }
  .card-list.view-detailed.discover-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
    align-items: stretch;
  }
  .discover-grid > .tier-head, .discover-grid > .band-head, .discover-grid > .show-more { grid-column: 1 / -1; }
  .discover-grid > .card-wrap { display: flex; }
  .discover-grid > .card-wrap > .card { flex: 1; min-width: 0; }
}

/* ---------- Loading: placeholders the height of a Discover card, so the first paint does not jump ---------- */
.loading-skeleton .skeleton-card { height: 112px; }
