/* ==========================================================================
   DRINKQ ARCHIVE — Compact Entry Card System
   Targets: .page-drinks, .page-ingredients
   
   Real card class: .encyclopedia-entry (rendered by renderItemCard in public.js)
   Inner classes: .entry-media, .entry-content, .entry-meta, .entry-desc,
                  .entry-tags, .entry-actions, .entry-type-pill
   Grid classes:  .catalog-grid--masonry / .catalog-grid--compact (toggled by JS)
   
   CSS-only. Zero HTML or JS changes.
   ========================================================================== */

/* ─────────────────────────────────────────────────────────────────────────────
   1. HIDE VIEW TOGGLE — Compact is the only view
   ───────────────────────────────────────────────────────────────────────────── */
.page-drinks .view-toggle,
.page-ingredients .view-toggle,
.page-home .view-toggle {
  display: none !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   2. GRID — 4 cols desktop → 3 laptop → 2 tablet → 1 mobile
   ───────────────────────────────────────────────────────────────────────────── */
.page-drinks .catalog-grid--masonry,
.page-drinks .catalog-grid--compact,
.page-drinks [data-grid],
.page-ingredients .catalog-grid--masonry,
.page-ingredients .catalog-grid--compact,
.page-ingredients [data-grid],
.page-home .catalog-grid--masonry,
.page-home .catalog-grid--compact,
.page-home [data-grid] {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 1rem !important;
  align-items: start !important;
}

@media (max-width: 1400px) {

  .page-drinks .catalog-grid--masonry,
  .page-drinks .catalog-grid--compact,
  .page-drinks [data-grid],
  .page-ingredients .catalog-grid--masonry,
  .page-ingredients .catalog-grid--compact,
  .page-ingredients [data-grid],
  .page-home .catalog-grid--masonry,
  .page-home .catalog-grid--compact,
  .page-home [data-grid] {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

@media (max-width: 900px) {

  .page-drinks .catalog-grid--masonry,
  .page-drinks .catalog-grid--compact,
  .page-drinks [data-grid],
  .page-ingredients .catalog-grid--masonry,
  .page-ingredients .catalog-grid--compact,
  .page-ingredients [data-grid],
  .page-home .catalog-grid--masonry,
  .page-home .catalog-grid--compact,
  .page-home [data-grid] {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.75rem !important;
  }
}

@media (max-width: 540px) {

  .page-drinks .catalog-grid--masonry,
  .page-drinks .catalog-grid--compact,
  .page-drinks [data-grid],
  .page-ingredients .catalog-grid--masonry,
  .page-ingredients .catalog-grid--compact,
  .page-ingredients [data-grid],
  .page-home .catalog-grid--masonry,
  .page-home .catalog-grid--compact,
  .page-home [data-grid] {
    grid-template-columns: 1fr !important;
    gap: 0.625rem !important;
  }
}

/* ─────────────────────────────────────────────────────────────────────────────
   3. ENCYCLOPEDIA ENTRY CARD — Complete compact card system
   ───────────────────────────────────────────────────────────────────────────── */
.page-drinks .encyclopedia-entry,
.page-ingredients .encyclopedia-entry,
.page-home .encyclopedia-entry {
  position: relative;
  display: flex;
  flex-direction: column;
  background: rgba(12, 9, 7, 0.85);
  border: 1px solid rgba(228, 179, 130, 0.1);
  border-radius: 10px;
  overflow: hidden;
  transition: transform 280ms ease, border-color 280ms ease, box-shadow 280ms ease;
  will-change: transform;
  /* Reset any editorial span overrides */
  grid-column: span 1 !important;
  grid-row: span 1 !important;
}

.page-drinks .encyclopedia-entry:hover,
.page-ingredients .encyclopedia-entry:hover,
.page-home .encyclopedia-entry:hover {
  transform: translateY(-3px);
  border-color: rgba(228, 179, 130, 0.35);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* ── 3a. Thumbnail (entry-media is an <a> wrapping <img>) */
.page-drinks .encyclopedia-entry .entry-media,
.page-ingredients .encyclopedia-entry .entry-media {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 3 / 2;
  flex-shrink: 0;
  background: rgba(8, 6, 4, 0.8);
  text-decoration: none;
}

.page-drinks .encyclopedia-entry .entry-media img,
.page-ingredients .encyclopedia-entry .entry-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms cubic-bezier(0.2, 0.9, 0.2, 1);
}

.page-drinks .encyclopedia-entry:hover .entry-media img,
.page-ingredients .encyclopedia-entry:hover .entry-media img {
  transform: scale(1.06);
}

/* Type pill badge on image */
.page-drinks .encyclopedia-entry .entry-type-pill,
.page-ingredients .encyclopedia-entry .entry-type-pill {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  font-size: 0.6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.5rem;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--brand-primary, #dfb15b);
  border-radius: 4px;
  border: 1px solid rgba(228, 179, 130, 0.25);
  pointer-events: none;
}

/* Favorite star button */
.page-drinks .encyclopedia-entry .favorite-btn,
.page-ingredients .encyclopedia-entry .favorite-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  width: 1.75rem;
  height: 1.75rem;
  padding: 0.3rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(228, 179, 130, 0.2);
  border-radius: 50%;
  color: rgba(228, 179, 130, 0.5);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 200ms ease, border-color 200ms ease, background 200ms ease;
}

.page-drinks .encyclopedia-entry .favorite-btn svg,
.page-ingredients .encyclopedia-entry .favorite-btn svg {
  width: 100%;
  height: 100%;
}

.page-drinks .encyclopedia-entry .favorite-btn:hover,
.page-ingredients .encyclopedia-entry .favorite-btn:hover,
.page-drinks .encyclopedia-entry .favorite-btn.is-active,
.page-ingredients .encyclopedia-entry .favorite-btn.is-active {
  color: var(--brand-primary, #dfb15b);
  border-color: rgba(228, 179, 130, 0.5);
  background: rgba(0, 0, 0, 0.8);
}

/* ── 3b. Text content area */
.page-drinks .encyclopedia-entry .entry-content,
.page-ingredients .encyclopedia-entry .entry-content {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 0.75rem 0.875rem 0.875rem;
  gap: 0.3rem;
  min-height: 0;
}

/* Hover Preview System */
.encyclopedia-entry .entry-content {
  position: relative;
  z-index: 1;
}

.encyclopedia-entry:hover .entry-desc {
  -webkit-line-clamp: 4;
  /* Show more on hover */
  color: var(--text-primary);
}

/* Meta line: "Type • Region" */
.page-drinks .encyclopedia-entry .entry-meta,
.page-ingredients .encyclopedia-entry .entry-meta {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-primary, #dfb15b);
  margin: 0;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Name heading */
.page-drinks .encyclopedia-entry .entry-content h3,
.page-ingredients .encyclopedia-entry .entry-content h3 {
  font-family: var(--font-display, 'Clash Display', sans-serif);
  font-size: 0.975rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
  color: var(--text-primary, #f0ece8);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Short description */
.page-drinks .encyclopedia-entry .entry-desc,
.page-ingredients .encyclopedia-entry .entry-desc {
  font-size: 0.775rem;
  line-height: 1.5;
  color: var(--text-secondary, #b8afa6);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 0;
}

/* Tags row */
.page-drinks .encyclopedia-entry .entry-tags,
.page-ingredients .encyclopedia-entry .entry-tags {
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  gap: 0.3rem;
  min-height: 0;
  margin: 0.1rem 0 0;
}

.page-drinks .encyclopedia-entry .entry-tags .chip,
.page-ingredients .encyclopedia-entry .entry-tags .chip {
  font-size: 0.6rem !important;
  padding: 0.15rem 0.5rem !important;
  white-space: nowrap;
  flex-shrink: 0;
  border-radius: 4px;
}

/* CTA row */
.page-drinks .encyclopedia-entry .entry-actions,
.page-ingredients .encyclopedia-entry .entry-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 0.5rem;
  flex-wrap: wrap;
}

.page-drinks .encyclopedia-entry .entry-actions .button--small,
.page-ingredients .encyclopedia-entry .entry-actions .button--small {
  font-size: 0.65rem !important;
  padding: 0.3rem 0.7rem !important;
  min-height: 0 !important;
  letter-spacing: 0.04em;
}

.page-drinks .encyclopedia-entry .congruence-pill,
.page-ingredients .encyclopedia-entry .congruence-pill {
  font-size: 0.6rem;
  padding: 0.2rem 0.5rem;
  background: rgba(228, 179, 130, 0.08);
  border: 1px solid rgba(228, 179, 130, 0.2);
  color: var(--brand-primary, #dfb15b);
  border-radius: 4px;
  white-space: nowrap;
}

.page-drinks .encyclopedia-entry .score-pill,
.page-ingredients .encyclopedia-entry .score-pill {
  font-size: 0.6rem;
  font-weight: 700;
  padding: 0.2rem 0.4rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-tertiary, #8a807a);
  border-radius: 4px;
}

/* ─────────────────────────────────────────────────────────────────────────────
   4. FILTER PANEL — Premium sticky sidebar
   ───────────────────────────────────────────────────────────────────────────── */
.page-drinks .filter-panel,
.page-drinks .archive-filter-panel,
.page-ingredients .filter-panel,
.page-ingredients .archive-filter-panel {
  background: rgba(10, 7, 5, 0.88) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: 1px solid rgba(228, 179, 130, 0.12) !important;
  border-radius: 12px !important;
  padding: 1.25rem !important;
  position: sticky !important;
  top: calc(var(--header-h, 88px) + 1rem) !important;
  height: max-content !important;
  max-height: calc(100vh - var(--header-h, 88px) - 2rem) !important;
  overflow-y: auto !important;
  scrollbar-width: thin !important;
  scrollbar-color: rgba(228, 179, 130, 0.15) transparent !important;
}

/* Panel header */
.page-drinks .filter-panel__head,
.page-drinks .archive-filter-panel__head,
.page-ingredients .filter-panel__head,
.page-ingredients .archive-filter-panel__head {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 1rem !important;
  padding-bottom: 0.75rem !important;
  border-bottom: 1px solid rgba(228, 179, 130, 0.1) !important;
}

.page-drinks .filter-panel__head strong,
.page-drinks .archive-filter-panel__head strong,
.page-ingredients .filter-panel__head strong,
.page-ingredients .archive-filter-panel__head strong {
  font-family: var(--museum-serif);
  font-size: 1rem !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.15em !important;
  color: var(--accent-primary) !important;
}

/* Filter groups */
.page-drinks .filter-panel__group,
.page-drinks .archive-filter-group,
.page-ingredients .filter-panel__group,
.page-ingredients .archive-filter-group {
  margin-bottom: 2rem !important;
  padding: 0 !important;
  border: none !important;
}

/* Group labels */
.page-drinks .filter-label,
.page-ingredients .filter-label {
  display: block !important;
  font-size: 0.65rem !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.18em !important;
  color: var(--text-muted) !important;
  margin-bottom: 0.75rem !important;
}

/* Selects */
.page-drinks .filter-panel select,
.page-drinks .filter-panel .select,
.page-drinks .archive-filter-group select,
.page-ingredients .filter-panel select,
.page-ingredients .filter-panel .select,
.page-ingredients .archive-filter-group select {
  width: 100% !important;
  font-size: 0.8rem !important;
  padding: 0.45rem 2rem 0.45rem 0.65rem !important;
  border-radius: 7px !important;
  border: 1px solid rgba(228, 179, 130, 0.14) !important;
  background-color: rgba(5, 3, 2, 0.75) !important;
  color: var(--text-primary, #f0ece8) !important;
  cursor: pointer !important;
  transition: border-color 180ms ease !important;
}

.page-drinks .filter-panel select:focus,
.page-drinks .archive-filter-group select:focus,
.page-ingredients .filter-panel select:focus,
.page-ingredients .archive-filter-group select:focus {
  border-color: rgba(228, 179, 130, 0.4) !important;
  outline: none !important;
}

/* Mood chips in filter */
.page-drinks .filter-panel .chip-row,
.page-drinks .archive-filter-panel .chip-row,
.page-ingredients .filter-panel .chip-row,
.page-ingredients .archive-filter-panel .chip-row {
  flex-wrap: wrap !important;
  gap: 0.3rem !important;
  margin: 0 !important;
  min-height: 0 !important;
}

.page-drinks .filter-panel .chip,
.page-drinks .archive-filter-panel .chip,
.page-ingredients .filter-panel .chip,
.page-ingredients .archive-filter-panel .chip {
  font-size: 0.65rem !important;
  padding: 0.2rem 0.55rem !important;
  cursor: pointer !important;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease !important;
}

.page-drinks .filter-panel .chip.is-active,
.page-drinks .archive-filter-panel .chip.is-active,
.page-ingredients .filter-panel .chip.is-active,
.page-ingredients .archive-filter-panel .chip.is-active {
  background: rgba(228, 179, 130, 0.14) !important;
  border-color: rgba(228, 179, 130, 0.4) !important;
  color: var(--brand-primary, #dfb15b) !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   5. RESULT TOOLBAR — Compact status bar
   ───────────────────────────────────────────────────────────────────────────── */
.page-drinks .result-toolbar,
.page-drinks .archive-meta-strip,
.page-ingredients .result-toolbar,
.page-ingredients .archive-meta-strip {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: rgba(10, 7, 5, 0.7) !important;
  border: 1px solid rgba(228, 179, 130, 0.1) !important;
  border-radius: 8px !important;
  padding: 0.5rem 1rem !important;
  margin-bottom: 1rem !important;
  gap: 1rem !important;
}

.page-drinks .result-toolbar p,
.page-drinks .archive-meta-strip p,
.page-ingredients .result-toolbar p,
.page-ingredients .archive-meta-strip p {
  font-size: 0.775rem !important;
  font-weight: 600 !important;
  color: var(--text-secondary, #b8afa6) !important;
  margin: 0 !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   6. SPOTLIGHT — Keep compact, not a hero section
   ───────────────────────────────────────────────────────────────────────────── */
.page-drinks .spotlight {
  max-height: 300px !important;
  margin-bottom: 1.25rem !important;
  border-radius: 12px !important;
  overflow: hidden !important;
}

.page-drinks .spotlight>img,
.page-drinks .spotlight img:first-child {
  max-height: 300px !important;
  aspect-ratio: 21 / 9 !important;
  object-fit: cover !important;
}

/* ─────────────────────────────────────────────────────────────────────────────
   7. RESET — Undo any wrong .catalog-card overrides from previous CSS iterations
      (Previous CSS in pages.css targeted .catalog-card which is the wrong class)
   ───────────────────────────────────────────────────────────────────────────── */
.page-drinks .catalog-card,
.page-ingredients .catalog-card {
  all: unset;
  display: contents;
  /* Make it invisible if it somehow appears */
}

/* ─────────────────────────────────────────────────────────────────────────────
   8. MOBILE — Filter panel goes horizontal on tablet
   ───────────────────────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {

  .page-drinks .filter-panel,
  .page-drinks .archive-filter-panel,
  .page-ingredients .filter-panel,
  .page-ingredients .archive-filter-panel {
    position: static !important;
    max-height: none !important;
    overflow-y: visible !important;
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
    gap: 0.75rem !important;
    align-items: start !important;
  }

  .page-drinks .filter-panel__head,
  .page-drinks .archive-filter-panel__head,
  .page-ingredients .filter-panel__head,
  .page-ingredients .archive-filter-panel__head {
    grid-column: 1 / -1 !important;
    margin-bottom: 0 !important;
  }
}

@media (max-width: 540px) {

  .page-drinks .filter-panel,
  .page-drinks .archive-filter-panel,
  .page-ingredients .filter-panel,
  .page-ingredients .archive-filter-panel {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media (max-width: 400px) {

  .page-drinks .filter-panel,
  .page-drinks .archive-filter-panel,
  .page-ingredients .filter-panel,
  .page-ingredients .archive-filter-panel {
    grid-template-columns: 1fr !important;
  }
}

.page-drinks .catalog-grid,
.page-ingredients .catalog-grid {
  grid-auto-rows: auto !important;
}

.page-drinks .encyclopedia-entry,
.page-ingredients .encyclopedia-entry {
  height: auto !important;
  min-height: 320px !important;
  overflow: visible !important;
}