/* Xiao Shang — academic portfolio styles (monochrome; light and dark themes) */

/* Light theme (default) */
:root,
:root[data-theme="light"] {
  --bg: #ffffff;
  --bg-rgb: 255, 255, 255;
  --panel: #f5f5f3;
  --panel-2: #ebebe8;
  --line: #e3e3df;
  --line-2: #c4c4bf;
  --fg: #0b0b0b;
  --text: #2c2c2c;
  --muted: #666666;
  --faint: #9a9a9a;
  --header-bg: rgba(255, 255, 255, .9);
  --hero-filter: none;
  --hero-wash: linear-gradient(90deg, rgba(255,255,255,.96) 0%, rgba(255,255,255,.82) 45%, rgba(255,255,255,.35) 100%),
               linear-gradient(0deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 40%);
  --hero-wash-mobile: linear-gradient(0deg, rgba(255,255,255,.97) 35%, rgba(255,255,255,.75) 100%);
  --pulse: 11, 11, 11;
  color-scheme: light;
}

/* Dark theme */
:root[data-theme="dark"] {
  --bg: #000000;
  --bg-rgb: 0, 0, 0;
  --panel: #0c0c0c;
  --panel-2: #141414;
  --line: #262626;
  --line-2: #3a3a3a;
  --fg: #ffffff;
  --text: #d6d6d6;
  --muted: #8f8f8f;
  --faint: #5e5e5e;
  --header-bg: rgba(0, 0, 0, .88);
  --hero-filter: brightness(.85);
  --hero-wash: linear-gradient(90deg, rgba(0,0,0,.92) 0%, rgba(0,0,0,.7) 45%, rgba(0,0,0,.25) 100%),
               linear-gradient(0deg, rgba(0,0,0,1) 0%, rgba(0,0,0,0) 40%);
  --hero-wash-mobile: linear-gradient(0deg, rgba(0,0,0,.95) 35%, rgba(0,0,0,.6) 100%);
  --pulse: 255, 255, 255;
  color-scheme: dark;
}

:root {
  --radius: 4px;
  --max: 1200px;
  --sans: "Barlow", "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background-color .25s ease, color .25s ease;
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--fg); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--fg); }

h1, h2, h3, h4 {
  font-family: var(--sans); color: var(--fg); line-height: 1.1; margin: 0 0 .55em;
  text-transform: uppercase; letter-spacing: .04em; font-weight: 600;
}
h1 { font-size: 3.2rem; }
h2 { font-size: 2.2rem; }
h3 { font-size: 1.2rem; letter-spacing: .05em; }
h4 { font-size: 1rem; letter-spacing: .06em; }
p { margin: 0 0 1em; }
b, strong { color: var(--fg); font-weight: 600; }
@media (max-width: 640px) { h1 { font-size: 2.3rem; } h2 { font-size: 1.7rem; } }

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

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 12px; }
.site-header nav { order: 2; margin-left: auto; }
.header-tools { order: 3; display: flex; align-items: center; gap: 8px; }
.brand {
  font-family: var(--sans); font-size: 1.3rem; font-weight: 700; color: var(--fg); white-space: nowrap;
  text-transform: uppercase; letter-spacing: .22em; text-decoration: none; display: flex; align-items: baseline; gap: 12px;
}
.brand .mark { display: none; }
.brand small { font-size: .68rem; font-weight: 500; color: var(--muted); letter-spacing: .14em; }
.brand:hover { text-decoration: none; }

.nav { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; align-items: center; }
.nav a {
  display: block; padding: 8px 11px; color: var(--fg); text-decoration: none;
  font-family: var(--sans); font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em;
  border-bottom: 2px solid transparent;
}
.nav a:hover { border-bottom-color: var(--muted); }
.nav a.current { border-bottom-color: var(--fg); }
.nav a.cv-link { border: 1.5px solid var(--fg); margin-left: 10px; padding: 7px 16px; }
.nav a.cv-link:hover { background: var(--fg); color: var(--bg); }

.theme-toggle, .nav-toggle {
  background: none; border: 1.5px solid var(--line-2); color: var(--fg); cursor: pointer;
  width: 38px; height: 38px; display: grid; place-items: center; font-size: .95rem; padding: 0;
}
.theme-toggle:hover, .nav-toggle:hover { border-color: var(--fg); }
.theme-toggle .fa-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .fa-sun { display: inline-block; }
:root[data-theme="dark"] .theme-toggle .fa-moon { display: none; }
.nav-toggle { display: none; }

