/* ==========================================================================
   Ba-Thinh Lam — personal research page
   ========================================================================== */

:root {
  /* Bright green + gold. --accent / --accent-2 are for fills and accents; --accent-text is the readable shade for text links. */
  --bg: #fafbf9;
  --bg-card: #ffffff;
  --bg-soft: #f0f4f1;
  --text: #141a17;
  --text-muted: #56615b;
  --border: #dde4df;
  --accent: #90ee90;
  --accent-text: #287a28;
  --accent-2: #ffc629;
  --accent-soft: #eafbea;
  --highlight: #f4fdf4;
  --highlight-border: #c4efc4;
  --me: #0b0f0d;
  --box: #32cd32;
  --box-ink: #0f2a1d;

  --tag-conf: #287a28;
  --tag-conf-bg: #eafbea;
  --tag-jour: #8f6a00;
  --tag-jour-bg: #fff3c4;
  --tag-work: #2f5fa8;
  --tag-work-bg: #e6eefa;
  --chip-conf: #90ee90;
  --chip-jour: #ffc629;
  --chip-work: #3b6fb6;

  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --maxw: 960px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c110f;
    --bg-card: #121915;
    --bg-soft: #17211c;
    --text: #e4ebe7;
    --text-muted: #97a49d;
    --border: #23302a;
    --accent: #90ee90;
    --accent-text: #90ee90;
    --accent-2: #ffc629;
    --accent-soft: #132a20;
    --highlight: #0f1f10;
    --highlight-border: #2a4d2c;
    --me: #ffffff;
    --box: #32cd32;
    --box-ink: #0f2a1d;
    --tag-conf: #90ee90;
    --tag-conf-bg: #132a20;
    --tag-jour: #f2c94c;
    --tag-jour-bg: #26220f;
    --tag-work: #9dbcf2;
    --tag-work-bg: #142036;
    --chip-conf: #90ee90;
    --chip-jour: #ffc629;
    --chip-work: #3b6fb6;
  }
}
:root[data-theme="dark"] {
  --bg: #0c110f;
  --bg-card: #121915;
  --bg-soft: #17211c;
  --text: #e4ebe7;
  --text-muted: #97a49d;
  --border: #23302a;
  --accent: #90ee90;
  --accent-text: #90ee90;
  --accent-2: #ffc629;
  --accent-soft: #132a20;
  --highlight: #0f1f10;
  --highlight-border: #2a4d2c;
  --me: #ffffff;
  --box: #32cd32;
  --box-ink: #0f2a1d;
  --tag-conf: #90ee90;
  --tag-conf-bg: #132a20;
  --tag-jour: #f2c94c;
  --tag-jour-bg: #26220f;
  --tag-work: #9dbcf2;
  --tag-work-bg: #142036;
  --chip-conf: #90ee90;
  --chip-jour: #ffc629;
  --chip-work: #3b6fb6;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background-color: var(--bg);
  /* faint dot grid, like a feature map */
  background-image: radial-gradient(color-mix(in srgb, var(--accent) 16%, transparent) 1px, transparent 1.2px);
  background-size: 24px 24px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
.mono { font-family: var(--mono); }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Top nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav .container { display: flex; align-items: center; justify-content: space-between; height: 56px; gap: 16px; }
.nav-brand { font-family: var(--serif); font-weight: 600; font-size: 18px; color: var(--text); white-space: nowrap; }
.nav-brand:hover { text-decoration: none; }
.nav-links { display: flex; align-items: center; gap: 20px; font-size: 14.5px; }
.nav-links a { color: var(--text-muted); }
.nav-links a:hover { color: var(--text); text-decoration: none; }
.theme-btn {
  border: 1px solid var(--border); background: transparent; color: var(--text-muted);
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.theme-btn:hover { color: var(--text); border-color: var(--text-muted); }
@media (max-width: 640px) {
  .nav-links a.hide-sm { display: none; }
  .nav-links { gap: 14px; }
}

/* ---------- Hero ---------- */
.hero-wrap { position: relative; overflow: hidden; border-bottom: 1px solid var(--border); }
/* Patch-grid canvas: noise patches slowly "denoise" toward a clean gradient. */
#patch-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  opacity: .9; pointer-events: none;
  -webkit-mask-image: linear-gradient(110deg, transparent 38%, #000 72%);
          mask-image: linear-gradient(110deg, transparent 38%, #000 72%);
}
.hero {
  position: relative;
  display: grid; grid-template-columns: 1fr 220px; gap: 48px;
  align-items: start; padding: 56px 0 44px;
}
.eyebrow {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .04em;
  color: var(--accent-text); margin: 0 0 10px;
}
.hero h1 {
  font-family: var(--serif); font-weight: 600; font-size: 44px; line-height: 1.1;
  margin: 0 0 8px; letter-spacing: -0.015em;
}
.hero h1 .native { font-size: 20px; color: var(--text-muted); font-weight: 400; margin-left: 6px; letter-spacing: 0; }
.hero .subtitle { color: var(--text-muted); font-size: 16px; margin: 0 0 20px; }
.hero p { margin: 0 0 14px; }

/* Photo with a detector-style bounding box */
.photo-box { position: relative; width: 220px; margin-top: 8px; }
.photo-box img {
  width: 220px; height: 264px; object-fit: cover; object-position: center 22%;
  border-radius: 6px; display: block;
}
.bbox {
  position: absolute; inset: -8px; border: 2px solid var(--box); border-radius: 4px;
  pointer-events: none; transition: inset .35s ease;
}
.bbox-label {
  position: absolute; top: -30px; left: -10px;
  font-family: var(--mono); font-size: 11.5px; font-weight: 600;
  background: var(--box); color: var(--box-ink); padding: 3px 7px; border-radius: 3px 3px 0 0;
  white-space: nowrap;
}
.photo-box:hover .bbox { inset: -4px; }
.photo-caption { font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); margin-top: 14px; text-align: center; }

.links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.links a {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 999px;
  font-size: 14px; color: var(--text); background: var(--bg-card);
  transition: border-color .15s, background .15s;
}
.links a:hover { text-decoration: none; border-color: var(--accent-text); background: var(--accent-soft); }
.links i { font-size: 15px; color: var(--text-muted); }
.links a:hover i { color: var(--accent-text); }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding: 40px 0 32px; }
  .hero-side { order: -1; }
  .photo-box { width: 140px; margin: 26px 0 0 8px; }
  .photo-box img { width: 140px; height: 168px; }
  .photo-caption { display: none; }
  .hero h1 { font-size: 34px; }
}

