/* ============================================================
   Faculty profile — Department of Mathematics
   Tokens → base → layout → components → responsive
   ============================================================ */

:root {
  --ink:        #14213d;
  --ink-soft:   #46536e;
  --muted:      #6b7793;
  --line:       #e3e0d9;
  --line-soft:  #efece5;
  --bg:         #faf8f4;
  --surface:    #ffffff;
  --surface-2:  #f4f1ea;
  --accent:     #c4581f;
  --accent-ink: #9c4416;
  --accent-wash:#fbeee5;
  --navy:       #14213d;
  --navy-2:     #1d2d52;

  --radius:     14px;
  --radius-sm:  8px;
  --shadow-sm:  0 1px 2px rgba(20,33,61,.06), 0 2px 8px rgba(20,33,61,.05);
  --shadow-md:  0 4px 12px rgba(20,33,61,.08), 0 14px 34px rgba(20,33,61,.08);

  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --wrap:   1180px;
  --gutter: clamp(1.1rem, 4vw, 2.5rem);
  --ease:   cubic-bezier(.22, .61, .36, 1);
}

html[data-theme="dark"] {
  --ink:        #eef1f7;
  --ink-soft:   #c3cadb;
  --muted:      #8e98b0;
  --line:       #2a3350;
  --line-soft:  #232b45;
  --bg:         #0e1526;
  --surface:    #151d33;
  --surface-2:  #1a2440;
  --accent:     #f08a4b;
  --accent-ink: #ffa96f;
  --accent-wash:#26243a;
  --navy:       #0a1020;
  --navy-2:     #151d33;
  --shadow-sm:  0 1px 2px rgba(0,0,0,.4);
  --shadow-md:  0 10px 34px rgba(0,0,0,.45);
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}

img, svg { max-width: 100%; display: block; }

a { color: var(--accent-ink); text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }

h1, h2, h3 { font-family: var(--serif); font-weight: 500; line-height: 1.2; margin: 0; letter-spacing: -.01em; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 1rem; top: -3rem; z-index: 100;
  background: var(--accent); color: #fff; padding: .6rem 1rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm); text-decoration: none;
  transition: top .2s var(--ease);
}
.skip-link:focus { top: 0; color: #fff; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

/* ---------- Utility bar ---------- */
.utility {
  background: var(--navy);
  color: rgba(255,255,255,.78);
  font-size: .8rem;
  letter-spacing: .02em;
}
.utility__inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 40px; }
.utility__tag { font-weight: 500; letter-spacing: .12em; text-transform: uppercase; font-size: .7rem; color: rgba(255,255,255,.62); }

.theme-toggle {
  margin-left: .4rem; display: grid; place-items: center;
  width: 30px; height: 30px; padding: 0;
  background: rgba(255,255,255,.1); border: 0; border-radius: 999px;
  color: #fff; cursor: pointer;
  transition: background-color .2s var(--ease), transform .2s var(--ease);
}
.theme-toggle:hover { background: rgba(255,255,255,.22); transform: rotate(-15deg); }
.theme-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.icon-moon, html[data-theme="dark"] .icon-sun { display: none; }
html[data-theme="dark"] .icon-moon { display: block; }

/* ---------- Masthead ---------- */
.masthead {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  transition: box-shadow .25s var(--ease), background-color .3s var(--ease);
}
.masthead.is-stuck { box-shadow: var(--shadow-sm); }
.masthead__inner { display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; min-height: 74px; }

.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); }
.brand__mark {
  width: auto; height: 46px; flex: none;
  object-fit: contain;
}
/* The emblem is navy line art over opaque white fills, so any brightness()
   filter flattens both to one tone and erases the detail. Give it a light
   chip in dark mode instead and let it keep its real colours. */
