/* Blog / editorial styles. Reuses the existing design tokens from main.css —
   no new colour values, no new fonts. Nothing here hides content: any
   animation belongs in animations.css under the `.js` scope. */

/* Narrow measure for long-form reading (~68 chars). */
.container--narrow { max-width: 760px; }

/* ---------------------------------------------------------------- listing */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 28px;
}

.blog-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--t), border-color var(--t);
}
.blog-card:hover { transform: translateY(-3px); border-color: var(--border-strong); }

.blog-card__media { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: var(--surface-2); }
.blog-card__media img { width: 100%; height: 100%; object-fit: cover; }

.blog-card__body { padding: 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

.blog-card__cat {
  align-self: flex-start;
  font-family: var(--font-head);
  font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--brand-2);
  background: var(--grad-soft);
  border: 1px solid var(--border);
  padding: 5px 10px; border-radius: 999px; text-decoration: none;
}
.blog-card__cat:hover { border-color: var(--border-strong); }

.blog-card__title { font-size: 1.2rem; line-height: 1.35; margin: 0; }
.blog-card__title a { color: var(--text); text-decoration: none; }
.blog-card__title a:hover { color: var(--brand-2); }

.blog-card__excerpt { color: var(--text-3); font-size: .95rem; margin: 0; }
.blog-card__meta { margin-top: auto; color: var(--text-4); font-size: .82rem; display: flex; gap: 8px; flex-wrap: wrap; }

/* ------------------------------------------------------------- pagination */
.pagination {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  margin-top: 56px; flex-wrap: wrap;
}
.pagination__link {
  color: var(--text); text-decoration: none; font-weight: 600;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 12px 20px; transition: background var(--t-fast);
}
.pagination__link:hover { background: rgba(255,255,255,.06); }
.pagination__status { color: var(--text-4); font-size: .9rem; }

/* ------------------------------------------------------------------- post */
.post__header { padding: 56px 0 24px; }
.post__title { font-size: clamp(2rem, 4.5vw, 3rem); line-height: 1.15; margin: 18px 0 24px; }

.post__byline { display: flex; gap: 16px; align-items: flex-start; }
.post__avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.post__byline-text p { margin: 0 0 4px; }
.post__author { font-weight: 600; color: var(--text-2); }
.post__author a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.post__author a:hover { color: var(--brand-2); }
.post__author-title { color: var(--text-3); font-weight: 400; }
.post__credentials { color: var(--text-4); font-size: .86rem; max-width: 60ch; }
.post__dates { color: var(--text-4); font-size: .86rem; }

.post__hero { margin: 32px 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.post__hero img { width: 100%; height: auto; display: block; }

/* Table of contents */
.post__toc {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px 28px; margin: 0 0 40px;
}
.post__toc-title { font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); margin: 0 0 12px; }
.post__toc ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.post__toc a { color: var(--text-2); text-decoration: none; }
.post__toc a:hover { color: var(--brand-2); }

/* Body copy */
.post__body { font-size: 1.06rem; line-height: 1.75; color: var(--text-2); }
.post__body > * + * { margin-top: 1.3em; }
.post__body h2 {
  font-size: clamp(1.5rem, 2.6vw, 1.9rem); line-height: 1.25;
  color: var(--text); margin-top: 2.2em; scroll-margin-top: 96px;
}
.post__body h3 { font-size: 1.22rem; color: var(--text); margin-top: 1.8em; scroll-margin-top: 96px; }
.post__body a { color: var(--brand-2); text-decoration: underline; text-underline-offset: 3px; }
.post__body ul, .post__body ol { padding-left: 24px; }
.post__body li + li { margin-top: .5em; }
.post__body strong { color: var(--text); }
.post__body blockquote {
  border-left: 3px solid var(--brand); background: var(--surface);
  padding: 18px 24px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2);
}
.post__body code {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 2px 6px; border-radius: 6px; font-size: .9em;
}
.post__body pre {
  background: var(--surface-2); border: 1px solid var(--border);
  padding: 18px; border-radius: var(--radius-sm); overflow-x: auto;
}
.post__body pre code { background: none; border: 0; padding: 0; }
.post__body img { max-width: 100%; height: auto; border-radius: var(--radius-sm); }
.post__body figure { margin: 2em 0; }
.post__body figcaption { color: var(--text-4); font-size: .85rem; margin-top: 8px; text-align: center; }

/* Tables scroll rather than breaking the layout on mobile. */
.post__body table { width: 100%; border-collapse: collapse; display: block; overflow-x: auto; font-size: .95rem; }
.post__body th, .post__body td { border: 1px solid var(--border); padding: 10px 14px; text-align: left; }
.post__body th { background: var(--surface-2); color: var(--text); font-family: var(--font-head); }

.post__faq { margin-top: 56px; }
.post__tags { margin-top: 40px; display: flex; gap: 10px; flex-wrap: wrap; }
.tag {
  font-size: .8rem; color: var(--text-3); text-decoration: none;
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px;
}
.tag:hover { color: var(--text); border-color: var(--border-strong); }

/* ---------------------------------------------------------------- authors */
.author-head { display: flex; gap: 20px; align-items: center; }
.author-head__avatar { border-radius: 50%; object-fit: cover; border: 2px solid var(--border-strong); }
.author-head__title { color: var(--text-3); margin: 6px 0 0; }
.author-bio { font-size: 1.05rem; line-height: 1.7; color: var(--text-2); }

/* ------------------------------------------------------------- ad slots --
   Heights are reserved so enabling ads later causes no layout shift. These
   rules style a slot IF one renders; while ADSENSE_ENABLED is false no
   .ad-slot element is emitted at all. */
.ad-slot { display: block; margin: 40px 0; text-align: center; }
.ad-slot--in_article_1,
.ad-slot--in_article_2 { min-height: 280px; }
.ad-slot--below_post   { min-height: 280px; }
.ad-slot--sidebar_sticky { min-height: 600px; position: sticky; top: 96px; }
@media (max-width: 1024px) { .ad-slot--sidebar_sticky { display: none; } }

@media (max-width: 640px) {
  .post__byline { flex-direction: column; }
  .blog-grid { grid-template-columns: 1fr; }
}