/* ---------- Sections ---------- */
section { padding: 40px 0 8px; }
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 0 0 20px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.sec-head h2 { font-family: var(--serif); font-size: 27px; font-weight: 600; margin: 0; }
.sec-head small { font-size: 13.5px; color: var(--text-muted); }

/* ---------- Research themes ---------- */
.themes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.theme {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: 12px;
  padding: 18px 18px 16px; position: relative; overflow: hidden;
}
.theme::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.theme .t-icon { font-size: 18px; color: var(--accent-text); margin-bottom: 8px; }
.theme h3 { font-size: 15.5px; margin: 0 0 6px; font-weight: 600; }
.theme p { font-size: 14px; color: var(--text-muted); margin: 0; line-height: 1.55; }
@media (max-width: 760px) { .themes { grid-template-columns: 1fr; } }

/* ---------- News ---------- */
.news { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 64px 1fr; gap: 8px; padding: 6px 0; font-size: 15px; }
@media (min-width: 900px) { .news li.one-line > span:last-child { white-space: nowrap; letter-spacing: -0.01em; } }
.news .date { font-family: var(--mono); color: var(--text-muted); font-size: 12.5px; padding-top: 3px; }
.news .emph { font-weight: 600; }
.news .hot {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: #fff; background: #e5484d;
  padding: 1px 6px; border-radius: 3px; margin-right: 6px; vertical-align: 2px;
}
@media (max-width: 600px) { .news li { grid-template-columns: 64px 1fr; gap: 8px; } }

