/* ===========================================================
   Ling-Wei Chen — stylesheet
   Colours and fonts are defined once here. Change a value to
   restyle the whole site. Dark-mode values follow below.
   =========================================================== */

:root {
  --paper: #f0f0ee;
  --surface: #fafaf8;
  --ink: #1d1e21;
  --muted: #5b5f66;
  --rule: #d3d5d6;
  --night: #33388a;        /* links, clock hand, night band */
  --night-soft: #dfe0f0;
  --day: #a96d0b;          /* daylight band, small markers */
  --day-soft: #f1e2c2;
  --j1: #33388a;           /* career journey: one colour per country */
  --j2: #3f7d6b;
  --j3: #b9790f;
  --j4: #8a3f5f;

  --sans: "Jost", "Noto Sans TC", "Futura", "Avenir Next", system-ui, sans-serif;
  --serif: "Newsreader", "Noto Serif TC", Georgia, "Times New Roman", serif;

  --wrap: 72rem;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --space: clamp(3rem, 7vw, 5.5rem);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15161a;
    --surface: #1c1d23;
    --ink: #e8e8ea;
    --muted: #a0a3aa;
    --rule: #2e3037;
    --night: #a9adf4;
    --night-soft: #272a4c;
    --day: #e4ad4d;
    --day-soft: #3a3121;
    --j1: #a9adf4;
    --j2: #7cc2ad;
    --j3: #e4ad4d;
    --j4: #e08fb1;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a {
  color: var(--night);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { text-decoration-thickness: 2px; }

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

h1, h2, h3 { margin: 0; font-family: var(--sans); font-weight: 300; }

h1 {
  font-size: clamp(2.2rem, 5vw, 3.6rem);
  line-height: 1.1;
  letter-spacing: -0.01em;
}
h2 { font-size: clamp(1.45rem, 2.4vw, 1.8rem); line-height: 1.25; }
h3 { font-size: 1.1rem; font-weight: 500; line-height: 1.35; }

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--muted); }
.ui { font-family: var(--sans); }

.skip-link {
  position: absolute; left: -999px; top: 0.5rem;
  background: var(--surface); padding: 0.5rem 1rem; z-index: 100;
  font-family: var(--sans);
}
.skip-link:focus { left: 0.5rem; }

/* ---------- Header: centred name, hairline, menu ---------- */

.site-header { font-family: var(--sans); }

.masthead {
  text-align: center;
  padding-block: clamp(1.75rem, 4vw, 2.75rem) clamp(1.1rem, 2.5vw, 1.6rem);
  border-bottom: 1px solid var(--ink);
}
.wordmark { color: var(--ink); text-decoration: none; display: inline-block; }
.wordmark-name {
  display: block;
  font-weight: 300;
  font-size: clamp(2rem, 6vw, 3.9rem);
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.wordmark-sub {
  display: block;
  margin-top: 0.7rem;
  font-size: clamp(0.95rem, 1.6vw, 1.15rem);
  color: var(--ink);
  letter-spacing: 0.01em;
}
.home .wordmark-name { font-size: clamp(2.3rem, 7.5vw, 4.8rem); }

.menu-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  padding-block: 1.1rem;
}
.menu-email { color: var(--ink); text-decoration: none; font-size: 0.98rem; white-space: nowrap; }
.menu-email:hover { color: var(--night); }

.site-nav ul { display: flex; flex-wrap: wrap; gap: 0.25rem clamp(1rem, 2vw, 1.75rem); list-style: none; margin: 0; padding: 0; }
.site-nav a {
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
  padding-block: 0.3rem;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover { border-bottom-color: var(--muted); }
.site-nav a[aria-current="page"] { border-bottom-color: var(--ink); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--ink);
  color: var(--ink);
  font: inherit;
  font-size: 0.95rem;
  padding: 0.35rem 1rem;
  border-radius: 999px;
  cursor: pointer;
}

@media (max-width: 60rem) {
  .menu-row { flex-wrap: wrap; }
  .nav-toggle { display: block; }
  .site-nav { display: none; width: 100%; }
  .site-nav.open { display: block; }
  .site-nav ul { flex-direction: column; gap: 0; }
  .site-nav li { border-top: 1px solid var(--rule); }
  .site-nav a { display: block; padding: 0.75rem 0; border-bottom: 0; }
  .site-nav a[aria-current="page"] { font-weight: 500; }
}

