/* Layout: transit-signage reading page. A 1120px column, section labels in a left rail on wide
   screens, research "lines" marked with route bullets (E, F, I, P) everywhere they appear. */
:root {
  --bg: #f4f7f6;
  --surface: #ffffff;
  --band: #e8eeec;
  --ink: #15232c;
  --muted: #56656d;
  --rule: #d2dbd8;
  --accent: #0a7564;
  --accent-ink: #ffffff;
  --line-E: #0b8572;
  --line-F: #c8711c;
  --line-I: #6a4fb3;
  --line-P: #6f7c85;
  --bullet-ink: #ffffff;
  --focus: #c8711c;
  --hero-fade: 0.86;
  --hero-gray: 0.35;

  --display: "Overpass", "Helvetica Neue", Arial, sans-serif;
  --body: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "Overpass Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --step--1: 0.875rem;
  --step-0: 1.0625rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.2rem;
  --step-4: clamp(2.4rem, 5vw + 1rem, 3.9rem);
  --radius: 10px;
  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d151a; --surface: #142028; --band: #101b21; --ink: #e3ebe9; --muted: #9aa9af; --rule: #26353e;
    --accent: #3fcdae; --accent-ink: #062019; --line-E: #2fb89c; --line-F: #e5944a; --line-I: #9d84ee; --line-P: #8a98a1;
    --bullet-ink: #071318; --focus: #f0a050; --hero-fade: 0.8; --hero-gray: 0.6; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d151a; --surface: #142028; --band: #101b21; --ink: #e3ebe9; --muted: #9aa9af; --rule: #26353e;
  --accent: #3fcdae; --accent-ink: #062019; --line-E: #2fb89c; --line-F: #e5944a; --line-I: #9d84ee; --line-P: #8a98a1;
  --bullet-ink: #071318; --focus: #f0a050; --hero-fade: 0.8; --hero-gray: 0.6; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 5rem; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 var(--step-0)/1.6 var(--body); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3, h4 { font-family: var(--display); line-height: 1.15; text-wrap: balance; margin: 0; }
p { margin: 0; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: var(--bg); padding: 0.5rem 1rem; z-index: 50; }
.skip:focus { left: 1rem; top: 1rem; }
.muted { color: var(--muted); }
.date { font: 600 var(--step--1)/1.4 var(--mono); color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; white-space: nowrap; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
section.wrap, .band > .wrap { padding-block: clamp(3rem, 6vw, 5rem); }
.band { background: var(--band); border-block: 1px solid var(--rule); }

/* Top bar */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--rule); }
.topbar-in { max-width: var(--wrap); margin-inline: auto; padding: 0.6rem var(--gutter); display: flex; align-items: center; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 0.55rem; color: var(--ink); text-decoration: none; font: 800 1.05rem/1 var(--display); letter-spacing: 0.01em; }
.brand-mark { width: 30px; height: 30px; }
.brand-mark rect { fill: var(--ink); }
.brand-mark path { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.nav { display: flex; gap: 0.15rem; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { font: 600 0.92rem/1 var(--display); color: var(--ink); text-decoration: none; padding: 0.55rem 0.7rem; border-radius: 6px; white-space: nowrap; }
.nav a:hover { background: var(--band); }
.nav a[aria-current="page"], .nav a.is-here { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.theme-btn { flex: none; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); cursor: pointer; display: grid; place-items: center; }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
@media (max-width: 760px) {
  .topbar-in { flex-wrap: wrap; row-gap: 0.2rem; }
  .nav { order: 3; width: 100%; margin-left: -0.7rem; }
  .theme-btn { margin-left: auto; }
}

/* Hero */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem 3.5rem; align-items: center; }
.eyebrow { font: 600 var(--step--1)/1.3 var(--display); text-transform: uppercase; letter-spacing: 0.09em; color: var(--accent); margin-bottom: 0.9rem; }
.hero h1, .page-head h1 { font-size: var(--step-4); font-weight: 800; letter-spacing: -0.02em; }
.lede { font-size: var(--step-1); line-height: 1.5; margin-top: 1rem; max-width: 36em; }
.hero-sub { margin-top: 0.6rem; color: var(--muted); font-family: var(--display); }
.cta { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.6rem; }
.btn { display: inline-flex; align-items: center; gap: 0.45rem; font: 600 0.95rem/1 var(--display); padding: 0.8rem 1.1rem; border-radius: 8px; border: 1.5px solid var(--ink); color: var(--ink); background: transparent; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--surface); }
.btn-solid { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-solid:hover { background: var(--accent); filter: brightness(1.08); }
.muted-inv { font: 400 0.75rem/1 var(--mono); opacity: 0.8; }
.hero-photo { margin: 6px; justify-self: end; position: relative; }
.hero-photo img { width: 300px; aspect-ratio: 1; object-fit: cover; border-radius: 50%; border: 10px solid var(--accent); box-shadow: 0 0 0 6px var(--bg); background: var(--surface); max-width: 100%; }
.stats { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 1.5rem 0 0; border-top: 2px solid var(--ink); }
.stats div { padding: 0.9rem 1rem 0 0; display: flex; flex-direction: column-reverse; gap: 0.3rem; }
.stats div + div { padding-left: 1rem; border-left: 1px solid var(--rule); }
.stats dt { font: 400 var(--step--1)/1.35 var(--display); color: var(--muted); }
.stats dd { margin: 0; font: 800 var(--step-3)/1 var(--display); font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; }
  .hero-photo { grid-row: 1; justify-self: start; }
  .hero-photo img { width: 168px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats div:nth-child(3) { padding-left: 0; border-left: 0; }
}

/* Section scaffolding */
.two-col { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 1.5rem 3rem; }
.sec-h { font-size: var(--step-2); font-weight: 800; letter-spacing: -0.01em; }
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.6rem 2rem; margin-bottom: 2rem; }
.sec-note { color: var(--muted); max-width: 38em; }
.more { font: 600 0.95rem/1.3 var(--display); }
.mini-h { font: 700 var(--step--1)/1.3 var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 1.8rem 0 0.7rem; }
.prose { max-width: 40em; display: grid; gap: 1rem; }
.prose .mini-h { margin-bottom: 0; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

/* News */
.news { list-style: none; margin: 0; padding: 0; display: grid; }
.news li { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 1rem; padding: 0.85rem 0; border-top: 1px solid var(--rule); }
.news li:first-child { border-top: 0; padding-top: 0; }

/* Education / lists */
.edu, .plain, .awards { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.85rem; }
.edu li, .awards li { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 1rem; }
.plain .date { margin-left: 0.35rem; }
.edu li { grid-template-columns: 9rem minmax(0, 1fr); }
.edu .date, .awards .date { white-space: normal; }
@media (max-width: 520px) { .news li, .edu li, .awards li { grid-template-columns: 1fr; gap: 0.15rem; } }

/* Route bullets */
.line-dot { flex: none; display: inline-grid; place-items: center; width: 1.7rem; height: 1.7rem; border-radius: 50%; font: 800 0.85rem/1 var(--display); color: var(--bullet-ink); background: var(--line-c, var(--line-P)); vertical-align: middle; }
.line-E { --line-c: var(--line-E); }
.line-F { --line-c: var(--line-F); }
.line-I { --line-c: var(--line-I); }
.line-P { --line-c: var(--line-P); }

/* Research lines */
.lines { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.line-card { background: var(--surface); border: 1px solid var(--rule); border-top: 6px solid var(--line-c); border-radius: var(--radius); padding: 1.4rem; display: flex; flex-direction: column; gap: 1rem; }
.line-card header { display: flex; gap: 0.8rem; align-items: center; }
.line-card header .line-dot { width: 2.4rem; height: 2.4rem; font-size: 1.15rem; }
.line-card h3 { font-size: var(--step-1); }
.line-card header p { font: 400 var(--step--1)/1.3 var(--display); margin-top: 0.15rem; }
.line-card .mini-h { margin: 0.4rem 0 0; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chips li { font: 400 0.78rem/1 var(--mono); padding: 0.35rem 0.5rem; border-radius: 4px; background: var(--band); color: var(--ink); }
.stops { list-style: none; margin: 0; padding: 0 0 0 1.1rem; position: relative; display: grid; gap: 0.75rem; }
.stops::before { content: ""; position: absolute; left: 0.3rem; top: 0.45rem; bottom: 0.45rem; width: 4px; border-radius: 2px; background: var(--line-c); }
.stops li { position: relative; display: grid; gap: 0.1rem; font-size: 0.95rem; line-height: 1.35; }
.stops li::before { content: ""; position: absolute; left: -1.08rem; top: 0.25rem; width: 0.7rem; height: 0.7rem; border-radius: 50%; background: var(--surface); border: 2.5px solid var(--line-c); }
.stops li.is-active::before { background: var(--line-c); }
.stops b { font-family: var(--display); font-weight: 600; }
.stops .muted { font-size: var(--step--1); }
.line-link { margin-top: auto; font: 600 0.92rem/1.3 var(--display); color: var(--line-c); }
@media (max-width: 960px) { .lines { grid-template-columns: 1fr; } }

/* Publications */
.pubs { list-style: none; margin: 0; padding: 0; display: grid; }
.pub { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; padding: 1.1rem 0; border-top: 1px solid var(--rule); }
.pub:first-child { border-top: 0; }
.pub .line-dot { margin-top: 0.1rem; }
.pub-body { display: grid; gap: 0.3rem; }
.pub-title { font: 600 var(--step-0)/1.35 var(--display); }
.pub-meta { color: var(--muted); font-size: 0.95rem; }
.pub-meta b { color: var(--ink); }
.pub-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1rem; font: 400 0.85rem/1.4 var(--mono); }
.pub-links a { overflow-wrap: anywhere; }
.tag { font: 600 0.72rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.07em; padding: 0.3rem 0.45rem; border-radius: 4px; border: 1px solid var(--rule); color: var(--muted); }
.tag-published { border-color: var(--accent); color: var(--accent); }
.tag-note { border-color: var(--line-F); color: var(--line-F); }
.cite-btn, .copy-btn { font: 600 0.78rem/1 var(--display); padding: 0.35rem 0.6rem; border-radius: 5px; border: 1px solid var(--rule); background: var(--surface); color: var(--ink); cursor: pointer; }
.cite-btn:hover, .copy-btn:hover { border-color: var(--ink); }

/* Experience route */
.route { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); }
.route-line { list-style: none; margin: 0; padding: 1.6rem 1.2rem 1.1rem; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(6.4rem, 1fr); overflow-x: auto; position: relative; border-bottom: 1px solid var(--rule); scrollbar-width: thin; }
.route-line li { position: relative; display: flex; justify-content: center; }
.route-line li::before { content: ""; position: absolute; top: calc(1.4rem - 3px); left: 0; right: 0; height: 6px; background: var(--ink); }
.route-line li:first-child::before { left: 50%; }
.route-line li:last-child::before { right: 50%; }
.stop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.2rem; background: none; border: 0; padding: 0 0.3rem 0.2rem; cursor: pointer; color: var(--ink); font-family: var(--display); }
.stop-dot { width: 2.8rem; height: 2.8rem; border-radius: 50%; background: var(--surface); border: 4px solid var(--ink); display: grid; place-items: center; overflow: hidden; font: 800 0.72rem/1 var(--display); letter-spacing: 0.02em; color: var(--ink); margin-bottom: 0.25rem; transition: transform 0.15s; }
.stop-dot img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.stop-research .stop-dot { border-color: var(--line-E); }
.stop-industry .stop-dot { border-color: var(--line-F); }
.stop-teaching .stop-dot { border-color: var(--line-I); }
.stop-name { font-weight: 700; font-size: 0.92rem; line-height: 1.1; text-align: center; }
.stop-region { font-size: 0.74rem; line-height: 1.2; color: var(--muted); text-align: center; }
.stop-year { font: 400 0.75rem/1 var(--mono); color: var(--muted); margin-top: 0.15rem; }
.stop:hover .stop-dot { transform: scale(1.08); }
.stop[aria-selected="true"] .stop-dot { background: var(--ink); color: var(--bg); transform: scale(1.12); }
.stop[aria-selected="true"] .stop-name { color: var(--accent); }
.route-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; margin: 0; padding: 0.8rem 1.5rem 0; font: 400 0.8rem/1.2 var(--display); color: var(--muted); }
.route-legend span { display: inline-flex; align-items: center; gap: 0.4rem; }
.route-legend i { width: 0.8rem; height: 0.8rem; border-radius: 50%; border: 3px solid var(--line-c); }
.route-panel { padding: 1.5rem; display: grid; gap: 0.4rem; max-width: 52em; }
.route-panel h3 { font-size: var(--step-1); }
.route-panel .org { font-family: var(--display); color: var(--muted); }
.route-panel ul { margin: 0.5rem 0 0; padding-left: 1.2rem; display: grid; gap: 0.35rem; }
.split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 3rem; margin-top: 1rem; }
.skills { margin: 0; display: grid; gap: 0.7rem; }
.skills dt { font: 600 0.9rem/1.3 var(--display); }
.skills dd { margin: 0; color: var(--muted); font: 400 0.85rem/1.5 var(--mono); }
@media (max-width: 760px) { .split { grid-template-columns: 1fr; } }

