/* ============================================================
   main.css - single shared stylesheet
   (merges legacy stylesheet.css + detail-overrides.css; adds
   design tokens, a clean container layout, and responsiveness)
   ============================================================ */

:root {
  --accent: #4f46e5;          /* indigo — unified site-wide with the detail skin */
  --accent-hover: #4338ca;
  --ink: #14181f;
  --muted: #5f6878;
  --faint: #626b7a;
  --line: #e3e6ea;
  --bg: #eef0f3;              /* gray shell — same page bg as the detail pages */
  --surface: #f8f9fa;
  --maxw: 800px;
  --maxw-wide: 960px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --text-body: 16px;
  --text-secondary: 14px;
  --text-caption: 13px;
  --text-label: 12px;
  --fig-bleed: 60px;   /* (920 container-inner - 800 text) / 2 — how far a band breaks out each side */
  --fig-radius: 8px;
}

* { box-sizing: border-box; }

html {
  scroll-padding-top: 60px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font);
  font-size: var(--text-body);
  line-height: 1.65;
  overflow-wrap: break-word;
}

a { color: var(--accent); text-decoration: none; }
a:hover, a:focus { color: var(--accent-hover); text-decoration: underline; }
a:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; border-radius: 2px; }

/* Long tokens (file paths, identifiers) in prose must never force horizontal scroll */
.tldr, .bullets li, .decisions p, .proj-section p, .detail p,
.pub-meta, .cv-note, table.foothold td { overflow-wrap: anywhere; }

/* Skip link (a11y) */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

h1, h2, h3 { font-family: var(--font); line-height: 1.25; }
h2 {
  margin: 2rem 0 1rem;
  font-size: 20px;
  font-weight: 700;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--line);
}
strong { font-weight: 700; }

