/* =========================================================
   RECIPES LISTING PAGE — extends style.css design tokens
   ========================================================= */

/* ---- Page hero ---- */
.recipes-hero {
  padding: 64px 0 40px;
}
.recipes-hero-inner {
  max-width: 720px;
}
.recipes-hero h1 {
  font-size: clamp(2.2rem, 4.4vw, 3.1rem);
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}
.recipes-lede {
  color: var(--ink-60);
  font-size: 1.05rem;
  max-width: 54ch;
  margin: 0 0 30px;
}

.main-nav a.is-active {
  color: var(--brick);
}
.main-nav a.is-active::after { width: 100%; }

/* ---- Search bar (shared visual language with 404 search) ---- */
.listing-search {
  width: 100%;
  max-width: 560px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 8px 8px 8px 20px;
  transition: border-color .18s ease;
}
.listing-search:focus-within { border-color: var(--olive); }
.listing-search svg { color: var(--ink-60); flex-shrink: 0; }
.listing-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-family: var(--font-body);
  font-size: 0.98rem;
  color: var(--ink);
  min-width: 0;
}
.listing-search input::placeholder { color: var(--ink-60); }
.listing-search .btn { padding: 11px 22px; flex-shrink: 0; }

/* ---- Filter / sort bar ---- */
.filter-bar {
  background: var(--paper);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 18px 0;
  position: sticky;
  top: 76px;
  z-index: 40;
}
.filter-bar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.filter-bar .chip-row { margin: 0; flex: 1; min-width: 260px; }

.sort-select {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-60);
  white-space: nowrap;
}
.sort-select select {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--ink);
  background: var(--cream);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 9px 34px 9px 16px;
  cursor: pointer;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%232B2320' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: border-color .18s ease;
}
.sort-select select:focus { border-color: var(--olive); }

/* ---- Listing section ---- */
.listing-section { padding-top: 40px; }

.result-count {
  color: var(--ink-60);
  font-size: 0.9rem;
  margin: 0 0 26px;
}
.result-count strong { color: var(--ink); }

.link-reset {
  background: none;
  border: none;
  padding: 0;
  color: var(--olive);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: inherit;
}

/* ---- Numbered pagination ---- */
#resultsTop { display: block; scroll-margin-top: 96px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 50px;
}

.page-btn {
  min-width: 42px;
  height: 42px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  transition: all .16s ease;
}
.page-btn:hover:not([disabled]):not(.active) {
  border-color: var(--olive);
  color: var(--olive);
}
.page-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--cream);
  cursor: default;
}
.page-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.page-btn.page-nav {
  font-size: 1.15rem;
  font-weight: 700;
}
.page-ellipsis {
  min-width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-60);
  font-weight: 700;
}

/* ---- Fade-in when a new page of cards renders ---- */
.recipe-grid { animation: card-fade-in .35s ease both; }
@keyframes card-fade-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- Responsive ---- */
@media (max-width: 720px) {
  .filter-bar { top: 68px; }
  .filter-bar-inner { align-items: stretch; }
  .sort-select { justify-content: space-between; }
  .listing-search { flex-wrap: wrap; border-radius: 20px; padding: 14px 16px; }
  .listing-search input { width: 100%; order: 1; }
  .listing-search svg { order: 0; }
  .listing-search .btn { width: 100%; order: 2; justify-content: center; }
}

@media (max-width: 480px) {
  .page-btn { min-width: 36px; height: 36px; padding: 0 8px; font-size: 0.88rem; }
  .page-ellipsis { min-width: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .recipe-grid { animation: none; }
}
