/* ==========================================================================
   sbn-blog.css — blog index + article layout (light redesign).
   Structure modelled on modern editorial blogs: featured lead post, sticky
   table of contents, author cards, side CTA. Colours/type stay on the sbn-*
   token layer — nothing new is invented here.
   ========================================================================== */

/* ---------- shared -------------------------------------------------------- */
.sbn-blog-wrap { max-width: var(--sbn-maxw); margin-inline: auto; padding-inline: var(--sbn-pad); }

/* The legacy dark main.css paints the bare <article> element (and .post) with a
   near-black fill. The redesigned post lives on the light surface, so neutralise
   it here rather than editing the legacy file. */
/* `overflow: hidden` here would silently disable position:sticky for the sidebar,
   so it has to be reset too, not just the paint properties. */
.sbn-lightpage article.sbn-post { background: transparent; color: var(--sbn-ink); padding: 0; border: 0; overflow: visible; }
/* post_class() also emits the bare `post` class, which legacy main.css treats as a
   teaser card: `.post:hover{transform:translateY(-5px)}` made the whole article
   jump on hover. Neutralise the card behaviour on the article itself. */
.sbn-lightpage article.sbn-post:hover { transform: none; border-color: transparent; box-shadow: none; }
.sbn-lightpage article.sbn-post:hover .sbn-post__cover img { transform: none; }

/* ---------- blog index: header ------------------------------------------- */
/* The old hero was an empty white box eating a full screen. This is a compact
   editorial masthead: title + lead on one row, filters directly beneath. */
.sbn-blog-head { padding: clamp(18px, 3vw, 34px) 0 clamp(20px, 3vw, 30px); }
.sbn-blog-head__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); gap: clamp(20px, 4vw, 56px); align-items: end; }
.sbn-blog-head h1 { font-family: var(--sbn-font-display); font-weight: 500; letter-spacing: var(--sbn-tracking-tight); line-height: 1.02; font-size: clamp(2.4rem, 6vw, 4.1rem); margin: 0; }
.sbn-blog-head__lead { color: var(--sbn-muted); font-size: 1.02rem; line-height: 1.55; margin: 0; text-wrap: pretty; }
@media (max-width: 860px) {
  .sbn-blog-head__row { grid-template-columns: 1fr; gap: 14px; align-items: start; }
}

/* ---------- category filter ---------------------------------------------- */
.sbn-blog-filter { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 clamp(22px, 3.4vw, 34px); }
.sbn-blog-filter .sbn-pill[aria-current="page"] { background: var(--sbn-ink); color: #fff; border-color: var(--sbn-ink); }

/* ---------- featured (lead) post ----------------------------------------- */
.sbn-feat { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(18px, 2.6vw, 30px);
  background: var(--sbn-card); border: 1px solid var(--sbn-line); border-radius: var(--sbn-r-lg);
  overflow: hidden; margin-bottom: clamp(26px, 4vw, 44px); text-decoration: none; color: inherit;
  transition: box-shadow var(--sbn-dur-ui) var(--sbn-ease-out), border-color var(--sbn-dur-ui) var(--sbn-ease-out); }
@media (hover: hover) { .sbn-feat:hover { box-shadow: var(--sbn-shadow-card); border-color: transparent; } }
.sbn-feat__media { position: relative; aspect-ratio: 16 / 11; background: var(--sbn-bg-2); overflow: hidden; }
.sbn-feat__media img { width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 600ms var(--sbn-ease-out); }
@media (hover: hover) { .sbn-feat:hover .sbn-feat__media img { transform: scale(1.03); } }
.sbn-feat__body { display: flex; flex-direction: column; justify-content: center; gap: 14px;
  padding: clamp(22px, 3vw, 40px) clamp(22px, 3vw, 40px) clamp(22px, 3vw, 40px) 0; }
.sbn-feat__title { font-family: var(--sbn-font-display); font-weight: 500; letter-spacing: var(--sbn-tracking-tight);
  line-height: 1.14; font-size: clamp(1.5rem, 2.7vw, 2.15rem); margin: 0; text-wrap: balance; }
.sbn-feat__excerpt { color: var(--sbn-muted); font-size: .99rem; line-height: 1.6; margin: 0; text-wrap: pretty; }
@media (max-width: 900px) {
  .sbn-feat { grid-template-columns: 1fr; }
  .sbn-feat__media { aspect-ratio: 16 / 9; }
  .sbn-feat__body { padding: clamp(18px, 5vw, 26px); }
}

/* ---------- byline (shared by cards, featured, article) ------------------- */
.sbn-byline { display: flex; align-items: center; gap: 10px; color: var(--sbn-muted); font-size: .85rem; }
.sbn-byline__ava { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none;
  border: 1px solid var(--sbn-line); background: var(--sbn-bg-2); }
.sbn-byline__ini { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--sbn-ink); color: var(--sbn-lime); font-size: .72rem; font-weight: 600; letter-spacing: .02em; }
.sbn-byline__name { color: var(--sbn-ink); font-weight: 600; }
.sbn-byline time, .sbn-byline .sbn-byline__mins { font-variant-numeric: tabular-nums; }

