/* The blog (src/pages/blog.ts). Colours, radii and type come from bioq.bio's tokens in bioq.css, so light and dark follow the site. No new fonts. */

.bhero { padding-bottom: 8px; }
.bhero .lead { max-width: 46em; }
.bback { font-size: 14.5px; font-weight: 600; color: var(--primary); }
.bback:hover { text-decoration: underline; }

.bsec { border-top: 0; padding-top: 32px; }
.bgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; }
.bcard { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-panel); overflow: hidden; transition: border-color .2s ease, transform .2s ease; }
.bcard:hover { border-color: var(--line-strong); }
.bcard-img { display: block; aspect-ratio: 16 / 10; background: var(--gel); border-bottom: 1px solid var(--line); overflow: hidden; }
.bcard-img img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.bcard-body { display: flex; flex-direction: column; gap: 10px; padding: 18px 20px 20px; flex: 1; }
.bcard h2 { font-size: 18px; line-height: 1.32; font-weight: 680; letter-spacing: -.01em; color: var(--ink); text-wrap: balance; }
.bcard h2 a { color: inherit; }
.bcard h2 a:hover { color: var(--primary); }
.bdesc { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--text); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.bcard .btags { margin-top: auto; padding-top: 4px; }

.bmeta { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; font-size: 13px; color: var(--muted); }
.bkind { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 12px; font-weight: 650; letter-spacing: .01em; }

.btags { display: flex; flex-wrap: wrap; gap: 6px; }
.btag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--gel); color: var(--text); font-size: 12.5px; line-height: 1.5; }
.btag span { color: var(--faint); font-size: 12px; }
.btag:hover { border-color: var(--primary); color: var(--primary); }
/* a chip inside a post is not a prose link: no underline, no link colour */
.bbody a.btag { color: var(--text); text-decoration: none; }
.bbody a.btag:hover { color: var(--primary); }
.bbody a.btag span { color: var(--faint); }
.btopics { margin-top: 48px; padding-top: 28px; border-top: 1px solid var(--line); }
.btopics h2 { font-size: 15px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.bempty { padding: 48px 0; font-size: 17px; color: var(--muted); }
.bfeed { margin-top: 28px; font-size: 14px; }
.bfeed a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.bfeed a:hover { color: var(--primary); }
.bpager { margin-top: 36px; display: flex; justify-content: space-between; align-items: center; gap: 16px; font-size: 14.5px; color: var(--muted); }
.bpager a { font-weight: 650; color: var(--primary); }

/* ── a post ── */
.bpost { padding-bottom: 24px; }
.bhead { padding: 48px 0 8px; }
.bnarrow { width: 100%; max-width: 760px; margin: 0 auto; padding: 0 var(--gutter); }
.bcrumb { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13.5px; color: var(--muted); margin-bottom: 26px; }
.bcrumb a { color: var(--muted); }
.bcrumb a:hover { color: var(--primary); }
.bhead .bmeta { margin-bottom: 16px; }
.bhead h1 { margin: 0; font-family: var(--font-display); font-stretch: var(--display-stretch); font-size: clamp(1.9rem, 1.3rem + 2.4vw, 3rem); line-height: 1.14; letter-spacing: var(--display-track); font-weight: 720; color: var(--ink); text-wrap: balance; }
.blede { margin: 22px 0 0; font-size: clamp(1.0625rem, 1rem + .3vw, 1.25rem); line-height: 1.65; color: var(--text); }
.basof { margin: 20px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font-size: 13.5px; line-height: 1.5; color: var(--muted); }
figure.bhero { width: 100%; max-width: 1040px; margin: 36px auto 0; padding: 0 var(--gutter); }
figure.bhero img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-panel); background: var(--surface); box-shadow: var(--shadow-window); }

.bcols { width: 100%; max-width: 1080px; margin: 48px auto 0; padding: 0 var(--gutter); display: grid; grid-template-columns: minmax(0, 1fr); gap: 32px; }
@media (min-width: 1100px) { .bcols:has(.btoc) { grid-template-columns: 220px minmax(0, 760px); justify-content: center; gap: 56px; } }
.btoc { font-size: 14px; }
.btoc h2 { font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.btoc ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; border-left: 2px solid var(--line); }
.btoc a { display: block; padding-left: 14px; color: var(--text); line-height: 1.5; }
.btoc a:hover { color: var(--primary); }
@media (min-width: 1100px) { .btoc { position: sticky; top: 92px; align-self: start; } }
@media (max-width: 1099px) { .btoc { border: 1px solid var(--line); border-radius: var(--r-input); background: var(--surface); padding: 16px 18px; } .btoc ol { border-left: 0; } .btoc a { padding-left: 0; } }

