/* =====================================================================
   Blog posts (layout: blog) and the blog index (blog/index.html)
   ===================================================================== */

/* blog.css is only loaded on blog pages, so these apply page-wide there */
:root {
  --ink: #14151a;
  --text: #262a33;
  --muted: #5d6575;
  --faint: #8a93a3;
  --line: #e3e8ef;
  --soft: #f5f7fa;
  --accent: #0077b6;
  --accent-soft: rgba(0, 119, 182, 0.08);
  --radius: 10px;
  --shadow: 0 18px 50px rgba(25, 30, 45, 0.10);
  --toc-w: 180px;
  --toc-gap: 48px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
/* Blog typography is scoped to blog content, so the shared site header
   (_includes/header.html) looks identical to every other page. */
.blog-head, .blog-hero-media, .blog-main, .post-list, .lightbox {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
:is(.blog-head, .blog-hero-media, .blog-main) a { color: var(--accent); }
:is(.blog-head, .blog-hero-media, .blog-main) a:hover { text-decoration: underline; }

#blog-progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 100;
  background: linear-gradient(90deg, var(--accent), #5ab0e0);
  transform: scaleX(0); transform-origin: 0 50%;
}

/* ---------------- post header ---------------- */
.blog-head { margin-top: 0; }
.blog-eyebrow {
  margin: 0 0 1rem; font-size: .75rem; line-height: 1.25rem; font-weight: 700;
  letter-spacing: .09em; text-transform: uppercase; color: var(--accent);
}
.blog-eyebrow a { color: inherit; }
.blog-eyebrow .sep { margin: 0 .5rem; color: var(--faint); }
.blog-title {
  margin: 0; max-width: 21em;
  font-size: clamp(2rem, 3.6vw, 3rem); line-height: 1.08;
  font-weight: 800; letter-spacing: -0.025em; color: var(--ink);
}
.blog-subtitle {
  margin: 1rem 0 0; max-width: 40em;
  font-size: clamp(1.08rem, 1.8vw, 1.35rem); line-height: 1.45; color: var(--muted); font-weight: 450;
}

.blog-byline {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 1.5rem 2.5rem; margin-top: 2.2rem; padding: 1.1rem 0;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  font-size: .95rem; line-height: 1.4; /* one line height for every column so first rows align */
}
.byline-label {
  font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); margin-bottom: .45rem;
}
.byline-authors { color: var(--ink); }
.byline-name { font-weight: 600; white-space: nowrap; }
.byline-sep { color: var(--muted); }
.byline-name a { color: var(--ink); }
.byline-name a:hover { color: var(--accent); }
.byline-name sup, .byline-affs sup { color: var(--muted); font-weight: 500; margin-left: 1px; line-height: 0; }
.byline-affs { margin-top: .35rem; font-size: .86rem; color: var(--muted); }
.byline-affs span { white-space: nowrap; }
.byline-affs span { margin-right: .9rem; }
.byline-note { font-size: .8rem; color: var(--faint); margin-top: .25rem; }
.byline-note span { display: inline-block; margin-right: 1rem; } /* a long note wraps as a unit */
.byline-note sup { margin-right: 1px; }
.byline-sub { font-size: .82rem; color: var(--faint); }
.blog-byline time { color: var(--ink); font-weight: 500; }
.blog-byline a[href="#citation"] { font-weight: 500; }

.blog-actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.5rem; }
.blog-btn {
  display: inline-flex; align-items: center; gap: .5rem;
  min-height: 40px; padding: 0 1.1rem; border-radius: 999px;
  border: 1px solid var(--line); background: #fff;
  color: var(--ink) !important; font-weight: 600; font-size: .92rem;
  transition: background .15s, border-color .15s;
}
.blog-btn:hover { background: var(--soft); text-decoration: none !important; }
.blog-btn-emoji { font-size: 1.05em; line-height: 1; }
.blog-btn.primary { background: #171a21; border-color: #171a21; color: #fff !important; }
.blog-btn.primary:hover { background: #000; }

.blog-hero-media { margin: 2rem 0 0; }
.blog-hero-media img, .blog-hero-media video {
  display: block; width: 100%; border-radius: var(--radius);
  box-shadow: var(--shadow); border: 1px solid rgba(20, 21, 26, .06);
}
.blog-hero-media figcaption { margin-top: .8rem; font-size: .9rem; color: var(--muted); }

/* ---------------- body grid + TOC ---------------- */
.blog-main { margin-top: 0; }
@media (min-width: 1200px) {
  .blog-main { display: grid; grid-template-columns: var(--toc-w) minmax(0, 1fr); gap: var(--toc-gap); }
}
.blog-toc { display: none; }
@media (min-width: 1200px) {
  .blog-toc { display: block; position: sticky; top: 2rem; align-self: start; max-height: calc(100vh - 4rem); overflow-y: auto; }
}
.blog-toc-label {
  font-size: .75rem; line-height: 1.25rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--faint); margin-bottom: .7rem; /* same metrics as .blog-eyebrow so the two align */
}
.blog-toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.blog-toc li a {
  display: block; margin-left: -2px; padding: .3rem 0 .3rem .9rem;
  border-left: 2px solid transparent; color: var(--muted); font-size: .86rem; line-height: 1.35;
}
.blog-toc li a:hover { color: var(--ink); text-decoration: none; }
.blog-toc li a.active { color: var(--accent); border-left-color: var(--accent); font-weight: 600; }

/* ---------------- body typography ---------------- */
.blog-article { min-width: 0; padding-bottom: 4rem; }
.blog-body { margin-top: 2.6rem; }
.blog-body { font-size: 1.065rem; line-height: 1.75; color: var(--text); counter-reset: figure section; }
.blog-body p, .blog-body ul, .blog-body ol, .blog-body blockquote { margin: 0 0 1.25rem; }
.blog-body li { margin-bottom: .35rem; }
.blog-body strong { color: var(--ink); font-weight: 650; }
.blog-body h2, .blog-citation h2, .blog-references h2 {
  font-size: clamp(1.45rem, 2.4vw, 1.9rem); font-weight: 800; letter-spacing: -0.015em;
  line-height: 1.2; color: var(--ink); margin: 3.6rem 0 1.1rem; scroll-margin-top: 1.5rem;
}
.blog-body h2 { counter-increment: section; }
.blog-body h2::before {
  content: counter(section, decimal-leading-zero);
  display: block; font-family: var(--mono); font-size: .8rem; font-weight: 600;
  letter-spacing: .05em; color: var(--accent); margin-bottom: .35rem;
}
.blog-body h3 { font-size: 1.25rem; font-weight: 700; color: var(--ink); margin: 2.4rem 0 .8rem; scroll-margin-top: 1.5rem; }
.blog-body h4 { font-size: 1.05rem; font-weight: 700; color: var(--ink); margin: 1.8rem 0 .6rem; }
.blog-body blockquote { border-left: 3px solid var(--accent); padding: .2rem 0 .2rem 1.1rem; color: var(--muted); font-style: italic; }
.blog-body hr { margin: 3rem 0; border: 0; border-top: 1px solid var(--line); opacity: 1; }
.blog-body img, .blog-body video { max-width: 100%; height: auto; }
.blog-body :not(pre) > code {
  font-family: var(--mono); font-size: .86em; background: var(--soft);
  border: 1px solid var(--line); padding: .08em .35em; border-radius: 5px; color: #b42357;
}

/* callout: <div class="callout" markdown="1"> ... </div> */
.callout {
  background: var(--accent-soft); border: 1px solid rgba(0, 119, 182, .18);
  border-radius: var(--radius); padding: 1.1rem 1.3rem; margin: 2rem 0;
}
.callout > :last-child { margin-bottom: 0; }

/* headline numbers: <div class="stats"><div><b>4</b><span>steps</span></div>...</div> */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .9rem; margin: 2.2rem 0; }
.stats > div {
  display: flex; flex-direction: column; gap: .35rem; padding: 1.1rem 1.2rem;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff;
  box-shadow: 0 10px 30px rgba(25, 30, 45, .04);
}
.stats b { font-size: 1.9rem; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; color: var(--accent); }
.stats span { font-size: .86rem; line-height: 1.35; color: var(--muted); }