/* ---------- Hero (home) ---------- */

.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: center;
  padding-block: clamp(2rem, 5vw, 4rem) clamp(3rem, 7vw, 5.5rem);
}
.hero h1 { max-width: 16ch; }

.lede {
  font-size: clamp(1.15rem, 1.7vw, 1.3rem);
  line-height: 1.6;
  color: var(--muted);
  max-width: 34rem;
  margin-top: 1.5rem;
}

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }

.button {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.98rem;
  padding: 0.6rem 1.3rem;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid var(--ink);
  color: var(--ink);
}
.button:hover { background: var(--ink); color: var(--paper); }
.button.primary { background: var(--ink); color: var(--paper); }
.button.primary:hover { background: var(--night); border-color: var(--night); }

.dial-figure { margin: 0; justify-self: center; width: 100%; max-width: 25rem; }
.dial-figure svg { width: 100%; height: auto; overflow: visible; }
.dial-figure figcaption {
  font-family: var(--sans);
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
  margin: 1rem auto 0;
  max-width: 23rem;
}
.dial-key {
  display: flex; justify-content: center; flex-wrap: wrap;
  gap: 0.4rem 1.1rem; margin-top: 0.6rem;
  font-family: var(--sans); font-size: 0.82rem; color: var(--muted);
}
.dial-key span { display: inline-flex; align-items: center; gap: 0.45rem; }
.swatch { width: 0.95rem; height: 0.4rem; border-radius: 2px; display: inline-block; }
.swatch.day { background: var(--day-soft); box-shadow: inset 0 0 0 1px var(--day); }
.swatch.night { background: var(--night-soft); box-shadow: inset 0 0 0 1px var(--night); }
.swatch.eat { background: var(--ink); height: 0.2rem; }

.dial .eat-arc { stroke-dasharray: var(--len); stroke-dashoffset: var(--len); animation: draw 1.6s 0.3s cubic-bezier(.6,0,.2,1) forwards; }
.dial .meal { opacity: 0; animation: appear 0.4s forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes appear { to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .dial .eat-arc { animation: none; stroke-dashoffset: 0; }
  .dial .meal { animation: none; opacity: 1; }
}

@media (max-width: 52rem) {
  .hero .wrap { grid-template-columns: 1fr; }
  .dial-figure { max-width: 20rem; }
}

/* ---------- Page header (inner pages) ---------- */

.page-head .wrap { padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1.25rem, 3vw, 2.25rem); }
.page-head .lede { margin-top: 1.1rem; }

/* ---------- Sections: heading left, content right ---------- */

.section { padding-block: var(--space); }
.section + .section { padding-top: 0; }
.page-head + .section { padding-top: clamp(1rem, 3vw, 2rem); }

.split {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 1.25rem clamp(2rem, 5vw, 4rem);
  border-top: 1px solid var(--rule);
  padding-top: 2rem;
}
.split > header p { color: var(--muted); font-family: var(--sans); font-size: 0.95rem; margin-top: 0.6rem; }
.split > header a { font-family: var(--sans); font-size: 0.95rem; }
@media (max-width: 52rem) { .split { grid-template-columns: minmax(0, 1fr); } }

.prose { max-width: 40rem; }
.prose p { margin-bottom: 1.1em; }

.meta, .news-date, .pub-authors, .pub-venue, .pub-links, .pub-count { font-family: var(--sans); }

/* ---------- Research ---------- */

.themes { list-style: none; margin: 0; padding: 0; }
.theme { padding-block: 1.4rem; border-bottom: 1px solid var(--rule); }
.theme:first-child { padding-top: 0; }
.theme:last-child { border-bottom: 0; }
.theme h3 { font-weight: 400; font-size: 1.35rem; margin-bottom: 0.35rem; }
.theme p { color: var(--muted); max-width: 38rem; }

.theme-detail { padding-block: 2rem; border-bottom: 1px solid var(--rule); }
.theme-detail:first-child { padding-top: 0; }
.theme-detail:last-child { border-bottom: 0; }
.theme-detail h3 { font-weight: 400; font-size: 1.55rem; margin-bottom: 0.75rem; }
.key-papers { font-family: var(--sans); font-size: 0.95rem; color: var(--muted); margin-top: 0.9rem; max-width: 40rem; }
.key-papers em { font-style: italic; }

