/*
 * Health Blog – Archive & Single Post Styles
 * Hello Elementor Child Theme
 * Color: #2E5442
 */

/* ─────────────────────────────────────────
   GOOGLE FONTS
───────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@0;1&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ─────────────────────────────────────────
   CSS VARIABLES
───────────────────────────────────────── */
:root {
  --hb-primary:        #2E5442;
  --hb-primary-light:  #3d7059;
  --hb-primary-pale:   #eef4f1;
  --hb-accent:         #5aab7e;
  --hb-text:           #1a1a2e;
  --hb-text-muted:     #6b7280;
  --hb-bg:             #f8faf9;
  --hb-white:          #ffffff;
  --hb-border:         #e2eae6;
  --hb-radius-sm:      6px;
  --hb-radius-md:      14px;
  --hb-radius-lg:      20px;
  --hb-shadow-sm:      0 2px 8px rgba(46,84,66,.08);
  --hb-shadow-md:      0 8px 32px rgba(46,84,66,.14);
  --hb-shadow-hover:   0 16px 48px rgba(46,84,66,.20);
  --hb-font-display:   'DM Serif Display', Georgia, serif;
  --hb-font-body:      'Plus Jakarta Sans', sans-serif;
  --hb-max-width:      1200px;
  --hb-gutter:         clamp(16px, 4vw, 48px);
}

/* ─────────────────────────────────────────
   GLOBAL RESETS & BASE
───────────────────────────────────────── */
.hb-archive-wrap,
.hb-single-wrap {
  font-family: var(--hb-font-body);
  color: var(--hb-text);
  background: var(--hb-bg);
  min-height: 60vh;
}

.hb-archive-wrap *,
.hb-single-wrap * {
  box-sizing: border-box;
}

/* ─────────────────────────────────────────
   BADGE
───────────────────────────────────────── */
.hb-badge {
  display: inline-block;
  background: var(--hb-white);
  border: 1.5px solid var(--hb-border);
  color: var(--hb-primary);
  font-family: var(--hb-font-body);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 6px 18px;
  border-radius: 50px;
  margin-bottom: 20px;
}

.hb-badge--sm {
  font-size: 11px;
  padding: 4px 12px;
  margin-bottom: 12px;
}

/* ─────────────────────────────────────────
   HERO / ARCHIVE HEADER
───────────────────────────────────────── */
.hb-hero {
  text-align: center;
  padding: clamp(48px, 8vw, 96px) var(--hb-gutter) clamp(32px, 5vw, 56px);
  background: var(--hb-white);
  border-bottom: 1px solid var(--hb-border);
}

.hb-hero__title {
  font-family: var(--hb-font-display);
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 400;
  line-height: 1.15;
  color: var(--hb-text);
  margin: 0 0 14px;
  letter-spacing: -.01em;
}

.hb-accent {
  color: var(--hb-accent);
}

.hb-hero__sub {
  font-size: clamp(15px, 1.8vw, 17px);
  color: var(--hb-text-muted);
  margin: 0 0 36px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

/* ─────────────────────────────────────────
   FILTER TABS
───────────────────────────────────────── */
.hb-filter-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}

.hb-filter-wrap::-webkit-scrollbar { display: none; }

.hb-filter-tabs {
  display: inline-flex;
  gap: 10px;
  white-space: nowrap;
  padding: 0 4px;
}

.hb-tab {
  font-family: var(--hb-font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 22px;
  border-radius: 50px;
  border: 1.5px solid var(--hb-border);
  background: var(--hb-white);
  color: var(--hb-text-muted);
  cursor: pointer;
  transition: all .22s ease;
  white-space: nowrap;
}

.hb-tab:hover {
  border-color: var(--hb-primary);
  color: var(--hb-primary);
}

.hb-tab.active {
  background: var(--hb-primary);
  border-color: var(--hb-primary);
  color: var(--hb-white);
  box-shadow: 0 4px 14px rgba(46,84,66,.30);
}

/* ─────────────────────────────────────────
   GRID SECTION
───────────────────────────────────────── */
.hb-grid-section {
  max-width: var(--hb-max-width);
  margin: 0 auto;
  padding: clamp(32px, 5vw, 64px) var(--hb-gutter);
}

/* ─────────────────────────────────────────
   BLOG GRID
───────────────────────────────────────── */
.hb-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-bottom: 48px;
}

.hb-grid--related {
  margin-bottom: 0;
}

@media (max-width: 900px) {
  .hb-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 560px) {
  .hb-grid { grid-template-columns: 1fr; gap: 20px; }
}