/* ---------- article: reading progress ------------------------------------ */
.sbn-progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: calc(var(--sbn-z-header) + 1);
  background: var(--sbn-lime); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }
@supports (animation-timeline: scroll()) {
  .sbn-progress { animation: sbn-progress-grow linear both; animation-timeline: scroll(root block); }
  @keyframes sbn-progress-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}
@media (prefers-reduced-motion: reduce) { .sbn-progress { display: none; } }

/* ---------- article: head ------------------------------------------------- */
/* No extra top padding: the grid already spaces the columns, and any padding here
   would push the breadcrumbs below the sidebar's first line. */
.sbn-post__head { padding-top: 0; }
.sbn-post__head h1 { font-family: var(--sbn-font-display); font-weight: 500; letter-spacing: var(--sbn-tracking-tight);
  line-height: 1.06; font-size: clamp(2rem, 4.6vw, 3.35rem); margin: 14px 0 0; max-width: 20ch; text-wrap: balance; }
.sbn-post__lead { margin: 16px 0 0; max-width: 62ch; font-size: clamp(1.02rem, 1.5vw, 1.18rem);
  line-height: 1.58; color: var(--sbn-body, var(--sbn-ink)); text-wrap: pretty; }
.sbn-post__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: clamp(18px, 2.4vw, 26px); }
.sbn-post__cover { margin: clamp(22px, 3.4vw, 38px) 0 0; border-radius: var(--sbn-r-lg); overflow: hidden;
  background: var(--sbn-bg-2); aspect-ratio: 16 / 9; }
.sbn-post__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- article: two columns from the very top ------------------------ */
/* Head (title, lead, cover) and body share the left column; the sidebar spans
   both rows so it starts level with the breadcrumbs, as on the reference. */
.sbn-post__grid { display: grid; grid-template-columns: minmax(0, 1fr) 19rem;
  column-gap: clamp(28px, 4vw, 64px); align-items: start;
  padding: clamp(14px, 2.4vw, 24px) 0 clamp(36px, 5vw, 64px); }
.sbn-post__head { grid-column: 1; grid-row: 1; }
.sbn-post__main { grid-column: 1; grid-row: 2; min-width: 0; padding-top: clamp(22px, 3vw, 34px); }
.sbn-post__side { grid-column: 2; grid-row: 1 / span 2; }

.sbn-post__dateline { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: clamp(14px, 2vw, 20px) 0 0;
  color: var(--sbn-muted); font-size: .88rem; font-variant-numeric: tabular-nums; }

/* author block at the top of the sidebar */
.sbn-post__authorbox { display: flex; align-items: center; gap: 12px; }
.sbn-post__authorava { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none;
  border: 1px solid var(--sbn-line); background: var(--sbn-bg-2); }
.sbn-post__authorini { width: 48px; height: 48px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--sbn-ink); color: var(--sbn-lime); font-weight: 600; font-size: .9rem; }
.sbn-post__authorname { font-weight: 600; color: var(--sbn-ink); text-decoration: none; line-height: 1.25; }
@media (hover: hover) { .sbn-post__authorname:hover { text-decoration: underline; } }
.sbn-post__authorrole { color: var(--sbn-muted); font-size: .85rem; margin-top: 2px; }
.sbn-post__cat { justify-self: start; }

