/* ─── Discover (Facts Index) — Mobile-first social feed layout ───────────────
 * Mobile  : full-width feed, horizontal filter strip at top
 * Desktop (≥ 900px): feed column (left) + sticky filter sidebar (right)
 * ─────────────────────────────────────────────────────────────────────────── */

/* ── Filter strip — mobile horizontal scroll row ───────────────────────────── */
.discover-filter-strip {
  position: sticky;
  top: var(--nav-height);
  z-index: 50;
  background: var(--white);
  border-bottom: 1px solid var(--cream-dark);
  /* Fade-out hint on right edge */
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 48px), transparent 100%);
  mask-image: linear-gradient(to right, black calc(100% - 48px), transparent 100%);
}

.discover-filter-strip__inner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
  /* Extra right padding so last pill isn't under the fade */
  padding-right: calc(var(--space-4) + 48px);
}

.discover-filter-strip__inner::-webkit-scrollbar {
  display: none;
}

/* ── Filter pill ─────────────────────────────────────────────────────────── */
.discover-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-3);
  height: 36px;
  border-radius: var(--radius-pill);
  border: 1.5px solid var(--cream-dark);
  background: var(--cream);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.discover-pill:active {
  background: var(--cream-dark);
}

.discover-pill--active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
}

.discover-pill--tag {
  color: var(--amber-dark);
  border-color: rgba(245, 166, 35, 0.35);
  background: rgba(245, 166, 35, 0.07);
}

.discover-pill--tag.discover-pill--active {
  background: var(--amber);
  border-color: var(--amber);
  color: var(--ink);
}

/* Category color dot inside category pills */
.discover-pill__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  background: var(--ink-muted);
}

/* Per-category dot colors — match browse.css cat-dot tokens */
.discover-pill--animals    .discover-pill__dot { background: var(--cat-animals); }
.discover-pill--food       .discover-pill__dot { background: var(--cat-food); }
.discover-pill--history    .discover-pill__dot { background: var(--cat-history); }
.discover-pill--science    .discover-pill__dot { background: var(--cat-science); }
.discover-pill--sports     .discover-pill__dot { background: var(--cat-sports); }
.discover-pill--technology .discover-pill__dot { background: var(--cat-technology); }
.discover-pill--geography  .discover-pill__dot { background: var(--cat-geography); }
.discover-pill--entertainment .discover-pill__dot { background: var(--cat-entertainment); }
.discover-pill--health     .discover-pill__dot { background: var(--cat-health); }
.discover-pill--politics   .discover-pill__dot { background: var(--cat-politics); }
.discover-pill--showbiz    .discover-pill__dot { background: var(--cat-showbiz); }
.discover-pill--miscellaneous .discover-pill__dot { background: var(--cat-miscellaneous); }

/* Active category pill — use amber instead of ink */
.discover-pill--category.discover-pill--active {
  background: var(--amber-light);
  border-color: var(--amber);
  color: var(--amber-dark);
}

/* Divider between categories and tags in the strip */
.discover-strip-divider {
  width: 1px;
  height: 20px;
  background: var(--cream-dark);
  flex-shrink: 0;
  margin: 0 var(--space-1);
}

/* ── Page layout — mobile: single column ───────────────────────────────────── */
.discover-layout {
  /* Mobile: full-width, no padding — cards edge-to-edge */
}

/* ── Sidebar — hidden on mobile ─────────────────────────────────────────────── */
.discover-sidebar {
  display: none;
}

/* ── Feed header ─────────────────────────────────────────────────────────────── */
.discover-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.discover-feed-count {
  font-size: 0.8rem;
  color: var(--ink-muted);
  font-weight: 500;
  white-space: nowrap;
}

/* ── Active filter chips (below feed header when filter is active) ───────────── */
.discover-active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0 var(--space-4) var(--space-3);
}

.discover-active-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  background: var(--amber-light);
  border: 1px solid var(--amber);
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--amber-dark);
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--transition), opacity var(--transition);
}

.discover-active-chip:active {
  opacity: 0.7;
}

.discover-active-chip__x {
  font-size: 0.7rem;
  opacity: 0.7;
}