html[data-theme="dark"] .brand__mark {
  box-sizing: content-box;
  background: #f2efe8;
  padding: 4px 6px;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35);
}
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__text strong { font-family: var(--serif); font-size: 1.32rem; font-weight: 600; letter-spacing: -.015em; }
.brand__text small { font-size: .68rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(60rem 22rem at 15% -30%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    linear-gradient(180deg, var(--surface), var(--bg));
  border-bottom: 1px solid var(--line);
}
/* Watermark: Srinivasa Ramanujan, 1913 passport photograph (public domain,
   via Wikimedia Commons). Faded and masked so it never fights the text. */
.hero::after {
  content: ""; position: absolute; right: 0; top: 0; bottom: 0;
  width: min(44%, 480px);
  background: url("assets/ramanujan.jpg") no-repeat 50% 18% / cover;
  filter: grayscale(1) contrast(1.08);
  opacity: .16;
  -webkit-mask-image: linear-gradient(to left, #000 18%, transparent 96%);
          mask-image: linear-gradient(to left, #000 18%, transparent 96%);
  pointer-events: none;
}
html[data-theme="dark"] .hero::after { opacity: .1; filter: grayscale(1) contrast(1.2) brightness(1.15); }
@media (max-width: 620px) { .hero::after { width: 62%; opacity: .1; } }
.hero__inner { padding: clamp(2.5rem, 6vw, 4.5rem) var(--gutter) clamp(2rem, 4vw, 3rem); position: relative; z-index: 1; }
.hero__eyebrow {
  margin: 0 0 .9rem; font-size: .72rem; font-weight: 600;
  letter-spacing: .16em; text-transform: uppercase; color: var(--accent);
}
.hero__name { font-size: clamp(2.4rem, 6vw, 4rem); font-weight: 500; }
.hero__title { margin: .5rem 0 0; font-size: clamp(1rem, 2vw, 1.2rem); color: var(--muted); font-style: italic; font-family: var(--serif); }

.tags { display: flex; flex-wrap: wrap; gap: .5rem; list-style: none; margin: 1.4rem 0 0; padding: 0; }
.tags a {
  display: inline-block; text-decoration: none;
  font-size: .8rem; font-weight: 500; letter-spacing: .01em;
  padding: .38rem .85rem; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-soft);
  transition: transform .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), background-color .2s var(--ease);
}
.tags a:hover { transform: translateY(-2px); border-color: var(--accent); color: var(--accent-ink); background: var(--accent-wash); }

/* ---------- Layout ---------- */
.layout {
  display: grid;
  grid-template-columns: 310px minmax(0, 1fr);
  gap: clamp(2rem, 4vw, 3.5rem);
  padding-block: clamp(2.2rem, 5vw, 3.6rem) clamp(3rem, 7vw, 5rem);
  align-items: start;
}

/* ---------- Sidebar ---------- */
.sidebar { position: sticky; top: 96px; display: grid; gap: 1.25rem; }

.portrait {
  margin: 0; overflow: hidden;
  border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm); background: var(--surface-2);
}
.portrait img, .portrait svg { width: 100%; height: auto; aspect-ratio: 7 / 8; object-fit: cover; object-position: 50% 20%; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.35rem 1.4rem; box-shadow: var(--shadow-sm);
}
.card__head {
  font-family: var(--sans); font-size: .7rem; font-weight: 700;
  letter-spacing: .15em; text-transform: uppercase; color: var(--muted);
  padding-bottom: .7rem; margin-bottom: .9rem; border-bottom: 1px solid var(--line-soft);
}

