
/* ═══════════════════════════════════════════════════════════════════
   ARTICLE LIBRARY — Page-specific styles
   ═══════════════════════════════════════════════════════════════════ */

.library-hero {
  padding-top: calc(var(--nav-height) + var(--section-pad));
  padding-bottom: var(--space-2xl);
  background:
    radial-gradient(ellipse at 80% 20%, rgba(212,160,67,0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 20% 80%, rgba(107,140,110,0.04) 0%, transparent 40%),
    var(--warm-white);
}
.library-hero .container {
  max-width: 800px;
  text-align: center;
}
.library-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: var(--text-xs); font-weight: 700;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--terracotta); margin-bottom: var(--space-md);
}
.library-eyebrow::before,
.library-eyebrow::after {
  content: ''; width: 20px; height: 1.5px;
  background: var(--terracotta); opacity: 0.5;
}
.library-hero h1 {
  font-family: 'Playfair Display', serif;
  font-size: var(--text-2xl);
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: var(--space-md);
}
.library-hero h1 em {
  font-style: italic; color: var(--terracotta);
}
.library-hero p {
  font-size: var(--text-base);
  color: var(--muted);
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto;
}

/* ── CONTROLS BAR ── */
.library-controls {
  position: sticky;
  top: var(--nav-height);
  z-index: 50;
  background: rgba(253,252,250,0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: var(--space-md) 0;
  transition: box-shadow 0.3s;
}
.library-controls.scrolled {
  box-shadow: 0 4px 20px rgba(26,26,24,0.06);
}
.controls-inner {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: 0 var(--page-pad);
}

/* Search + sort row */
.controls-top {
  display: flex;
  gap: var(--space-md);
  align-items: center;
  margin-bottom: var(--space-md);
}
.library-search-wrap {
  flex: 1;
  position: relative;
}
.library-search-icon {
  position: absolute;
  left: 14px; top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.library-search {
  width: 100%;
  padding: 0.7rem 1rem 0.7rem 2.6rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: var(--text-base);
  font-family: inherit;
  background: white;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}
.library-search:focus {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 3px rgba(196,103,58,0.1);
}
.library-search::placeholder { color: var(--muted); opacity: 0.7; }

.sort-select {
  padding: 0.7rem 2rem 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: var(--text-sm);
  font-family: inherit;
  background: white url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%238a8278' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  color: var(--ink);
  cursor: pointer;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  flex-shrink: 0;
}
.sort-select:focus {
  border-color: var(--terracotta);
}

/* Category filter pills */
.filter-row {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.filter-row::-webkit-scrollbar { display: none; }

.filter-pill {
  flex-shrink: 0;
  padding: 0.38rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--earth);
  background: white;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  font-family: inherit;
  outline: none;
}
.filter-pill:hover {
  border-color: var(--border-dark);
  background: var(--cream-light);
}
.filter-pill.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.filter-pill .pill-count {
  display: inline-block;
  margin-left: 4px;
  font-weight: 400;
  opacity: 0.6;
  font-size: 0.65rem;
}

/* ── RESULTS AREA ── */
.library-main {
  max-width: var(--max-width-wide);
  margin: 0 auto;
  padding: var(--space-xl) var(--page-pad) var(--section-pad);
}

.results-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-lg);
  font-size: var(--text-sm);
  color: var(--muted);
}
.results-count {
  font-weight: 500;
}
.results-count strong {
  color: var(--ink);
}
.clear-filters {
  font-size: var(--text-sm);
  color: var(--terracotta);
  font-weight: 600;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
  display: none;
  padding: 0;
}
.clear-filters:hover { text-decoration: underline; }
.clear-filters.visible { display: inline; }

/* Article grid */
.articles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

/* Article card (library version) */
.lib-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  transition: all 0.2s;
}
.lib-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 36px rgba(0,0,0,0.07);
  border-color: var(--border-dark);
}

.lib-card-color {
  height: 4px;
  width: 100%;
}

.lib-card-body {
  padding: 1.4rem 1.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.lib-card-tag {
  display: inline-block;
  background: var(--cream);
  color: var(--earth);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.55rem;
  border-radius: 100px;
  border: 1px solid var(--border);
  margin-bottom: 0.7rem;
  align-self: flex-start;
}

.lib-card-title {
  font-family: 'Playfair Display', serif;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.28;
  margin-bottom: 0.55rem;
  color: var(--ink);
}

.lib-card-desc {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lib-card-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.68rem;
  color: var(--muted);
  padding-top: 0.75rem;
  border-top: 1px solid var(--cream);
}
.lib-card-meta-dot {
  width: 3px; height: 3px;
  background: var(--border-dark);
  border-radius: 50%;
}
.lib-card-read {
  font-weight: 600;
  color: var(--terracotta);
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 3px;
}

/* No results */
.no-results {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--muted);
}
.no-results-icon {
  font-size: 2.5rem;
  margin-bottom: var(--space-md);
  opacity: 0.4;
}
.no-results h3 {
  font-family: 'Playfair Display', serif;
  font-size: var(--text-lg);
  color: var(--ink);
  margin-bottom: var(--space-sm);
}
.no-results p {
  font-size: var(--text-sm);
  max-width: 400px;
  margin: 0 auto;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .library-hero { padding-bottom: var(--space-xl); }
  .articles-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .controls-top { flex-direction: column; gap: 0.6rem; }
  .sort-select { width: 100%; }
  .results-meta { flex-direction: column; gap: 0.5rem; align-items: flex-start; }
}
@media (max-width: 480px) {
  .lib-card-body { padding: 1.1rem 1.2rem 1.2rem; }
  .lib-card-title { font-size: 1rem; }
}

/* Category color accents */
.cat-longevity    { background: linear-gradient(90deg, var(--terracotta), var(--amber)); }
.cat-exercise     { background: linear-gradient(90deg, #2d6a4f, var(--sage)); }
.cat-nutrition    { background: linear-gradient(90deg, var(--amber), #e8c060); }
.cat-supplements  { background: linear-gradient(90deg, #7b5ea7, #a78bcc); }
.cat-biomarkers   { background: linear-gradient(90deg, #2d5a8e, #5b8ab5); }
.cat-sleep        { background: linear-gradient(90deg, #3d4a7a, #6b78a8); }
.cat-epigenetics  { background: linear-gradient(90deg, #8b5e3c, var(--terracotta)); }
.cat-cellular     { background: linear-gradient(90deg, var(--sage), #a8c4a2); }
.cat-hormones     { background: linear-gradient(90deg, #9b2226, #c4503a); }
.cat-brain        { background: linear-gradient(90deg, #5c4a82, #8b6eb0); }
.cat-lifestyle    { background: linear-gradient(90deg, var(--earth), #8a7558); }
.cat-news         { background: linear-gradient(90deg, var(--ink), var(--amber)); }
.cat-default      { background: linear-gradient(90deg, var(--muted), var(--border-dark)); }
