/* /<country>/<genre>/trending page. Sits adjacent to the existing browse
   grid but ranks by price-trend severity instead of year/brand. Visual
   language echoes browse.css (tile-based) but cards lean on the
   trend_badge.css palette for primary color signal. */

.trending-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.trending-head h1 {
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.trending-sub {
  font-size: 14px;
  color: var(--ink-2, #4a4030);
  margin: 0 0 20px;
  max-width: 720px;
}

.trending-sub-detail {
  display: block;
  font-size: 12px;
  color: var(--ink-3, #9b8e76);
  margin-top: 2px;
}

/* ── Direction tabs ───────────────────────────────────────────────── */

.trending-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--rule-soft, #d8cdb6);
  margin-bottom: 24px;
}

.trending-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--ink-2, #4a4030);
  font-size: 14px;
  font-weight: 600;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 120ms ease, border-color 120ms ease;
}

.trending-tab:hover { color: var(--ink-1, #1a1410); }

.trending-tab.active {
  color: var(--ink-1, #1a1410);
  border-bottom-color: var(--ink-1, #1a1410);
}

.trending-tab .tab-arrow {
  font-size: 12px;
  line-height: 1;
}
.trending-tab .tab-arrow.up   { color: #b94a3b; }
.trending-tab .tab-arrow.down { color: #3e7d2e; }

.trending-tab .tab-count {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3, #9b8e76);
  font-variant-numeric: tabular-nums;
  padding: 2px 6px;
  background: rgba(155, 142, 118, 0.12);
  border-radius: 10px;
}

/* ── Empty state ──────────────────────────────────────────────────── */

.trending-empty {
  padding: 64px 24px;
  text-align: center;
  color: var(--ink-2, #4a4030);
}
.trending-empty .muted {
  font-size: 13px;
  color: var(--ink-3, #9b8e76);
  margin-top: 8px;
}

/* ── Tile grid ────────────────────────────────────────────────────── */

.trending-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
}

.trending-tile {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  background: rgba(255, 252, 245, 0.6);
  border: 1px solid var(--rule-soft, #d8cdb6);
  border-radius: 6px;
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease,
              border-color 160ms ease;
}

.trending-tile:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(15, 15, 15, 0.10);
  border-color: rgba(15, 15, 15, 0.20);
}

/* Direction-tinted left edge — subtle accent that scales with severity.
   Lets the eye scan the grid for red vs green clusters without reading
   the badge on every tile. */
.trending-tile.direction-down { border-left: 3px solid rgba(62, 125, 46, 0.55); }
.trending-tile.direction-up   { border-left: 3px solid rgba(185, 74, 59, 0.55); }
.trending-tile.band-down_high { border-left-color: #3e7d2e; }
.trending-tile.band-up_high   { border-left-color: #b94a3b; }

.tile-thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: rgba(216, 205, 182, 0.25);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.tile-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.tile-thumb-empty {
  width: 100%; height: 100%;
  background: linear-gradient(135deg,
              rgba(216, 205, 182, 0.30) 0%,
              rgba(216, 205, 182, 0.15) 100%);
}

.tile-badge {
  position: absolute;
  top: 8px; right: 8px;
  padding: 4px 8px;
  background: rgba(255, 252, 245, 0.92);
  border-radius: 4px;
  backdrop-filter: blur(2px);
  box-shadow: 0 1px 3px rgba(15, 15, 15, 0.12);
}

.tile-body {
  padding: 12px 14px 14px;
}

.tile-eyebrow {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3, #9b8e76);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.tile-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink-1, #1a1410);
  margin-bottom: 8px;
  /* Cap at 2 lines so tiles align in the grid even with long titles. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}

.tile-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink-1, #1a1410);
}

.tile-was {
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3, #9b8e76);
}

@media (max-width: 640px) {
  .trending-page { padding: 20px 12px 60px; }
  .trending-head h1 { font-size: 24px; }
  .trending-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
  }
  .tile-body { padding: 10px 12px 12px; }
  .tile-name { font-size: 14px; }
  .tile-price { font-size: 15px; }
}