.contact { margin: 0; display: grid; gap: .1rem; font-size: .92rem; }
.contact dt {
  font-size: .68rem; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted); margin-top: .85rem;
}
.contact dt:first-of-type { margin-top: 0; }
.contact dd { margin: .15rem 0 0; color: var(--ink-soft); overflow-wrap: anywhere; }
.contact a { text-decoration: none; }
.contact a:hover { text-decoration: underline; }
.contact__email { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.copy {
  font: inherit; font-size: .68rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase;
  padding: .2rem .5rem; cursor: pointer; color: var(--muted);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
  transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease);
}
.copy:hover { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-wash); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  margin-top: 1.3rem; width: 100%;
  font-size: .88rem; font-weight: 600; letter-spacing: .01em;
  padding: .72rem 1.1rem; border-radius: var(--radius-sm); text-decoration: none;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease);
}
.btn--solid { background: var(--navy); color: #fff; }
.btn--solid:hover { background: var(--navy-2); color: #fff; transform: translateY(-2px); box-shadow: var(--shadow-md); }
html[data-theme="dark"] .btn--solid { background: var(--accent); color: #14213d; }

.btn--outline { background: transparent; color: var(--navy); box-shadow: inset 0 0 0 1px var(--line); margin-top: .6rem; }
.btn--outline:hover { color: var(--accent-ink); box-shadow: inset 0 0 0 1px var(--accent-ink); transform: translateY(-2px); }
html[data-theme="dark"] .btn--outline { color: var(--ink); }
html[data-theme="dark"] .btn--outline:hover { color: var(--accent); }

.linklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; font-size: .9rem; }
.linklist a {
  display: block; padding: .4rem 0 .4rem .95rem; position: relative;
  color: var(--ink-soft); text-decoration: none;
  transition: color .18s var(--ease), padding-left .18s var(--ease);
}
.linklist a::before {
  content: "→"; position: absolute; left: 0; color: var(--accent);
  opacity: .5; transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.linklist a:hover { color: var(--accent-ink); padding-left: 1.25rem; }
.linklist a:hover::before { opacity: 1; transform: translateX(2px); }

/* ---------- Tabs ---------- */
.tabs__bar {
  display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--line); margin-bottom: 2rem;
}
.tabs__bar::-webkit-scrollbar { display: none; }
.tabs__bar button {
  font: inherit; font-size: .93rem; font-weight: 500; white-space: nowrap;
  background: none; border: 0; cursor: pointer; color: var(--muted);
  padding: .8rem 1.05rem; margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.tabs__bar button:hover { color: var(--ink); }
.tabs__bar button[aria-selected="true"] { color: var(--accent-ink); border-bottom-color: var(--accent); }

[role="tabpanel"] { animation: fade .45s var(--ease) both; }
[role="tabpanel"]:focus { outline: none; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Prose ---------- */
.content p { margin: 0 0 1.15rem; color: var(--ink-soft); max-width: 68ch; }
.lede {
  font-family: var(--serif); font-size: clamp(1.12rem, 2vw, 1.3rem);
  line-height: 1.55; color: var(--ink) !important; margin-bottom: 1.5rem !important;
}
.content h3 {
  font-size: 1.4rem; margin: 2.4rem 0 1.1rem;
  padding-bottom: .55rem; border-bottom: 1px solid var(--line-soft);
}



/* ---------- Publications ---------- */
.pubs { list-style: none; margin: 0; padding: 0; counter-reset: pub; display: grid; gap: .4rem; }
.pubs li {
  counter-increment: pub; position: relative;
  padding: 1.1rem 1.2rem 1.1rem 3.2rem;
  border: 1px solid transparent; border-radius: var(--radius);
  transition: border-color .22s var(--ease), background-color .22s var(--ease), transform .22s var(--ease);
}
.pubs li::before {
  content: counter(pub, decimal-leading-zero);
  position: absolute; left: 1.1rem; top: 1.15rem;
  font-family: var(--serif); font-size: .95rem; color: var(--accent); opacity: .65;
}
.pubs li:hover { border-color: var(--line); background: var(--surface); transform: translateX(3px); }
.pubs__title { margin: 0 !important; font-weight: 600; color: var(--ink) !important; }
.pubs__meta { margin: .25rem 0 .5rem !important; font-size: .87rem; color: var(--muted) !important; }

/* ---------- Footer ---------- */
.site-footer {
  max-width: var(--wrap); margin: 0 auto; padding: 2.4rem var(--gutter) 3rem;
  text-align: center; display: grid; gap: .4rem;
  border-top: 1px solid var(--line-soft);
}
.site-footer__note { margin: 0; font-size: .82rem; color: var(--muted); }
.site-footer__visits {
  margin: 0; display: inline-flex; align-items: center; justify-self: center;
}
.site-footer__visits img { display: block; height: 20px; width: auto; border-radius: 4px; }

/* ---------- Back to top + toast ---------- */
.totop {
  position: fixed; right: 1.4rem; bottom: 1.4rem; z-index: 60;
  width: 44px; height: 44px; display: grid; place-items: center;
  font-size: 1.1rem; cursor: pointer;
  background: var(--navy); color: #fff; border: 0; border-radius: 50%;
  box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s, background-color .2s var(--ease);
}
.totop.is-visible { opacity: 1; visibility: visible; transform: none; }
.totop:hover { background: var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: 1.8rem; z-index: 70;
  transform: translate(-50%, 1.2rem);
  padding: .65rem 1.15rem; border-radius: 999px;
  background: var(--navy); color: #fff; font-size: .85rem; box-shadow: var(--shadow-md);
  opacity: 0; visibility: hidden;
  transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
}
.toast.is-visible { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------- Reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.is-in { opacity: 1; transform: none; }

/* ---------- Sidebar metrics ---------- */
.metrics { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.metrics li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline;
  gap: .4rem; padding: .6rem 0; border-bottom: 1px solid var(--line-soft);
}
.metrics li:last-child { border-bottom: 0; }
.metrics__label { font-size: .82rem; color: var(--ink-soft); }
.metrics__all {
  font-family: var(--serif); font-size: 1.6rem; line-height: 1;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.metrics__recent { grid-column: 1 / -1; font-size: .72rem; color: var(--muted); }
.card__note { margin: .9rem 0 0; font-size: .72rem; color: var(--muted); }

.pill {
  display: inline-block; margin-left: .35rem; padding: .05rem .42rem;
  font-size: .68rem; font-weight: 600; font-variant-numeric: tabular-nums;
  color: var(--muted); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 999px;
}

/* ---------- At a glance ---------- */
.stats {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .8rem;
}
.stats li {
  display: flex; flex-direction: column; gap: .15rem;
  padding: 1.1rem 1.15rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease);
}
.stats li:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.stats strong {
  font-family: var(--serif); font-size: 2.1rem; font-weight: 500; line-height: 1;
  color: var(--accent); font-variant-numeric: tabular-nums;
}
.stats span { font-size: .78rem; color: var(--muted); line-height: 1.35; }

/* ---------- Year chart ---------- */
.chart { margin: 0; }
.chart__plot {
  display: flex; align-items: stretch; gap: 0;
  height: 190px; padding: 1rem 1rem .35rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow-x: auto;
}

/* Grid rows give the track a definite height, so the bar's percentage
   height resolves against the plot area alone and not the axis label. */
.chart__col {
  flex: 1 1 0; min-width: 18px; height: 100%;
  display: grid; grid-template-rows: 1fr auto;
}
.chart__track {
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  min-height: 0;
  border-bottom: 1px solid color-mix(in srgb, var(--muted) 45%, var(--line));
}
.chart__n {
  flex: none;
  font-size: .62rem; font-weight: 600; line-height: 1;
  color: var(--muted); margin-bottom: 3px;
  font-variant-numeric: tabular-nums;
  transition: color .2s var(--ease);
}
.chart__bar {
  flex: none;
  width: calc(100% - 3px); border-radius: 4px 4px 0 0;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 55%, transparent));
  transition: filter .2s var(--ease);
}
.chart__bar.is-empty { height: 3px; background: var(--line); }
.chart__col:hover .chart__bar { filter: brightness(1.14); }
.chart__col:hover .chart__n { color: var(--accent-ink); }
.chart__label {
  margin-top: .4rem; font-size: .64rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
  height: 1rem; line-height: 1rem;
  text-align: center; white-space: nowrap; overflow: visible;
}

/* ---------- Themes ---------- */
.hint { font-size: .84rem; color: var(--muted) !important; margin-bottom: 1rem !important; }
.themes { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .5rem; }
.themes button, .chip {
  font: inherit; font-size: .85rem; font-weight: 500; cursor: pointer;
  padding: .5rem .9rem; border-radius: 999px;
  color: var(--ink-soft); background: var(--surface); border: 1px solid var(--line);
  transition: transform .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease), background-color .2s var(--ease);
}
.themes button:hover, .chip:hover {
  transform: translateY(-2px); border-color: var(--accent);
  color: var(--accent-ink); background: var(--accent-wash);
}

/* Avatar — photo when a file exists, generated monogram otherwise */
.avatar {
  position: relative; flex: none; width: 46px; height: 46px;
  display: grid; place-items: center; overflow: hidden;
  border-radius: 50%; background: hsl(var(--h) 38% 90%);
  box-shadow: inset 0 0 0 1px hsl(var(--h) 30% 78%);
}
.avatar__mono {
  font-family: var(--serif); font-size: 1.02rem; font-weight: 500;
  letter-spacing: .02em; color: hsl(var(--h) 42% 34%);
}
.avatar img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 25%;
}
html[data-theme="dark"] .avatar { background: hsl(var(--h) 26% 26%); box-shadow: inset 0 0 0 1px hsl(var(--h) 22% 38%); }
html[data-theme="dark"] .avatar__mono { color: hsl(var(--h) 48% 78%); }

/* ---------- Education ---------- */
.edu { list-style: none; margin: 0 0 2rem; padding: 0; display: grid; gap: 0; }
.edu li {
  display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 1rem;
  padding: .95rem 0; border-bottom: 1px solid var(--line-soft);
}
.edu li:last-child { border-bottom: 0; }
.edu__year {
  font-family: var(--serif); font-size: 1.15rem; font-weight: 500;
  color: var(--accent-ink); line-height: 1.3;
}
.edu__body { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.edu__body strong { font-size: .96rem; color: var(--ink); font-weight: 600; }
.edu__place { font-size: .85rem; color: var(--ink-soft); }
.edu__detail { font-size: .82rem; color: var(--muted); }

/* ---------- Research Guide ---------- */
.guide {
  display: flex; align-items: flex-start; gap: 1.1rem; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.25rem 1.35rem; margin-bottom: 2rem;
}
.guide__body { display: flex; flex-direction: column; gap: .2rem; min-width: 220px; flex: 1 1 260px; }
.guide__name { font-family: var(--serif); font-size: 1.08rem; font-weight: 500; color: var(--ink); }
.guide__name a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); transition: color .15s var(--ease), border-color .15s var(--ease); }
.guide__name a:hover { color: var(--accent-ink); border-color: var(--accent-ink); }
.guide__name a span { font-size: .8em; opacity: .7; }
.guide__role { font-size: .78rem; color: var(--muted); }
.guide__bio { margin: .55rem 0 0 !important; font-size: .9rem !important; color: var(--ink-soft) !important; max-width: none !important; }

