/*
 * Vorota.me — article styling (Tinkoff-Journal-like)
 * Applied only on single posts via wp_enqueue in child theme functions.php
 * Mobile-first.
 */

/* === scope === */
.single-post .entry-content { max-width: 720px; margin: 0 auto; font-size: 18px; line-height: 1.65; color: #1f2329; }
.single-post .entry-content p { margin: 0 0 1.1em; }
.single-post .entry-content h2 { font-size: 1.55em; line-height: 1.25; margin: 1.8em 0 0.6em; font-weight: 700; letter-spacing: -0.01em; }
.single-post .entry-content h3 { font-size: 1.2em; line-height: 1.3; margin: 1.4em 0 0.5em; font-weight: 600; }
.single-post .entry-title { font-size: 2em; line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; margin: 0.4em 0 0.3em; }
@media (min-width: 768px) {
  .single-post .entry-content { font-size: 19px; }
  .single-post .entry-title { font-size: 2.6em; }
  .single-post .entry-content h2 { font-size: 1.7em; }
}

/* === dedupe: hide first inline cover when same as featured === */
.single-post .entry-content > figure.article-cover:first-child { display: none; }
.single-post .entry-content > figure.article-cover:first-child + h2 { margin-top: 0.4em; }

/* === lead paragraph (first <p> after first <h2>) === */
.single-post .entry-content > h2:first-of-type + p {
  font-size: 1.18em;
  line-height: 1.55;
  color: #3a4150;
  font-weight: 400;
  border-left: 3px solid #ffd84d;
  padding: 0.1em 0 0.1em 14px;
  margin-bottom: 1.4em;
}

/* === Auto TOC inserted by JS before first H2 === */
.tj-toc {
  background: #f6f7f9;
  border-radius: 10px;
  padding: 16px 18px;
  margin: 1.2em 0 1.8em;
  font-size: 0.96em;
}
.tj-toc-title {
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #6b7280;
  font-weight: 600;
  margin-bottom: 8px;
}
.tj-toc ol { margin: 0; padding-left: 20px; }
.tj-toc li { margin: 4px 0; line-height: 1.4; }
.tj-toc a { color: #1f2329; text-decoration: none; border-bottom: 1px dotted #c4c8d0; }
.tj-toc a:hover { color: #0066ff; border-bottom-color: #0066ff; }
.tj-toc ol ol { margin-top: 4px; padding-left: 18px; font-size: 0.94em; color: #555; }

/* === Figures (inline images with caption) === */
.single-post .entry-content figure { margin: 1.6em -8px; }
.single-post .entry-content figure img { width: 100%; height: auto; display: block; border-radius: 6px; }
.single-post .entry-content figure figcaption {
  font-size: 0.9em;
  color: #6b7280;
  padding: 8px 4px 0;
  line-height: 1.4;
}

/* === Author card === */
.tj-author {
  display: flex;
  gap: 14px;
  align-items: center;
  background: #fafbfc;
  border: 1px solid #ebedf0;
  border-radius: 12px;
  padding: 16px 18px;
  margin: 2.4em 0 1em;
}
.tj-author__avatar {
  flex: 0 0 64px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #ffd84d;
  color: #1f2329;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 22px;
  overflow: hidden;
}
.tj-author__avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.tj-author__body { flex: 1 1 auto; min-width: 0; }
.tj-author__name { font-size: 0.8em; font-weight: 700; margin: 2px 0 4px; }
.tj-author__name a { color: #1f2329; }
.tj-author__bio { font-size: 0.94em; color: #3a4150; line-height: 1.45; margin: 0; }
@media (min-width: 768px) {
  .tj-author { padding: 20px 22px; gap: 18px; }
  .tj-author__avatar { flex-basis: 72px; width: 72px; height: 72px; font-size: 26px; }
}

/* Author archive: Об эксперте link appended after bio */
.tj-author__expert-link { display: inline-block; margin-top: 8px; font-weight: 600; }

/* === Global link styling within article + author card ===
 * Remove underlines, switch hover color to site accent (Astra primary). */
.entry-content a,
.tj-author a,
.tj-toc a,
.tj-hero a {
  text-decoration: none;
  border-bottom: none;
}
.entry-content a:hover,
.tj-author a:hover,
.tj-toc a:hover,
.tj-hero a:hover {
  color: var(--ast-global-color-0, #0170B9);
  text-decoration: none;
}

/* === Anchor scroll offset for sticky headers (Astra has 60-90px sticky) === */
.single-post .entry-content h2[id], .single-post .entry-content h3[id] { scroll-margin-top: 90px; }

/* ============================================================
 * Author archive — Tinkoff-Journal-like layout (left-aligned hero, card list)
 * Donor reference: journal.tinkoff.ru/users/{slug}/
 * Targets Astra's <section class="ast-author-box ast-archive-description"> + post loop.
 * ============================================================ */
.author .ast-author-box.ast-archive-description {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
  text-align: left;
  max-width: 900px;
  margin: 0 auto 1.4em;
  padding: 28px 16px 24px;
  background: transparent;
  border: 0;
}
.author .ast-author-box .ast-author-avatar {
  flex: 0 0 96px;
  width: 96px;
  height: 96px;
  margin: 0;
  float: none;
}
.author .ast-author-box .ast-author-avatar img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  /* Top-aligned crop: keep head/face in frame, not center where Gravatar may clip it */
  object-position: center top;
  display: block;
}
.author .ast-author-box .ast-author-bio {
  text-align: left;
  padding: 0;
  flex: 1 1 auto;
  min-width: 0;
}
.author .ast-author-box .ast-author-bio h1.page-title.ast-archive-title {
  font-size: 1.8em;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 0.35em;
  color: #1f2329;
}
.author .ast-author-box .ast-author-bio p {
  font-size: 0.98em;
  line-height: 1.5;
  color: #3a4150;
  margin: 0;
  max-width: 620px;
}
@media (min-width: 768px) {
  .author .ast-author-box.ast-archive-description { padding: 40px 16px 28px; gap: 28px; }
  .author .ast-author-box .ast-author-avatar { flex-basis: 144px; width: 144px; height: 144px; }
  .author .ast-author-box .ast-author-bio h1.page-title.ast-archive-title { font-size: 2.6em; }
  .author .ast-author-box .ast-author-bio p { font-size: 1.05em; }
}
@media (max-width: 540px) {
  /* On narrow phones — drop to stacked, avatar still left-aligned */
  .author .ast-author-box.ast-archive-description { gap: 14px; padding: 20px 12px 16px; }
  .author .ast-author-box .ast-author-avatar { flex-basis: 72px; width: 72px; height: 72px; }
  .author .ast-author-box .ast-author-bio h1.page-title.ast-archive-title { font-size: 1.5em; }
  .author .ast-author-box .ast-author-bio p { font-size: 0.92em; }
}

/* Article count divider — "X статей" with underline before post list.
 * Astra doesn't render a counter; we synthesize via ::before on first article wrapper. */
.author .ast-archive-description + .ast-row > .post,
.author #primary > article:first-of-type {
  position: relative;
}

/* Card-style post items in the author loop (donor list look) */
.author #primary .ast-article-post,
.author .ast-row > article.post {
  background: #fff;
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  border: 1px solid #ececec;
}
.author #primary .ast-article-post .post-thumb-img-content,
.author .ast-row article.post .post-thumb-img-content {
  border-radius: 10px;
  overflow: hidden;
}
.author #primary .ast-article-post .entry-title,
.author .ast-row article.post .entry-title {
  font-size: 1.2em;
  line-height: 1.3;
  font-weight: 700;
  margin: 0.4em 0 0.5em;
}
.author #primary .ast-article-post .entry-title a,
.author .ast-row article.post .entry-title a { color: #1f2329; }
.author #primary .ast-article-post .entry-meta,
.author .ast-row article.post .entry-meta {
  font-size: 0.85em;
  color: #6b7280;
}
.author #primary .ast-article-post .ast-the-content-wrap,
.author #primary .ast-article-post .ast-blog-meta-container { font-size: 0.92em; }

/* Tighten gap between meta and excerpt; clamp excerpt to fit beside thumbnail */
body.author .ast-article-post .entry-header { margin-bottom: 4px !important; }
body.author .ast-article-post .entry-content { margin-top: 0 !important; overflow: hidden; }
body.author .ast-article-post .entry-content > p {
  display: -webkit-box !important;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0 !important;
  max-height: calc(1.6em * 3);
}
@media (max-width: 768px) {
  body.author .ast-article-post .entry-content > p {
    -webkit-line-clamp: 4;
    max-height: calc(1.6em * 4);
  }
}

/* Per-post "От {author}" meta declension is fixed via PHP filter on `the_author`
 * (see functions.php — genitive map "Леонид Барышников" → "Леонида Барышникова"). */
