/* ==========================================================================
   Love Counter — blog.css
   Blog listing cards, featured post, category nav, pagination, article layout.
   ========================================================================== */

#blog-grid .card[hidden] { display: none !important; }

/* Category filter */
.blog-cats { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: var(--space-6); }
.blog-cats__btn {
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--rose-deep);
  border-radius: var(--radius-pill);
  padding: 0.45rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font-body);
  text-decoration: none;
  cursor: pointer;
  transition: all var(--dur) var(--ease);
}
.blog-cats__btn:hover { border-color: var(--rose); color: var(--wine); }
.blog-cats__btn.is-active { background: var(--plum); color: var(--white); border-color: var(--plum); }

/* Featured post */
.blog-featured {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 0;
  align-items: stretch;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin-bottom: var(--space-7);
}
.blog-featured__media { background: var(--rose-mist); min-height: 260px; }
.blog-featured__media img { width: 100%; height: 100%; object-fit: cover; }
.blog-featured__body {
  padding: clamp(1.5rem, 3vw, 2.5rem);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.5rem;
}
.blog-featured__body h2 { font-size: var(--fs-h3); margin: 0.2rem 0; }
/* .card__meta pushes itself down with margin-top:auto inside grid cards;
   in this centred column that auto margin tears the block apart. */
.blog-featured__body .card__meta { margin-top: 0; padding-top: 0; }
.blog-featured__body h2 a { color: var(--plum); text-decoration: none; }
.blog-featured__body h2 a:hover { color: var(--rose-deep); }
.blog-featured__body p { color: var(--text-muted); }

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.4rem;
  margin-top: var(--space-7);
  flex-wrap: wrap;
}
.pagination a, .pagination span {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  padding: 0 0.75rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--white);
  color: var(--rose-deep);
  text-decoration: none;
  font-weight: 600;
  transition: all var(--dur) var(--ease);
}
.pagination a:hover { border-color: var(--rose); color: var(--wine); }
.pagination .is-current {
  background: var(--plum);
  color: var(--white);
  border-color: var(--plum);
}
.pagination .is-disabled {
  opacity: 0.4;
  pointer-events: none;
}
.pagination svg { width: 18px; height: 18px; }

#blog-empty { text-align: center; padding: 2rem; color: var(--text-muted); }

/* ---------- Article layout ---------- */
.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: transparent;
  z-index: 200;
}
.read-progress__fill {
  display: block;
  height: 100%;
  width: 100%;
  transform: scaleX(0);
  transform-origin: 0 50%;
  background: linear-gradient(90deg, var(--rose), var(--wine));
}

.article { padding-block: clamp(1.5rem, 4vw, 3rem) clamp(3rem, 6vw, 5rem); }
.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}
.article-main { min-width: 0; }
/* The sidebar column must fill the row height, otherwise the sticky TOC
   inside it has no track to travel along and never actually sticks. */
.article-layout > aside {
  align-self: stretch;
  min-width: 0;
}
.article__header { margin-bottom: 1.5rem; }
.article__title { font-size: var(--fs-h1); margin: 0.6rem 0; }
.article__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.article__hero-media {
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1.75rem;
  box-shadow: var(--shadow-md);
  aspect-ratio: 16 / 9;
}
.article__hero-media img { width: 100%; height: 100%; object-fit: cover; }

.article__body { font-size: 1.02rem; line-height: 1.75; }
.article__body > * { max-width: 100%; }
.article__body p { margin-bottom: 1.1rem; color: var(--ink); max-width: none; }
.article__body h2 {
  font-size: var(--fs-h3);
  margin: 2.5rem 0 0.85rem;
  scroll-margin-top: calc(var(--header-h) + 1.25rem);
}
.article__body h3 { font-size: 1.2rem; margin: 1.5rem 0 0.6rem; scroll-margin-top: calc(var(--header-h) + 1.25rem); }
.article__body > :first-child { margin-top: 0; }
.article__body ul, .article__body ol { margin-bottom: 1.1rem; padding-left: 1.4rem; }
.article__body li { margin-bottom: 0.4rem; }
.article__body a { color: var(--rose-deep); font-weight: 500; }
.article__body blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.35rem;
  border-left: 4px solid var(--rose);
  background: var(--rose-soft);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--plum);
}
.article__body blockquote p { margin: 0; }

.callout {
  padding: 1.35rem 1.5rem;
  border-radius: var(--radius-md);
  margin: 1.75rem 0;
  border: 1px solid var(--border);
}
.callout h2 { margin-top: 0 !important; font-size: 1.2rem !important; }
.callout--info { background: var(--rose-soft); border-left: 4px solid var(--rose); }
.callout ul { margin-bottom: 0; }
.callout li { color: var(--ink); }

.formula {
  background: var(--plum);
  color: var(--white);
  padding: 1rem 1.35rem;
  border-radius: var(--radius-sm);
  margin: 1.35rem 0;
  text-align: center;
  font-size: 1.05rem;
}
.formula strong { color: var(--rose); }

.article__cta {
  margin: 2.5rem 0;
  padding: 2rem 1.75rem;
  text-align: center;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--rose-soft), var(--rose-mist));
  border: 1px solid var(--border);
}
.article__cta h3 { font-size: var(--fs-h4); margin-bottom: 0.4rem; }
.article__cta p { margin-inline: auto; margin-bottom: 1.25rem; color: var(--text-muted); }
.article__body .article__cta .btn--primary,
.article__body .article__cta .btn--primary:visited,
.article__body .article__cta .btn--primary:hover {
  color: var(--white);
}

/* Sidebar TOC — follows the reader down the article */
.side-toc {
  position: sticky;
  top: calc(var(--header-h) + 1.25rem);
  max-height: calc(100vh - var(--header-h) - 2.5rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.35rem;
  border-radius: var(--radius-md);
  background: var(--white);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.side-toc h2 {
  font-family: var(--font-body);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--rose-deep);
  margin-bottom: 0.85rem;
}
.side-toc ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.side-toc a {
  display: block;
  padding: 0.35rem 0.6rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  border-left: 2px solid transparent;
  transition: all var(--dur) var(--ease);
}
.side-toc a:hover { color: var(--rose-deep); background: var(--rose-soft); }
.side-toc a.is-current {
  color: var(--rose-deep);
  background: var(--rose-soft);
  border-left-color: var(--rose);
  font-weight: 600;
}

/* Related posts */
.related-posts { margin-top: 3rem; }
.related-posts h2 { text-align: center; margin-bottom: 1.5rem; }

/* Author box */
.author-box {
  display: flex;
  gap: 1rem;
  align-items: center;
  padding: 1.35rem;
  border-radius: var(--radius-md);
  background: var(--white);
  border: 1px solid var(--border);
  margin-top: 2.5rem;
}
.author-box__avatar {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rose), var(--wine));
  color: var(--white);
  flex: none;
}
.author-box__avatar svg { width: 28px; height: 28px; }
.author-box__name { font-family: var(--font-display); font-weight: 700; color: var(--plum); }
.author-box__bio { font-size: 0.88rem; color: var(--text-muted); margin: 0; }

@media (max-width: 900px) {
  .article-layout { grid-template-columns: 1fr; }
  /* Hide the whole column, not just the TOC — an empty grid item still
     costs a row gap below the article. */
  .article-layout > aside { display: none; }
  .blog-featured { grid-template-columns: 1fr; }
  .blog-featured__media { min-height: 220px; }
}