.avatar--lg { width: 68px; height: 68px; flex: none; }
.avatar--lg .avatar__mono { font-size: 1.4rem; }

/* ---------- Students ---------- */
.students {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.2rem;
  align-items: start;
}
.students__col h3 { margin-bottom: .3rem; }
.students__col .hint { margin-bottom: .9rem !important; }
.students__list { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; counter-reset: stu; }
.students__list li {
  display: flex; align-items: flex-start; justify-content: space-between; gap: .8rem;
  padding: .75rem .2rem; border-bottom: 1px solid var(--line-soft);
  counter-increment: stu;
}
.students__list li::before {
  content: counter(stu) ".";
  color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums;
  margin-right: .55rem; margin-top: .2rem; flex: none;
}
.students__list li:last-child { border-bottom: 0; }
.students__main { display: flex; flex-direction: column; gap: .18rem; flex: 1 1 auto; min-width: 0; }
.students__name { font-size: .92rem; color: var(--ink); font-weight: 500; }
.students__role { font-size: .78rem; color: var(--muted); line-height: 1.4; }
.students__list li .badge { flex: none; margin-top: .15rem; }
.students__list--present li::before { content: "→"; color: var(--accent); font-size: .85rem; margin-top: .15rem; }

/* ---------- Gallery ---------- */
.gallery {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 1rem;
}
.gallery li { display: flex; flex-direction: column; gap: .5rem; }
.gallery__thumb {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 3;
  border-radius: var(--radius); overflow: hidden;
  background: linear-gradient(155deg, hsl(var(--h) 45% 92%), hsl(var(--h) 35% 82%));
  box-shadow: inset 0 0 0 1px hsl(var(--h) 30% 78%);
}
html[data-theme="dark"] .gallery__thumb {
  background: linear-gradient(155deg, hsl(var(--h) 26% 24%), hsl(var(--h) 22% 16%));
  box-shadow: inset 0 0 0 1px hsl(var(--h) 22% 38%);
}
.gallery__thumb.is-placeholder::after {
  content: "◇"; position: absolute; inset: 0; display: grid; place-items: center;
  font-size: 1.8rem; color: hsl(var(--h) 42% 40%); opacity: .55;
}
html[data-theme="dark"] .gallery__thumb.is-placeholder::after { color: hsl(var(--h) 48% 78%); }
.gallery__thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
}
.gallery__cap { font-size: .82rem; color: var(--ink-soft); display: flex; flex-direction: column; gap: .15rem; }

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .85em; color: var(--accent-ink);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 4px; padding: .05rem .35rem;
}

