/* ═══════════════════════════════════════════════════════════════════
   articles.css — Article listing page styles
   jules.buddocloud.com/articles.html
   Depends on: main.css (tokens, reset, shared components)
   ═══════════════════════════════════════════════════════════════════ */

/* ── PAGE HEADER ─────────────────────────────────────────────────── */

.articles-page-header {
  padding: clamp(3rem, 6vw, 5rem) 0 clamp(1.5rem, 3vw, 2.5rem);
  border-bottom: 1px solid var(--border);
}

.articles-header-inner {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.articles-page-title {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 800;
  line-height: var(--leading-display);
  letter-spacing: var(--tracking-display);
  color: var(--text-emphasis);
  margin: 0;
  text-wrap: balance;
}

.articles-page-count {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin: 0;
}

#article-count {
  color: var(--red-primary);
  font-weight: var(--weight-semibold);
}

/* ── FILTER BAR ───────────────────────────────────────────────────── */

.filter-bar-wrap {
  position: sticky;
  top: var(--nav-height);
  z-index: 50;
  background: rgba(20, 20, 23, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: var(--space-2) 0;
  overflow-x: auto;
  scrollbar-width: none; /* Firefox */
  -ms-overflow-style: none; /* IE */
}

.filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 1rem;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-secondary);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition:
    color var(--anim-hover),
    background var(--anim-hover),
    border-color var(--anim-hover),
    box-shadow var(--anim-hover);
  white-space: nowrap;
}

.filter-btn:hover {
  color: var(--text-primary);
  background: var(--bg-highlight);
  border-color: var(--red-primary);
}

.filter-btn:focus-visible {
  outline: 2px solid var(--red-primary);
  outline-offset: 2px;
}

.filter-btn.active {
  color: #fff;
  background: var(--red-primary);
  border-color: var(--red-primary);
  font-weight: var(--weight-semibold);
}

.filter-btn.active:hover {
  background: var(--red-bright);
  border-color: var(--red-bright);
}

/* ── ARTICLE MAIN / GRID ─────────────────────────────────────────── */

.articles-main {
  padding-top: clamp(2rem, 4vw, 3.5rem);
  padding-bottom: clamp(4rem, 8vw, 7rem);
}

.article-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-8);
}

@media (min-width: 640px) {
  .article-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .article-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── ARTICLE CARD ────────────────────────────────────────────────── */

.article-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition:
    transform var(--dur-base) var(--ease-out-expo),
    border-color var(--dur-base) var(--ease-out-expo),
    box-shadow var(--dur-base) var(--ease-out-expo);
}

.article-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-2);
  box-shadow: var(--shadow-lg), 0 0 0 1px var(--border-2);
}

/* Card image */
.card__img-link {
  display: block;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
}

.card__img-wrap {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-slow) var(--ease-out-expo);
}

.article-card:hover .card__img {
  transform: scale(1.04);
}

/* Image placeholder (until real images provided) */
.card__img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  transition: transform var(--dur-slow) var(--ease-out-expo);
}

.article-card:hover .card__img-placeholder {
  transform: scale(1.04);
}

