/* Discover page — sizing for the timeline + a few card polish bits.
   Cards otherwise use Bootstrap utilities; nothing custom-bespoke here. */

/* The timeline container has to override base.html's RTL direction —
   year axis must read left→right (0500 → 2100), and bands shouldn't be
   placed by RTL coordinate logic. Vis-timeline's `rtl: false` option
   handles its internal coords; this CSS handles the surrounding box. */
#discover-timeline {
  direction: ltr;
  text-align: left;
  overflow: hidden; /* fail-safe in case verticalScroll doesn't catch overflow */
  max-height: 240px;
}

.discover-page .vis-timeline {
  border: 1px solid var(--bs-border-color, #e9ecef);
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 0.8rem;
  direction: ltr;
}

/* Each Era item is a colored band; bands without books fade out. */
.vis-item.era-band {
  border-radius: 0.35rem;
  border-color: transparent;
  background: linear-gradient(180deg, #ffe7c2 0%, #ffd58a 100%);
  color: #6b3e00;
}
.vis-item.era-band--has-books {
  background: linear-gradient(180deg, #ffd58a 0%, #ffb84a 100%);
  color: #5a2f00;
}
.vis-item.era-band.era-empty {
  opacity: 0.35;
}
.vis-item.era-band.vis-selected {
  outline: 2px solid #ff8a00;
  outline-offset: 1px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

/* Discover cards. */
.discover-card {
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.discover-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 0.5rem 1.25rem rgba(0, 0, 0, 0.08) !important;
}
.discover-card__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.3;
  min-height: 2.6em; /* Reserve space so cards align even with 1-line titles. */
}

/* Filter chips. */
.discover-chips .discover-chip {
  font-size: 0.78rem;
  padding: 0.4rem 0.6rem;
  font-weight: 500;
  background: var(--bs-light, #f5f8fa);
  color: var(--bs-dark, #1e2129);
}
.discover-chip--era       { background: #fff4dc; color: #7a4500; }
.discover-chip--region    { background: #e6f7ee; color: #2c6e49; }
.discover-chip--document_type { background: #e0f2ff; color: #0a558c; }
.discover-chip--topic     { background: #ede7ff; color: #41338a; }
.discover-chip--theme     { background: #ffe7e0; color: #8c2a17; }
.discover-chip--q         { background: #f0f0f0; color: #333; }
.discover-chip .btn-close {
  width: 0.6rem; height: 0.6rem;
  padding: 0; margin-left: 0.2rem;
  filter: opacity(0.6);
}
.discover-chip .btn-close:hover { filter: opacity(1); }

/* Mobile: tighter cards, shorter timeline. */
@media (max-width: 575.98px) {
  .discover-page #discover-timeline { height: 180px !important; }
  .discover-card__title { font-size: 0.9rem; }
}