/* ── Desktop layout (≥ 900px) ───────────────────────────────────────────────── */
@media (min-width: 900px) {
  /* Hide the mobile filter strip — sidebar handles filtering */
  .discover-filter-strip {
    display: none;
  }

  /* Feed + sidebar 2-col grid, matching home feed-layout pattern */
  .discover-layout {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 0 var(--space-6);
    align-items: start;
    padding-block: var(--space-6);
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--space-5);
  }

  /* Main feed in left column */
  .discover-feed {
    grid-column: 1;
    min-width: 0;
  }

  /* Sidebar — sticky, right column */
  .discover-sidebar {
    display: block;
    grid-column: 2;
    position: sticky;
    top: calc(var(--nav-height) + var(--space-4));
    max-height: calc(100vh - var(--nav-height) - var(--space-8));
    overflow-y: auto;
    scrollbar-width: thin;
  }

  /* Desktop sidebar: wrap filter form in a card */
  .discover-sidebar .filter-form {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: var(--space-5);
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(26, 26, 46, 0.06);
  }

  /* Cards get gap between them */
  #facts-feed-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    padding-bottom: var(--space-5);
  }

  /* Active filter chips — desktop padding */
  .discover-active-filters {
    padding: 0 0 var(--space-3);
  }
}

/* ─── Filter Form (desktop sidebar) ─────────────────────────────────────────── */
.filter-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.filter-form__section-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-muted);
  margin-bottom: var(--space-3);
}

.filter-form__search {
  position: relative;
}

.filter-form__search-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.filter-form__input {
  width: 100%;
  padding: var(--space-3) var(--space-3) var(--space-3) 2.25rem;
  border: 1.5px solid var(--cream-dark);
  border-radius: var(--radius-md);
  background: var(--cream);
  color: var(--ink);
  font-size: 0.9rem;
  transition:
    border-color var(--transition),
    box-shadow var(--transition);
  outline: none;
}

.filter-form__input:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(245, 166, 35, 0.15);
}

.filter-form__categories {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.filter-form__cat-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--ink-soft);
  background: transparent;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition:
    background var(--transition),
    color var(--transition),
    border-color var(--transition);
  text-align: left;
  text-decoration: none;
  width: 100%;
}

.filter-form__cat-btn:hover {
  background: var(--cream);
  color: var(--ink);
}

.filter-form__cat-btn--active {
  background: var(--amber-light);
  color: var(--amber-dark);
  border-color: var(--amber);
  font-weight: 600;
}

.filter-form__cat-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.filter-form__cat-dot--animals      { background: var(--cat-animals); }
.filter-form__cat-dot--food         { background: var(--cat-food); }
.filter-form__cat-dot--history      { background: var(--cat-history); }
.filter-form__cat-dot--science      { background: var(--cat-science); }
.filter-form__cat-dot--sports       { background: var(--cat-sports); }
.filter-form__cat-dot--technology   { background: var(--cat-technology); }
.filter-form__cat-dot--geography    { background: var(--cat-geography); }
.filter-form__cat-dot--entertainment{ background: var(--cat-entertainment); }
.filter-form__cat-dot--health       { background: var(--cat-health); }
.filter-form__cat-dot--miscellaneous{ background: var(--cat-miscellaneous); }
.filter-form__cat-dot--politics     { background: var(--cat-politics); }
.filter-form__cat-dot--showbiz      { background: var(--cat-showbiz); }

.filter-form__cat-name {
  flex: 1;
  margin-left: var(--space-2);
}

.filter-form__clear {
  font-size: 0.8rem;
  color: var(--ink-muted);
  text-decoration: underline;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  text-align: left;
}

.filter-form__clear:hover {
  color: var(--red);
}

.filter-form__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}

/* ── Empty state ─────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: var(--space-10) var(--space-5);
}

.empty-state__icon {
  font-size: 3rem;
  margin-bottom: var(--space-4);
}

.empty-state__title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: var(--space-2);
}

.empty-state__body {
  color: var(--ink-muted);
  font-size: 0.95rem;
}