/* release timeline: <ol class="timeline"><li class="done"><span>When</span>What</li>...</ol> */
.blog-body .timeline { list-style: none; padding: 0; margin: 2rem 0; }
.blog-body .timeline li { position: relative; margin: 0; padding: 0 0 1.3rem 1.75rem; }
.blog-body .timeline li:last-child { padding-bottom: 0; }
.blog-body .timeline li::before {   /* milestone dot: hollow = upcoming, filled = released */
  content: ""; position: absolute; left: 0; top: .3rem; width: .7rem; height: .7rem;
  border-radius: 50%; border: 2px solid #b4bcc8; background: #fff; box-sizing: border-box;
}
.blog-body .timeline li.done::before { border-color: var(--accent); background: var(--accent); }
.blog-body .timeline li:not(:last-child)::after {   /* connector down to the next dot */
  content: ""; position: absolute; left: calc(.35rem - 1px); top: 1.2rem; bottom: .1rem;
  width: 2px; background: var(--line);
}
.blog-body .timeline li.done:not(:last-child)::after { background: linear-gradient(var(--accent), var(--line)); }
.blog-body .timeline span {
  display: block; margin-bottom: .1rem;
  font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.blog-body .timeline li.done span { color: var(--accent); }

/* ---------------- figures ---------------- */
.fig { margin: 2.4rem 0; text-align: center; }
.fig img, .fig video { display: inline-block; max-width: 100%; border-radius: var(--radius); border: 1px solid rgba(20, 21, 26, .06); }
.fig figcaption { font-size: .9rem; line-height: 1.55; color: var(--muted); margin-top: .75rem; text-align: left; }
.fig.numbered { counter-increment: figure; }
.fig.numbered figcaption::before { content: "Figure " counter(figure) ".  "; font-weight: 700; color: var(--ink); white-space: pre; }
.fig.full img, .fig.full video { width: 100%; }

/* side-by-side grids: <div class="grid grid-3"> {% include figure.html ... %} ... </div> */
.blog-body .grid { display: grid; gap: .75rem; margin: 2.4rem 0; }
.blog-body .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.blog-body .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.blog-body .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.blog-body .grid .fig { margin: 0; }
.blog-body .grid .fig img, .blog-body .grid .fig video { width: 100%; }
.blog-body .grid .fig figcaption { text-align: center; margin-top: .4rem; font-size: .84rem; }
.blog-body .grid .fig figcaption::before { content: none; }
@media (max-width: 576px) { .blog-body .grid-3, .blog-body .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------------- gallery (_includes/gallery.html) ----------------
   Opened: a full-window-width band like an opened comparison viewer (JS stretches the figure out of
   the reading column, over the sticky TOC). Clips sit in equal-width columns at their own aspect
   ratio (--ar); JS places them in order into the shortest column (.gal-col). */
.gal {
  --cols: 3;
  position: relative; z-index: 3; margin: 2.6rem 0; padding: 1.5rem 0 1.4rem; text-align: left;
  background: var(--soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.gal-inner { width: min(1640px, calc(100% - 48px)); margin: 0 auto; }
.gal-head { display: flex; align-items: center; gap: .7rem; margin-bottom: .9rem; }
.gal-toggle { margin-left: auto; }

/* folded state: the first six clips, as a card within the reading column's width */
.gal.gal-collapsed {
  --cols: 2; z-index: auto; padding: 1rem 0 1.1rem;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(25, 30, 45, .04);
}
.gal-collapsed .gal-inner, .gal-collapsed > figcaption { width: calc(100% - 2rem); }
.gal-collapsed .gal-tile.gal-cut { display: none; }
.gal-open { display: none; }
.gal-collapsed .gal-open {
  display: inline-flex; align-items: center; gap: .5rem; margin-top: 1rem; padding: .45rem 1rem; border: 0; border-radius: 999px;
  background: #171a21; color: #fff; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
}
.gal-collapsed .gal-open:hover { background: #000; }
.gal-open i { font-size: .8rem; }
.gal-toggle .fa-down-left-and-up-right-to-center, .gal-collapsed .gal-toggle .fa-up-right-and-down-left-from-center { display: inline-block; }
.gal-toggle .fa-up-right-and-down-left-from-center, .gal-collapsed .gal-toggle .fa-down-left-and-up-right-to-center { display: none; }
.gal-anim { transition: width .38s ease, margin-left .38s ease; }
.gal-inner { transition: opacity .2s; }
.gal-anim .gal-inner, .gal-folding .gal-inner { opacity: 0; }
.gal-title { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); }
.gal-count { font-size: .8rem; color: var(--faint); }
.gal-cols { column-count: var(--cols); column-gap: .8rem; }           /* no-JS fallback */
.gal-cols.gal-js { display: flex; align-items: flex-start; gap: .8rem; }
.gal-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: .8rem; }
.gal-tile {
  display: block; width: 100%; margin: 0 0 .8rem; break-inside: avoid;
  padding: 0; border: 0; background: none; text-align: left; cursor: pointer; font: inherit; color: inherit;
}
.gal-js .gal-tile { margin: 0; }
.gal-tile[hidden] { display: none; }
.gal-media { position: relative; display: block; aspect-ratio: var(--ar); overflow: hidden; border-radius: 8px; background: #0d0e11; }
.gal-media > video, .gal-media > img { display: block; width: 100%; height: 100%; object-fit: cover; }
.gal-tile:hover .gal-media, .gal-tile:focus-visible .gal-media { box-shadow: 0 0 0 2px var(--accent); }
.gal-inputs { position: absolute; top: .5rem; right: .5rem; display: flex; gap: .3rem; }
.gal-inputs img {
  display: block; width: 72px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px;
  border: 2px solid #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, .4);
}
.gal-more-btn {
  display: block; margin: 1.2rem auto 0; padding: .45rem 1.1rem; border: 0; border-radius: 999px;
  background: #171a21; color: #fff; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
}
.gal-more-btn:hover { background: #000; }
.gal > figcaption { width: min(1640px, calc(100% - 48px)); margin: .9rem auto 0; font-size: .9rem; line-height: 1.55; color: var(--muted); }
.gal figcaption > * { max-width: 920px; }
.gal.numbered { counter-increment: figure; }
.gal.numbered figcaption::before { content: "Figure " counter(figure) ".  "; font-weight: 700; color: var(--ink); white-space: pre; }
@media (max-width: 576px) {
  .gal, .gal.gal-collapsed { --cols: 1; }
  .gal-inner { width: calc(100% - 24px); }
  .gal-inputs img { width: 52px; }
}

/* ---------------- viewer (gallery tiles, zoomable images) ----------------
   Media fills the left side and always fits the window; the details panel on the right scrolls. */
.lightbox {
  position: fixed; inset: 0; z-index: 200; display: none;
  grid-template-columns: minmax(0, 1fr) 400px; grid-template-rows: 100%;
  background: rgba(10, 11, 14, .94); backdrop-filter: blur(8px); color: #e8eaee;
}
.lightbox.open { display: grid; }
.lightbox.lb-bare { grid-template-columns: minmax(0, 1fr); }
.lb-bare .lb-panel { display: none; }
.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; padding: 3.5rem 4.5rem; }
.lb-media { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; min-height: 0; }
.lb-media video, .lb-media img { display: block; flex: 0 1 auto; max-width: 100%; max-height: 100%; min-height: 0; object-fit: contain; border-radius: 8px; }
.lb-media video { background: #000; }
.lb-caption { margin: .8rem 0 0; max-width: 760px; font-size: .92rem; line-height: 1.5; text-align: center; }
.lb-panel { overflow-y: auto; padding: 3.6rem 1.6rem 2rem; background: #15161a; border-left: 1px solid rgba(255, 255, 255, .08); }
.lb-btn {
  position: absolute; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, .1); color: #fff; font-size: 1.1rem; cursor: pointer;
}
.lb-btn:hover { background: rgba(255, 255, 255, .2); }
.lb-close { top: .9rem; right: .9rem; z-index: 1; }
.lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }
.lb-single .lb-prev, .lb-single .lb-next { display: none; }
.lb-count { font-size: .76rem; color: #8b919c; margin-bottom: .5rem; }
.lb-title { margin: 0; font-size: 1.2rem; font-weight: 800; letter-spacing: -0.01em; color: #fff; }
.lb-meta { margin-top: .3rem; font-size: .84rem; color: #a3a9b4; }
.lb-inputs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; margin-top: 1.1rem; }
.lb-inputs figure { margin: 0; }
.lb-inputs img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #000; border-radius: 6px; }
.lb-inputs figcaption { margin-top: .3rem; font-size: .76rem; color: #a3a9b4; }
.lb-prompt { margin-top: 1.3rem; }
.lb-sec + .lb-sec { margin-top: 1.1rem; }
.lb-sec h4 { margin: 0 0 .4rem; font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: #8b919c; }
.lb-sec p { margin: 0; font-size: .875rem; line-height: 1.62; color: #dcdfe5; }
.lb-sec p + p { margin-top: .65rem; }
.lb-sec-ref p { color: #a3a9b4; font-size: .82rem; }
.lb-shot-n { display: block; margin-bottom: .1rem; font-size: .74rem; font-weight: 700; color: #fff; }
.lb-ref { font-weight: 600; color: #fff; }
.lb-line { display: block; margin: .45rem 0; padding: .1rem 0 .1rem .7rem; border-left: 2px solid var(--accent); color: #fff; font-style: italic; }
.lb-lang {
  display: inline-block; margin-right: .45rem; padding: 0 .4rem; border-radius: 4px; background: rgba(255, 255, 255, .12);
  font-size: .68rem; font-style: normal; font-weight: 600; line-height: 1.6; color: #c9ced6; vertical-align: 1px;
}
@media (max-width: 900px) {
  .lightbox, .lightbox.lb-bare { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; overflow-y: auto; }
  .lb-stage { padding: 3.6rem .8rem 1rem; }
  .lb-media { height: auto; }
  .lb-media video, .lb-media img { max-height: 62vh; }
  .lb-panel { overflow: visible; padding: 1.2rem 1rem 2.5rem; border-left: 0; border-top: 1px solid rgba(255, 255, 255, .08); }
  .lb-prev, .lb-next { top: 1rem; transform: none; width: 38px; height: 38px; }
  .lb-prev { left: .8rem; } .lb-next { left: 3.6rem; right: auto; }
  .lb-close { position: fixed; }
}

/* ---------------- comparison viewer (_includes/compare.html + assets/js/compare.js) ----------------
   Starts as a folded preview card in the reading column. Opened, it is a full-window-width band
   (JS stretches the figure out of the column) that slides over the sticky TOC while it passes.
   Single clips can go fullscreen (Fullscreen API; fallback: full-window overlay). */
.cmp {
  position: relative; z-index: 3; margin: 2.6rem 0; padding: 1.6rem 0 1.4rem;
  background: var(--soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left;
}
.cmp-ui, .cmp > figcaption { width: min(1640px, calc(100% - 48px)); margin: 0 auto; }
.cmp-top { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .9rem; }
.cmp-title { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); }
.cmp-top-right { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.cmp-modes { display: inline-flex; gap: .25rem; padding: .2rem; background: #fff; border: 1px solid var(--line); border-radius: 999px; }
.cmp-mode { border: 0; background: none; padding: .28rem .85rem; border-radius: 999px; font: inherit; font-size: .84rem; font-weight: 600; line-height: 1.4; color: var(--muted); cursor: pointer; }
.cmp-mode.active { background: var(--ink); color: #fff; }
.cmp-icon-btn, .cmp-play, .cmp-snd {
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 999px; cursor: pointer;
}
.cmp-icon-btn { width: 36px; height: 36px; font-size: .9rem; }
.cmp-icon-btn:hover, .cmp-snd:hover { background: #eef1f5; }

.cmp-strip { display: flex; gap: 1.4rem; overflow-x: auto; margin-bottom: 1rem; scrollbar-width: thin; }
.cmp-strip-run { flex: 0 0 auto; }
.cmp-strip-tag { font-size: .7rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); margin-bottom: .35rem; }
.cmp-strip-items { display: flex; gap: .6rem; }
.cmp-thumb { width: 128px; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; opacity: .6; transition: opacity .15s; }
.cmp-thumb img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; border: 2px solid transparent; }
.cmp-thumb span { display: block; margin-top: .25rem; font-size: .78rem; line-height: 1.25; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-thumb:hover { opacity: .9; }
.cmp-thumb.active { opacity: 1; }
.cmp-thumb.active img { border-color: var(--accent); }
.cmp-thumb.active span { color: var(--ink); font-weight: 600; }

.cmp-stage { position: relative; }
.cmp-grid { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin: 0 auto; } /* JS balances the rows; block and rows centered */
.cmp-tile { min-width: 0; }
.cmp-media { position: relative; background: #0d0e11; border-radius: 8px; overflow: hidden; }
.cmp-media video { display: block; width: 100%; height: 100%; object-fit: contain; }
.cmp-tile.ours .cmp-media { box-shadow: 0 0 0 2px var(--accent); }
.cmp-cap { display: flex; align-items: center; gap: .45rem; height: 38px; font-size: .9rem; line-height: 1.2; }
.cmp-name { font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 1; }
.cmp-tile.ours .cmp-name { color: var(--accent); }
.cmp-detail { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; flex-shrink: 2; }
.cmp-tools { display: flex; gap: .3rem; margin-left: auto; }
.cmp-snd { width: 30px; height: 30px; font-size: .8rem; color: var(--muted); }
.cmp-tile.audible .cmp-snd:first-child, .cmp-wipe-sel .cmp-snd.on { color: #fff; background: var(--accent); border-color: var(--accent); }
.cmp-fs-label { display: none; }
.cmp-loading .cmp-media::after {
  content: ""; position: absolute; top: 50%; left: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border: 3px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: cmp-spin .8s linear infinite;
}
@keyframes cmp-spin { to { transform: rotate(360deg); } }

/* a single clip in fullscreen (or the full-window overlay fallback) */
.cmp-media:fullscreen, .cmp-media.cmp-media-fs { border-radius: 0; background: #000; display: flex; align-items: center; justify-content: center; }
.cmp-media.cmp-media-fs { position: fixed; inset: 0; z-index: 250; aspect-ratio: auto !important; }
.cmp-media:fullscreen video, .cmp-media-fs video { width: 100%; height: 100%; }
.cmp-media:fullscreen .cmp-fs-label, .cmp-media-fs .cmp-fs-label {
  display: flex; gap: .5rem; position: absolute; top: 1rem; left: 1rem; padding: .35rem .8rem; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 1rem;
}
.cmp-fs-label .cmp-name { color: #fff !important; }
.cmp-fs-label .cmp-detail { color: #c9ced6; }

.cmp-wipe { display: flex; flex-direction: column; align-items: center; }
.cmp-wipe-sel { display: flex; align-items: center; gap: .6rem; margin-bottom: .7rem; flex-wrap: wrap; justify-content: center; }
.cmp-select { font: inherit; font-size: .9rem; font-weight: 600; color: var(--ink); padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.cmp-vs { font-size: .82rem; color: var(--faint); }
.cmp-wipe-box { max-width: 100%; cursor: ew-resize; touch-action: none; user-select: none; }
.cmp-wipe-box video { position: absolute; inset: 0; }
.cmp-wipe-box video:first-child { position: relative; }
.cmp-handle { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 6px rgba(0, 0, 0, .5); pointer-events: none; }
.cmp-handle span { position: absolute; top: 50%; left: 50%; width: 32px; height: 32px; margin: -16px 0 0 -16px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.cmp-handle span::before { content: "\2039\00a0\203A"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: .95rem; font-weight: 700; color: var(--ink); }
.cmp-wipe-note { margin: .55rem 0 0; font-size: .82rem; color: var(--faint); text-align: center; }

.cmp-bar { display: flex; align-items: center; gap: .8rem; margin-top: .8rem; }
.cmp-play { width: 38px; height: 38px; background: #171a21; border-color: #171a21; color: #fff; font-size: .85rem; }
.cmp-play:hover { background: #000; }
.cmp-seek { flex: 1; accent-color: var(--accent); min-width: 0; }
.cmp-time { font-family: var(--mono); font-size: .8rem; color: var(--muted); white-space: nowrap; }
.cmp-prompt { margin-top: .6rem; font-size: .88rem; }
.cmp-prompt summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.cmp-prompt pre {
  margin: .5rem 0 0; padding: .9rem 1.1rem; max-height: 280px; overflow: auto; white-space: pre-wrap;
  font-family: inherit; font-size: .86rem; line-height: 1.6; background: #fff; border: 1px solid var(--line); color: var(--text);
}
.cmp > figcaption { font-size: .9rem; line-height: 1.55; color: var(--muted); margin-top: .9rem; }
.cmp > figcaption > * { max-width: 920px; }
.cmp.numbered { counter-increment: figure; }
.cmp.numbered figcaption::before { content: "Figure " counter(figure) ".  "; font-weight: 700; color: var(--ink); white-space: pre; }

/* folded state: a preview card in the reading column; click opens the full-width band */
.cmp-preview { display: none; }
.cmp.cmp-collapsed { z-index: auto; padding: 0; background: none; border: 0; }
.cmp-collapsed .cmp-ui { display: none; }
.cmp-collapsed > figcaption { width: auto; }
.cmp-collapsed .cmp-preview {
  display: block; width: 100%; padding: 1rem 1rem 1.05rem; text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(25, 30, 45, .04); transition: box-shadow .2s, border-color .2s;
}
.cmp-collapsed .cmp-preview:hover { border-color: #c9d3df; box-shadow: 0 16px 40px rgba(25, 30, 45, .10); }
.cmp-preview-head { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.cmp-preview-meta { font-size: .8rem; color: var(--faint); white-space: nowrap; }
.cmp-preview-grid { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 8px; }
.cmp-preview-tile img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; background: #0d0e11; }
.cmp-preview-tile.ours img { box-shadow: 0 0 0 2px var(--accent); }
.cmp-preview-tile span { display: block; margin-top: .3rem; font-size: .76rem; line-height: 1.3; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-preview-tile b { color: var(--ink); font-weight: 700; }
.cmp-preview-tile.ours b { color: var(--accent); }
.cmp-preview-cta {
  display: inline-flex; align-items: center; gap: .5rem; margin-top: .9rem; padding: .45rem 1rem; border-radius: 999px;
  background: #171a21; color: #fff; font-size: .88rem; font-weight: 600; transition: background .15s;
}
.cmp-preview:hover .cmp-preview-cta { background: #000; }
.cmp-preview-cta i { font-size: .8rem; }
@media (max-width: 576px) { .cmp-preview-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* open/fold animation between the column width and the full window width */
.cmp-anim { transition: width .38s ease, margin-left .38s ease; }
.cmp-ui { transition: opacity .2s; }
.cmp-anim .cmp-ui, .cmp-folding .cmp-ui { opacity: 0; }

@media (max-width: 576px) {
  .cmp-ui, .cmp > figcaption { width: calc(100% - 24px); }
  .cmp-thumb { width: 96px; }
}

/* ---------------- embedded Hugging Face Space (_includes/hf_space.html) ---------------- */
.hf-space { margin: 1.6rem 0 2.4rem; }
.hf-space iframe {
  display: block; width: 100%; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--soft); box-shadow: 0 10px 30px rgba(25, 30, 45, .04);
}
.hf-space figcaption { margin-top: .6rem; font-size: .88rem; color: var(--muted); }

/* ---------------- bar chart ---------------- */
.bar-chart {
  text-align: left; padding: 1.3rem 1.4rem 1.1rem; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; box-shadow: 0 10px 30px rgba(25, 30, 45, .04);
}
.bar-chart-note { font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: .8rem; }
.bar-chart-rows { display: grid; gap: .55rem; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 30%) minmax(0, 1fr); align-items: center; gap: 1rem; font-size: .9rem; }
.bar-label { text-align: right; color: var(--muted); line-height: 1.25; }
.bar-track { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.bar-fill { height: 1.6rem; min-width: 4px; background: #d6dce5; border-radius: 6px; }
.bar-value { font-family: var(--mono); font-size: .82rem; color: var(--muted); white-space: nowrap; }
.bar-row.highlight .bar-label { color: var(--ink); font-weight: 700; }
.bar-row.highlight .bar-value { color: var(--accent); font-weight: 600; }
.bar-row.highlight .bar-fill { background: linear-gradient(90deg, #0077b6, #3aa0d8); }
.bar-chart figcaption { border-top: 1px solid var(--line); padding-top: .8rem; margin-top: 1.1rem; }

/* ---------------- stacked component bars (_includes/stacked_bars.html) ---------------- */
.sbar {
  margin: 2.4rem 0; padding: 1.2rem 1.3rem 1rem; text-align: left;
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: 0 10px 30px rgba(25, 30, 45, .04);
}
.sbar-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .7rem 1rem; margin-bottom: 1rem; }
.sbar-legend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; font-size: .82rem; color: var(--muted); }
.sbar-legend span { display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap; }
.sbar-legend i { width: 12px; height: 12px; border-radius: 3px; }
.sbar-switch { display: inline-flex; gap: .2rem; padding: .2rem; background: var(--soft); border-radius: 999px; }
.sbar-switch button { border: 0; background: none; padding: .25rem .7rem; border-radius: 999px; font: inherit; font-size: .78rem; font-weight: 600; line-height: 1.4; color: var(--muted); cursor: pointer; white-space: nowrap; }
.sbar-switch button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(20, 21, 26, .12); }
.sbar-rows { display: grid; grid-template-columns: fit-content(40%) minmax(0, 1fr);  /* label column fits each chart's own labels */ column-gap: 1rem; row-gap: .45rem; align-items: center; }
.sbar-group {
  grid-column: 1 / -1; margin-top: .45rem; font-size: .7rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--faint);
}
.sbar-group:first-child { margin-top: 0; }
.sbar-row { display: contents; }
.sbar-label { text-align: right; font-size: .88rem; line-height: 1.25; color: var(--muted); }
.sbar-label b { color: var(--ink); font-weight: 700; }
.sbar-row.ours .sbar-label b { color: var(--accent); }
.sbar-track { display: flex; align-items: center; gap: .55rem; min-width: 0; padding-right: 3.6rem; } /* room for the total label */
.sbar-bar { display: flex; gap: 2px; height: 1.75rem; flex-shrink: 0; }   /* width = % of the track; 2px surface gap between segments */
.sbar-seg {
  position: relative; flex-basis: 0; min-width: 3px; display: flex; align-items: center; justify-content: center;
  outline-offset: 2px; cursor: default;
}
.sbar-seg:last-child { border-radius: 0 4px 4px 0; }                       /* rounded data end */
.sbar-seg em { font-style: normal; font-size: .76rem; font-weight: 600; color: #fff; white-space: nowrap; pointer-events: none; }
.sbar-seg:hover, .sbar-seg:focus-visible { filter: brightness(1.08); }
.sbar-seg:hover::after, .sbar-seg:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); z-index: 5;
  padding: .3rem .55rem; border-radius: 6px; background: #171a21; color: #fff; font-size: .76rem; font-weight: 500;
  white-space: nowrap; pointer-events: none; box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
}
.sbar-track { position: relative; }
.sbar-marker { position: absolute; top: -.25rem; bottom: -.25rem; width: 0; border-left: 1.5px dashed var(--ink); opacity: .55; z-index: 2; pointer-events: none; }
.sbar-marker-label {
  position: absolute; top: 1.15rem; transform: translateX(-50%); font-size: .72rem; font-weight: 600; color: var(--ink);
  white-space: nowrap; background: #fff; padding: 0 .3rem;
}
.sbar-axis > div:has(.sbar-marker-label) { margin-bottom: 1.1rem; }
.sbar-total { position: relative; z-index: 3; padding: 0 3px; background: #fff; font-family: var(--mono); font-size: .82rem; color: var(--muted); white-space: nowrap; margin-right: -3.6rem; }
.sbar-row.ours .sbar-total { color: var(--ink); font-weight: 600; }
.sbar-axis { padding-right: 3.6rem; margin-top: .15rem; }
.sbar-axis > div { position: relative; height: 1.2rem; border-top: 1px solid var(--line); }
.sbar-axis span { position: absolute; top: .2rem; transform: translateX(-50%); font-family: var(--mono); font-size: .7rem; color: var(--faint); white-space: nowrap; }
.sbar-axis span:first-child { transform: none; }
.sbar-table { margin-top: .7rem; font-size: .86rem; }
.sbar-table summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.blog-body .sbar-table table { margin: .6rem 0 0; font-size: .82rem; }
.sbar figcaption { font-size: .9rem; line-height: 1.55; color: var(--muted); margin-top: .9rem; padding-top: .8rem; border-top: 1px solid var(--line); }
.sbar.numbered { counter-increment: figure; }
.sbar.numbered figcaption::before { content: "Figure " counter(figure) ".  "; font-weight: 700; color: var(--ink); white-space: pre; }
@media (max-width: 576px) {
  .sbar { padding: 1rem .8rem .8rem; }
  .sbar-rows { grid-template-columns: 1fr; row-gap: .2rem; }
  .sbar-label { text-align: left; margin-top: .35rem; }
}

/* ---------------- tables (Markdown) ---------------- */
.blog-body .ours-name { color: var(--accent); font-weight: 700; }   /* our method's name, blue as in the charts */
.blog-body table {
  width: 100%; margin: 2rem 0 1.25rem; border-collapse: separate; border-spacing: 0;
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  font-size: .9rem;
}
.blog-body th, .blog-body td { padding: .6rem .85rem; border-bottom: 1px solid var(--line); }
/* Numeric columns (right-aligned in Markdown, `---:`) get equal-width digits so numbers line up.
   Text columns keep Inter's normal punctuation: tabular figures also widen its hyphen. */
.blog-body td[style*="right"], .blog-body th[style*="right"] { font-variant-numeric: tabular-nums; }
/* Side-by-side comparison (`{: .side-by-side}` under the table): a fixed label column, and the
   compared columns share the rest equally instead of being sized by how much text they hold. */
.blog-body table.side-by-side { table-layout: fixed; }
.blog-body table.side-by-side tr:first-child > :first-child { width: 22%; }
.blog-body thead th { background: var(--soft); color: var(--ink); font-weight: 700; font-size: .82rem; }
.blog-body tbody tr:last-child td { border-bottom: 0; }
.blog-body tbody tr:hover td { background: #fafbfc; }
.blog-body p.caption { font-size: .9rem; color: var(--muted); margin-top: -.4rem; }
.blog-body p.caption strong, .blog-body p.caption b { color: var(--ink); }

/* ---------------- math ---------------- */
.blog-body mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; padding: .4rem 0; margin: 1.4rem 0 !important; }

/* ---------------- code (Rouge, GitHub light) ---------------- */
.blog-body pre, .bibtex {
  font-family: var(--mono); background: #f6f8fa; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1rem 1.15rem; font-size: .84rem; line-height: 1.6; overflow-x: auto; color: #24292f;
}
.blog-body div.highlighter-rouge { margin: 1.6rem 0; }
.blog-body div.highlighter-rouge pre { margin: 0; }
.highlight .c, .highlight .c1, .highlight .cm, .highlight .cs, .highlight .cd { color: #6a737d; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kp, .highlight .kr, .highlight .kc, .highlight .ow { color: #cf222e; }
.highlight .kt, .highlight .nc, .highlight .nf, .highlight .fm { color: #8250df; }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sd, .highlight .sa, .highlight .si, .highlight .se, .highlight .sb { color: #0a3069; }
.highlight .m, .highlight .mi, .highlight .mf, .highlight .mh, .highlight .il { color: #0550ae; }
.highlight .nb, .highlight .bp, .highlight .no, .highlight .nv, .highlight .vc { color: #0550ae; }
.highlight .nd, .highlight .ne { color: #953800; }
.highlight .o { color: #cf222e; }
.highlight .err { color: inherit; background: none; }

/* ---------------- footnotes (kramdown [^1]) ---------------- */
.blog-body .footnotes { font-size: .88rem; color: var(--muted); border-top: 1px solid var(--line); margin-top: 3rem; padding-top: 1rem; }
.blog-body .footnotes p { margin-bottom: .4rem; }

/* ---------------- in-text citations ---------------- */
.cite { white-space: nowrap; font-size: .92em; }
.cite a { color: var(--accent); font-weight: 500; }
.cite-missing { color: #d00; font-weight: 700; }

/* ---------------- citation + references ---------------- */
.blog-citation, .blog-references { scroll-margin-top: 1.5rem; }
.blog-citation h2, .blog-references h2 { padding-top: 2.4rem; border-top: 1px solid var(--line); }
.blog-references h2 { border-top: 0; padding-top: 0; margin-top: 3rem; }
.blog-citation-text { font-size: .95rem; color: var(--muted); }
.blog-citation-text a { word-break: break-all; }
.bibtex-card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: #f6f8fa; }
.bibtex-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: .45rem .6rem .45rem 1.15rem; border-bottom: 1px solid var(--line); background: #fff;
  font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint);
}
.bibtex { margin: 0; border: 0; border-radius: 0; white-space: pre; }
.bibtex-copy {
  font-family: inherit; font-size: .8rem; font-weight: 600; letter-spacing: 0; text-transform: none;
  padding: .3rem .7rem; border: 1px solid var(--line); background: #fff; border-radius: 999px; color: var(--ink); cursor: pointer;
}
.bibtex-copy:hover { background: var(--soft); }
.blog-references ol { list-style: none; padding: 0; margin: 0; font-size: .9rem; line-height: 1.55; color: var(--muted); }
.blog-references li { display: grid; grid-template-columns: 2.6rem minmax(0, 1fr); padding: .35rem .4rem; margin: 0 -.4rem; border-radius: 6px; }
.blog-references li { transition: background-color 1.2s ease; }
.blog-references li.flash { background: #fff6d1; transition: none; }  /* brief highlight after jumping to a reference */
.ref-num { font-family: var(--mono); font-size: .8rem; color: var(--faint); padding-top: .12rem; }
.ref-title { color: var(--ink); }
.blog-references a { word-break: break-all; }

@media (max-width: 768px) {
  .blog-body table { display: block; overflow-x: auto; white-space: nowrap; }
}
@media (max-width: 768px) {
  .blog-byline { grid-template-columns: 1fr 1fr; }
  .byline-people { grid-column: 1 / -1; }
  .blog-body { font-size: 1rem; }
  .bar-row { grid-template-columns: 36% minmax(0, 1fr); gap: .6rem; }
}

/* =====================================================================
   Blog index: a list of rows (thumbnail + text); each row is as tall as its own content
   ===================================================================== */
.post-list { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; margin: -1.6rem 0 4rem; }
.post-row {
  display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 1.75rem; align-items: center;
  padding: 1.6rem 0; border-bottom: 1px solid var(--line);
  color: inherit !important; text-decoration: none !important;
}
.post-row:last-child { border-bottom: 0; }
/* Thumbnails preserve the social card's aspect ratio. */
.post-row-thumb { aspect-ratio: 1200 / 630; border-radius: 8px; overflow: hidden; background: var(--soft); border: 1px solid var(--line); }
.post-row-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.post-row:hover .post-row-thumb img { transform: scale(1.03); }
.post-row:hover .post-row-title { color: var(--accent); }
.post-row-meta { font-size: .82rem; line-height: 1.25rem; color: var(--faint); margin-bottom: .35rem; }
.post-row-meta .sep { margin: 0 .4rem; }
.post-row-tag { color: var(--accent); font-weight: 600; }
.post-row-title { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; color: var(--ink); margin: 0 0 .45rem; transition: color .15s;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-row-desc { font-size: .95rem; line-height: 1.6; color: var(--muted); margin: 0 0 .5rem;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; }
.post-row-authors { font-size: .85rem; line-height: 1.5; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 576px) {
  .post-row { grid-template-columns: minmax(0, 1fr); gap: .9rem; }
}

/* ---------------- print / "Save as PDF" ---------------- */
@media print {
  header.border-bottom, .blog-actions, .bibtex-copy, .blog-toc, #blog-progress { display: none !important; }
  .blog-main { display: block; margin-top: 1.5rem; }
  .fig, pre, table, .stats, .bar-chart { break-inside: avoid; }
  .blog-body table { display: table; white-space: normal; }   /* undo the narrow-screen horizontal scroll */
  .blog-main a { color: inherit !important; }
}

.blog-body img[data-zoom] { cursor: zoom-in; }