/* ─────────────────────────────────────────
   BLOG CARD
───────────────────────────────────────── */
.hb-card {
  background: var(--hb-white);
  border-radius: var(--hb-radius-lg);
  overflow: hidden;
  box-shadow: var(--hb-shadow-sm);
  border: 1px solid var(--hb-border);
  transition: transform .28s cubic-bezier(.25,.46,.45,.94),
              box-shadow .28s cubic-bezier(.25,.46,.45,.94);
  /* animate in */
  opacity: 0;
  transform: translateY(20px);
  animation: hbCardIn .45s ease forwards;
}

.hb-card:nth-child(1) { animation-delay: .05s; }
.hb-card:nth-child(2) { animation-delay: .12s; }
.hb-card:nth-child(3) { animation-delay: .19s; }
.hb-card:nth-child(4) { animation-delay: .05s; }
.hb-card:nth-child(5) { animation-delay: .12s; }
.hb-card:nth-child(6) { animation-delay: .19s; }

@keyframes hbCardIn {
  to { opacity: 1; transform: translateY(0); }
}

.hb-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--hb-shadow-hover);
}

.hb-card__link {
  display: block;
  text-decoration: none;
  color: inherit;
}

/* Card Image */
.hb-card__img-wrap {
  position: relative;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--hb-primary-pale);
}

.hb-card__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .5s cubic-bezier(.25,.46,.45,.94);
}

.hb-card:hover .hb-card__img {
  transform: scale(1.06);
}

.hb-card__img--placeholder {
  background: linear-gradient(135deg, var(--hb-primary-pale) 0%, #d0e6da 100%);
}

/* Category Badge on Image */
.hb-card__badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--hb-primary);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 5px 12px;
  border-radius: 50px;
  border: 1px solid rgba(46,84,66,.15);
}

/* Card Body */
.hb-card__body {
  padding: 18px 20px 22px;
}

.hb-card__date {
  display: block;
  font-size: 12px;
  color: var(--hb-text-muted);
  font-weight: 500;
  margin-bottom: 8px;
  letter-spacing: .02em;
}

.hb-card__title {
  font-family: var(--hb-font-display);
  font-size: clamp(16px, 1.8vw, 20px);
  font-weight: 400;
  line-height: 1.35;
  color: var(--hb-text);
  margin: 0;
  transition: color .2s ease;
}

.hb-card:hover .hb-card__title {
  color: var(--hb-primary);
}

/* ─────────────────────────────────────────
   LOADER
───────────────────────────────────────── */
.hb-loader {
  display: flex;
  justify-content: center;
  padding: 40px 0;
}

.hb-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--hb-border);
  border-top-color: var(--hb-primary);
  border-radius: 50%;
  animation: hbSpin .7s linear infinite;
}

@keyframes hbSpin { to { transform: rotate(360deg); } }

/* ─────────────────────────────────────────
   NO RESULTS
───────────────────────────────────────── */
.hb-no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--hb-text-muted);
  font-size: 16px;
}

/* ─────────────────────────────────────────
   PAGINATION
───────────────────────────────────────── */
.hb-pagination { display: flex; justify-content: center; }

.hb-pagination .page-numbers {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  list-style: none;
  margin: 0;
  padding: 0;
  justify-content: center;
}

.hb-pagination .page-numbers li { margin: 0; }

.hb-pagination a.page-numbers,
.hb-pagination span.page-numbers {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 42px;
  padding: 0 14px;
  border-radius: 50px;
  font-family: var(--hb-font-body);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  border: 1.5px solid var(--hb-border);
  color: var(--hb-text-muted);
  background: var(--hb-white);
  transition: all .2s ease;
}

.hb-pagination a.page-numbers:hover {
  border-color: var(--hb-primary);
  color: var(--hb-primary);
}

.hb-pagination .current {
  background: var(--hb-primary) !important;
  border-color: var(--hb-primary) !important;
  color: var(--hb-white) !important;
}

/* ─────────────────────────────────────────
   ── SINGLE POST ──
───────────────────────────────────────── */
.hb-single-wrap {
  max-width: 800px;
  margin: 0 auto;
  padding: clamp(40px, 7vw, 80px) var(--hb-gutter);
}

.hb-single__header {
  text-align: center;
  margin-bottom: 32px;
}

.hb-single__date {
  display: block;
  font-size: 13px;
  color: var(--hb-text-muted);
  font-weight: 500;
  letter-spacing: .04em;
  margin-bottom: 14px;
}

.hb-single__title {
  font-family: var(--hb-font-display);
  font-size: clamp(28px, 4.5vw, 48px);
  font-weight: 400;
  line-height: 1.18;
  color: var(--hb-text);
  margin: 0 auto;
  max-width: 720px;
  letter-spacing: -.015em;
}