/* ---------- Publications ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 20px; }
.filters button {
  font: inherit; font-size: 13.5px; cursor: pointer;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted);
}
.filters button:hover { color: var(--text); border-color: var(--text-muted); }
.filters button[aria-pressed="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.pub-year { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 26px 0 8px; letter-spacing: .05em; }
.pub-year:first-child { margin-top: 0; }

.pub {
  display: grid; grid-template-columns: 220px 1fr; gap: 22px;
  padding: 14px; margin: 0 -14px 4px; border-radius: 12px;
  border: 1px solid transparent;
}
.pub.featured { background: var(--highlight); border-color: var(--highlight-border); box-shadow: inset 3px 0 0 var(--accent); }
.pub[hidden] { display: none; }

.pub-media {
  position: relative; width: 220px; height: 136px; border-radius: 8px; overflow: hidden;
  background: #fff; border: 1px solid var(--border);
}
.pub-media img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pub-media .venue-chip {
  position: absolute; left: 6px; top: 6px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; letter-spacing: .02em;
  padding: 2px 6px; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.venue-chip.conf { color: #0f2e10; background: var(--chip-conf); }
.venue-chip.jour { color: #2a2000; background: var(--chip-jour); }
.venue-chip.work { color: #fff; background: var(--chip-work); }
.venue-chip.pre  { color: #fff; background: #b36b00; }

/* Venue card used when a paper has no teaser figure */
.pub-media.card {
  display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;
  font-family: var(--mono); background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 17px 17px; background-color: var(--bg-card);
}
.pub-media.card b { font-size: 18px; letter-spacing: .02em; padding: 2px 8px; border-radius: 4px; background: var(--bg-card); }
.pub-media.card span { font-size: 11.5px; color: var(--text-muted); margin-top: 6px; background: var(--bg-card); padding: 0 6px; }
.pub-media.card.conf b { color: var(--tag-conf); }
.pub-media.card.jour b { color: var(--tag-jour); }
.pub-media.card.work b { color: var(--tag-work); }

/* Before / after comparison slider */
.compare { cursor: ew-resize; background: #000; touch-action: pan-y; }
.compare img { object-fit: cover; position: absolute; inset: 0; user-select: none; -webkit-user-drag: none; }
.compare .after { clip-path: inset(0 0 0 var(--pos, 50%)); }
.compare .handle {
  position: absolute; top: 0; bottom: 0; left: var(--pos, 50%); width: 2px; margin-left: -1px;
  background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); pointer-events: none;
}
.compare .handle::after {
  content: "\2194"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 22px; height: 22px; border-radius: 50%; background: #fff; color: #111;
  font-size: 13px; line-height: 22px; text-align: center; box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.compare .lbl {
  position: absolute; bottom: 6px; font-family: var(--mono); font-size: 10px; font-weight: 600;
  color: #fff; background: rgba(0,0,0,.55); padding: 1px 5px; border-radius: 3px; pointer-events: none;
}
.compare .lbl.l { left: 6px; } .compare .lbl.r { right: 6px; }
.compare input[type=range] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }
.media-note { font-family: var(--mono); font-size: 10.5px; color: var(--text-muted); margin-top: 5px; text-align: center; }

.pub-title { font-weight: 600; font-size: 16px; line-height: 1.4; margin: 0 0 4px; color: var(--text); }
.pub-authors { font-size: 14.5px; color: var(--text-muted); margin: 0 0 3px; line-height: 1.5; }
.pub-authors .me { color: var(--me); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent-text); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.pub-meta { font-size: 14.5px; margin: 0 0 6px; }
.pub-meta em { font-style: italic; }
.pub-meta strong { font-weight: 700; }
.pub-meta .note { color: var(--text-muted); }
.pub-tldr { font-size: 14px; color: var(--text-muted); margin: 0 0 8px; }
.pub-tldr b { font-family: var(--mono); font-size: 11.5px; color: var(--accent-text); font-weight: 600; margin-right: 4px; }
.pub-links { display: flex; flex-wrap: wrap; gap: 6px; }
.pub-links a {
  font-family: var(--mono); font-size: 11.5px; font-weight: 500; padding: 2px 9px; border-radius: 5px;
  border: 1px solid var(--border); color: var(--text-muted); background: var(--bg-card);
}
.pub-links a:hover { text-decoration: none; color: var(--accent-text); border-color: var(--accent-text); }
.pub-links a i { margin-right: 4px; }
.pub-foot { font-size: 13.5px; color: var(--text-muted); margin-top: 16px; }

