/* A single blog post (scripts/sahi-site/blog-posts.mjs), on top of blogs.css. The words are sahi.com's;
   the page is ours: a calm head with the category, title, subtitle, author, date and reading time, the cover,
   the article at a reading width beside a sticky contents list that follows you, a reading bar, the post's
   FAQs, the author, share links, the newer and older post, and three to keep reading. */

/* reading progress, under the site header */
.bp-progress { position: fixed; z-index: 60; left: 0; right: 0; top: 0; height: 3px; pointer-events: none; }
.bp-progress span { display: block; height: 100%; width: calc(var(--bp-p, 0) * 100%); background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 55%, var(--up))); }

/* ---- Head ---------------------------------------------------------------------- */
.bp-head { padding-bottom: 0; }
.bp-head__in { max-width: 860px; margin: clamp(10px, 2vw, 22px) auto 0; text-align: center; }
.bp-head .bc__cat { text-decoration: none; }
.bp-title { margin: 16px 0 0; font: 400 clamp(32px, 4.4vw, 54px)/1.08 var(--disp); letter-spacing: -.02em; color: var(--ink); text-wrap: balance; }
.bp-sub { max-width: 720px; margin: 16px auto 0; font-size: clamp(17px, 1.6vw, 20px); line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.bp-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 12px 22px; margin-top: 24px; }
.bp-by { display: inline-flex; align-items: center; gap: 10px; text-align: left; }
.bp-by b { display: block; font: 500 15px/1.2 var(--sans); color: var(--ink); }
.bp-by small { display: block; font-size: 13px; color: var(--ink-3); }
.bp-avatar { display: grid; place-items: center; flex: none; width: 40px; height: 40px; border-radius: 50%; font: 600 14px/1 var(--sans); color: var(--on-brand); background: var(--brand); }
.bp-avatar--lg { width: 64px; height: 64px; font-size: 20px; }
.bp-facts { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bp-facts i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.bp-cover { max-width: 1040px; margin: clamp(28px, 4vw, 44px) auto 0; border-radius: var(--radius); overflow: hidden; box-shadow: 0 0 0 1px var(--line), var(--shadow-3); }
.bp-cover img { display: block; width: 100%; height: auto; }

/* ---- Article beside its contents --------------------------------------------------- */
/* sahi.css drops the top padding of a plain band that follows another; the article needs it under the cover */
.page-blog-post .bp-main { padding-top: clamp(32px, 5vw, 64px) !important; }
.bp-grid { display: grid; grid-template-columns: minmax(0, 720px) 280px; justify-content: center; gap: clamp(32px, 5vw, 72px); align-items: start; }
.bp-grid:not(:has(.bp-side)) { grid-template-columns: minmax(0, 720px); }
.bp-body { font-size: 18px; line-height: 1.75; color: var(--ink-2); }
.bp-body > * + * { margin-top: 1.4em; }
.bp-intro { font-size: 19.5px; color: var(--ink); }
.bp-intro > * + * { margin-top: 1em; }
.bp-sec { scroll-margin-top: calc(var(--nav-h) + 24px); }
.bp-sec > * + * { margin-top: 1em; }
.bp-body h2 { margin-top: 0; padding-top: .4em; font: 400 clamp(26px, 2.6vw, 32px)/1.2 var(--disp); letter-spacing: -.01em; color: var(--ink); scroll-margin-top: calc(var(--nav-h) + 24px); }
.bp-body h2::after { content: ""; display: block; width: 48px; height: 3px; margin-top: 12px; border-radius: 3px; background: var(--accent); }
.bp-body h3 { margin-top: 1.5em; font: 500 21px/1.35 var(--sans); color: var(--ink); }
.bp-body h4 { margin-top: 1.4em; font: 600 13px/1.3 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.bp-body strong, .bp-body b { color: var(--ink); font-weight: 600; }
.bp-body a { color: var(--brand-ink); text-underline-offset: 3px; }
.bp-body ul, .bp-body ol { padding-left: 1.3em; }
.bp-body li + li { margin-top: .5em; }
.bp-body li::marker { color: var(--accent); }
.bp-body blockquote { margin-inline: 0; padding: 4px 0 4px 20px; border-left: 3px solid var(--accent); font-size: 19px; color: var(--ink); }
.bp-body .pu-img img { display: block; width: 100%; height: auto; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg-alt); }
.bp-body .pu-img--phone { display: flex; justify-content: center; }
.bp-body .pu-img--phone img { width: min(100%, 320px); border-radius: 24px; }
.bp-body .table-wrap { font-size: 15px; line-height: 1.5; }
.bp-body .table th { color: var(--ink); }
.bp-faq .faq { max-width: none; }
.bp-faq .answer { padding: 0 4px 18px; font-size: 16.5px; line-height: 1.7; color: var(--ink-2); }
.bp-note { margin-top: 2.4em !important; padding-top: 18px; border-top: 1px solid var(--line); font-size: 13px; line-height: 1.6; color: var(--ink-3); }

/* the contents list stays beside you and marks where you are */
.bp-side { position: sticky; top: calc(var(--nav-h) + 24px); display: flex; flex-direction: column; gap: 16px; max-height: calc(100vh - var(--nav-h) - 48px); }
.bp-toc { display: flex; flex-direction: column; min-height: 0; padding: 18px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.bp-toc summary { display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 600 13px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); list-style: none; cursor: pointer; }
.bp-toc summary::-webkit-details-marker { display: none; }
.bp-toc summary span { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--brand-ink); }
.bp-toc ol { margin: 14px 0 0; padding: 0; list-style: none; overflow-y: auto; scrollbar-width: thin; counter-reset: toc; }
.bp-toc li { counter-increment: toc; }
.bp-toc a { position: relative; display: block; padding: 8px 8px 8px 30px; border-radius: 10px; font-size: 14px; line-height: 1.4; color: var(--ink-2); text-decoration: none; transition: background-color .2s, color .2s; }
.bp-toc a::before { content: counter(toc, decimal-leading-zero); position: absolute; left: 6px; top: 9px; font: 500 11px/1.4 var(--sans); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bp-toc a:hover { background: var(--bg-alt); color: var(--ink); }
.bp-toc a.is-on { background: var(--brand-wash); color: var(--brand-ink); font-weight: 500; box-shadow: inset 2px 0 0 var(--accent); }
.bp-toc a.is-on::before { color: var(--brand-ink); }
.bp-share { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 4px; font-size: 13px; color: var(--ink-3); }
.bp-share > span { width: 100%; font: 600 12px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; }
.bp-share a, .bp-share button { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: 500 13px/1 var(--sans); color: var(--ink-2); text-decoration: none; cursor: pointer; }
.bp-share a:hover, .bp-share button:hover { border-color: var(--hairline); color: var(--ink); }
.bp-share svg { width: 14px; height: 14px; }

/* ---- Author, pager, related ------------------------------------------------------- */
.bp-author { padding-block: clamp(24px, 4vw, 40px) 0; }
.bp-author__card { display: flex; gap: 18px; max-width: 1072px; margin-inline: auto; padding: clamp(20px, 3vw, 28px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-alt); }
.bp-author__card .eyebrow { color: var(--brand-ink); }
.bp-author__card b { display: block; margin-top: 4px; font: 500 20px/1.3 var(--sans); color: var(--ink); }
.bp-author__card small { display: block; font-size: 14px; color: var(--ink-3); }
.bp-author__card p { margin-top: 10px; font-size: 15px; line-height: 1.65; color: var(--ink-2); }
.bp-pager { padding-block: clamp(24px, 4vw, 40px); }
.bp-pager__row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 1120px; }
.bp-pager__link { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: inherit; text-decoration: none; transition: border-color .2s, transform .3s var(--ease); }
.bp-pager__link:hover { border-color: var(--brand-line); transform: translateY(-2px); }
.bp-pager__link span { display: inline-flex; align-items: center; gap: 6px; font: 600 12px/1 var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--brand-ink); }
.bp-pager__link span svg { width: 14px; height: 14px; }
.bp-pager__link b { font: 500 16px/1.4 var(--sans); color: var(--ink); }
.bp-pager__link--older { text-align: right; align-items: flex-end; }
.bp-related { padding-block: clamp(32px, 5vw, 56px); border-top: 1px solid var(--line); background: var(--bg-alt); }
.bp-rels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(18px, 2.2vw, 28px); margin: 0; padding: 0; list-style: none; }
.bp-rel a { display: flex; flex-direction: column; gap: 8px; color: inherit; text-decoration: none; }
.bp-rel__media { display: block; aspect-ratio: 1200 / 630; overflow: hidden; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.bp-rel__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.bp-rel a:hover img { transform: scale(1.04); }
.bp-rel__cat { margin-top: 6px; font: 600 12px/1 var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--brand-ink); }
.bp-rel b { font: 500 17px/1.4 var(--sans); color: var(--ink); }
.bp-rel a:hover b { text-decoration: underline; text-underline-offset: 4px; }
.bp-rel__meta { font-size: 13px; color: var(--ink-3); }