/* ── the body: ONE vertical rhythm ──
   Every block of .bbody, and of the sections inside it, gets its space from the family of rules below. They are all written as  P > :where(...)  so they weigh exactly the same, and the ORDER decides (later wins).
   Do not put margins on p, ul, ol, h2, table… directly: a rule like  .bbody p { margin: 0 }  out-weighs the flow rule and the block loses its space (that is what made headings, lists and tables touch the next block). */
.bbody { min-width: 0; font-size: var(--bu); line-height: 1.75; color: var(--text); --bu: 17.5px; --flow: calc(var(--bu) * 1.2); overflow-wrap: break-word; }
:where(.bbody) :where(ul, ol, pre, figure, blockquote, hr) { margin: 0; }
:is(.bbody, .bbody > section) > :where(* + *) { margin-top: var(--flow); }                                               /* paragraph to paragraph */
:is(.bbody, .bbody > section) > :where(p:has(> strong:first-child)) { margin-top: calc(var(--bu) * 1.9); }                                /* a bold lead-in label opens a new group */
:is(.bbody, .bbody > section) > :where(.bp-fig + *, .bp-table + *) { margin-top: calc(var(--bu) * 2.3); }                                 /* after a table or figure: room to breathe */
:is(.bbody, .bbody > section) > :where(.bp-code + *) { margin-top: calc(var(--bu) * 1); }
:is(.bbody, .bbody > section) > :where(* + .bp-table, * + .bp-fig) { margin-top: calc(var(--bu) * 1.6); }
:is(.bbody, .bbody > section) > :where(* + .bp-code) { margin-top: calc(var(--bu) * 1); }
:is(.bbody, .bbody > section) > :where(h2) { margin-top: calc(var(--bu) * 3.2); }
:is(.bbody, .bbody > section) > :where(h3) { margin-top: calc(var(--bu) * 2.4); }
:is(.bbody, .bbody > section) > :where(h4) { margin-top: calc(var(--bu) * 2); }
:is(.bbody, .bbody > section) > :where(hr, hr + *) { margin-top: calc(var(--bu) * 2.6); }
:is(.bbody, .bbody > section) > :where(section, aside) { margin-top: calc(var(--bu) * 3.4); }
:is(.bbody, .bbody > section) > :where(h2 + *) { margin-top: calc(var(--bu) * .95); }                                                      /* a heading keeps close to what it introduces */
:is(.bbody, .bbody > section) > :where(h3 + *) { margin-top: calc(var(--bu) * .7); }
:is(.bbody, .bbody > section) > :where(h4 + *) { margin-top: calc(var(--bu) * .55); }
:is(.bbody, .bbody > section) > :where(.btags-end) { margin-top: calc(var(--bu) * 2.6); }
:is(.bbody, .bbody > section) > :where(.bnote) { margin-top: calc(var(--bu) * 1.4); }
:is(.bbody, .bbody > section) > :where(:first-child) { margin-top: 0; }

.bbody h2 { font-family: var(--font-display); font-stretch: var(--display-stretch); font-size: clamp(1.45rem, 1.2rem + .9vw, 1.9rem); line-height: 1.22; letter-spacing: var(--display-track); font-weight: 700; color: var(--ink); text-wrap: balance; scroll-margin-top: 88px; }
.bbody h3 { font-size: 1.2rem; line-height: 1.35; font-weight: 680; color: var(--ink); scroll-margin-top: 88px; }
.bbody h4 { font-size: 1.05rem; line-height: 1.4; font-weight: 680; color: var(--ink); }
.bbody a { color: var(--primary); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.bbody a:hover { text-decoration-thickness: 2px; }
.bbody strong { color: var(--ink); font-weight: 680; }
.bbody code { font-family: var(--font-mono); font-size: .88em; padding: .1em .4em; border-radius: 5px; background: var(--gel); border: 1px solid var(--line); color: var(--ink); }
.bbody hr { border: 0; border-top: 1px solid var(--line); }
.bbody blockquote { padding: 4px 0 4px 18px; border-left: 3px solid var(--primary); color: var(--text); background: transparent; }
.bbody blockquote p + p { margin-top: calc(var(--bu) * .7); }

/* lists: room between items (an item is often a whole paragraph), numbers and bullets that read as numbers and bullets */
.bbody :is(ul, ol) { padding-left: 1.7em; }
.bbody li { padding-left: .25em; }
.bbody li + li { margin-top: .9em; }
.bbody li::marker { color: var(--muted); font-weight: 650; font-variant-numeric: tabular-nums; }

.bp-code { padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-input); background: var(--gel); overflow-x: auto; font-size: 14px; line-height: 1.6; }
.bp-code code { padding: 0; border: 0; background: transparent; font-size: inherit; white-space: pre; }
.bp-fig img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--r-input); background: var(--surface); }
.bp-fig figcaption { margin-top: 12px; font-size: 13.5px; line-height: 1.55; color: var(--muted); }
.bp-table { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-input); -webkit-overflow-scrolling: touch;
  /* a wide table scrolls sideways: a soft shadow on the side that still has more (covers use the table's own colour) */
  background: linear-gradient(to right, var(--surface) 30%, transparent) left / 36px 100% no-repeat local, linear-gradient(to left, var(--surface) 30%, transparent) right / 36px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgb(0 0 0 / .16), transparent) left / 12px 100% no-repeat scroll, radial-gradient(farthest-side at 100% 50%, rgb(0 0 0 / .16), transparent) right / 12px 100% no-repeat scroll var(--surface); }