.cohorts { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1.75rem 2.5rem; }
.cohorts h3 { margin-bottom: 0.25rem; }
.cohorts p { color: var(--muted); font-size: 1rem; }

/* ---------- Lists ---------- */

.news-list, .plain-list { list-style: none; margin: 0; padding: 0; }

.news-list li {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 1rem;
  padding-block: 1rem;
  border-bottom: 1px solid var(--rule);
}
.news-list li:first-child { padding-top: 0; }
.news-list li:last-child { border-bottom: 0; }
.news-date { color: var(--muted); font-size: 0.92rem; padding-top: 0.15rem; }
@media (max-width: 30rem) { .news-list li { grid-template-columns: 1fr; gap: 0.15rem; } }

.plain-list li { padding-block: 1rem; border-bottom: 1px solid var(--rule); }
.plain-list li:first-child { padding-top: 0; }
.plain-list li:last-child { border-bottom: 0; }
.plain-list .meta { color: var(--muted); font-size: 0.92rem; margin-top: 0.2rem; }

/* timeline rows: years, then what */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  gap: 1.25rem;
  padding-block: 0.85rem;
  border-bottom: 1px solid var(--rule);
}
.timeline li:first-child { padding-top: 0; }
.timeline li:last-child { border-bottom: 0; }
.timeline .years { font-family: var(--sans); color: var(--muted); font-size: 0.95rem; padding-top: 0.1rem; font-variant-numeric: tabular-nums; }
.timeline .place { color: var(--muted); font-size: 1rem; }
@media (max-width: 30rem) { .timeline li { grid-template-columns: 1fr; gap: 0.1rem; } }

/* ---------- Publications ---------- */

.pub-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; margin-bottom: 0.9rem; font-family: var(--sans); }

.search {
  flex: 1 1 16rem;
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 0.6rem 1.15rem;
}
.search::placeholder { color: var(--muted); }

.segmented { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--rule); border-radius: 999px; padding: 0.2rem; background: var(--surface); }
.segmented button {
  font: inherit; font-size: 0.92rem;
  border: 0; background: none; color: var(--muted);
  padding: 0.4rem 0.9rem; border-radius: 999px; cursor: pointer;
}
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }

.check { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.95rem; color: var(--muted); cursor: pointer; }
.check input { accent-color: var(--night); width: 1rem; height: 1rem; }

.pub-count { font-size: 0.9rem; color: var(--muted); margin-bottom: 2rem; }

.year-group {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: 1rem clamp(1.5rem, 4vw, 3rem);
  border-top: 1px solid var(--rule);
  padding-block: 1.75rem;
}
.year-label { font-family: var(--sans); font-weight: 300; font-size: 1.9rem; line-height: 1; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 40rem) { .year-group { grid-template-columns: 1fr; } }

.pubs { list-style: none; margin: 0; padding: 0; }
.pub { padding-bottom: 1.5rem; max-width: 46rem; }
.pub:last-child { padding-bottom: 0; }
.pub-title { font-size: 1.1rem; line-height: 1.4; }
.pub-authors { color: var(--muted); font-size: 0.9rem; margin-top: 0.35rem; }
.pub-authors strong { color: var(--ink); font-weight: 500; }
.pub-venue { font-size: 0.9rem; margin-top: 0.15rem; }
.pub-links { font-size: 0.88rem; margin-top: 0.3rem; }
.pub-type { color: var(--day); }

.empty { color: var(--muted); padding-block: 2rem; border-top: 1px solid var(--rule); font-family: var(--sans); }

/* ---------- Team ---------- */

.pi { display: grid; grid-template-columns: 12rem minmax(0, 1fr); gap: clamp(1.5rem, 4vw, 3rem); align-items: start; }
@media (max-width: 40rem) { .pi { grid-template-columns: 1fr; } }

.portrait, .monogram { width: 100%; max-width: 12rem; aspect-ratio: 4 / 5; border-radius: 0.4rem; object-fit: cover; }
.monogram {
  display: grid; place-items: center;
  background: var(--night-soft); color: var(--night);
  font-family: var(--sans); font-weight: 300; font-size: 3rem; letter-spacing: 0.04em;
}
.monogram.small, .portrait.small { width: 3.5rem; height: 3.5rem; aspect-ratio: 1; border-radius: 50%; }
.monogram.small { font-size: 1.15rem; }