/* ---------- Layout container ---------- */
.container {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* ---------- Site nav (single source - reconciled) ---------- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.95);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 10px 24px;
  font-size: var(--text-secondary);
}
.site-nav-inner {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.site-nav-home { font-weight: 700; color: var(--accent); white-space: nowrap; }
.site-nav-home:hover, .site-nav-home:focus { color: var(--accent-hover); }
.site-nav-links { display: flex; gap: 18px; flex-wrap: wrap; }
.site-nav-links a { color: #495057; font-size: var(--text-secondary); }
.site-nav-links a:hover, .site-nav-links a:focus { color: var(--accent-hover); }

/* ---------- Home: profile ---------- */
.profile {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  margin-top: 8px;
}
.profile-photo {
  padding: 12px;                  /* even mat around the full portrait */
  background: #fff;
  border: 1px solid #d6dadf;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.10);
  align-self: flex-start;         /* card hugs the photo, doesn't stretch */
}
.profile-photo img {
  display: block;
  width: 200px;
  height: auto;                   /* full 3:4 portrait, NOT cropped */
  border-radius: 6px;
}
.name {
  margin: 0 0 .25rem;
  font-size: clamp(1.95rem, 1.7rem + 1vw, 2.25rem);
  font-weight: 400;
  line-height: 1.18;
}
.role { margin: 0 0 .5rem; color: var(--muted); font-size: var(--text-body); }
.contact { margin: 0 0 .75rem; }

/* ---------- Publication + project lists ---------- */
.pub-list, .project-list { list-style: none; padding: 0; margin: 0; }
.pub-list li, .project-list li { margin: 0 0 1rem; }
.pub-venue { color: var(--muted); }
.papertitle { font-weight: 700; }

.pub-badge {
  display: inline;
  font-size: var(--text-label);
  font-weight: 600;
  letter-spacing: .3px;
  margin-left: 6px;
  color: var(--muted);
}
.pub-badge::before { content: "\00b7 "; color: #c0c0c0; font-weight: 400; margin-right: 2px; }

/* ---------- Detail pages ---------- */
.detail { max-width: var(--maxw); margin: 0 auto; }
.detail-head h1 {
  font-size: clamp(1.8rem, 1.55rem + 1.3vw, 2.15rem);
  margin: 0 0 .5rem;
  font-weight: 700;
}
.detail .lead, .detail .authors, .detail .venue { color: var(--muted); margin: .25rem 0; }
.detail-back { margin-top: 2rem; }
.tldr {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  padding: 14px 18px;
  border-radius: 6px;
  margin: 1.25rem 0;
}
.paper-pill {
  display: inline-block;
  padding: 4px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  font-size: var(--text-secondary);
}
.project-thumb, .img-responsive { max-width: 100%; height: auto; }

/* ---------- Hover-image effect (legacy home thumbnails) ---------- */
.one { width: 160px; height: 160px; position: relative; }
.two {
  width: 160px; height: 160px; position: absolute;
  transition: opacity .2s ease-in-out;
}
.fade { transition: opacity .2s ease-in-out; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; }
.site-footer-inner {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  padding: 20px;
  color: var(--muted);
  font-size: var(--text-secondary);
}
.site-footer-inner a { color: var(--muted); }
.site-footer-inner a:hover, .site-footer-inner a:focus { color: var(--accent-hover); }

.bio { margin: .5rem 0 0; }
h2 .count { color: var(--muted); font-weight: 500; font-size: var(--text-secondary); }

/* ---------- CV lists (education / experience) ---------- */
.cv-list { list-style: none; padding: 0; margin: 0; }
.cv-list li { margin: 0 0 1.1rem; }
.cv-line { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.cv-period { color: var(--muted); white-space: nowrap; font-size: var(--text-secondary); }
.cv-org { color: var(--accent); }
.cv-note { color: var(--muted); font-size: var(--text-secondary); margin-top: .15rem; line-height: 1.6; }

/* ---------- Skills ---------- */
.skills { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0; }
.skills dt { font-weight: 700; }
.skills dd { margin: 0; color: var(--muted); }
/* Colour, not weight, marks the core skills — the label is already bold. */
.sk-core { color: var(--accent); font-weight: 600; }
.sk-core + .sk-rest::before { content: "\00a0\2014\00a0"; }

/* ---------- Publication list ---------- */
.pub-list { padding-left: 1.4rem; }
.pub-item { margin: 0 0 1.25rem; padding: .35rem .5rem; border-radius: 6px; }
.pub-title { margin-bottom: .1rem; }
.pub-authors { font-size: var(--text-secondary); }
.pub-meta { color: var(--muted); font-size: var(--text-secondary); }
.pub-links { margin-top: .25rem; font-size: var(--text-caption); display: flex; gap: 14px; flex-wrap: wrap; }

/* Publications without a detail page: one line each, links intact. */
.pub-more-head { font-size: 16px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
                 color: var(--muted); margin: 1.75rem 0 .6rem; }
.pub-compact { list-style: none; padding: 0; margin: 0; }
.pub-compact li { margin: 0 0 .55rem; font-size: 15px; line-height: 1.55; }
.pub-compact-meta { color: var(--muted); font-size: var(--text-secondary); }
.pub-compact-meta::before { content: "\2014 "; }
.pub-compact-bib { font-size: var(--text-caption); margin-left: 6px; }

/* ---------- Project grid ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}
.project-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  color: inherit;
  background: #fff;
  transition: box-shadow .15s ease, transform .15s ease;
}
.project-card:hover, .project-card:focus {
  box-shadow: 0 6px 22px rgba(0,0,0,.10);
  transform: translateY(-2px);
  color: inherit;
}
.project-card-thumb { background: var(--surface); aspect-ratio: 16 / 10; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.project-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.project-card-body { padding: 14px 16px 18px; }
.project-card-scope, .project-scope {
  margin: 0 0 .45rem;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-label);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
.project-scope { margin-bottom: .55rem; }
.project-card-title { margin: 0 0 .4rem; font-size: 18px; font-weight: 700; }
.project-card-tagline {
  margin: 0; color: var(--muted); font-size: var(--text-secondary); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.detail-actions { margin: .5rem 0; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Rich detail sections (project + publication) ---------- */
.proj-section { margin: 2rem 0; }
.proj-section > h2 { font-size: 19px; }
.bullets { padding-left: 1.2rem; }
.bullets li { margin: .3rem 0; }

.decisions { padding-left: 1.3rem; }
.decisions > li { margin: 0 0 1rem; }
.decision-title { display: block; font-size: 17px; font-weight: 700; line-height: 1.4; }
.decisions p { margin: .35rem 0 0; }

table.foothold { width: 100%; border-collapse: collapse; font-size: var(--text-secondary); }
table.foothold th, table.foothold td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.foothold th { color: var(--muted); font-weight: 700; }
table.foothold td code { font-size: var(--text-caption); color: #333; overflow-wrap: anywhere; word-break: break-word; }

.gallery { display: grid; gap: 22px; }
.gallery figure { margin: 0; }
.gallery img, .gallery picture { width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.gallery figcaption { margin-top: .4rem; font-size: var(--text-caption); color: var(--muted); line-height: 1.55; }

.bibtex {
  width: 100%; box-sizing: border-box; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: var(--text-caption); line-height: 1.55; color: #222; background: var(--surface);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px; resize: vertical;
}
.copy-btn {
  font: inherit; font-size: var(--text-caption); margin-left: 8px; padding: 2px 10px; cursor: pointer;
  border: 1px solid var(--accent); color: var(--accent); background: #fff; border-radius: 999px;
}
.copy-btn:hover { background: var(--accent); color: #fff; }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .profile { flex-direction: column; gap: 16px; }
  .profile-photo { padding: 10px; }
  .profile-photo img { width: 150px; height: auto; }
  .skills { grid-template-columns: 1fr; gap: .15rem; }
  .skills dt { margin-top: .5rem; }
}
@media (max-width: 480px) {
  .site-nav { padding: 8px 12px; }
  .site-nav-links { gap: 10px; }
  .site-nav-links a { font-size: 13px; }
  .name { font-size: 1.95rem; }
}

/* ============================================================
   Redesigned project detail: figures interleaved with narrative
   (Pattern A full-width band, B side-by-side decision, C inline)
   ============================================================ */

/* Pattern C — inline figure (default) */
.proj-figure { margin: 1.5rem 0; }
.proj-figure :is(img, picture) {
  display: block; width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: var(--fig-radius);
  background: var(--surface);
}
.proj-figure picture img { border: 0; border-radius: 0; }   /* border lives on the <picture> */
.proj-figure figcaption { margin-top: .4rem; font-size: var(--text-caption); color: var(--muted); line-height: 1.55; }
.proj-figure--narrow { max-width: 520px; margin-inline: auto; }

/* Short title above a figure (figures lifted from the papers, which carry no title of their own) */
.fig-title { margin: 0 0 .5rem; font-size: 16px; font-weight: 700; color: var(--ink); line-height: 1.35; }
.results-grid .fig-title { font-size: 15px; }

/* Lead hero + Pattern A band */
.figure-hero { margin: .5rem 0 1.5rem; }
.figure-band {
  margin: 1.75rem 0; padding: 22px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.figure-band :is(img, picture) { border: 0; border-radius: 6px; background: #fff; }
.figure-band figcaption, .figure-hero figcaption { max-width: var(--maxw); }  /* keep caption at reading measure */

/* Featured result — a single dense/headline figure promoted out of the grid to full width
   so its labels/brackets stay legible (the grid would otherwise shrink it to ~300px). */
.figure-feature { margin: 1.25rem 0; }
.figure-feature figcaption { max-width: var(--maxw); }

/* Pattern B — per-decision figure column */
.decision-row .proj-figure { margin: 0; }
.decision-figs { display: grid; gap: 14px; }

/* Results / foothold evidence — auto-fit grids instead of a 1-col stack */
.results-grid, .foothold-evidence {
  display: grid; grid-template-columns: 1fr; gap: 18px;
}
.results-grid { margin: 1.25rem 0; }
.foothold-evidence { margin-top: 1.25rem; }
.results-grid .proj-figure, .foothold-evidence .proj-figure { margin: 0; }

/* Detailed dashboards and charts need more than a 3-column thumbnail to remain legible. */
@media (min-width: 720px) {
  .results-grid, .foothold-evidence {
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  }
  .results-grid > .proj-figure:last-child:nth-child(odd),
  .foothold-evidence > .proj-figure:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

/* Tablet+ : side-by-side decision rows, alternating sides by decision position */
@media (min-width: 769px) {
  .decision-row.has-figure {
    display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 26px; align-items: start;
  }
  .decision-row.has-figure .decision-body { min-width: 0; }   /* prevent overflow */
  .decisions > li:nth-of-type(even) .decision-row.has-figure { grid-template-columns: 360px minmax(0, 1fr); }
  .decisions > li:nth-of-type(even) .decision-row.has-figure .decision-body { order: 2; }
  .decisions > li:nth-of-type(even) .decision-row.has-figure .decision-figs { order: 1; }
}

/* Wide only (>= 961px): the gutter exists, so hero/band may break out to the container edge.
   Below this the gutter is < --fig-bleed and bleeding would force horizontal scroll. */
@media (min-width: 961px) {
  .figure-hero, .figure-band, .figure-feature {
    margin-left: calc(-1 * var(--fig-bleed));
    margin-right: calc(-1 * var(--fig-bleed));
  }
}

/* A decision figure promoted to a full-width band lives inside <ol class="decisions">, which
   is indented (padding-left:1.3rem). Cancel that indent so the band aligns with section bands. */
.decision-band { margin-left: -1.3rem; }
@media (min-width: 961px) {
  .decision-band { margin-left: calc(-1 * var(--fig-bleed) - 1.3rem); }
}

/* Project image viewer ---------------------------------------------------- */
.project-detail.is-image-viewer-ready figure img {
  cursor: zoom-in;
}
.project-detail.is-image-viewer-ready figure img:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 72%, white);
  outline-offset: 4px;
}
@media (hover: hover) {
  .project-detail.is-image-viewer-ready figure img {
    transition: filter .15s ease;
  }
  .project-detail.is-image-viewer-ready figure img:hover {
    filter: brightness(.97);
  }
}

body.image-viewer-open { overflow: hidden; }
.image-viewer {
  width: min(96vw, 1400px);
  height: min(94dvh, 1000px);
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 24px 80px rgba(10, 18, 38, .35);
}
.image-viewer::backdrop {
  background: rgba(8, 14, 28, .82);
  backdrop-filter: blur(3px);
}
.image-viewer__shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
.image-viewer__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 8px 12px 8px 18px;
  border-bottom: 1px solid var(--line);
}
.image-viewer__title { font-size: 15px; font-weight: 700; }
.image-viewer__actions { display: flex; align-items: center; gap: 8px; }
.image-viewer__button {
  min-height: 34px;
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: var(--text-caption);
  font-weight: 600;
  cursor: pointer;
}
.image-viewer__button:hover { border-color: var(--accent); color: var(--accent); }
.image-viewer__button:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, white); outline-offset: 2px; }
.image-viewer__close { width: 34px; padding: 0; font-size: 22px; line-height: 1; }
.image-viewer__stage {
  min-height: 0;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #eef1f6;
  overscroll-behavior: contain;
}
.image-viewer__image {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  background: #fff;
  box-shadow: 0 4px 20px rgba(20, 30, 50, .14);
}
.image-viewer.is-actual .image-viewer__image {
  width: var(--viewer-width);
  max-width: none;
  max-height: none;
}
.image-viewer__caption {
  max-height: 20dvh;
  margin: 0;
  padding: 12px 18px 14px;
  overflow: auto;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.5;
}

@media (max-width: 600px) {
  .figure-band { padding: 12px; }
  .project-detail figure.is-wide-zoom::after {
    content: "Tap image to enlarge";
    display: block;
    margin-top: .35rem;
    color: var(--accent);
    font-size: var(--text-label);
    font-weight: 600;
    text-align: right;
  }
  .image-viewer {
    width: 100vw;
    height: 100dvh;
    border-radius: 0;
  }
  .image-viewer__toolbar { padding-inline: 12px 8px; }
  .image-viewer__stage { padding: 12px; }
  .image-viewer__caption { max-height: 24dvh; padding-inline: 12px; }
}

/* ---------- Publication: evidence stat strip (headline numbers under the TL;DR) ---------- */
.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px; margin: 1.25rem 0;
}
.stat-card {
  border: 1px solid var(--line); border-radius: var(--fig-radius);
  background: var(--surface); padding: 14px 16px;
}
.stat-value { display: block; font-size: 28px; font-weight: 700; color: var(--accent); line-height: 1.15; }
.stat-value--compact { font-size: 22px; letter-spacing: -.025em; white-space: nowrap; }
.stat-label { display: block; font-size: var(--text-secondary); font-weight: 700; color: var(--ink); margin-top: .25rem; }
.stat-sub   { display: block; font-size: var(--text-caption); color: var(--muted); margin-top: .15rem; line-height: 1.5; }

@media (max-width: 800px) {
  .stat-value--compact { font-size: 20px; }
}
@media (max-width: 480px) {
  .stat-value--compact { font-size: 19px; }
}

/* ---------- Publication: collapsed reference (citation / BibTeX / acknowledgements) ---------- */
.pub-reference { border-top: 1px solid var(--line); margin-top: 2.25rem; }
.pub-reference > summary {
  cursor: pointer; font-weight: 700; font-size: 17px; padding: .8rem 0; color: var(--ink);
}
.pub-reference > summary:hover { color: var(--accent); }
.pub-reference[open] > summary { color: var(--muted); }
.pub-reference h3 { font-size: 15px; margin: 0 0 .35rem; }
.pub-reference .proj-section { margin: 1rem 0; }
@media print {
  /* never hide reference material in a printed / PDF copy */
  .pub-reference > :not(summary) { display: revert !important; }
  .pub-reference > summary { list-style: none; }
}

/* ============================================================
   DIRECTION B — "Technical" modern skin for PUBLICATION detail
   pages only. Fully scoped under body.pub-page / .pub-detail so
   the home + project pages keep the Lato baseline untouched.
   ============================================================ */
body.pub-page { background: #eef0f3; }
.pub-page .container { max-width: 900px; padding-top: 16px; }

.pub-detail {
  --pa: #4f46e5; --pa-soft: #ecebfd;          /* primary indigo */
  --pk: #0d9488; --pk-soft: #e3f5f2; --pk-line: #9bd9d0;  /* novelty teal */
  --pink: #0b0f1a; --pbody: #39414f; --pmut: var(--muted); --pfaint: var(--faint);
  --pline: #eceef2; --pline2: #dfe3ea; --psurf: #f7f8fb;
  --pmono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  /* match the project-detail frame: plain centered content on the gray shell, no white card */
  max-width: var(--maxw); margin: 0 auto; padding: 0;
  color: var(--pbody);
  font-family: 'Inter', var(--font); font-size: var(--text-body); line-height: 1.65;
}
.pub-detail a { color: var(--pa); }
.pub-detail a:hover, .pub-detail a:focus { color: var(--pa); text-decoration: underline; }

/* header */
.pub-detail .detail-head { border-bottom: 1px solid var(--pline); padding-bottom: 18px; margin-bottom: 4px; }
.pub-detail .eyebrow {
  font-family: var(--pmono); font-size: var(--text-label); font-weight: 600; letter-spacing: .02em;
  text-transform: lowercase; color: var(--pmut); margin: 0 0 .7rem;
}
.pub-detail .eyebrow::before { content: "# "; color: var(--pa); font-weight: 700; }
.pub-detail .detail-head h1 {
  font-family: 'Inter', var(--font); font-size: clamp(1.8rem, 1.55rem + 1.3vw, 2.15rem); line-height: 1.18;
  letter-spacing: -.025em; font-weight: 800; color: var(--pink); margin: 0 0 .55rem;
}
.pub-detail .authors { color: var(--pbody); font-size: var(--text-body); margin: .1rem 0; }
.pub-detail .authors strong { color: var(--pink); }
.pub-detail .venue {
  font-family: var(--pmono); font-size: var(--text-secondary); color: var(--pmut);
  display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; margin: .35rem 0 0;
}
.pub-detail .pub-badge {
  font-size: var(--text-label); font-weight: 800; letter-spacing: .06em; margin: 0;
  padding: .2em .55em; border-radius: 4px; background: var(--pa-soft); color: var(--pa);
}
.pub-detail .pub-badge::before { content: none; }
.pub-detail .pub-badge-scie, .pub-detail .pub-badge-sci { background: #e7f3ec; color: #1d7a45; }

/* icon link row */
.pub-detail .detail-actions { gap: .5rem; margin: 1.1rem 0 0; }
.pub-detail .paper-pill {
  display: inline-flex; align-items: center; gap: .42rem; font-size: var(--text-secondary); font-weight: 600;
  color: var(--pa); background: #fff; border: 1px solid var(--pline2);
  padding: .42rem .8rem; border-radius: 8px; transition: .16s;
}
.pub-detail .paper-pill:hover { border-color: var(--pa); color: var(--pa); transform: translateY(-1px); text-decoration: none; }
.pub-detail .paper-pill.solid { background: var(--pa); color: #fff; border-color: var(--pa); }
.pub-detail .paper-pill.solid:hover { filter: brightness(1.08); color: #fff; }
.pub-detail .paper-pill svg { width: 14px; height: 14px; flex: none; }

/* TL;DR */
.pub-detail .tldr { background: var(--psurf); border-left: 3px solid var(--pa); border-radius: 6px; color: var(--pbody); }

/* evidence strip */
.pub-detail .stat-strip { gap: 12px; }
.pub-detail .stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--fig-radius); }
.pub-detail .stat-value { font-family: var(--pmono); font-size: 1.75rem; font-weight: 700;
  color: var(--pink); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.pub-detail .stat-label { color: var(--pbody); }
.pub-detail .stat-sub { color: var(--pfaint); }

/* Section headings — readable Inter anchors with a mono indigo hash. */
.pub-detail .proj-section > h2 {
  font-family: var(--font);
  font-size: clamp(1.125rem, 1.05rem + .35vw, 1.25rem);
  font-weight: 800;
  line-height: 1.3;
  text-transform: none;
  letter-spacing: -.012em;
  color: var(--pink);
  border: 0;
  padding: 0;
  margin: 0 0 1rem;
}
.pub-detail .proj-section > h2::before {
  content: "#";
  margin-right: .4em;
  color: var(--pa);
  font-family: var(--pmono);
  font-size: .75em;
  letter-spacing: 0;
}
.pub-detail .proj-section { margin: 2.5rem 0; }
.pub-detail .bullets li::marker { color: var(--pa); }

/* figures — flat, matching the project-detail figure style (no shadow) */
.pub-detail .proj-figure { margin: 1.4rem 0; }
.pub-detail .proj-figure :is(img, picture) {
  border: 1px solid var(--line); border-radius: var(--fig-radius); background: var(--surface);
}
.pub-detail .figure-hero, .pub-detail .figure-feature, .pub-detail .figure-band { margin-left: 0; margin-right: 0; }
.pub-detail .figure-band { background: var(--psurf); border-color: var(--pline); }
.pub-detail .fig-title { color: var(--pink); font-size: 16px; }
.pub-detail .proj-figure figcaption, .pub-detail .gallery figcaption { color: var(--pmut); }
.pub-detail .gallery img, .pub-detail .gallery picture { border-color: var(--line); border-radius: var(--fig-radius); }

/* method pipeline — no-wrap, scrolls if tight; novelty = inner chip (never overlaps) */
.pub-detail .flow {
  display: flex; align-items: stretch; gap: 6px; overflow-x: auto; scrollbar-width: thin;
  background: var(--psurf); border: 1px solid var(--pline); border-radius: 12px;
  padding: 18px 14px; margin: 0 0 1.1rem;
}
.pub-detail .step {
  flex: 1 0 116px; display: flex; flex-direction: column; justify-content: center; gap: .22rem;
  background: #fff; border: 1px solid var(--pline); border-radius: 10px; padding: 12px 11px; text-align: center;
}
.pub-detail .step b { color: var(--pink); font-size: var(--text-secondary); font-weight: 700; line-height: 1.3; }
.pub-detail .step small { color: var(--pfaint); font-size: var(--text-label); }
.pub-detail .step .chip {
  align-self: center; font-size: var(--text-label); font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  color: #fff; background: var(--pk); padding: .08rem .42rem; border-radius: 3px; margin-bottom: .12rem;
}
.pub-detail .step.key { background: var(--pk-soft); border-color: var(--pk-line); }
.pub-detail .step.key b { color: var(--pk); }
.pub-detail .sep { flex: 0 0 16px; align-self: center; display: flex; align-items: center; justify-content: center;
  color: var(--pline2); font-size: 1rem; font-weight: 700; }
.pub-detail .sep::before { content: "\203A"; }

/* reference block */
.pub-detail .pub-reference { border: 1px solid var(--pline); border-radius: 12px; background: var(--psurf); margin-top: 2rem; }
.pub-detail .pub-reference > summary { padding: 14px 18px; font-size: var(--text-body); color: var(--pink); }
.pub-detail .pub-reference > summary:hover { color: var(--pa); }
.pub-detail .pub-reference .proj-section { margin: 0 18px; padding-bottom: 14px; }
.pub-detail .bibtex { font-family: var(--pmono); border-color: var(--pline); background: #fff; }
.pub-detail .copy-btn { border-color: var(--pline2); color: var(--pa); font-family: var(--pmono); }
.pub-detail .copy-btn:hover { background: var(--pa); color: #fff; border-color: var(--pa); }
.pub-detail .detail-back a { font-size: var(--text-secondary); }

/* ============================================================
   BRIDGE — carry the detail "Technical" surface (Inter type,
   indigo accent, gray shell, mono "#" section eyebrows) across
   the HOME + PROJECT pages so the site reads as one. Layouts are
   kept; only the surface changes. Scoped to body:not(.pub-page)
   so the publication-detail card skin is untouched.
   ============================================================ */

/* Section headings → readable Inter anchors with a mono indigo hash. */
body:not(.pub-page) .container > section > h2,
body:not(.pub-page) .proj-section > h2 {
  font-family: var(--font);
  font-size: clamp(1.125rem, 1.05rem + .35vw, 1.25rem);
  font-weight: 800;
  line-height: 1.3;
  text-transform: none;
  letter-spacing: -.012em;
  color: var(--ink);
  border: 0;
  padding: 0;
  margin: 2.5rem 0 1rem;
}
body:not(.pub-page) .container > section:first-of-type > h2 { margin-top: 1.4rem; }
body:not(.pub-page) .container > section > h2::before,
body:not(.pub-page) .proj-section > h2::before {
  content: "#";
  margin-right: .4em;
  color: var(--accent);
  font-family: var(--mono);
  font-size: .75em;
  letter-spacing: 0;
}
body:not(.pub-page) h2 .count {
  font-family: var(--font); font-weight: 600; font-size: var(--text-secondary);
  letter-spacing: 0; text-transform: none; color: var(--muted);
}

/* Home identity + project-detail title → Inter display weight */
body:not(.pub-page) .name { font-weight: 800; letter-spacing: -.02em; color: var(--ink); }
body:not(.pub-page) .detail-head h1 {
  font-weight: 800; letter-spacing: -.022em;
  font-size: clamp(1.8rem, 1.55rem + 1.3vw, 2.15rem);
  line-height: 1.18; color: var(--ink);
}

/* Section divider rhythm: a hairline above each section heading reads cleaner on the shell */
body:not(.pub-page) .container > section + section > h2 {
  border-top: 1px solid var(--line); padding-top: 1.75rem;
}

/* Wordmark + nav read as part of the technical skin */
.site-nav-home { letter-spacing: -.01em; }

/* ---- Home publication list: Barron-style thumbnails ---- */
body:not(.pub-page) .pub-list { list-style: none; padding-left: 0; }
.pub-item.has-thumb { display: flex; gap: 16px; align-items: flex-start; }
.pub-thumb {
  flex: 0 0 auto; width: 104px; height: 92px;
  border-radius: 10px; overflow: hidden; background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 10px 24px -16px rgba(16,24,40,.25);
  transition: transform .15s ease, box-shadow .15s ease;
}
.pub-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pub-item.has-thumb:hover .pub-thumb {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(16,24,40,.08), 0 16px 30px -16px rgba(16,24,40,.3);
}
.pub-body { flex: 1 1 auto; min-width: 0; }
@media (max-width: 480px) {
  .pub-thumb { width: 80px; height: 76px; }
  .pub-item.has-thumb { gap: 12px; }
}

/* ============================================================
   Before / after crossfade (.ba) — scoped to the publication
   detail card. Default shows the "before" state; hover, keyboard
   focus, or a tap (sticky .is-after, set by copy.js) reveals the
   "after" state. Pairs are pre-cropped to identical dimensions.
   ============================================================ */
.pub-detail .ba-figure { margin: 1.5rem auto; max-width: 500px; }
.pub-detail .ba {
  position: relative; display: block; width: 100%;
  border: 1px solid var(--pline); border-radius: 12px; overflow: hidden;
  background: #fff; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.pub-detail .ba:focus-visible { outline: 2px solid var(--pa); outline-offset: 2px; }
.pub-detail .ba :is(img, picture) {
  display: block; width: 100%; height: auto; border: 0; border-radius: 0; box-shadow: none;
}
.pub-detail .ba-after {
  position: absolute; inset: 0; opacity: 0; transition: opacity .35s ease;
}
.pub-detail .ba-after :is(img, picture) { width: 100%; height: 100%; }
.pub-detail .ba-after img { object-fit: cover; }
.pub-detail .ba:hover .ba-after,
.pub-detail .ba:focus-visible .ba-after,
.pub-detail .ba.is-after .ba-after { opacity: 1; }

/* state tags (top-left, one visible at a time) */
.pub-detail .ba-tag {
  position: absolute; top: 10px; left: 10px; z-index: 2;
  font-family: var(--pmono); font-size: var(--text-label); font-weight: 700; letter-spacing: .03em;
  padding: .26em .62em; border-radius: 5px; color: #fff;
  transition: opacity .25s ease;
}
.pub-detail .ba-tag-before { background: rgba(11,15,26,.82); }
.pub-detail .ba-tag-after { background: var(--pk); opacity: 0; }
.pub-detail .ba:hover .ba-tag-before,
.pub-detail .ba:focus-visible .ba-tag-before,
.pub-detail .ba.is-after .ba-tag-before { opacity: 0; }
.pub-detail .ba:hover .ba-tag-after,
.pub-detail .ba:focus-visible .ba-tag-after,
.pub-detail .ba.is-after .ba-tag-after { opacity: 1; }

/* affordance hint (bottom-right) */
.pub-detail .ba-hint {
  position: absolute; right: 10px; bottom: 10px; z-index: 2;
  font-family: var(--pmono); font-size: var(--text-label); font-weight: 600; color: #fff;
  background: rgba(11,15,26,.55); padding: .24em .6em; border-radius: 999px;
  pointer-events: none; transition: opacity .25s ease;
}
.pub-detail .ba:hover .ba-hint, .pub-detail .ba.is-after .ba-hint { opacity: .4; }

@media (prefers-reduced-motion: reduce) {
  .pub-detail .ba-after, .pub-detail .ba-tag, .pub-detail .ba-hint { transition: none; }
}