/* Featured Image */
.hb-single__hero-img {
  border-radius: var(--hb-radius-lg);
  overflow: hidden;
  margin-bottom: 48px;
  box-shadow: var(--hb-shadow-md);
  aspect-ratio: 16/9;
}

.hb-single__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─────────────────────────────────────────
   PROSE (Post Content)
───────────────────────────────────────── */
.hb-prose {
  font-size: clamp(16px, 1.5vw, 18px);
  line-height: 1.78;
  color: #2d3748;
}

.hb-prose h2,
.hb-prose h3,
.hb-prose h4 {
  font-family: var(--hb-font-display);
  font-weight: 400;
  color: var(--hb-text);
  line-height: 1.3;
  margin: 2em 0 .75em;
}

.hb-prose h2 { font-size: clamp(22px, 2.5vw, 30px); }
.hb-prose h3 { font-size: clamp(18px, 2vw, 24px); }

.hb-prose p { margin: 0 0 1.5em; }

.hb-prose a {
  color: var(--hb-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.hb-prose ul,
.hb-prose ol {
  margin: 0 0 1.5em 1.5em;
}

.hb-prose li { margin-bottom: .5em; }

.hb-prose blockquote {
  margin: 2em 0;
  padding: 20px 28px;
  border-left: 4px solid var(--hb-primary);
  background: var(--hb-primary-pale);
  border-radius: 0 var(--hb-radius-md) var(--hb-radius-md) 0;
  font-style: italic;
  color: var(--hb-primary);
}

.hb-prose img {
  max-width: 100%;
  border-radius: var(--hb-radius-md);
  margin: 1.5em 0;
}

.hb-prose code {
  font-size: .875em;
  background: var(--hb-primary-pale);
  color: var(--hb-primary);
  padding: 2px 7px;
  border-radius: var(--hb-radius-sm);
}

/* ─────────────────────────────────────────
   POST META FOOTER (tags + share)
───────────────────────────────────────── */
.hb-single__meta-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 48px;
  padding-top: 28px;
  border-top: 1px solid var(--hb-border);
}

.hb-tags {
  font-size: 13px;
  color: var(--hb-text-muted);
}

.hb-tags a {
  color: var(--hb-primary);
  text-decoration: none;
  font-weight: 600;
}

.hb-share {
  display: flex;
  align-items: center;
  gap: 10px;
}

.hb-share__label {
  font-size: 13px;
  color: var(--hb-text-muted);
  font-weight: 600;
}

.hb-share__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--hb-primary-pale);
  color: var(--hb-primary);
  border: 1px solid var(--hb-border);
  transition: all .2s ease;
  text-decoration: none;
}

.hb-share__btn:hover {
  background: var(--hb-primary);
  color: var(--hb-white);
  border-color: var(--hb-primary);
  transform: translateY(-2px);
}

/* ─────────────────────────────────────────
   RELATED POSTS
───────────────────────────────────────── */
.hb-related {
  max-width: var(--hb-max-width);
  margin: 0 auto;
  padding: clamp(48px, 6vw, 80px) var(--hb-gutter);
  background: var(--hb-white);
  border-top: 1px solid var(--hb-border);
}

/* When used inside single-wrap, expand full width */
.hb-single-wrap ~ * { max-width: 100%; }

/* Related section needs wider container */
.hb-single-wrap .hb-related {
  max-width: none;
  margin: 64px calc(var(--hb-gutter) * -1) 0;
  padding: clamp(40px, 5vw, 64px) var(--hb-gutter);
  border-radius: 0;
}

.hb-related__header {
  margin-bottom: 32px;
}

.hb-related__title {
  font-family: var(--hb-font-display);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 400;
  color: var(--hb-text);
  margin: 0;
}

/* ─────────────────────────────────────────
   RESPONSIVE OVERRIDES
───────────────────────────────────────── */
@media (max-width: 768px) {
  .hb-single-wrap {
    padding-top: 40px;
  }

  .hb-single__meta-footer {
    flex-direction: column;
    align-items: flex-start;
  }

  .hb-filter-tabs {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 480px) {
  .hb-hero {
    padding-left: 20px;
    padding-right: 20px;
  }
}

/* ─────────────────────────────────────────
   TRANSITION for AJAX filter
───────────────────────────────────────── */
.hb-grid.hb-fade-out {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .2s ease, transform .2s ease;
}

.hb-grid.hb-fade-in {
  opacity: 1;
  transform: translateY(0);
  transition: opacity .3s ease, transform .3s ease;
}