.pi h2 { margin-bottom: 0.15rem; }
.pi .role { color: var(--muted); font-family: var(--sans); margin-bottom: 1.25rem; }

.facts { margin: 1.5rem 0 0; display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 0.5rem 1rem; font-size: 1rem; }
.facts dt { color: var(--muted); font-family: var(--sans); font-size: 0.95rem; }
.facts dd { margin: 0; }

.member-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: 1.75rem 2rem; }
.member { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr); gap: 0.9rem; align-items: start; }
.member-name { font-family: var(--sans); font-size: 1.15rem; line-height: 1.3; }
.member .meta { color: var(--muted); font-size: 0.92rem; }
.member .topic { font-size: 0.98rem; margin-top: 0.25rem; }

.alumni h3 { font-weight: 400; }
.alumni .thesis { font-style: italic; color: var(--muted); font-size: 1rem; margin-top: 0.2rem; }

/* ---------- Resources ---------- */

.courses { list-style: none; margin: 0; padding: 0; }
.courses li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.25rem 1.5rem; padding-block: 0.9rem; border-bottom: 1px solid var(--rule); }
.courses li:first-child { padding-top: 0; }
.courses li:last-child { border-bottom: 0; }
.courses .meta { color: var(--muted); font-size: 0.92rem; text-align: right; }
@media (max-width: 30rem) { .courses li { grid-template-columns: 1fr; } .courses .meta { text-align: left; } }

.callout { background: var(--surface); border: 1px solid var(--rule); border-radius: 0.6rem; padding: 1.5rem 1.75rem; max-width: 40rem; margin-bottom: 2rem; }
.callout h3 { margin-bottom: 0.4rem; }

/* ---------- Contact ---------- */

.contact-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1.75rem 2.5rem; }
.contact-grid h3 { margin-bottom: 0.35rem; }
.contact-grid p { color: var(--muted); }
.contact-grid a { word-break: break-word; }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--ink); margin-top: var(--space); font-family: var(--sans); font-size: 0.95rem; color: var(--muted); }
.site-footer .wrap { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem 2.5rem; padding-block: 2.5rem 3rem; }
.footer-name { font-size: 1.15rem; color: var(--ink); letter-spacing: 0.05em; text-transform: uppercase; font-weight: 300; margin-bottom: 0.5rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li + li { margin-top: 0.3rem; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--ink); }
@media (max-width: 40rem) { .site-footer .wrap { grid-template-columns: 1fr; } }

/* ---------- Icons ---------- */

.icon { width: 1.1em; height: 1.1em; flex-shrink: 0; }
.icon.lead { display: inline-block; vertical-align: -0.17em; margin-right: 0.45em; }
a .icon.lead { color: inherit; }
h3 > .icon.lead { color: var(--night); }
.prose strong > .icon.lead { color: var(--night); }
.pub-links .icon.lead { width: 0.95em; height: 0.95em; margin-right: 0.3em; }

/* round badges beside the research themes */
.has-badge { display: grid; grid-template-columns: 2.75rem minmax(0, 1fr); column-gap: 1.1rem; }
.has-badge > .badge { grid-row: 1 / span 4; }
.has-badge > :not(.badge) { grid-column: 2; }
.badge {
  width: 2.75rem; height: 2.75rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--night-soft); color: var(--night);
}
.badge .icon { width: 1.35rem; height: 1.35rem; }
.theme-detail.has-badge > .badge { margin-top: 0.1rem; }
@media (max-width: 30rem) {
  .has-badge { grid-template-columns: 2.25rem minmax(0, 1fr); column-gap: 0.85rem; }
  .badge { width: 2.25rem; height: 2.25rem; }
  .badge .icon { width: 1.1rem; height: 1.1rem; }
}

/* profile links as small rounded buttons */
.pills { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.pill {
  display: inline-flex; align-items: center;
  font-family: var(--sans); font-size: 0.9rem;
  padding: 0.35rem 0.85rem; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--surface);
  color: var(--ink); text-decoration: none;
}
.pill:hover { border-color: var(--night); color: var(--night); }
.pill .icon.lead { margin-right: 0.4em; }
.site-footer .with-icon { text-decoration: none; display: inline-flex; align-items: center; }
.site-footer .with-icon:hover { text-decoration: underline; }