@media (max-width: 1080px) {
  .nav-toggle { display: grid; }
  .site-header nav { margin-left: 0; }
  .nav {
    display: none; position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; align-items: stretch; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px 16px 18px;
  }
  .nav.open { display: flex; }
  .nav a { padding: 12px 4px; border-bottom: 1px solid var(--line); }
  .nav a.cv-link { margin: 12px 0 0; text-align: center; }
}

/* ---------- Sections ---------- */
main { min-height: 60vh; }
.section { padding: 96px 0; border-top: 1px solid var(--line); }
.section.alt { background: var(--panel); }
.section.dark { background: var(--bg); }
.section-head { margin-bottom: 44px; }
.section-head p { color: var(--muted); max-width: 760px; font-size: 1.02rem; }
.eyebrow {
  display: inline-block; font-family: var(--sans); font-size: .78rem; font-weight: 600; letter-spacing: .28em;
  text-transform: uppercase; color: var(--muted); margin-bottom: 14px;
}

/* Page heads on inner pages */
.page-head {
  position: relative; overflow: hidden; padding: 120px 0 72px; background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.page-head h1 { font-size: clamp(2.4rem, 5vw, 3.8rem); }
.page-head p, .page-head p.lead { color: var(--muted); }
.page-head p.lead { font-size: 1.15rem; max-width: 820px; }
.lead { font-size: 1.12rem; }
.jump { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.jump a {
  font-family: var(--sans); font-size: .76rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  padding: 7px 13px; border: 1px solid var(--line-2); color: var(--fg); text-decoration: none;
}
.jump a:hover { background: var(--fg); color: var(--bg); }

/* ---------- Home hero ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: min(calc(100vh - 68px), 860px); display: flex; align-items: flex-end;
  background: var(--bg);
}
.hero-media {
  position: absolute; top: 0; bottom: 0; right: 0; left: 38%;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 35%);
  mask-image: linear-gradient(90deg, transparent 0%, #000 35%);
}
@media (max-width: 900px) { .hero-media { left: 0; -webkit-mask-image: none; mask-image: none; } }
.hero-media img { width: 100%; height: 100%; object-fit: cover; filter: var(--hero-filter); transform: scaleX(-1); }
.hero-media::after { content: ""; position: absolute; inset: 0; background: var(--hero-wash); }
.hero .container { position: relative; z-index: 1; padding-top: 96px; padding-bottom: 88px; width: 100%; }
.hero-copy { max-width: 780px; }
.hero h1 { font-size: clamp(3rem, 7vw, 5.4rem); letter-spacing: .08em; font-weight: 700; margin-bottom: .2em; }
.hero .role { font-size: .98rem; color: var(--muted); margin-bottom: 1.6em; }
.hero .tagline { font-size: clamp(1.15rem, 2vw, 1.4rem); line-height: 1.55; color: var(--fg); margin-bottom: 1.4em; font-weight: 400; }
.market {
  display: inline-flex; align-items: center; gap: 12px; padding: 0; margin-bottom: 30px;
  font-family: var(--sans); font-size: .82rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--fg);
}
.market .dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--fg); animation: pulse 2s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(var(--pulse), .6); } 70% { box-shadow: 0 0 0 10px rgba(var(--pulse), 0); } 100% { box-shadow: 0 0 0 0 rgba(var(--pulse), 0); } }
.hero-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line-2); max-width: 760px; }
.hero-meta div { font-family: var(--sans); font-size: .74rem; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }
.hero-meta b { display: block; font-family: var(--sans); font-size: 2.4rem; font-weight: 600; letter-spacing: .02em; color: var(--fg); line-height: 1.1; margin-bottom: 4px; }
@media (max-width: 700px) { .hero-media::after { background: var(--hero-wash-mobile); } .hero-meta { grid-template-columns: repeat(2, 1fr); gap: 22px; } }
@media (prefers-reduced-motion: reduce) { .market .dot { animation: none; } }

.grad-text { color: inherit; }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-wrap: wrap; gap: 14px; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; padding: 14px 28px;
  font-family: var(--sans); font-size: .82rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  background: transparent; color: var(--fg); border: 2px solid var(--fg); text-decoration: none;
  transition: background .2s ease, color .2s ease;
}
.btn:hover { background: var(--fg); color: var(--bg); }
.btn.ghost { border-color: var(--line-2); }
.btn.ghost:hover { border-color: var(--fg); }
.btn.outline { border-color: var(--fg); }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.stats.wide { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--bg); padding: 22px 24px; }
.stat .num { font-family: var(--sans); font-size: 2.4rem; font-weight: 600; line-height: 1.05; color: var(--fg); }
.stat .lbl { font-family: var(--sans); font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-top: 8px; }
@media (max-width: 760px) { .stats.wide { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Grid & cards ---------- */
.grid { display: grid; gap: 24px; }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 960px) { .grid.cols-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; } }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column; transition: border-color .2s ease;
}
a.card { color: inherit; text-decoration: none; }
a.card:hover { border-color: var(--muted); }
a.card:hover .thumb { transform: scale(1.03); }
.card .thumb { aspect-ratio: 16 / 10; object-fit: cover; width: 100%; background: var(--panel-2); transition: transform .5s ease; }
.card .thumb.contain { object-fit: contain; background: #fff; }
.card .body { padding: 24px 26px 26px; display: flex; flex-direction: column; flex: 1; background: var(--panel); position: relative; }
.card h3 { font-size: 1.1rem; }
.card p { font-size: .94rem; color: var(--muted); }
.card .tag { display: inline-block; font-family: var(--sans); font-size: .7rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }

/* Image tiles with overlay text */
.tile {
  position: relative; display: block; overflow: hidden; border-radius: var(--radius);
  aspect-ratio: 4 / 3; background: var(--panel); color: var(--fg); isolation: isolate; text-decoration: none;
  border: 1px solid var(--line);
}
.tile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s ease; z-index: -2; }
.tile img.contain { object-fit: contain; object-position: top; background: #fff; padding: 10px 10px 46%; }
.tile::after {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(0deg, rgba(var(--bg-rgb),1) 0%, rgba(var(--bg-rgb),1) 44%, rgba(var(--bg-rgb),0) 56%);
}
.tile .tile-body { position: absolute; left: 0; right: 0; bottom: 0; padding: 22px 24px; }
.tile .tag { font-family: var(--sans); font-size: .68rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); }
.tile h3 { font-size: 1.1rem; margin: 6px 0 6px; }
.tile p { color: var(--muted); font-size: .88rem; margin: 0; }
.tile:hover { border-color: var(--muted); }
.tile:hover img { transform: scale(1.04); }

