/* ==========================================================================
   HasanWebs Category Archive — compact hero + article grid.
   Loaded only on is_category() (see functions.php), AFTER blog.css, so all
   .hwb-card / .hwb-eyebrow / pagination styling and the --hwb-* CSS
   variables are inherited from that shared stylesheet — nothing here is
   duplicated. Everything below is scoped under .hwb-cat-archive so it
   cannot leak into the Blog page, Search Results, single posts, Projects,
   Contact, the header, or the footer.
   ========================================================================== */

.hwb-cat-archive {
  background: var(--hwb-bg);
  color: var(--hwb-body);
  /* Reduce excessive whitespace before the footer, per spec: ~80px desktop. */
  padding-bottom: 80px;
}

/* Same Astra "boxed container on a blue page" fix already applied to the
   Blog page and Search Results, scoped here to category archives only. */
body.category.ast-separate-container,
body.tax-category.ast-separate-container {
  background: #FFFFFF;
}

body.category.ast-separate-container #primary,
body.category .ast-separate-container #primary,
body.tax-category.ast-separate-container #primary,
body.tax-category .ast-separate-container #primary {
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
  background: #FFFFFF;
}

body.category .site-content .ast-container {
  max-width: none;
  width: 100%;
}

/* --------------------------------- Hero ---------------------------------- */
/* Compact by design: eyebrow + H1 + short description + article count.
   No image, no large padding — this replaces Astra's oversized default
   category page-header. */

.hwb-cat-hero {
  background: var(--hwb-bg);
  padding: clamp(40px, 5vw, 56px) var(--hwb-gutter) clamp(28px, 3.5vw, 36px);
}

.hwb-cat-hero__inner {
  max-width: var(--hwb-max);
  margin: 0 auto;
  max-width: 760px;
}

.hwb-cat-hero__title {
  font-size: clamp(2rem, 3.6vw, 2.75rem);
  margin-bottom: 12px;
}

.hwb-cat-hero__desc {
  font-size: clamp(0.98rem, 1.3vw, 1.05rem);
  line-height: 1.7;
  color: var(--hwb-body);
  margin: 0 0 10px;
  max-width: 62ch;
}

.hwb-cat-hero__count {
  font-size: 0.84rem;
  color: var(--hwb-muted);
  font-weight: 600;
  margin: 0;
}

/* -------------------------------- Grid ------------------------------------ */

.hwb-cat-grid {
  max-width: var(--hwb-max);
  margin: 0 auto;
  padding: 0 var(--hwb-gutter);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(28px, 3vw, 32px);
}

/* Single-article categories: keep the one card at normal card width instead
   of stretching it across the full grid track. */
.hwb-cat-grid--single {
  grid-template-columns: minmax(0, 380px);
}

/* --------------------------- Card (category variant) ---------------------- */
/* Reuses .hwb-card / .hwb-card__media / .hwb-card__body / .hwb-card__title /
   .hwb-card__excerpt / .hwb-card__meta from blog.css almost as-is. The whole
   card is an <a>, so only the parts that differ from the shared component
   are overridden here: the category label becomes plain text (no nested
   link is valid inside an <a>), and a "Read article" hint is added. */

a.hwb-card--category {
  display: flex;
}

a.hwb-card--category:hover .hwb-card__title {
  color: var(--hwb-accent-ink);
}

.hwb-card--category .hwb-card__cat {
  cursor: default;
}

.hwb-card--category .hwb-card__read-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--hwb-accent-ink);
}

.hwb-card--category .hwb-card__read-more svg {
  transition: transform 0.2s ease;
}

a.hwb-card--category:hover .hwb-card__read-more svg {
  transform: translateX(3px);
}

/* ---------------------------------- Empty --------------------------------- */

.hwb-cat-empty {
  max-width: var(--hwb-max);
  margin: 0 auto;
  padding: 0 var(--hwb-gutter);
}

/* -------------------------------- Pagination ------------------------------ */

.hwb-cat-archive .hwb-pagination {
  max-width: var(--hwb-max);
  margin: 40px auto 0;
  padding: 0 var(--hwb-gutter);
}

/* -------------------------------- RTL ------------------------------------- */

html[dir="rtl"] .hwb-cat-hero__inner { text-align: right; }
html[dir="rtl"] .hwb-card--category .hwb-card__read-more svg { transform: scaleX(-1); }
html[dir="rtl"] a.hwb-card--category:hover .hwb-card__read-more svg { transform: scaleX(-1) translateX(3px); }

/* ------------------------------- Tablet (≤1024px) ------------------------ */

@media (max-width: 1024px) {
  .hwb-cat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .hwb-cat-grid--single {
    grid-template-columns: minmax(0, 380px);
  }
}

/* -------------------------------- Mobile (≤640px) -------------------------- */

@media (max-width: 640px) {
  .hwb-cat-archive {
    padding-bottom: 64px;
  }
  .hwb-cat-hero {
    padding: 32px 20px 24px;
  }
  .hwb-cat-hero__title {
    font-size: 2rem;
  }
  .hwb-cat-grid {
    grid-template-columns: 1fr;
    gap: 22px;
  }
  .hwb-cat-grid--single {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ------------------------------ Focus states -------------------------------- */

a.hwb-card--category:focus-visible {
  outline: 2px solid var(--hwb-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .hwb-cat-archive * { transition: none !important; }
}