@media (max-width: 640px) {
  .pub { grid-template-columns: 1fr; gap: 12px; }
  .pub-media { width: 100%; height: 180px; }
  .compare { height: auto; aspect-ratio: 1 / 1; max-width: 280px; }
}

/* ---------- Education / awards / service ---------- */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; gap: 0; } }

.edu { list-style: none; margin: 0; padding: 0; }
.edu li { padding: 6px 0 10px; }
.edu .where { font-weight: 600; }
.edu .what { color: var(--text-muted); font-size: 14.5px; }
.edu .when { font-family: var(--mono); font-size: 12px; color: var(--text-muted); }

.awards { list-style: none; margin: 0; padding: 0; }
.awards li { display: grid; grid-template-columns: 52px 1fr; gap: 12px; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 15px; }
.awards li:last-child { border-bottom: none; }
.awards .yr { font-family: var(--mono); color: var(--text-muted); font-size: 12.5px; padding-top: 2px; }
.awards .rank { font-weight: 600; }
.awards .small-links { font-family: var(--mono); font-size: 11.5px; margin-left: 2px; white-space: nowrap; }

.plain { margin: 0; padding-left: 18px; font-size: 15px; }
.plain li { margin: 4px 0; }

/* ---------- Footer ---------- */
footer.site { margin-top: 56px; padding: 24px 0 40px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 13px; }
footer.site .container { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-family: var(--mono); font-size: 12px; }

/* Linked paper titles */
.pub-title a { color: inherit; }
.pub-title a:hover { color: var(--accent-text); }

/* Current page in nav */
.nav-links a[aria-current="page"] { color: var(--text); font-weight: 600; }

/* ---------- Research theme tags ---------- */
.theme-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.theme-tags a {
  font-family: var(--mono); font-size: 11.5px; padding: 2px 8px; border-radius: 5px;
  background: var(--accent-soft); color: var(--accent-text); border: 1px solid transparent;
}
.theme-tags a:hover { text-decoration: none; border-color: var(--accent-text); }

/* ---------- Sub-page header ---------- */
.page-head { padding: 44px 0 8px; }
.page-head h1 { font-family: var(--serif); font-weight: 600; font-size: 38px; line-height: 1.15; margin: 0 0 8px; }
.page-head .subtitle { color: var(--text-muted); font-size: 14.5px; margin: 0; }

/* ---------- Publication search ---------- */
.search-panel {
  margin: 20px 0 28px; padding: 18px; border: 1px solid var(--border); border-radius: 12px;
  background: var(--bg-card);
}
.search-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.search-box {
  flex: 1 1 280px; display: flex; align-items: center; gap: 8px;
  border: 1px solid var(--border); border-radius: 8px; padding: 0 12px; background: var(--bg);
}
.search-box:focus-within { border-color: var(--accent-text); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-box i { color: var(--text-muted); font-size: 14px; }
.search-box input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; padding: 9px 0; }
.search-row select {
  font: inherit; font-size: 14px; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; cursor: pointer;
}
.search-row .check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text-muted); cursor: pointer; }
.search-row .check input { accent-color: var(--accent-text); width: 15px; height: 15px; }

.topic-group { display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: start; padding: 6px 0; }
.tg-name { font-family: var(--mono); font-size: 11.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; padding-top: 6px; }
.tg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.topic-chip {
  font: inherit; font-size: 13px; cursor: pointer; padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--bg); color: var(--text);
}
.topic-chip span { font-family: var(--mono); font-size: 11px; color: var(--text-muted); margin-left: 2px; }
.topic-chip:hover { border-color: var(--accent-text); }
.topic-chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent-text); color: var(--bg); }
.topic-chip[aria-pressed="true"] span { color: inherit; opacity: .75; }
@media (max-width: 640px) { .topic-group { grid-template-columns: 1fr; gap: 4px; } .tg-name { padding-top: 0; } }

.result-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
#count { font-family: var(--mono); font-size: 12.5px; color: var(--text-muted); }
.clear-btn { font: inherit; font-size: 13px; color: var(--accent-text); background: none; border: 0; cursor: pointer; padding: 0; }
.clear-btn:hover { text-decoration: underline; }
.empty { color: var(--text-muted); text-align: center; padding: 32px 0; }