/* Thrust cards */
.thrust .label {
  font-family: var(--sans); font-size: 3rem; font-weight: 300; color: var(--fg); line-height: 1; margin-bottom: 18px;
}

/* ---------- Scale graphic ---------- */
.scales { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.scales::before { content: ""; position: absolute; left: 10%; right: 10%; top: 62px; height: 1px; background: var(--line-2); }
.scale-step { position: relative; text-align: center; }
.scale-step .icon {
  width: 124px; height: 124px; margin: 0 auto 18px; border-radius: 50%;
  background: var(--panel); border: 1px solid var(--line-2); display: grid; place-items: center;
  box-shadow: 0 0 0 8px var(--bg);
}
.scale-step h4 { margin-bottom: 4px; }
.scale-step .len { font-family: var(--sans); font-size: .76rem; color: var(--muted); font-weight: 600; letter-spacing: .14em; }
.scale-step p { font-size: .86rem; color: var(--muted); margin: 10px 0 0; }
.scale-step.now .icon { border: 1.5px solid var(--fg); }
.across {
  margin-top: 44px; display: flex; align-items: center; justify-content: center; gap: 18px; text-align: center;
  font-family: var(--sans); font-size: .84rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--fg);
}
.across i { font-style: normal; text-decoration: underline; text-underline-offset: 4px; }
.across .bar { flex: 1; min-width: 30px; max-width: 220px; height: 1px; background: var(--line-2); }
@media (max-width: 900px) {
  .scales { grid-template-columns: repeat(2, 1fr); row-gap: 34px; }
  .scales::before { display: none; }
  .scale-step:last-child { grid-column: 1 / -1; }
}

