/* Area: blog (P2). /blog/, the built post and the author pages. Loads after core.css (and tools-index.css on /blog/ for the search box and chips). */

/* ---------- Avatar monogram, byline, meta ---------- */
.b-av {
  display: inline-grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-ink); font: 600 .75rem/1 var(--font-mono); letter-spacing: .02em;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 25%, transparent);
}
.b-av--lg { width: 72px; height: 72px; font-size: 1.25rem; }
.b-av--xl { width: clamp(88px, 12vw, 132px); height: clamp(88px, 12vw, 132px); font: 650 clamp(1.75rem, 1.2rem + 2vw, 2.75rem)/1 var(--font-display); letter-spacing: -.03em; }
.byline { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; color: var(--fg); text-decoration: none; }
.byline-txt { display: grid; gap: 2px; min-width: 0; }
.byline-n { font-weight: 600; font-size: .9375rem; line-height: 1.2; }
.byline-r { font-size: .8125rem; color: var(--muted); line-height: 1.2; }
.byline:hover .byline-n { color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; }
.b-when { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font: 500 .75rem/1.4 var(--font-mono); color: var(--muted); }
.b-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; }
.b-cat { font: 500 .75rem/1.3 var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }

/* ---------- Post cards ---------- */
.bgrid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.bgrid--3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.bcard {
  position: relative; display: grid; grid-template-rows: auto 1fr; min-width: 0; overflow: hidden;
  border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--bg);
  transition: transform .3s var(--ease), border-color .2s, box-shadow .3s var(--ease);
}
.bcard:hover, .bcard:focus-within { transform: translateY(-3px); border-color: var(--fg); box-shadow: 0 18px 34px -24px var(--shadow-c2); }
.bcard-media { aspect-ratio: 16 / 10; overflow: hidden; background: var(--panel); border-bottom: 1px solid var(--line); }
.bcard-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.bcard:hover .bcard-media img { transform: scale(1.04); }
.bcard-body { display: grid; grid-template-rows: auto auto 1fr auto; gap: 10px; padding: 18px 20px 14px; min-width: 0; }
.bcard-t { font-size: clamp(1.125rem, 1.02rem + .35vw, 1.3125rem); line-height: 1.25; letter-spacing: -.02em; }
.bcard-link { color: inherit; text-decoration: none; }
.bcard-link::after { content: ""; position: absolute; inset: 0; z-index: 0; border-radius: inherit; }
.bcard-link:focus-visible { outline: none; }
.bcard:has(.bcard-link:focus-visible) { outline: 3px solid var(--accent-ink); outline-offset: 3px; }
.bcard-x { font-size: .9375rem; line-height: 1.55; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bcard .b-meta { padding-top: 10px; border-top: 1px solid var(--line); }

/* ---------- /blog/ layout: main + sidebar ---------- */
.blog-index { padding-bottom: clamp(48px, 6vw, 96px); }
.blog-layout { display: grid; gap: 48px; }
.blog-layout > * { min-width: 0; }
@media (min-width: 1100px) { .blog-layout { grid-template-columns: minmax(0, 1fr) 300px; gap: 56px; align-items: start; } }
.blog-main { display: grid; gap: 28px; align-content: start; }
.blog-bar { display: grid; gap: 12px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.blog-bar .tsearch-box { max-width: 520px; }


.bfeat { position: relative; display: grid; overflow: hidden; border-radius: var(--r-xl); border: 1px solid var(--line); background: var(--panel); }
@media (min-width: 760px) { .bfeat { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } }
.bfeat-media { aspect-ratio: 4 / 3; background: var(--panel-2); overflow: hidden; }
.bfeat-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .9s var(--ease); }
.bfeat:hover .bfeat-media img { transform: scale(1.03); }
.bfeat-body { display: grid; align-content: center; gap: 14px; padding: clamp(20px, 3vw, 36px); min-width: 0; }
.bfeat-body .eyebrow { color: var(--muted); }
.b-cat-in { color: var(--accent-ink); }
.bfeat-t { font-size: clamp(1.625rem, 1.15rem + 1.6vw, 2.5rem); line-height: 1.08; letter-spacing: -.035em; }
.bfeat-x { color: var(--muted); }
.bfeat:has(.bcard-link:focus-visible) { outline: 3px solid var(--accent-ink); outline-offset: 3px; }
.bfeat:hover .bfeat-t { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; }

.blog-posts { display: grid; gap: 18px; }
.blog-posts-h { font-size: clamp(1.375rem, 1.1rem + .8vw, 1.75rem); letter-spacing: -.03em; }
.blog-empty { margin-top: 4px; }
.bpages { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; margin-top: 18px; padding-top: 20px; border-top: 1px solid var(--line); }
.bpages-k { font: 500 .8125rem/1.3 var(--font-mono); color: var(--muted); }
.bpages-n { display: flex; align-items: center; gap: 4px; }
.bpages-n a, .bpages-n span { display: inline-grid; place-items: center; min-width: 44px; height: 44px; padding: 0 8px; border-radius: 999px; font: 500 .875rem/1 var(--font-mono); text-decoration: none; color: var(--fg); }
.bpages-n a:hover { background: var(--panel); }
.bpages-n [aria-current="page"] { background: var(--fg); color: var(--bg); }
.bpages-gap { color: var(--muted); padding: 0 4px; }

/* ---------- Sidebar ---------- */
.blog-side { display: grid; gap: 16px; align-content: start; }
@media (min-width: 760px) and (max-width: 1099px) { .blog-side { grid-template-columns: repeat(2, minmax(0, 1fr)); } .bside-news { grid-column: 1 / -1; } }
.bside { display: grid; gap: 12px; padding: 20px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--bg); min-width: 0; }
.bside-h { font-size: 1.125rem; letter-spacing: -.02em; }
.bside-p { font-size: .9375rem; color: var(--muted); }
.bside-cats { display: grid; }
.bside-cats li + li { border-top: 1px solid var(--line); }
.bside-cats a { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; padding: 6px 0; color: var(--fg); text-decoration: none; font-size: .9375rem; }
@media (pointer: coarse) { .bside-cats a { min-height: 44px; } }
.bside-cats a:hover { color: var(--accent-ink); }
.bside-n { font: 500 .75rem/1 var(--font-mono); color: var(--muted); }
.bside-more summary { display: flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; list-style: none; font-weight: 600; font-size: .9375rem; color: var(--accent-ink); border-top: 1px solid var(--line); }
.bside-more summary::-webkit-details-marker { display: none; }
.bside-more summary .ic { width: 16px; height: 16px; transition: transform .3s var(--ease); }
.bside-more[open] summary .ic { transform: rotate(180deg); }
.b-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.b-tag { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); color: var(--fg); font-size: .8125rem; text-decoration: none; transition: border-color .2s, background-color .2s; }
@media (pointer: coarse) { .b-tag { min-height: 44px; } }
.b-tag:hover { border-color: var(--fg); background: var(--bg); }
.bside-news { background: var(--panel); }
.bnews-form { display: grid; gap: 10px; }
.bnews-form .field input { background: var(--bg); }
.bnews-form .btn { justify-self: start; }
.bnews-done { display: grid; gap: 10px; justify-items: start; }
.bnews-done-h { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.bnews-done-h:focus { outline: none; }
.bnews-done-h .ic { width: 18px; height: 18px; padding: 3px; border-radius: 50%; background: var(--ok); color: var(--bg); }
.bnews-done .preview-note { font-size: .875rem; }
.bnews-done-e { font-size: .875rem; color: var(--muted); overflow-wrap: anywhere; }
.bnews-done-e b { color: var(--fg); font-weight: 600; }

/* ---------- Post: reading progress, head, hero ---------- */
.read-bar { position: fixed; z-index: 59; left: var(--rail-w); right: 0; top: calc(var(--header-h) + env(safe-area-inset-top, 0px)); height: 3px; pointer-events: none; }
.read-bar span { display: block; height: 100%; background: var(--accent); transform: scaleX(var(--read, 0)); transform-origin: 0 50%; }
html:not(.js) .read-bar { display: none; }
.post-head { padding-bottom: clamp(28px, 4vw, 48px); }
.post-head .crumbs li:last-child { min-width: 0; max-width: 100%; }
.post-head .crumbs [aria-current="page"] { display: block; max-width: min(42ch, 100%); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 44px; }
.post-top { display: grid; gap: 18px; max-width: 60rem; }
.post-cats { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.post-cats a { display: inline-flex; align-items: center; min-height: 32px; color: var(--accent-ink); text-decoration: none; }
.post-cats [aria-hidden] { color: var(--line); }
.post-title { max-width: 22ch; }
.post-dek { margin-top: 0; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.post-meta .b-when { font-size: .8125rem; }
.post-copy { margin-left: auto; }
.post-copy .ic { width: 16px; height: 16px; }
.post-copy:hover .ic { transform: none; }
.post-copy-msg:empty { display: none; }
@media (max-width: 639px) { .post-copy { margin-left: 0; } }
.post-hero { margin-top: clamp(28px, 4vw, 48px); border-radius: var(--r-xl); overflow: hidden; border: 1px solid var(--line); background: var(--panel); }
.post-hero img { width: 100%; }

/* ---------- Post body ---------- */
.post-body { padding-top: clamp(24px, 3vw, 40px); }
.post-fig { margin-block: 1.6em; }
.post-fig img { width: 100%; border: 1px solid var(--line); }
.post-fig--narrow img { width: min(320px, 100%); margin-inline: auto; }
.post-body .faq { margin-top: 1.2em; }
.post-body .faq summary { font-size: clamp(1.0625rem, 1rem + .3vw, 1.25rem); }
.post-body .faq-a { padding-right: 0; color: var(--fg); }
.post-body .faq-a > * + * { margin-top: .8em; }

/* ---------- Author box (post) ---------- */
.author-box { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; max-width: 60rem; padding: clamp(22px, 3vw, 36px); border-radius: var(--r-xl); border: 1px solid var(--line); background: var(--panel); }
@media (min-width: 1024px) { .author-box { margin-left: calc(min(260px, 22vw) + 56px); } }
@media (max-width: 479px) { .author-box { grid-template-columns: minmax(0, 1fr); } }
.author-main { display: grid; gap: 8px; justify-items: start; }
.author-n { font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem); letter-spacing: -.03em; }
.author-n a { color: inherit; text-decoration: none; }
.author-role { font-weight: 600; color: var(--accent-ink); }
.author-bio { color: var(--muted); max-width: 44rem; }
.author-acts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.author-acts .post-copy { margin-left: 0; }
.post-related { border-top: 1px solid var(--line); }

/* ---------- Author page ---------- */
.author-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(18px, 3vw, 40px); align-items: start; }
@media (max-width: 479px) { .author-hero { grid-template-columns: minmax(0, 1fr); } }
.author-hero-main { display: grid; gap: 10px; min-width: 0; }
.author-title { font-size: clamp(2.5rem, 1rem + 5.5vw, 5.75rem); }
.author-hero-role { font-size: clamp(1.125rem, 1rem + .5vw, 1.375rem); font-weight: 600; color: var(--accent-ink); }
.author-hero-role .muted { font-weight: 400; }
.author-intro { margin-top: 6px; }
.author-count { font: 500 .8125rem/1.4 var(--font-mono); color: var(--muted); margin-top: 6px; }
.author-posts { padding-bottom: clamp(56px, 7vw, 104px); }
.author-more { margin-top: 24px; font-weight: 500; }

@media (prefers-reduced-motion: reduce) {
  .bcard:hover, .bcard:focus-within { transform: none; }
  .bcard:hover .bcard-media img, .bfeat:hover .bfeat-media img { transform: none; }
}
@media print { .read-bar, .post-copy { display: none !important; } }