.pub-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.pub-tags button {
  font-family: var(--mono); font-size: 10.5px; cursor: pointer; padding: 1px 7px; border-radius: 4px;
  border: 1px solid transparent; background: var(--bg-soft); color: var(--text-muted);
}
.pub-tags button:hover { color: var(--accent-text); border-color: var(--accent-text); }
.pub-tags button.on { background: var(--accent-soft); color: var(--accent-text); }

/* ---------- Visitor map (hidden until a widget script is pasted in) ---------- */
#visitors:not(:has(script)) { display: none; }
.visitor-map { max-width: 560px; margin: 0 auto; padding: 8px 0; }
.visitor-map img, .visitor-map canvas, .visitor-map iframe { max-width: 100%; height: auto; border-radius: 8px; }

/* ---------- BibTeX ---------- */
.pub-links .bib-btn {
  font-family: var(--mono); font-size: 11.5px; font-weight: 500; padding: 2px 9px; border-radius: 5px;
  border: 1px solid var(--border); color: var(--text-muted); background: var(--bg-card); cursor: pointer;
}
.pub-links .bib-btn i { margin-right: 4px; }
.pub-links .bib-btn:hover, .pub-links .bib-btn[aria-expanded="true"] { color: var(--accent-text); border-color: var(--accent-text); }
.bib-panel { position: relative; margin-top: 10px; }
.bib-panel pre {
  margin: 0; padding: 12px 14px; max-height: 240px; overflow: auto;
  font-family: var(--mono); font-size: 11.5px; line-height: 1.55; white-space: pre;
  background: var(--bg-soft); border: 1px solid var(--border); border-radius: 8px; color: var(--text);
}
.bib-copy {
  position: absolute; top: 8px; right: 8px;
  font-family: var(--mono); font-size: 11px; padding: 2px 8px; border-radius: 5px; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-muted);
}
.bib-copy i { margin-right: 4px; }
.bib-copy:hover { color: var(--accent-text); border-color: var(--accent-text); }

/* ---------- Research map ---------- */
:root { --map-0: #90ee90; --map-1: #f5b800; --map-2: #3b6fb6; --map-3: #8a948e; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --map-0: #90ee90; --map-1: #ffc629; --map-2: #9dbcf2; --map-3: #8d9a93; } }
:root[data-theme="dark"] { --map-0: #90ee90; --map-1: #ffc629; --map-2: #9dbcf2; --map-3: #8d9a93; }

.rm-wrap { margin-top: 22px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card); padding: 14px 14px 6px; }
.rm-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 0 4px 6px; }
.rm-head h3 { margin: 0; font-size: 15.5px; font-weight: 600; }
.rm-head small { font-family: var(--mono); font-size: 11.5px; color: var(--text-muted); }
#research-map { overflow-x: auto; -webkit-overflow-scrolling: touch; }
#research-map svg { display: block; width: 100%; min-width: 760px; height: auto; }

.rm-edge { fill: none; stroke-width: 1.4; opacity: .28; transition: opacity .15s, stroke-width .15s; }
.rm-edge.g0 { stroke: var(--map-0); } .rm-edge.g1 { stroke: var(--map-1); }
.rm-edge.g2 { stroke: var(--map-2); } .rm-edge.g3 { stroke: var(--map-3); }
.dim .rm-edge { opacity: .06; }
.dim .rm-edge.on { opacity: .9; stroke-width: 2.2; }