/* ---------- Feature rows (ongoing projects) ---------- */
.feature { display: grid; grid-template-columns: 1.1fr 1fr; gap: 64px; align-items: center; padding: 56px 0; }
.feature + .feature { border-top: 1px solid var(--line); }
.feature.flip .feature-media { order: 2; }
.feature-media { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.feature-media img { width: 100%; }
.feature h3 { font-size: 1.6rem; }
.feature p { color: var(--muted); }
.feature ul { color: var(--muted); padding-left: 1.1em; font-size: .95rem; margin: 0 0 1.2em; }
.feature li { margin-bottom: 6px; }
@media (max-width: 860px) {
  .feature { grid-template-columns: 1fr; gap: 26px; }
  .feature.flip .feature-media { order: 0; }
}

.pill {
  display: inline-block; font-family: var(--sans); font-size: .68rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  padding: 4px 10px; border: 1px solid var(--line-2); color: var(--text); margin: 2px 6px 10px 0; border-radius: 2px;
}
.pill.ongoing { border-color: var(--fg); color: var(--fg); }

/* ---------- Scale ladder (research page) ---------- */
.ladder { list-style: none; margin: 0; padding: 0; position: relative; }
.ladder::before { content: ""; position: absolute; left: 132px; top: 8px; bottom: 8px; width: 1px; background: var(--line-2); }
.rung { display: grid; grid-template-columns: 112px 1fr; gap: 44px; padding: 14px 0; position: relative; }
.rung::before {
  content: ""; position: absolute; left: 126px; top: 24px; width: 13px; height: 13px;
  border-radius: 50%; background: var(--bg); border: 1.5px solid var(--muted);
}
.rung.current::before { border-color: var(--fg); background: var(--fg); }
.rung .scale { text-align: right; padding-top: 4px; line-height: 1.4; font-family: var(--sans); font-size: .74rem; letter-spacing: .14em; color: var(--muted); }
.rung .scale b { display: block; font-size: .86rem; letter-spacing: .12em; text-transform: uppercase; }
.rung .content { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; display: grid; grid-template-columns: 1fr 180px; gap: 26px; align-items: start; }
.rung .content > img { border-radius: 2px; aspect-ratio: 4 / 3; object-fit: cover; width: 100%; background: #fff; border: 1px solid var(--line); }
.rung .content > img.contain { object-fit: contain; }
.rung .content h3 { font-size: 1.02rem; }
.rung .content p { font-size: .93rem; margin-bottom: .55em; color: var(--muted); }
.rung .content p:last-child { margin-bottom: 0; }
@media (max-width: 760px) { .rung .content { grid-template-columns: 1fr; } .rung .content > img { max-width: 280px; } }
@media (max-width: 640px) {
  .ladder::before { left: 6px; }
  .rung { grid-template-columns: 1fr; gap: 6px; padding-left: 30px; }
  .rung::before { left: 0; top: 16px; }
  .rung .scale { text-align: left; }
  .rung .scale b { display: inline; margin-right: 8px; }
}

/* ---------- Lists ---------- */
.clean { list-style: none; margin: 0; padding: 0; }
.news li { display: grid; grid-template-columns: 120px 1fr; gap: 22px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.news li:last-child { border-bottom: 0; }
.news .date { font-family: var(--sans); font-size: .76rem; font-weight: 600; color: var(--muted); padding-top: 3px; letter-spacing: .16em; text-transform: uppercase; }
@media (max-width: 560px) { .news li { grid-template-columns: 1fr; gap: 2px; } }

.pubs { padding-left: 0; list-style: none; counter-reset: pub var(--start, 0); }
.pubs li { position: relative; padding: 16px 0 16px 56px; border-bottom: 1px solid var(--line); font-size: .95rem; color: var(--muted); }
.pubs li::before {
  counter-increment: pub -1; content: counter(pub);
  position: absolute; left: 0; top: 16px; width: 38px; text-align: right;
  font-family: var(--sans); font-weight: 600; color: var(--faint); font-size: .95rem; letter-spacing: .04em;
}
.pubs li.first::before { color: var(--fg); }
.pubs.plain li::before { content: none; }
.pubs.plain li { padding-left: 0; }
.pubs .venue { font-style: italic; color: var(--text); }
.pubs .me { font-weight: 600; color: var(--fg); }
.pubs .badge { display: inline-block; font-family: var(--sans); font-size: .64rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; padding: 2px 8px; border: 1px solid var(--fg); color: var(--fg); margin-left: 6px; vertical-align: 1px; }
.pubs .links { margin-top: 8px; }
.pubs .links a {
  display: inline-block; font-family: var(--sans); font-size: .68rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  margin-right: 6px; padding: 3px 10px; border: 1px solid var(--line-2); color: var(--fg); text-decoration: none;
}
.pubs .links a:hover { background: var(--fg); color: var(--bg); }

.entries > div { display: grid; grid-template-columns: 160px 1fr; gap: 24px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.entries > div:last-child { border-bottom: 0; }
.entries .when { font-family: var(--sans); font-size: .76rem; color: var(--muted); font-weight: 600; letter-spacing: .14em; text-transform: uppercase; padding-top: 2px; }
.entries h4 { margin-bottom: .35em; font-size: .95rem; }
.entries p { margin-bottom: .3em; font-size: .95rem; color: var(--muted); }
.entries ul { margin: .3em 0 0; padding-left: 1.1em; font-size: .94rem; }
@media (max-width: 620px) { .entries > div { grid-template-columns: 1fr; gap: 4px; } }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; gap: 32px; } }

.prose { max-width: 820px; }
ul { padding-left: 1.2em; }

/* Icon lists */
.icon-list { display: grid; gap: 18px; list-style: none; padding: 0; margin: 0; }
.icon-list li { display: grid; grid-template-columns: 44px 1fr; gap: 16px; align-items: start; font-size: .95rem; color: var(--muted); }
.icon-list i {
  width: 44px; height: 44px; display: grid; place-items: center; font-size: 1rem;
  border: 1px solid var(--line-2); color: var(--fg); border-radius: 50%;
}

/* ---------- Project pages ---------- */
.project { padding: 72px 0; border-bottom: 1px solid var(--line); }
.project:last-child { border-bottom: 0; }
.project p { color: var(--muted); }
.project .assoc { font-family: var(--sans); font-size: .76rem; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); margin-top: -.2em; }
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin: 26px 0; }
.figs figure { margin: 0; }
.figs img { width: 100%; border-radius: 2px; border: 1px solid var(--line); }
.figs figcaption { font-size: .84rem; color: var(--faint); margin-top: 8px; }
.figs .wide { grid-column: 1 / -1; }
.key { border-left: 2px solid var(--fg); padding: 6px 0 6px 20px; font-size: .96rem; margin: 22px 0; color: var(--text); }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg); color: var(--muted); padding: 72px 0 32px; font-size: .92rem; border-top: 1px solid var(--line); }
.site-footer a { color: var(--fg); }
.site-footer h4 { margin-bottom: .8em; font-size: .85rem; letter-spacing: .2em; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.social { display: flex; gap: 10px; font-size: 1rem; margin-top: 10px; }
.social a { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid var(--line-2); border-radius: 50%; text-decoration: none; }
.social a:hover { background: var(--fg); color: var(--bg); }
.copyright { border-top: 1px solid var(--line); margin-top: 40px; padding-top: 20px; font-family: var(--sans); font-size: .72rem; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr; gap: 24px; } }