/* ---------- sticky sidebar ------------------------------------------------ */
.sbn-post__side { position: sticky; top: calc(var(--sbn-header-h, 76px) + 18px); display: grid; gap: 14px; }
.sbn-toc { background: var(--sbn-card); border: 1px solid var(--sbn-line); border-radius: var(--sbn-r-lg);
  padding: 18px 18px 14px; }
.sbn-toc__ttl { font-size: .74rem; text-transform: uppercase; letter-spacing: .14em; color: var(--sbn-muted);
  font-weight: 600; margin: 0 0 12px; }
.sbn-toc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; counter-reset: toc; }
.sbn-toc a { display: block; padding: 7px 0 7px 14px; border-left: 2px solid var(--sbn-line);
  color: var(--sbn-muted); font-size: .9rem; line-height: 1.4; text-decoration: none;
  transition: color var(--sbn-dur-ui) var(--sbn-ease-out), border-color var(--sbn-dur-ui) var(--sbn-ease-out); }
@media (hover: hover) { .sbn-toc a:hover { color: var(--sbn-ink); border-left-color: var(--sbn-muted); } }
.sbn-toc a[aria-current="true"] { color: var(--sbn-ink); font-weight: 600; border-left-color: var(--sbn-ink); }

.sbn-side-cta { background: var(--sbn-ink); color: #fff; border-radius: var(--sbn-r-lg); padding: 20px; }
.sbn-side-cta h3 { font-family: var(--sbn-font-display); font-weight: 500; font-size: 1.12rem;
  line-height: 1.2; margin: 0 0 8px; color: #fff; letter-spacing: var(--sbn-tracking-tight); }
.sbn-side-cta p { margin: 0 0 14px; font-size: .88rem; line-height: 1.5; color: rgba(255, 255, 255, .72); }
.sbn-side-cta .sbn-btn { width: 100%; justify-content: center; }

/* Below the two-column breakpoint the TOC collapses into a disclosure that
   sits above the article body, so mobile keeps the navigation affordance. */
@media (max-width: 1080px) {
  /* single column, explicit order: head → sidebar (author + TOC) → article body */
  .sbn-post__grid { grid-template-columns: 1fr; }
  .sbn-post__head { grid-column: 1; grid-row: 1; }
  .sbn-post__side { grid-column: 1; grid-row: 2; position: static; margin: 24px 0 0; }
  .sbn-post__main { grid-column: 1; grid-row: 3; }
  .sbn-toc { padding: 0; border-radius: var(--sbn-r-lg); }
  /* `.sbn-toc ol` (0,1,1) outranks a bare `.sbn-toc__list` (0,1,0), so the hide
     rule has to match at least as specifically or both lists render. */
  .sbn-toc__ttl, .sbn-toc ol.sbn-toc__list { display: none; }
  .sbn-toc details > summary { list-style: none; cursor: pointer; padding: 15px 18px; font-weight: 600;
    font-size: .95rem; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .sbn-toc details > summary::-webkit-details-marker { display: none; }
  .sbn-toc details > summary::after { content: ""; width: 9px; height: 9px; flex: none; border-right: 2px solid var(--sbn-muted);
    border-bottom: 2px solid var(--sbn-muted); transform: rotate(45deg) translateY(-2px);
    transition: transform var(--sbn-dur-ui) var(--sbn-ease-out); }
  .sbn-toc details[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
  .sbn-toc ol { padding: 0 18px 16px; }
  .sbn-side-cta { display: none; }
}
@media (min-width: 1081px) {
  .sbn-toc details { display: none; }
}

/* ---------- article: prose tuning ---------------------------------------- */
.sbn-post__main .sbn-prose { max-width: 68ch; }
.sbn-post__main .sbn-prose h2 { scroll-margin-top: calc(var(--sbn-header-h, 76px) + 24px); }
.sbn-post__main .sbn-prose > :first-child { margin-top: 0; }

/* optional editor-written summary box, rendered only when the post has one */
.sbn-post__summary { background: var(--sbn-tint-lime, var(--sbn-bg-2)); border: 1px solid var(--sbn-line);
  border-radius: var(--sbn-r-lg); padding: clamp(18px, 2.4vw, 26px); margin: 0 0 clamp(22px, 3vw, 30px); }
.sbn-post__summary h2 { font-size: 1.02rem; margin: 0 0 10px; font-weight: 600; }
.sbn-post__summary p:last-child { margin-bottom: 0; }

/* ---------- author card --------------------------------------------------- */
.sbn-authorcard { display: flex; gap: 16px; align-items: flex-start; margin-top: clamp(30px, 4vw, 44px);
  padding-top: clamp(24px, 3vw, 30px); border-top: 1px solid var(--sbn-line); }
.sbn-authorcard__ava { width: 60px; height: 60px; border-radius: 50%; object-fit: cover; flex: none;
  border: 1px solid var(--sbn-line); background: var(--sbn-bg-2); }
.sbn-authorcard__ini { width: 60px; height: 60px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--sbn-ink); color: var(--sbn-lime); font-weight: 600; font-size: 1.05rem; }
.sbn-authorcard__ey { font-size: .74rem; text-transform: uppercase; letter-spacing: .14em; color: var(--sbn-muted); font-weight: 600; }
.sbn-authorcard__nm { font-weight: 600; font-size: 1.04rem; margin-top: 5px; }
.sbn-authorcard__nm span { color: var(--sbn-muted); font-weight: 400; }
.sbn-authorcard p { margin: 8px 0 0; color: var(--sbn-muted); font-size: .93rem; line-height: 1.55; max-width: 60ch; }

/* ---------- share --------------------------------------------------------- */
.sbn-post__share { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: clamp(26px, 3vw, 34px); }
.sbn-post__share .lbl { color: var(--sbn-muted); font-size: .88rem; margin-right: 4px; }
.sbn-post__share a { display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; min-height: 40px;
  border-radius: 999px; border: 1px solid var(--sbn-line); background: var(--sbn-card); color: var(--sbn-ink);
  font-size: .87rem; font-weight: 500; text-decoration: none; touch-action: manipulation;
  transition: border-color var(--sbn-dur-ui) var(--sbn-ease-out), transform var(--sbn-dur-press) var(--sbn-ease-out); }
@media (hover: hover) { .sbn-post__share a:hover { border-color: var(--sbn-ink); } }
.sbn-post__share a:active { transform: translateY(1px); }

/* ---------- related ------------------------------------------------------- */
.sbn-related-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2vw, 22px); }
@media (max-width: 900px) { .sbn-related-grid { grid-template-columns: 1fr; } }

/* ---------- homepage blog strip ------------------------------------------ */
.sbn-blogstrip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2vw, 22px); }
@media (max-width: 900px) { .sbn-blogstrip { grid-template-columns: 1fr; } }