/* ---------- Filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: 1.1rem; }
.field { flex: 1 1 260px; }
.field--sm { flex: 0 0 auto; }
.filters input, .filters select {
  font: inherit; font-size: .9rem; width: 100%;
  padding: .68rem .95rem; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.filters input:focus, .filters select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.filters select { cursor: pointer; }
.chip--clear { flex: 0 0 auto; }

.result-count {
  font-size: .8rem; letter-spacing: .02em; color: var(--muted) !important;
  padding-bottom: .8rem; margin-bottom: .8rem !important; border-bottom: 1px solid var(--line-soft);
}
.empty { font-style: italic; color: var(--muted) !important; padding: 2rem 0; }

/* ---------- Publication badges ---------- */
.pubs__badges { margin: .45rem 0 0 !important; display: flex; gap: .4rem; }
.badge {
  font-size: .7rem; font-weight: 600; letter-spacing: .03em; font-variant-numeric: tabular-nums;
  padding: .18rem .55rem; border-radius: 999px;
  color: var(--muted); background: var(--surface-2); border: 1px solid var(--line);
}
.badge--cite { color: var(--accent-ink); background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.pubs__meta strong { color: var(--ink); font-weight: 600; }

/* ---------- Linked publications ---------- */
.pubs__title a {
  color: var(--ink); text-decoration: none;
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0% 1px; background-position: 0 100%; background-repeat: no-repeat;
  transition: background-size .28s var(--ease), color .2s var(--ease);
}
.pubs__title a:hover, .pubs__title a:focus-visible { color: var(--accent-ink); background-size: 100% 1px; }
.pubs__ext {
  display: inline-block; margin-left: .35rem; font-size: .78em;
  color: var(--accent); opacity: 0; transform: translate(-3px, 2px);
  transition: opacity .2s var(--ease), transform .2s var(--ease);
}
.pubs li:hover .pubs__ext, .pubs__title a:focus-visible .pubs__ext { opacity: 1; transform: none; }

a.badge--cite { text-decoration: none; }
a.badge--cite:hover {
  color: #fff; background: var(--accent); border-color: var(--accent);
}
html[data-theme="dark"] a.badge--cite:hover { color: #14213d; }


/* ---------- Live sync status ---------- */
.sync {
  display: flex; align-items: center; flex-wrap: wrap; gap: .5rem;
  font-size: .8rem; color: var(--muted) !important;
  margin: 0 0 1.2rem !important; padding: .6rem .9rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--line);
}
.sync:empty { display: none; }
.sync strong { color: var(--accent-ink); }
.sync--new { background: var(--accent-wash); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.sync--off { opacity: .8; }
.sync__btn {
  font: inherit; font-size: .72rem; font-weight: 600; cursor: pointer;
  margin-left: auto; padding: .25rem .7rem; border-radius: 999px;
  color: var(--ink-soft); background: var(--surface);
  border: 1px solid var(--line);
  transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease);
}
.sync__btn:hover { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-wash); }
.sync__dot {
  width: 7px; height: 7px; flex: none; border-radius: 50%;
  background: var(--accent); animation: pulse 1.1s var(--ease) infinite;
}
@keyframes pulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.1); } }