.rm-node { cursor: default; outline: none; transition: opacity .15s; }
a.rm-node { cursor: pointer; }
.rm-node rect { fill: var(--bg); stroke: var(--border); stroke-width: 1; transition: stroke .15s, fill .15s; }
.rm-node.g0 rect { stroke: color-mix(in srgb, var(--map-0) 45%, var(--border)); }
.rm-node.g1 rect { stroke: color-mix(in srgb, var(--map-1) 55%, var(--border)); }
.rm-node.g2 rect { stroke: color-mix(in srgb, var(--map-2) 45%, var(--border)); }
.rm-node.g3 rect { stroke: color-mix(in srgb, var(--map-3) 45%, var(--border)); }
.rm-node.area rect { stroke-width: 0; }
.rm-node.area.g0 rect { fill: var(--map-0); }
.rm-node.area.g0 .rm-label { fill: #0f2e10 !important; } .rm-node.area.g1 rect { fill: var(--map-1); }
.rm-node.area.g2 rect { fill: var(--map-2); } .rm-node.area.g3 rect { fill: var(--map-3); }
.rm-node.area .rm-label { fill: #fff; font-weight: 600; }
:root[data-theme="dark"] .rm-node.area .rm-label { fill: #0c110f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rm-node.area .rm-label { fill: #0c110f; } }
.rm-node.paper.first rect { fill: var(--highlight); stroke: var(--highlight-border); }

.rm-label { font-family: var(--sans); font-size: 12px; fill: var(--text); }
.rm-venue { font-family: var(--mono); font-size: 10.5px; fill: var(--text-muted); }
.dim .rm-node { opacity: .28; }
.dim .rm-node.on { opacity: 1; }
.rm-node.on rect, .rm-node:focus-visible rect { stroke: var(--accent); stroke-width: 1.6; }
.rm-node.area.on rect { stroke-width: 0; }

/* ---------- Photo easter egg: bounding box -> segmentation mask on hover ---------- */
.photo-box .seg-mask {
  position: absolute; left: 0; top: 0; width: 220px; height: 264px; border-radius: 6px;
  opacity: 0; transition: opacity .35s ease; pointer-events: none;
}
.bbox { transition: inset .35s ease, border-color .35s ease; }
.bbox-label { transition: opacity .25s ease; }
.bbox-label.seg { opacity: 0; }
.photo-box:hover .seg-mask, .photo-box.seg .seg-mask { opacity: 1; }
.photo-box:hover .bbox, .photo-box.seg .bbox { inset: 0; border-color: transparent; }
.photo-box:hover .bbox-label.det, .photo-box.seg .bbox-label.det { opacity: 0; }
.photo-box:hover .bbox-label.seg, .photo-box.seg .bbox-label.seg { opacity: 1; }
.photo-box:hover .bbox-label, .photo-box.seg .bbox-label { top: -22px; left: 0; }
@media (max-width: 760px) { .photo-box .seg-mask { width: 140px; height: 168px; } }
.pub-meta .venue { font-weight: 600; color: var(--text); cursor: help; }

/* Research map toggle */
details.rm-wrap > summary { list-style: none; cursor: pointer; padding-bottom: 8px; }
details.rm-wrap > summary::-webkit-details-marker { display: none; }
details.rm-wrap > summary h3::after { content: "\25B8"; margin-left: 8px; color: var(--text-muted); display: inline-block; transition: transform .2s; }
details.rm-wrap[open] > summary h3::after { transform: rotate(90deg); }
details.rm-wrap > summary h3 i { color: var(--accent-text); margin-right: 4px; }
details.rm-wrap:not([open]) { padding-bottom: 8px; }

/* Compact research cards */
.theme { padding: 16px 16px 14px; }
.theme h3 { margin-bottom: 2px; }
.theme .theme-tags { margin-top: 10px; }

/* ---------- Selected publications (home page): Shamrock Green cover and badges ---------- */
:root { --sel: #009e60; --sel-bg: #eef8f3; --sel-border: #a6dcc4; --sel-chip: #009e60; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --sel-bg: #0a1f17; --sel-border: #1c5540; } }
:root[data-theme="dark"] { --sel-bg: #0a1f17; --sel-border: #1c5540; }
#selected-list .pub, #pub-list .pub.featured {
  background: var(--sel-bg); border-color: var(--sel-border);
  box-shadow: inset 3px 0 0 var(--sel);
}
#selected-list .venue-chip, #pub-list .pub.featured .venue-chip { background: var(--sel-chip); color: #ffffff; }

/* ---------- Titles: name + section headings in dark green (Charlotte Green) ---------- */
:root { --title: #0d7850; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --title: #5fc794; } }
:root[data-theme="dark"] { --title: #5fc794; }
.hero h1, .page-head h1, .sec-head h2 { color: var(--title); }