/* ---------- post card refinements ---------------------------------------- */
.pcard__excerpt { margin: 0; color: var(--sbn-muted); font-size: .92rem; line-height: 1.55; text-wrap: pretty; }
.pcard__meta { margin-top: auto; padding-top: 4px; }
.pcard__meta .sbn-byline { font-size: .82rem; }
.pcard__meta .sbn-byline__ava, .pcard__meta .sbn-byline__ini { width: 26px; height: 26px; }
.pcard__title { text-wrap: balance; }

/* Long author names must not shred the card byline: keep the name whole and let
   the date / reading-time pair drop to the next line as a unit. */
.pcard__meta .sbn-byline { flex-wrap: wrap; gap: 4px 8px; font-size: .8rem; }
.pcard__meta .sbn-byline__name { white-space: nowrap; }
.pcard__meta .sbn-byline time { white-space: nowrap; }

/* Article byline on narrow screens: keep the name on one line, let date and
   reading time wrap together underneath instead of splitting into columns. */
@media (max-width: 640px) {
  .sbn-post__meta { gap: 6px 14px; }
  .sbn-post__meta .sbn-byline { flex-wrap: wrap; gap: 4px 10px; }
  .sbn-post__meta .sbn-byline__name, .sbn-post__meta .sbn-byline time { white-space: nowrap; }
}

/* ---------- homepage blog section header --------------------------------- */
/* `.sbn-head` is a narrow centred-copy block; the blog strip needs a full-width
   row so "Все статьи" sits flush right instead of drifting to the middle. */
.sbn-head--row { max-width: none; width: 100%; display: flex; align-items: flex-end;
  justify-content: space-between; gap: 20px 28px; flex-wrap: wrap; }
.sbn-head--row h2 { margin: 0; }
.sbn-head--row .sbn-more { margin: 0; white-space: nowrap; }
@media (max-width: 600px) { .sbn-head--row { align-items: flex-start; } }