@media (max-width: 1080px) {
  .bp-grid { grid-template-columns: minmax(0, 720px); }
  .bp-side { position: static; order: -1; max-height: none; }
  .bp-toc ol { max-height: 50vh; }
}
@media (max-width: 760px) {
  .bp-body { font-size: 17px; }
  .bp-intro { font-size: 18px; }
  .bp-cover { border-radius: var(--radius-sm); }
  .bp-pager__row, .bp-rels { grid-template-columns: minmax(0, 1fr); }
  .bp-pager__link--older { text-align: left; align-items: flex-start; }
  .bp-author__card { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { .bp-rel__media img, .bp-pager__link { transition: none; } }
@media print { .bp-progress, .bp-side, .bp-pager, .bp-related { display: none; } }
/* the same for the bands after the article */
.page-blog-post .bp-author { padding-top: clamp(24px, 4vw, 40px) !important; }
.page-blog-post .bp-pager { padding-top: clamp(20px, 3vw, 32px) !important; }
.page-blog-post .bp-related { padding-top: clamp(32px, 5vw, 56px) !important; }

/* sahi.com's text sometimes sets plain paragraphs in <pre> and carries long unbroken strings (URLs, codes):
   both pushed the page sideways. Everything in the article now wraps inside its column; tables scroll. */
.bp-body { min-width: 0; overflow-wrap: break-word; }
.bp-body pre { max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; }
.bp-body img, .bp-body video, .bp-body iframe { max-width: 100%; height: auto; }
.bp-body .table-scroll { max-width: 100%; overflow-x: auto; }
