/* ==========================================================================
   PNG To DDS — blog.css
   Blog listing, featured post, category filter, pagination, article layout.
   ========================================================================== */

/* ----- Featured post ----- */
.blog-featured {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: var(--space-6);
  align-items: center;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  margin-bottom: var(--space-6);
}
.blog-featured__media { aspect-ratio: 16 / 10; overflow: hidden; background: var(--slate-100); }
.blog-featured__media img { width: 100%; height: 100%; object-fit: cover; }
.blog-featured__body { padding: var(--space-6); display: flex; flex-direction: column; gap: 0.7rem; }
.blog-featured__body > .btn,
.blog-featured__body > .chip {
  width: auto;
  align-self: flex-start;
}
.card__body > .chip {
  width: auto;
  align-self: flex-start;
}
.blog-featured__body h2 { font-size: var(--fs-h3); }
.blog-featured__body h2 a { color: var(--text-heading); text-decoration: none; }
.blog-featured__body h2 a:hover {
  color: var(--red-deep);
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
}
.blog-featured__body p { color: var(--text-muted); font-size: 0.96rem; }
@media (max-width: 800px) { .blog-featured { grid-template-columns: 1fr; } }

/* ----- Category filter ----- */
.blog-cats { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: var(--space-6); }
.blog-cats__btn {
  width: auto;
  flex: 0 0 auto;
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--white);
  font-family: var(--font-display); font-weight: 500; font-size: 0.9rem;
  color: var(--slate-700);
  transition: all var(--dur) var(--ease);
}
.blog-cats__btn:hover { border-color: var(--ink); }
.blog-cats__btn.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ----- Pagination ----- */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 0.4rem;
  margin-top: var(--space-8);
}
.pagination a, .pagination span {
  min-width: 42px; height: 42px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--white); color: var(--slate-700);
  text-decoration: none; font-family: var(--font-display); font-weight: 500;
  transition: all var(--dur) var(--ease);
}
.pagination a:hover {
  border-color: var(--ink);
  background: var(--slate-100);
  color: var(--ink);
  text-decoration: none;
}
.pagination a svg, .pagination span svg { width: 18px; height: 18px; }
.pagination .is-current { background: var(--red); color: #fff; border-color: var(--red); }
.pagination .is-disabled { opacity: 0.4; cursor: not-allowed; }

/* ----- Article layout ----- */
.article { padding-block: var(--space-6) var(--space-8); }
.article-layout { display: grid; grid-template-columns: 1fr 260px; gap: var(--space-8); align-items: start; }
.article-main { min-width: 0; }
.article__header { margin-bottom: var(--space-5); }
.article__title { font-size: var(--fs-h1); margin: var(--space-3) 0; }
.article__meta {
  display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center;
  font-size: var(--fs-small); color: var(--text-muted); font-family: var(--font-mono);
}
.article__hero-media { border-radius: var(--radius-lg); overflow: hidden; margin-bottom: var(--space-6); box-shadow: var(--shadow-md); }
.article__hero-media img { width: 100%; height: auto; }

.article__body { font-size: 1.03rem; }
.article__body > * { max-width: 72ch; }
.article__body h2 { font-size: var(--fs-h3); margin-top: var(--space-7); margin-bottom: var(--space-3); scroll-margin-top: calc(var(--header-h) + 1.5rem); }
.article__body h3 { font-size: var(--fs-h4); margin-top: var(--space-5); margin-bottom: var(--space-2); }
.article__body p { margin-bottom: var(--space-4); color: var(--slate-700); }
.article__body ul, .article__body ol { margin-bottom: var(--space-4); padding-left: 1.4rem; }
.article__body li { margin-bottom: 0.45rem; }
.article__body a { color: var(--red-deep); font-weight: 500; }
.article__body a:hover {
  color: var(--ink);
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
}
.article__body strong { color: var(--text-heading); }
.article__body blockquote {
  margin: var(--space-5) 0; padding: var(--space-4) var(--space-5);
  border-left: 4px solid var(--red); background: var(--red-soft);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic; color: var(--slate-800);
}
.article__body blockquote p { margin: 0; max-width: none; }
.article__callout {
  margin: var(--space-5) 0; padding: var(--space-5);
  background: var(--slate-100); border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.article__callout h3 { margin-top: 0; }
.article__body figure { margin: var(--space-5) 0; }
.article__body figure img { border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.article__body figcaption { font-size: var(--fs-small); color: var(--text-muted); margin-top: 0.5rem; text-align: center; }

/* Data table in article */
.article__body table { width: 100%; border-collapse: collapse; margin: var(--space-5) 0; font-size: 0.94rem; }
.article__body th, .article__body td { padding: 0.7rem 0.9rem; border: 1px solid var(--border); text-align: left; }
.article__body thead th { background: var(--slate-100); font-family: var(--font-display); }

/* ----- Sidebar TOC ----- */
.article-side { position: sticky; top: calc(var(--header-h) + 1.5rem); }
.side-toc {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: var(--space-5);
}
.side-toc__title { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin-bottom: var(--space-3); }
.side-toc ul { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 0.2rem; }
.side-toc a {
  display: block; padding: 0.4rem 0.6rem; border-radius: var(--radius-sm);
  color: var(--slate-500); text-decoration: none; font-size: 0.88rem;
  border-left: 2px solid transparent;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.side-toc a:hover {
  color: var(--ink);
  background: var(--slate-100);
  border-left-color: var(--slate-400);
  text-decoration: none;
}
.side-toc a.is-current { color: var(--red-deep); border-left-color: var(--red); font-weight: 500; }

@media (max-width: 960px) {
  .article-layout { grid-template-columns: 1fr; }
  .article-side { display: none; }
}

/* ----- Reading progress ----- */
.read-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px;
  background: transparent; z-index: 110;
}
.read-progress__fill {
  display: block; height: 100%; width: 100%;
  background: var(--red); transform: scaleX(0); transform-origin: 0 50%;
}

/* ----- Author / related ----- */
.author-box {
  display: flex; gap: var(--space-4); align-items: center;
  margin-top: var(--space-7); padding: var(--space-5);
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.author-box__avatar {
  width: 56px; height: 56px; flex: none; border-radius: 50%;
  background: var(--slate-800); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700;
}
.author-box__name { font-weight: 600; color: var(--text-heading); }
.author-box__role { font-size: var(--fs-small); color: var(--text-muted); }

.related-posts { margin-top: var(--space-8); }
.related-posts h2 { font-size: var(--fs-h3); margin-bottom: var(--space-5); }

.share-row { display: flex; align-items: center; gap: 0.6rem; margin-top: var(--space-6); flex-wrap: wrap; }
.share-row__label { font-size: var(--fs-small); color: var(--text-muted); font-family: var(--font-mono); }
.share-btn {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); border-radius: 50%; background: var(--white); color: var(--slate-700);
  transition: all var(--dur) var(--ease); text-decoration: none;
}
.share-btn:hover { background: var(--ink); color: #fff; border-color: var(--ink); }
.share-btn svg { width: 18px; height: 18px; }