/* Code */
.code-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.code-card { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.3rem; display: flex; flex-direction: column; gap: 0.6rem; min-width: 0; }
.code-card-wide { grid-column: span 3; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); column-gap: 2rem; align-items: start; }
.code-card-wide > * { grid-column: 1; }
.code-card-wide .install, .code-card-wide .code-links { grid-column: 2; }
.code-card-wide .install { grid-row: 2; }
.code-card-wide .code-links { grid-row: 3; }
.code-kind { display: flex; align-items: center; gap: 0.5rem; font: 600 0.75rem/1 var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.code-kind .line-dot { width: 1.4rem; height: 1.4rem; font-size: 0.72rem; }
.code-card h3 { font: 700 var(--step-1)/1.2 var(--mono); overflow-wrap: anywhere; }
.code-card p { font-size: 0.97rem; }
.code-links { display: flex; flex-wrap: wrap; gap: 0.4rem 1rem; margin-top: auto; font: 600 0.9rem/1.3 var(--display); }
.install { display: flex; align-items: center; gap: 0.5rem; background: var(--ink); color: var(--bg); border-radius: 8px; padding: 0.6rem 0.6rem 0.6rem 0.9rem; min-width: 0; }
.install code { font: 400 0.88rem/1.4 var(--mono); overflow-x: auto; white-space: nowrap; flex: 1; min-width: 0; }
.install code::before { content: "$ "; opacity: 0.6; }
.install .copy-btn { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 40%, transparent); }
@media (max-width: 960px) {
  .code-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .code-card-wide { grid-column: span 2; }
}
@media (max-width: 640px) {
  .code-grid { grid-template-columns: minmax(0, 1fr); }
  .code-card-wide { grid-column: auto; display: flex; align-items: stretch; }
}