/* Placeholder colors match category palette */
.card__img-placeholder--empire-resistance  { background: linear-gradient(135deg, #2A0A0A 0%, #1A0505 100%); }
.card__img-placeholder--us-politics        { background: linear-gradient(135deg, #0A1020 0%, #050A18 100%); }
.card__img-placeholder--borders-migration  { background: linear-gradient(135deg, #2A1200 0%, #1A0900 100%); }
.card__img-placeholder--class-labor        { background: linear-gradient(135deg, #280808 0%, #180303 100%); }
.card__img-placeholder--animal-liberation  { background: linear-gradient(135deg, #081A10 0%, #041008 100%); }
.card__img-placeholder--ecology-capital    { background: linear-gradient(135deg, #061A18 0%, #031010 100%); }
.card__img-placeholder--culture-commodity  { background: linear-gradient(135deg, #180A24 0%, #0E0518 100%); }
.card__img-placeholder--theory-method      { background: linear-gradient(135deg, #0F1218 0%, #080A0E 100%); }

/* Card body */
.card__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: var(--space-3);
  gap: var(--space-2);
}

/* Category badge */
.card__category {
  align-self: flex-start;
  text-decoration: none;
}

/* Headline */
.card__headline {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  line-height: var(--leading-headline);
  letter-spacing: var(--tracking-display);
  margin: 0;
  text-wrap: balance;
}

.card__headline a {
  color: var(--text-emphasis);
  text-decoration: none;
  transition: color var(--anim-hover);
}

.card__headline a:hover {
  color: var(--red-primary);
}

/* Excerpt */
.card__excerpt {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  color: var(--text-secondary);
  margin: 0;
  /* 2-line clamp */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

/* Meta row */
.card__meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  color: var(--text-faint);
  margin-top: auto;
  padding-top: var(--space-2);
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
}

.card__sep { color: var(--border-2); }

.card__date,
.card__author,
.card__readtime { color: var(--text-faint); }

/* Compact card variant (used in related articles) */
.article-card--compact .card__excerpt { display: none; }
.article-card--compact .card__headline { font-size: var(--text-base); }
.article-card--compact .card__body { padding: var(--space-2); gap: var(--space-1); }

/* ── CATEGORY BADGES ─────────────────────────────────────────────── */

.cat-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  border-radius: var(--radius-full);
  text-decoration: none;
  transition: opacity var(--anim-hover);
  white-space: nowrap;
}

.cat-badge:hover { opacity: 0.82; }

/* Per-category colors */
.cat-badge--empire-resistance  { background: rgba(192, 57, 43, 0.15);  color: #E05A4A;  border: 1px solid rgba(192, 57, 43, 0.3); }
.cat-badge--us-politics        { background: rgba(26, 58, 92, 0.25);   color: #5B8AB8;  border: 1px solid rgba(26, 58, 92, 0.5); }
.cat-badge--borders-migration  { background: rgba(211, 84, 0, 0.15);   color: #E87830;  border: 1px solid rgba(211, 84, 0, 0.3); }
.cat-badge--class-labor        { background: rgba(231, 76, 60, 0.15);  color: #F06B55;  border: 1px solid rgba(231, 76, 60, 0.3); }
.cat-badge--animal-liberation  { background: rgba(25, 111, 61, 0.18);  color: #3DAA6A;  border: 1px solid rgba(25, 111, 61, 0.35); }
.cat-badge--ecology-capital    { background: rgba(20, 143, 119, 0.15); color: #30C4A8;  border: 1px solid rgba(20, 143, 119, 0.3); }
.cat-badge--culture-commodity  { background: rgba(108, 52, 131, 0.18); color: #B070D8;  border: 1px solid rgba(108, 52, 131, 0.35); }
.cat-badge--theory-method      { background: rgba(52, 73, 94, 0.25);   color: #8AA8C4;  border: 1px solid rgba(52, 73, 94, 0.5); }

/* ── EMPTY STATE ─────────────────────────────────────────────────── */

.articles-empty {
  display: none; /* JS overrides to flex when visible */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(3rem, 8vw, 6rem) var(--space-4);
  border: 1px dashed var(--border-2);
  border-radius: var(--radius-lg);
  margin: var(--space-4) 0;
}

.articles-empty[style*="display: flex"],
.articles-empty:not([hidden]) {
  display: flex;
}

.articles-empty__title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
}

.articles-empty__desc {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin: 0 0 var(--space-4);
  max-width: 28rem;
  line-height: var(--leading-body);
}

.articles-empty__reset {
  padding: 0.65rem 1.75rem;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: #fff;
  background: var(--red-primary);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--anim-hover);
}

.articles-empty__reset:hover { background: var(--red-bright); }

/* ── SHOW MORE / PAGINATION ──────────────────────────────────────── */

.articles-pagination {
  display: flex;
  justify-content: center;
  padding: var(--space-4) 0;
}

.show-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 2.5rem;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-ui);
  color: var(--text-primary);
  background: transparent;
  border: 1.5px solid var(--border-2);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition:
    color var(--anim-hover),
    border-color var(--anim-hover),
    background var(--anim-hover),
    transform var(--anim-hover);
  position: relative;
}

.show-more-btn:hover {
  color: var(--red-primary);
  border-color: var(--red-primary);
  transform: translateY(-1px);
}

.show-more-btn:focus-visible {
  outline: 2px solid var(--red-primary);
  outline-offset: 3px;
}

.show-more-btn[hidden] { display: none; }

.show-more-btn__count {
  font-size: var(--text-xs);
  color: var(--text-faint);
  font-weight: var(--weight-regular);
}

/* ── SCROLL REVEAL STATES ────────────────────────────────────────── */

.js-enabled [data-reveal] {
  opacity: 0;
  transform: translateY(32px);
}

.js-enabled [data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.55s var(--ease-out-expo),
    transform 0.55s var(--ease-out-expo);
}

/* Stagger delays for grid cards */
.article-grid .article-card:nth-child(3n+2) { transition-delay: 0.08s; }
.article-grid .article-card:nth-child(3n+3) { transition-delay: 0.16s; }

@media (prefers-reduced-motion: reduce) {
  .js-enabled [data-reveal] {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