/* Let grid children shrink on narrow screens */
.two-col > *, .entries > div > *, .grid > *, .feature > * { min-width: 0; overflow-wrap: anywhere; }

/* Dark mode: darken the light schematic illustrations while keeping their hues */
:root[data-theme="dark"] img[src*="illustrations/"] { filter: invert(.93) hue-rotate(180deg); }

@media (max-width: 480px) {
  .brand { font-size: 1.1rem; letter-spacing: .14em; }
  .brand small { display: none; }
}

/* Figures inside feature rows */
figure.feature-media { margin: 0; }
.feature-media img + img { border-top: 1px solid var(--line); }
.feature-media figcaption { padding: 12px 16px; font-size: .84rem; color: var(--muted); border-top: 1px solid var(--line); background: var(--panel); }

/* Headshot */
.headshot { width: 100%; max-width: 280px; aspect-ratio: 4 / 5; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); margin-bottom: 26px; }
.headshot.sm { max-width: 170px; }

/* Journal covers (falls back to a name tile when no image is present) */
.covers { display: grid; grid-template-columns: repeat(5, 1fr); gap: 18px; margin-top: 18px; }
.cover {
  position: relative; aspect-ratio: 3 / 4; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--panel); display: flex; align-items: flex-end;
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover span {
  position: relative; width: 100%; padding: 12px 14px; font-family: var(--sans); font-size: .78rem; font-weight: 600;
  letter-spacing: .1em; text-transform: uppercase; color: var(--fg); background: rgba(var(--bg-rgb), .92); border-top: 1px solid var(--line);
}
.cover:not(:has(img)) { align-items: center; }
.cover:not(:has(img)) span { background: none; border: 0; text-align: center; font-size: .95rem; line-height: 1.35; }
@media (max-width: 900px) { .covers { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 560px) { .covers { grid-template-columns: repeat(2, 1fr); } }

/* Scale graphic with real figures */
.scale-step .icon { overflow: hidden; }
.scale-step .icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.scale-step p.src { margin-top: 4px; font-size: .74rem; font-style: italic; color: var(--faint); }

/* Institution logos under the affiliation line (MIT in white on dark backgrounds) */
.inst-logos { display: flex; align-items: center; flex-wrap: wrap; gap: 28px; margin: -0.6em 0 1.6em; }
.inst-logos img { height: 48px; width: auto; }
:root[data-theme="dark"] .inst-logos img[src*="mit.svg"] { filter: brightness(0) invert(1); }
@media (max-width: 600px) { .inst-logos { gap: 20px; } .inst-logos img { height: 36px; } }