/* Service */
.svc { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem; }
.svc .mini-h:first-child { margin-top: 0; }
.svc-feature { border-left: 6px solid var(--line-E); padding-left: 1.2rem; display: grid; gap: 0.6rem; align-content: start; }
.svc-feature .big { font: 800 4.2rem/0.9 var(--display); color: var(--line-E); font-variant-numeric: tabular-nums; }
.amt { font: 600 0.8rem/1 var(--mono); color: var(--accent); }
.awards li { grid-template-columns: 3.4rem minmax(0, 1fr); }
@media (max-width: 960px) { .svc { grid-template-columns: 1fr 1fr; } .svc-feature { grid-column: 1 / -1; } }
@media (max-width: 640px) { .svc { grid-template-columns: 1fr; } }

/* Gallery */
#gallery > .wrap { padding-bottom: 1.5rem; }
.gallery { list-style: none; margin: 0 auto; padding: 0 var(--gutter) clamp(3rem, 6vw, 5rem); display: grid; grid-auto-flow: column; grid-auto-columns: min(78vw, 340px); gap: 1rem; overflow-x: auto; scroll-snap-type: x mandatory; scroll-padding-inline: var(--gutter); max-width: calc(var(--wrap) + 2 * var(--gutter)); }
.gallery li { scroll-snap-align: start; display: grid; gap: 0.5rem; align-content: start; }
.gal-item { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: var(--radius); overflow: hidden; }
.gal-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform 0.3s; }
.gal-item:hover img { transform: scale(1.03); }
.gal-cap { font-size: 0.88rem; color: var(--muted); line-height: 1.4; }
.lightbox { border: 0; padding: 0; background: transparent; max-width: min(92vw, 1100px); color: #f2f5f4; }
.lightbox::backdrop { background: rgba(6, 12, 16, 0.86); }
.lightbox img { max-height: 80vh; width: auto; margin-inline: auto; border-radius: 8px; }
.lb-cap { margin-top: 0.7rem; text-align: center; font-family: var(--display); }
.lightbox form { text-align: right; margin-bottom: 0.5rem; }
.lb-close { font: 600 0.9rem/1 var(--display); background: #f2f5f4; color: #15232c; border: 0; border-radius: 6px; padding: 0.5rem 0.8rem; cursor: pointer; }

/* Contact */
.contact { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem; }
.contact > div { display: grid; gap: 1rem; align-content: start; }
.emails { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.emails li { display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; font: 600 1rem/1.3 var(--mono); }
.foot-links { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; font: 600 0.95rem/1.4 var(--display); }
.form { display: grid; gap: 0.4rem; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.4rem; }
.form label { font: 600 0.88rem/1.3 var(--display); margin-top: 0.4rem; }
.form input, .form textarea { font: inherit; font-size: 1rem; color: var(--ink); background: var(--bg); border: 1px solid var(--rule); border-radius: 6px; padding: 0.65rem 0.75rem; width: 100%; }
.form input:focus, .form textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.form .btn { justify-self: start; margin-top: 0.8rem; }
.form-status { font-family: var(--display); font-size: 0.92rem; color: var(--accent); min-height: 1.2em; }
@media (max-width: 760px) { .contact { grid-template-columns: 1fr; } }

/* Publications page */
.page-head { padding-bottom: 1.5rem !important; }
.page-head .lede { max-width: 42em; }
.filters { display: grid; gap: 0.9rem; padding-block: 0 1.5rem; position: sticky; top: calc(env(safe-area-inset-top, 0px) + 3.6rem); z-index: 5; background: var(--bg); }
@media (max-width: 760px) { .filters { position: static; } }
.filter-row { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.fchip { display: inline-flex; align-items: center; gap: 0.45rem; font: 600 0.9rem/1 var(--display); padding: 0.35rem 0.8rem 0.35rem 0.4rem; border-radius: 999px; border: 1.5px solid var(--rule); background: var(--surface); color: var(--ink); cursor: pointer; }
.fchip[data-line="all"] { padding-left: 0.8rem; }
.fchip .line-dot { width: 1.4rem; height: 1.4rem; font-size: 0.72rem; }
.fchip[aria-pressed="true"] { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.search { flex: 1 1 18rem; }
.search input { width: 100%; font: 400 1rem/1.2 var(--display); padding: 0.7rem 0.9rem; border-radius: 8px; border: 1.5px solid var(--rule); background: var(--surface); color: var(--ink); }
.count { font: 400 0.88rem/1 var(--mono); color: var(--muted); }
.pub-groups { padding-top: 0 !important; display: grid; gap: 2.5rem; }
.group-h { font-size: var(--step-1); display: flex; align-items: baseline; gap: 0.6rem; padding-bottom: 0.6rem; border-bottom: 2px solid var(--ink); }
.group-h .n { font: 400 0.9rem/1 var(--mono); color: var(--muted); }
.empty { color: var(--muted); font-family: var(--display); }

/* Footer */
.foot { border-top: 1px solid var(--rule); }
.foot-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.8rem 2rem; padding-block: 2rem; font: 400 0.9rem/1.4 var(--display); }

/* Thematic hero image: a faded photo behind the page opener, never behind reading text. */
.hero-band { position: relative; isolation: isolate; overflow: hidden; border-bottom: 1px solid var(--rule); }
.hero-bg { position: absolute; inset: 0; z-index: -2; background-position: center 60%; background-size: cover; background-repeat: no-repeat; filter: grayscale(var(--hero-gray)); }
.hero-canvas { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; display: block; }
.hero-bg-podium { background-position: 80% 18%; }
.hero-band::after { content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, var(--bg) 0%, color-mix(in srgb, var(--bg) calc(var(--hero-fade) * 100%), transparent) 55%, color-mix(in srgb, var(--bg) 55%, transparent) 100%),
              linear-gradient(0deg, var(--bg) 0%, transparent 35%); }
.hero-band-net::after { background: linear-gradient(90deg, var(--bg) 0%, var(--bg) 42%, color-mix(in srgb, var(--bg) 35%, transparent) 60%, transparent 100%); }
@media (max-width: 720px) { .hero-band::after { background: color-mix(in srgb, var(--bg) 86%, transparent); } }
.hero .stats { background: color-mix(in srgb, var(--bg) 70%, transparent); }

/* Grants */
.grants { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.grant-feature { background: var(--surface); border: 1px solid var(--rule); border-top: 6px solid var(--line-c); border-radius: var(--radius); padding: 1.5rem; display: grid; gap: 0.7rem; }
.grant-role { display: flex; align-items: center; gap: 0.55rem; font: 700 var(--step--1)/1.2 var(--display); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.grant-amt { font: 800 var(--step-3)/1 var(--display); color: var(--line-c); font-variant-numeric: tabular-nums; }
.grant-feature h3 { font-size: var(--step-1); }
.grant-meta { margin: 0; display: grid; gap: 0.5rem; }
.grant-meta div { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 0.8rem; }
.grant-meta dt { font: 600 0.85rem/1.5 var(--display); color: var(--muted); }
.grant-meta dd { margin: 0; font-size: 0.95rem; }
.grant-side .mini-h:first-child { margin-top: 0; }
.grant-list li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.8rem; }
@media (max-width: 860px) { .grants { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 520px) { .grant-meta div { grid-template-columns: 1fr; gap: 0; } }

/* Citations chart */
.sel-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; }
@media (max-width: 960px) { .sel-grid { grid-template-columns: minmax(0, 1fr); } }
.cites { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 1.3rem; display: grid; gap: 0.9rem; min-width: 0; }
.cites-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.8rem 1.5rem; }
.cites-title { font-size: var(--step-1); }
.cites-src { font-size: 0.85rem; margin-top: 0.2rem; }
.cites-stats { display: flex; gap: 1.4rem; margin: 0; }
.cites-stats div { display: flex; flex-direction: column-reverse; }
.cites-stats dt { font: 400 0.8rem/1.2 var(--display); color: var(--muted); }
.cites-stats dd { margin: 0; font: 800 1.9rem/1 var(--display); font-variant-numeric: tabular-nums; }
.cites-plot svg { display: block; width: 100%; height: auto; overflow: visible; }
.cites-plot .base { stroke: var(--rule); stroke-width: 1; }
.cites-plot .guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; }
.cites-plot .axis { fill: var(--muted); font: 400 11px var(--mono); font-variant-numeric: tabular-nums; }
.cites-plot .area { fill: color-mix(in srgb, var(--accent) 16%, transparent); }
.cites-plot .ln { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
.cites-plot .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; transition: r 0.12s; }
.cites-plot .dot.on { r: 6.5; }
.cites-plot .val { fill: var(--ink); font: 600 12px var(--display); font-variant-numeric: tabular-nums; }
.cites-plot .hit { fill: transparent; cursor: pointer; }
.cites-plot .hit:focus { outline: none; }
.cites-tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font: 600 0.85rem/1.3 var(--display); padding: 0.45rem 0.6rem; border-radius: 6px; transform: translate(-50%, -100%); white-space: nowrap; z-index: 2; }
.cites-tip span { display: block; font-weight: 400; opacity: 0.8; font-size: 0.78rem; }
.cites-table summary { font: 600 0.85rem/1.3 var(--display); color: var(--accent); cursor: pointer; }
.cites-table table { margin-top: 0.6rem; border-collapse: collapse; font: 400 0.88rem/1.4 var(--mono); font-variant-numeric: tabular-nums; }
.cites-table th, .cites-table td { text-align: right; padding: 0.25rem 1rem 0.25rem 0; border-bottom: 1px solid var(--rule); }
.cites-table th:first-child, .cites-table td:first-child { text-align: left; }
.pub-cites { padding-block: 0 2.5rem !important; }
.pub-cites .cites { max-width: 680px; }