/* ---------- Gallery (Team members page) ---------- */

.gallery {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(9.5rem, 42%), 1fr));
  gap: 1.25rem 1rem;
  max-width: 44rem;
}
.gallery-item {
  display: block; width: 100%; padding: 0; border: 0;
  background: var(--surface); border-radius: 0.4rem; overflow: hidden;
  cursor: zoom-in;
}
.gallery-item img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover;
  transition: transform 0.35s ease, opacity 0.2s ease;
}
.gallery-item:hover img { transform: scale(1.04); }
.gallery-caption {
  display: block; margin-top: 0.45rem;
  font-family: var(--sans); font-size: 0.85rem; line-height: 1.35; color: var(--muted);
}
@media (prefers-reduced-motion: reduce) { .gallery-item img { transition: none; } .gallery-item:hover img { transform: none; } }

/* full-size viewer */
.lightbox {
  border: 0; padding: 0; background: transparent;
  max-width: 92vw; max-height: 92vh; overflow: visible;
}
.lightbox::backdrop { background: rgba(12, 12, 16, 0.86); }
.lightbox figure { margin: 0; }
.lightbox img { max-width: 92vw; max-height: 82vh; width: auto; height: auto; border-radius: 0.4rem; margin: 0 auto; }
.lightbox figcaption { color: #e8e8ea; font-family: var(--sans); font-size: 0.95rem; text-align: center; margin-top: 0.75rem; }
.lb-btn {
  position: fixed; width: 2.75rem; height: 2.75rem; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: rgba(255, 255, 255, 0.12); color: #fff; border: 1px solid rgba(255, 255, 255, 0.25);
}
.lb-btn:hover { background: rgba(255, 255, 255, 0.24); }
.lb-btn .icon { width: 1.35rem; height: 1.35rem; }
.lb-close { top: 1rem; right: 1rem; }
.lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }

/* ---------- Publication themes ---------- */

.theme-chips { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0.25rem 0 1.25rem; font-family: var(--sans); }
.theme-chips button {
  font: inherit; font-size: 0.9rem;
  padding: 0.38rem 0.85rem; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--surface); color: var(--ink);
}
.theme-chips button span { color: var(--muted); font-size: 0.82rem; margin-left: 0.2rem; font-variant-numeric: tabular-nums; }
.theme-chips button:hover { border-color: var(--night); }
.theme-chips button[aria-pressed="true"] { background: var(--night); border-color: var(--night); color: var(--paper); }
.theme-chips button[aria-pressed="true"] span { color: inherit; opacity: 0.8; }

.pub-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1.5rem; margin-bottom: 2rem; }
.pub-meta .pub-count { margin: 0; }
.group-toggle { display: flex; align-items: center; gap: 0.6rem; font-family: var(--sans); font-size: 0.9rem; color: var(--muted); }
.group-toggle .segmented button { font-size: 0.85rem; padding: 0.3rem 0.8rem; }

.theme-group { border-top: 1px solid var(--rule); padding-block: 1.75rem 2rem; }
.theme-group-title { font-size: clamp(1.3rem, 2.2vw, 1.6rem); margin-bottom: 1.4rem; }
.theme-count { font-size: 0.9rem; color: var(--muted); font-variant-numeric: tabular-nums; margin-left: 0.35rem; }
.theme-group .pubs { max-width: 50rem; }

.pub-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; }
.tag {
  font-family: var(--sans); font-size: 0.78rem; line-height: 1.2;
  padding: 0.22rem 0.6rem; border-radius: 999px; cursor: pointer;
  border: 0; background: var(--night-soft); color: var(--night);
}
.tag:hover { background: var(--night); color: var(--paper); }
@media (max-width: 30rem) { .pub-tools .segmented { border-radius: 1.1rem; } }

/* ---------- Publications chart ---------- */