/* Papers that arrived from the live feed, not the baked snapshot */
.badge--new {
  color: #fff; background: var(--accent); border-color: var(--accent);
  text-transform: uppercase; letter-spacing: .08em; font-size: .62rem;
}
html[data-theme="dark"] .badge--new { color: #14213d; }
.pubs li.is-new { border-color: color-mix(in srgb, var(--accent) 30%, transparent); background: var(--surface); }

/* ---------- Responsive ----------
   Grids that can collapse use minmax(min(Xpx, 100%), 1fr) so a track can
   never be wider than the screen — that is what causes sideways scroll on
   small phones. Anything that must stay wide (tab bar, year chart) scrolls
   inside its own box instead of pushing the page. */

/* Sidebar leaves the left rail and becomes a row of cards */
@media (max-width: 960px) {
  .layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }
  .sidebar {
    position: static;
    grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
    align-items: start;
  }
  .portrait { max-width: 300px; }
}

/* Tablet and large phone */
@media (max-width: 700px) {
  .masthead__inner { min-height: 64px; }
  .brand__mark { height: 38px; }
  .brand__text strong { font-size: 1.15rem; }
  .brand__text small { font-size: .62rem; }

  .hero__inner { padding-block: 2.2rem 1.8rem; }

  /* On phone, the sidebar's own box is dropped (display: contents) so its
     cards can be individually reordered alongside the tabs/content block,
     rather than moving as one fixed unit. Order: portrait photo, then
     contact info, then the section nav + its content (unchanged, still
     sticky below the masthead), then citation metrics and frequent
     venues at the end. */
  .sidebar { display: contents; }
  .portrait { order: 1; max-width: 240px; margin-inline: auto; }
  .card--contact { order: 2; }
  .content { order: 3; }
  .card--metrics { order: 4; }
  .card--venues { order: 5; }

  .tabs__bar {
    position: sticky; top: 65px; z-index: 20;
    background: var(--bg); margin-inline: calc(var(--gutter) * -1); padding-inline: var(--gutter);
  }

  .tabs__bar { margin-bottom: 1.5rem; }
  .tabs__bar button { padding: .7rem .8rem; font-size: .88rem; }

  .content h3 { font-size: 1.25rem; margin-top: 2rem; }

  .stats { grid-template-columns: repeat(auto-fit, minmax(min(140px, 100%), 1fr)); gap: .6rem; }
  .stats li { padding: .9rem 1rem; }
  .stats strong { font-size: 1.75rem; }


  .students { grid-template-columns: minmax(0, 1fr); gap: 1.6rem; }
  .edu li { grid-template-columns: 64px 1fr; }
  .guide { padding: 1.1rem; }

  .chart__plot { height: 160px; padding: .9rem .8rem .3rem; }
  .chart__col { min-width: 15px; }

  .pubs li { padding: 1rem 1rem 1rem 2.7rem; }
  .pubs li::before { left: .8rem; }
}