/* the Korean page sets overflow-wrap: anywhere on the body, which lets a table column shrink to one letter (IC5 / 0): inside a table, break only between words */
.bp-table table { width: 100%; border-collapse: collapse; font-size: 14.5px; line-height: 1.5; overflow-wrap: normal; }
.bp-table th, .bp-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.bp-table thead th { background: var(--gel); font-size: 12.5px; font-weight: 700; letter-spacing: .03em; line-height: 1.4; color: var(--muted); vertical-align: bottom; }
.bp-table tbody tr:last-child td { border-bottom: 0; }
.bp-table tbody tr:hover td { background: color-mix(in srgb, var(--gel) 55%, transparent); }
.bp-table td { font-variant-numeric: tabular-nums; }

.bcta { padding: 28px 30px; border-radius: var(--r-panel); background: var(--primary-soft); border: 1px solid color-mix(in srgb, var(--primary) 25%, var(--line)); }
.bcta h2 { margin: 0; font-size: 1.35rem; }
.bcta p { margin-top: 12px; font-size: 16px; line-height: 1.6; }
.bcta .bcta-act { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.bcta .btn { text-decoration: none; }
.bbody .bcta a.btn-primary { color: var(--primary-ink); }

/* the closing sections: queries, questions, sources — each one set off by a rule */
.bbody > .bsmall, .bbody > .bfaq { padding-top: 2.2em; border-top: 1px solid var(--line); }
.bsmall h2, .bfaq h2 { font-size: 1.3rem; }
.bbody .bqueries { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px; }
.bbody .bqueries li, .bbody .bqueries li + li { margin: 0; padding: 0; }
.bbody .bqueries a { text-decoration: none; }
.bbody .bqueries code { display: inline-block; padding: 6px 12px; background: var(--gel); }
.bbody .bqueries a:hover code { border-color: var(--primary); color: var(--primary); }
.bfaq > h3 { margin-top: 1.9em; font-size: 1.08rem; line-height: 1.4; }
.bfaq > h2 + h3 { margin-top: 1.2em; }
.bfaq > h3 + p { margin-top: .6em; }
.bbody .bsources { padding-left: 1.7em; font-size: 15px; line-height: 1.65; }
.bbody .bsources li + li { margin-top: .85em; }
.bsrc-type { display: inline-block; margin-right: 6px; padding: 0 8px; border-radius: 999px; background: var(--gel); border: 1px solid var(--line); font-size: 11.5px; font-weight: 650; line-height: 1.7; color: var(--muted); vertical-align: 1px; }
.bsrc-year { color: var(--muted); font-size: 13.5px; }
.bsrc-doi { display: block; margin-top: 3px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.bnote { font-size: 13.5px; line-height: 1.65; color: var(--muted); }
.bmore { margin-top: 64px; padding: 52px 0 8px; border-top: 1px solid var(--line); }
.bmore h2 { font-size: 1.5rem; margin-bottom: 24px; }

@media (max-width: 1100px) { .bgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) {
  .bgrid { grid-template-columns: minmax(0, 1fr); }
  .bhead { padding-top: 28px; }
  .bbody { --bu: 16.5px; }
  .bcols { margin-top: 36px; }
  .bcta { padding: 22px 20px; }
}
@media (prefers-reduced-motion: reduce) { .bcard { transition: none; } }
@media print { .btoc, .bcta, .bmore { display: none; } .bbody { font-size: 11pt; } }