.pub-chart { margin: 0 0 2.5rem; max-width: 52rem; }
.pub-chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.pub-chart .axis { stroke: var(--rule); stroke-width: 1; }
.pub-chart .hit-area { fill: transparent; }
.pub-chart .bar { cursor: pointer; outline: none; }
.pub-chart .bar-all { fill: var(--rule); }
.pub-chart .bar-hit { fill: var(--night); transition: height 0.3s ease, y 0.3s ease; }
.pub-chart .bar:hover .bar-hit, .pub-chart .bar:focus-visible .bar-hit { fill: var(--day); }
.pub-chart .bar:focus-visible .bar-all { stroke: var(--night); stroke-width: 2; }
.pub-chart .bar-n { font-family: var(--sans); font-size: 15px; fill: var(--muted); text-anchor: middle; font-variant-numeric: tabular-nums; }
.pub-chart .bar-year { font-family: var(--sans); font-size: 15px; fill: var(--muted); text-anchor: middle; }
.pub-chart figcaption { font-family: var(--sans); font-size: 0.88rem; color: var(--muted); margin-top: 0.5rem; }
@media (max-width: 40rem) {
  .pub-chart .bar-n { font-size: 24px; }
  .pub-chart .bar-year { font-size: 24px; }
  .pub-chart .bar-year.odd { display: none; }
}

/* ---------- Map ---------- */