/* Phone */
@media (max-width: 520px) {
  .utility__tag { font-size: .62rem; letter-spacing: .1em; }

  .brand { gap: .6rem; }
  .brand__mark { height: 34px; }
  .brand__text small { line-height: 1.3; }

  .hero__name { letter-spacing: -.02em; }
  .tags { gap: .4rem; }
  .tags a { font-size: .74rem; padding: .32rem .7rem; }

  .card { padding: 1.1rem 1.15rem; }
  .stats { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }

  /* Search and sort each take a full row rather than squeezing side by side */
  .filters { gap: .5rem; }
  .field, .field--sm { flex: 1 1 100%; }
  .filters select { width: 100%; }
  .chip--clear { width: 100%; }

  .sync { font-size: .75rem; padding: .55rem .75rem; }
  .sync__btn { margin-left: 0; }

  /* 29 columns must fit a phone without the chart needing its own
     sideways scroll: 29 x 9px = 261px inside ~325px of content. */
  .chart__plot { height: 140px; padding: .8rem .6rem .3rem; }
  .chart__col { min-width: 9px; }
  .chart__n { font-size: .58rem; }
  .chart__label { font-size: .6rem; }

  .avatar { width: 40px; height: 40px; }
  .avatar--lg { width: 56px; height: 56px; }
  .totop { right: 1rem; bottom: 1rem; width: 40px; height: 40px; }

  .edu li { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  .edu__year { font-size: 1rem; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); }
}

/* Long unbroken strings — DOIs, journal names — must wrap, not overflow */
.pubs__title, .pubs__meta, .lede, .content p, .metrics__label {
  overflow-wrap: break-word;
}

@media (prefers-reduced-motion: reduce) {

  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  .reveal { opacity: 1; transform: none; }
}

@media print {
  .utility, .masthead, .totop, .toast, .tabs__bar, .sync { display: none !important; }
  [role="tabpanel"][hidden] { display: block !important; }
  body { background: #fff; }
}