.map-frame { background: var(--surface); border: 1px solid var(--rule); border-radius: 0.6rem; padding: 0.5rem; }
.map svg { width: 100%; height: auto; display: block; }
.map .land { fill: var(--rule); }
.map .link { fill: none; stroke: var(--night); stroke-width: 1.6; stroke-dasharray: 3 5; opacity: 0.55; }
.map .region-area { fill: var(--night); opacity: 0.12; stroke: var(--night); stroke-width: 1.2; stroke-dasharray: 4 4; }
.map .dot { fill: var(--night); stroke: var(--surface); stroke-width: 2.5; }
.map .home .dot { fill: var(--day); }
.map .num { font-family: var(--sans); font-size: 12px; font-weight: 500; fill: var(--surface); text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.map .map-label { font-family: var(--sans); font-size: 19px; fill: var(--ink); paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.map .pulse { fill: none; stroke: var(--day); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { from { transform: scale(1); opacity: 0.9; } to { transform: scale(3.2); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .map .pulse { animation: none; opacity: 0; } }
.map .place { cursor: default; }
.map .place.active .dot { r: 13; }
.map .place.active .map-label { font-weight: 500; }
@media (max-width: 40rem) { .map .map-label { display: none; } .map .num { font-size: 18px; } .map .dot { r: 16; } .map .home .pulse { r: 16; } }

.map-list { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr)); gap: 1.1rem 2rem; }
.map-list li { display: grid; grid-template-columns: 1.6rem minmax(0, 1fr); gap: 0.7rem; padding: 0.4rem; margin: -0.4rem; border-radius: 0.4rem; transition: background 0.2s; }
.map-list li.active { background: var(--night-soft); }
.map-list strong { font-family: var(--sans); font-weight: 500; }
.map-list p { color: var(--muted); font-size: 0.98rem; margin-top: 0.15rem; }
.map-num { width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center; background: var(--night); color: var(--paper); font-family: var(--sans); font-size: 0.8rem; margin-top: 0.1rem; }
.map-num.home { background: var(--day); }

/* ---------- Career journey ---------- */

.journey { list-style: none; margin: 0; padding: 0; display: flex; min-height: 13rem; }
.journey li { flex: var(--grow) 1 0; position: relative; min-width: 0; }
.journey li::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -3px; background: var(--c); }
.journey li:first-child::before { border-radius: 3px 0 0 3px; }
.journey li.last::before { border-radius: 0 3px 3px 0; background: linear-gradient(90deg, var(--c) 60%, transparent); }
.journey li::after { content: ""; position: absolute; left: 0; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%; background: var(--paper); border: 3px solid var(--c); box-sizing: border-box; z-index: 1; }
.j-label { position: absolute; left: -7px; width: 10.5rem; display: flex; flex-direction: column; gap: 0.05rem; padding-left: 0.1rem; }
.journey li.up .j-label { bottom: calc(50% + 16px); }
.journey li.down .j-label { top: calc(50% + 16px); }
.j-year { font-family: var(--sans); font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.j-title { font-family: var(--sans); font-size: 0.98rem; line-height: 1.25; }
.j-where { font-size: 0.88rem; line-height: 1.3; color: var(--muted); }
.journey-key { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin-top: 1rem; font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }
.journey-key span { display: inline-flex; align-items: center; gap: 0.45rem; }
.journey-key i { width: 1.1rem; height: 0.4rem; border-radius: 2px; display: inline-block; }

@media (max-width: 56rem) {
  .journey { flex-direction: column; min-height: 0; }
  .journey li { flex: none; padding: 0 0 1.4rem 1.75rem; }
  .journey li::before { left: 4px; right: auto; top: 0; bottom: 0; width: 6px; height: auto; margin: 0; border-radius: 0 !important; }
  .journey li.last::before { background: linear-gradient(180deg, var(--c) 50%, transparent); }
  .journey li::after { left: 7px; top: 0.55rem; margin: 0 0 0 -7px; }
  .j-label, .journey li.up .j-label, .journey li.down .j-label { position: static; width: auto; }
}

/* ---------- Meal-timing explainer ---------- */

.explainer { display: grid; grid-template-columns: minmax(0, 18rem) minmax(0, 1fr); gap: 1.5rem clamp(1.5rem, 4vw, 3rem); align-items: center; max-width: 44rem; }
.ex-dial svg { width: 100%; height: auto; display: block; overflow: visible; }
.ex-field { display: block; margin-bottom: 1.1rem; font-family: var(--sans); }
.ex-field span { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.95rem; margin-bottom: 0.35rem; }
.ex-field output { color: var(--night); font-variant-numeric: tabular-nums; font-weight: 500; }
.ex-field input[type="range"] { width: 100%; accent-color: var(--night); }
.ex-stats { display: flex; gap: 2rem; margin: 0.5rem 0 1rem; }
.ex-stats dt { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }
.ex-stats dd { margin: 0; font-family: var(--sans); font-size: 1.5rem; font-weight: 300; font-variant-numeric: tabular-nums; }
.ex-note { font-size: 1rem; line-height: 1.55; min-height: 4.6em; }
.ex-small { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }
@media (max-width: 40rem) { .explainer { grid-template-columns: 1fr; } .ex-dial { max-width: 16rem; margin: 0 auto; } }

/* full-width sections: heading above, content across the page */
.split.stacked { grid-template-columns: minmax(0, 1fr); }
.split.stacked > header { max-width: 40rem; }
.split.stacked .map-frame { max-width: 60rem; }

/* ---------- Publication links and citations ---------- */

.pub-links { display: flex; flex-wrap: wrap; gap: 0.3rem 1.1rem; }
.pub-links a { text-decoration: none; }
.pub-links a:hover { text-decoration: underline; }
.pub-links .cites { color: var(--day); font-weight: 500; display: inline-flex; align-items: center; }
.pub-links .icon.lead { width: 0.95em; height: 0.95em; margin-right: 0.3em; }
.pubs.ranked { counter-reset: rank; }
.pubs.ranked .pub { position: relative; padding-left: 2.6rem; }
.pubs.ranked .pub::before {
  counter-increment: rank; content: counter(rank);
  position: absolute; left: 0; top: 0.1rem;
  font-family: var(--sans); font-weight: 300; font-size: 1.35rem; color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- Home page intro animation ---------- */

.meal-dot { transform: scale(0); transition: transform 0.5s cubic-bezier(0.34, 1.7, 0.64, 1); }
.meal-dot.on { transform: scale(1); }
.dial-figure .dial:focus-visible { outline: 2px solid var(--night); outline-offset: 6px; border-radius: 50%; }
.swatch.glucose { background: var(--day-soft); box-shadow: inset 0 -2px 0 var(--day); height: 0.55rem; }

.hero h1, .hero .lede, .hero .actions, .dial-figure figcaption, .dial-key {
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.hero .lede { animation-delay: 0.15s; }
.hero .actions { animation-delay: 0.3s; }
.dial-figure figcaption, .dial-key { animation-delay: 0.6s; }
.dial-figure .dial { animation: fade 1s 0.2s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: reduce) {
  .meal-dot { transition: none; }
  .hero h1, .hero .lede, .hero .actions, .dial-figure figcaption, .dial-key, .dial-figure .dial { animation: none; }
}

/* menu centred under the name (no email on the left) */
.menu-row { justify-content: center; }
@media (max-width: 60rem) { .menu-row { justify-content: flex-end; } }
