/* ── Animation tokens ─────────────────────────────────────────────── */
:root {
  --ease-standard:  cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:       cubic-bezier(0, 0, 0.2, 1);
  --ease-out-quint: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out:    cubic-bezier(0.4, 0, 0.6, 1);
  --dur-fast:   150ms;
  --dur-base:   200ms;
  --dur-slow:   300ms;
  --dur-enter:  400ms;
  --dur-enter-slow: 600ms;
}

/* Poppins — self-hosted */
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/poppins/poppins-400.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/poppins/poppins-500.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/poppins/poppins-600.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; font-display: swap; src: url('../fonts/poppins/poppins-700.woff2') format('woff2'); }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/jost/jost-600-latin.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/jost/jost-600-latin-ext.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Zen Old Mincho'; font-style: normal; font-weight: 500; font-display: swap; src: url('https://fonts.gstatic.com/s/zenoldmincho/v13/tss3ApVaYytLwxTqcxfMyBveyb4Dqlla.ttf') format('truetype'); }
@font-face { font-family: 'Courier Prime'; font-style: normal; font-weight: 700; font-display: swap; src: url('https://fonts.gstatic.com/s/courierprime/v11/u-4k0q2lgwslOqpF_6gQ8kELY7pMf-c.ttf') format('truetype'); }
@font-face { font-family: 'Dosis'; font-style: normal; font-weight: 600; font-display: swap; src: url('https://fonts.gstatic.com/s/dosis/v34/HhyJU5sn9vOmLxNkIwRSjTVNWLEJ6bQV3A.ttf') format('truetype'); }
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url('https://fonts.gstatic.com/s/instrumentserif/v5/jizHRFtNs2ka5fXjeivQ4LroWlx-6zATiw.ttf') format('truetype'); }
@font-face { font-family: 'Sixtyfour Convergence'; font-style: normal; font-weight: 400; font-display: swap; src: url('https://fonts.gstatic.com/s/sixtyfourconvergence/v5/m8IQjepPf7mIglv5K__zM9srGA7wurbybZMfZsqG2Q6EWlJro5FJSJ4acT9PoOPwGgieaK7zkSpdXP-GrR9Yw9Tg7E4HGLbUKPlOh102hos.ttf') format('truetype'); }

@import url("/css/fontawesome-all.min.css");

body,
.navigation,
.navigation-title,
.navigation-list,
.title,
h1, h2, h3, h4, h5, h6,
a {
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  line-height: 1.5;
}

.title {
  font-weight: 600;
}

.navigation-title {
  font-weight: 600;
}

.navigation-link {
  font-weight: 600;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
}

/* Top-level headings (home name, page/section titles, content subsections)
   use Jost SemiBold; body text and icon fonts are untouched. */
.centered .about h1,
.title,
.title .title-link,
.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
  font-family: "Jost", "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-weight: 600;
}

p, li {
  font-weight: 400;
}

/* Header/navigation uses Jost (icon fonts are restored just below) */
.navigation,
.navigation * {
  font-family: "Jost", "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif !important;
  font-weight: 600;
}

/* Preserve Font Awesome icon fonts */
.fa, .fa-solid {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 900 !important;
}
.fa-regular {
  font-family: "Font Awesome 6 Free" !important;
  font-weight: 400 !important;
}
.fa-brands, .fab {
  font-family: "Font Awesome 6 Brands" !important;
  font-weight: 400 !important;
}

/* ── Navigation links — animated underline wipe ───────────────────── */
.navigation a:hover,
.navigation a:focus {
  color: inherit !important;
  text-decoration: none !important;
  opacity: 0.85;
}

.navigation a.navigation-link {
  position: relative;
  text-decoration: none !important;
}

.navigation a.navigation-link::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform var(--dur-fast) var(--ease-in-out);
}

.navigation a.navigation-link:hover::after,
.navigation a.navigation-link:focus-visible::after {
  transform: scaleX(1);
  transform-origin: left center;
}

/* ── Avatar ───────────────────────────────────────────────────────── */
.avatar {
  overflow: hidden;
  border-radius: 50%;
  display: inline-block;
}

.avatar img {
  width: 18rem;
  height: 18rem;
  object-fit: cover;
  border-radius: 50%;
  transition: box-shadow var(--dur-slow) var(--ease-standard);
}

.avatar img:hover {
  box-shadow: 0 0 0 4px rgba(33, 33, 33, 0.12);
}

@media only screen and (max-width: 768px) {
  .avatar img {
    width: 10rem;
    height: 10rem;
  }
}

/* ── Social icon links (hero) ─────────────────────────────────────── */
.about ul li a {
  display: inline-block;
  transition: opacity var(--dur-fast) var(--ease-standard);
}

.about ul li a:hover,
.about ul li a:focus-visible {
  opacity: 0.55;
}

.about ul li a:active {
  opacity: 0.4;
}

/* ── Software logos ───────────────────────────────────────────────── */
.software-logos {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: center;
}
.software-logos img {
  max-height: 96px;
  width: auto;
  display: block;
}
.software-logo-button {
  position: relative;
  display: inline-grid;
  overflow: hidden;
  line-height: 0;
  isolation: isolate;
}
.software-logo-ripple {
  position: absolute;
  z-index: 1;
  width: var(--software-ripple-size);
  height: var(--software-ripple-size);
  border-radius: 50%;
  background: #fff;
  opacity: 0.35;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0);
  transform-origin: center;
  animation: software-logo-ripple 0.6s ease-out forwards;
  will-change: transform, opacity;
}
@keyframes software-logo-ripple {
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(3);
  }
}
.software-logos a {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  text-align: center;
  max-width: 220px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #212121;
  text-decoration: none;
  transition: opacity var(--dur-fast) var(--ease-standard);
}
.software-logos a:hover,
.software-logos a:focus {
  color: #212121;
  text-decoration: none;
  opacity: 0.6;
}
.software-logo-copy {
  display: block;
  font-size: 1.4rem;
  line-height: 1.4;
  color: inherit;
}
.software-logos strong {
  font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
  .software-logo-ripple {
    animation-duration: 1ms;
  }
}

/* ── GitHub contributions ────────────────────────────────────────── */
.github-calendar-root {
  margin-top: 4rem;
}

.github-contributions__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 1.4rem;
}

.markdown-body .github-contributions__header h3 {
  margin: 0;
  font-size: 2rem;
}

.markdown-body .github-contributions__profile {
  flex: 0 0 auto;
  color: #52525b;
  font-size: 1.35rem;
  font-weight: 500;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease-standard);
}

.markdown-body .github-contributions__profile:hover,
.markdown-body .github-contributions__profile:focus-visible {
  color: #18181b;
  text-decoration: none;
}

.github-contributions__calendar {
  overflow-x: auto;
  padding: 1.6rem;
  border: 1px solid #e4e4e7;
  background: #fff;
  color: #3f3f46;
  scrollbar-width: thin;
  scrollbar-color: #a1a1aa transparent;
}

.github-contributions__calendar:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

.github-contributions__calendar article {
  min-width: max-content;
}

.github-contributions__loading {
  margin: 0;
  color: #71717a;
  font-size: 1.4rem;
}

.colorscheme-dark .github-contributions__calendar {
  border-color: #3f3f46;
  background: #18181b;
  color: #d4d4d8;
  scrollbar-color: #71717a transparent;
}

.colorscheme-dark .markdown-body .github-contributions__profile {
  color: #a1a1aa;
}

.colorscheme-dark .markdown-body .github-contributions__profile:hover,
.colorscheme-dark .markdown-body .github-contributions__profile:focus-visible {
  color: #f4f4f5;
}

@media (max-width: 600px) {
  .github-calendar-root {
    margin-top: 3.2rem;
  }

  .github-contributions__header {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.4rem;
  }

  .github-contributions__calendar {
    padding: 1.2rem;
  }
}

/* ── Publication entries ──────────────────────────────────────────── */
.publication-list {
  display: grid;
  row-gap: 4rem;
}

.publication-entry {
  padding: 0;
}

.markdown-body .publication-title {
  margin: 0 0 0.7rem;
  font-size: 1.9rem;
  font-weight: 700;
  line-height: 1.4;
}

.publication-authors {
  text-align: left !important;
}

.publication-authors {
  margin: 0 0 1.2rem;
  font-size: 1.55rem;
  line-height: 1.65;
}

.publication-date {
  white-space: nowrap;
  color: #71717a;
  font-size: 0.94em;
}

.publication-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: 0.8rem;
}

.publication-links > a:not(.publication-link) {
  display: none !important;
}

.publication-link {
  display: inline-flex;
  align-items: flex-start;
  justify-content: center;
  width: 12.4rem;
  height: 3.8rem;
  padding: 0;
  overflow: hidden;
  border: 1px solid #e4e4e7;
  border-radius: 0;
  background: #fff;
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.04);
}

.publication-link:hover,
.publication-link:focus-visible {
  text-decoration: none;
}

.publication-link:focus-visible {
  outline: 2px solid #3f3f46;
  outline-offset: 2px;
}

.publication-link__stack {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 200%;
  transform: translateY(0);
  transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
}

.publication-link:hover .publication-link__stack,
.publication-link:focus-visible .publication-link__stack {
  transform: translateY(-50%);
}

.publication-link__label {
  display: flex;
  flex: 0 0 50%;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
}

.publication-link__label--read {
  gap: 0.6rem;
  color: #27272a;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.025em;
}

.publication-link__arrow {
  font-size: 1.55rem;
  line-height: 1;
}

.publication-link img {
  display: block;
  width: auto;
  max-width: 10.4rem;
  object-fit: contain;
}

.content article .publication-link::after {
  content: none;
  padding: 0;
}

.publication-link--biorxiv img {
  max-height: 2.6rem;
}

.publication-link--pubmed img {
  max-height: 2.8rem;
}

.publication-link--advanced-science img {
  max-height: 3.2rem;
}

.colorscheme-dark .publication-date {
  color: #a1a1aa;
}

@media only screen and (max-width: 480px) {
  .publication-link {
    width: calc(50% - 0.4rem);
    min-width: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .publication-link__stack {
    transition-duration: 1ms;
  }
}

/* Hide About link in the header without removing the page */
.navigation a[href="/about/"],
.navigation a[href="/about"],
.navigation .navigation-link[href="/about/"],
.navigation .navigation-link[href="/about"] {
  display: none !important;
}

/* ── Notes page ───────────────────────────────────────────────────── */
.notes-intro {
  font-size: 1.4rem;
  color: #666;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.notes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.note-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition:
    border-color var(--dur-base) var(--ease-standard),
    box-shadow   var(--dur-base) var(--ease-standard);
}

.note-card:hover {
  border-color: #aaa;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  text-decoration: none;
  color: inherit;
}

.note-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  object-position: top;
  border-bottom: 1px solid #e0e0e0;
  background: #f5f5f5;
}

.note-info {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.note-info strong {
  font-size: 1.35rem;
  font-weight: 600;
  color: #212121;
}

.note-info span {
  font-size: 1.15rem;
  color: #666;
  line-height: 1.5;
}

/* Dark mode support for notes */
.colorscheme-dark .notes-intro {
  color: #aaa;
}

.colorscheme-dark .note-card {
  background: #1a1a1a;
  border-color: #333;
}

.colorscheme-dark .note-card:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.colorscheme-dark .note-card img {
  border-color: #333;
  background: #222;
}

.colorscheme-dark .note-info strong {
  color: #e0e0e0;
}

.colorscheme-dark .note-info span {
  color: #999;
}

/* Responsive adjustments for notes */
@media only screen and (max-width: 600px) {
  .notes-grid {
    grid-template-columns: 1fr;
  }

  .note-card img {
    height: 150px;
  }
}

/* Research page graphical abstracts */
.markdown-body img[alt="Graphical abstract"] {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0 2.5rem 0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.colorscheme-dark .markdown-body img[alt="Graphical abstract"] {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ── Theme toggle ─────────────────────────────────────────────────── */
#dark-mode-toggle {
  position: static !important;
  bottom: auto !important;
  left: auto !important;
  z-index: auto !important;
  margin: 0 !important;
  font-size: inherit !important;
  line-height: inherit !important;
  cursor: pointer;
  transition: opacity var(--dur-slow) var(--ease-standard);
}

#dark-mode-toggle:hover {
  opacity: 0.85;
}

/* Icon color for light mode - moon icon */
.colorscheme-light #dark-mode-toggle i.fa-moon,
#dark-mode-toggle i.fa-moon {
  color: inherit;
}

/* Icon color for dark mode - sun icon with golden color */
.colorscheme-dark #dark-mode-toggle i.fa-sun {
  color: #ffd700;
}

/* Improved contrast for dark mode text */
.colorscheme-dark {
  --text-color: #e0e0e0;
  --background-color: #1a1a1a;
  --link-color: #66b3ff;
}

.colorscheme-dark body {
  color: var(--text-color);
  background-color: var(--background-color);
}

.colorscheme-dark a {
  color: var(--link-color);
}

.colorscheme-dark .software-logos a {
  color: #e0e0e0;
}

.colorscheme-dark .software-logos a:hover,
.colorscheme-dark .software-logos a:focus {
  color: #e0e0e0;
}

/* ── RA/PhD popup ─────────────────────────────────────────────────── */
.ra-popup {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(33, 33, 33, 0.4);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-standard);
}

.ra-popup.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.ra-popup__panel {
  position: relative;
  width: min(92vw, 520px);
  border-radius: 6px;
  border: 1px solid #e0e0e0;
  border-top: 2px solid #212121;
  background: #fafafa;
  color: #212121;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.08);
  padding: 2.4rem 2.4rem 2rem;
  transform: translateY(8px);
  opacity: 0;
  transition: transform var(--dur-base) var(--ease-out), opacity var(--dur-base) var(--ease-standard);
  outline: none;
}

.ra-popup.is-visible .ra-popup__panel {
  transform: translateY(0);
  opacity: 1;
}

.ra-popup__panel::before {
  display: none;
}

.ra-popup__eyebrow {
  margin: 0 0 0.6rem;
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #888;
  font-weight: 600;
}

.ra-popup__title {
  margin: 0 0 0.8rem;
  font-size: 2rem;
  line-height: 1.3;
  font-weight: 600;
  color: #212121;
}

.ra-popup__body {
  margin: 0 0 1.8rem;
  font-size: 1.5rem;
  line-height: 1.6;
  color: #555;
  font-weight: 400;
}

.ra-popup__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.ra-popup__button,
.ra-popup__ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem 1.4rem;
  border-radius: 4px;
  font-size: 1.35rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}

.ra-popup__button {
  background: #212121;
  color: #fafafa;
  box-shadow: none;
}

.ra-popup__button:hover,
.ra-popup__button:focus {
  background: #424242;
  text-decoration: none;
  color: #fafafa;
}

.ra-popup__ghost {
  background: transparent;
  color: #212121;
  border-color: #ccc;
}

.ra-popup__ghost:hover,
.ra-popup__ghost:focus {
  background: #f0f0f0;
  color: #212121;
}

.ra-popup__close {
  position: absolute;
  top: 1.4rem;
  right: 1.4rem;
  border: 0;
  background: transparent;
  color: #999;
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease-standard);
}

.ra-popup__close:hover,
.ra-popup__close:focus {
  color: #212121;
}

.ra-popup-open {
  overflow: hidden;
}

/* Dark mode */
.colorscheme-dark .ra-popup {
  background: rgba(0, 0, 0, 0.5);
}

.colorscheme-dark .ra-popup__panel {
  background: #212121;
  border-color: #424242;
  border-top-color: #dadada;
  color: #dadada;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}

.colorscheme-dark .ra-popup__eyebrow {
  color: #888;
}

.colorscheme-dark .ra-popup__title {
  color: #dadada;
}

.colorscheme-dark .ra-popup__body {
  color: #aaa;
}

.colorscheme-dark .ra-popup__button {
  background: #dadada;
  color: #212121;
}

.colorscheme-dark .ra-popup__button:hover,
.colorscheme-dark .ra-popup__button:focus {
  background: #f0f0f0;
  color: #212121;
}

.colorscheme-dark .ra-popup__ghost {
  color: #dadada;
  border-color: #4f4f4f;
}

.colorscheme-dark .ra-popup__ghost:hover,
.colorscheme-dark .ra-popup__ghost:focus {
  background: #2c2c2c;
  color: #dadada;
}

.colorscheme-dark .ra-popup__close {
  color: #777;
}

.colorscheme-dark .ra-popup__close:hover,
.colorscheme-dark .ra-popup__close:focus {
  color: #dadada;
}

@media (max-width: 600px) {
  .ra-popup__panel {
    padding: 2rem 1.6rem 1.6rem;
  }

  .ra-popup__title {
    font-size: 1.8rem;
  }

  .ra-popup__actions {
    flex-direction: column;
    align-items: stretch;
  }
}

/* ── Values marquee ───────────────────────────────────────────────── */
.values-marquee {
  overflow: hidden;
  width: 100%;
  padding: 0.4rem 0 0.8rem;
  outline: none;
}

.values-track {
  display: flex;
  gap: 16px;
  width: max-content;
  will-change: transform;
}

.values-card {
  flex-shrink: 0;
  width: 290px;
  padding: 1.6rem 1.5rem 1.4rem;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  user-select: none;
  transition:
    border-color var(--dur-fast) var(--ease-standard),
    background   var(--dur-fast) var(--ease-standard);
}

.values-card:hover {
  border-color: #bbb;
  background: #fafafa;
}

.values-card__icon {
  font-size: 2rem;
  color: #212121;
  line-height: 1;
}

.values-card__title {
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #212121;
  margin: 0;
  line-height: 1.35;
}

.values-card__belief {
  font-family: "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 1.2rem;
  font-weight: 400;
  color: #666;
  margin: 0;
  line-height: 1.55;
}

/* Dark mode */
.colorscheme-dark .values-card {
  background: #2a2a2a;
  border-color: #424242;
}

.colorscheme-dark .values-card__icon,
.colorscheme-dark .values-card__title {
  color: #dadada;
}

.colorscheme-dark .values-card__belief {
  color: #999;
}

/* Reduced motion: JS skips animation; CSS wraps cards into a readable grid */
@media (prefers-reduced-motion: reduce) {
  .values-track {
    flex-wrap: wrap;
    width: 100%;
  }
  .values-card[aria-hidden="true"] {
    display: none;
  }
}

/* Home footer visitor tracker (mini) */
.home-visit-map {
  margin-top: 1.4rem;
  display: flex;
  justify-content: center;
  line-height: 0;
}

.home-visit-map__scale {
  width: 230px;
  height: 145px;
  transform: scale(0.62);
  transform-origin: top center;
}

.home-visit-map img {
  width: 230px;
  height: auto;
  border: 0;
}

@media only screen and (max-width: 768px) {
  .home-visit-map {
    justify-content: center;
  }

  .home-visit-map__scale {
    transform: scale(0.68);
    transform-origin: top center;
  }
}

/* ── Page-load entrance animations ───────────────────────────────── */
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.container.centered {
  animation: fade-up var(--dur-enter) var(--ease-out) both;
}

.stacked-section:nth-child(1) {
  animation: fade-up var(--dur-enter-slow) var(--ease-out) both;
  animation-delay: 80ms;
}
.stacked-section:nth-child(2) {
  animation: fade-up var(--dur-enter-slow) var(--ease-out) both;
  animation-delay: 160ms;
}
.stacked-section:nth-child(3) {
  animation: fade-up var(--dur-enter-slow) var(--ease-out) both;
  animation-delay: 240ms;
}
.stacked-section:nth-child(4) {
  animation: fade-up var(--dur-enter-slow) var(--ease-out) both;
  animation-delay: 320ms;
}
.stacked-section:nth-child(5) {
  animation: fade-up var(--dur-enter-slow) var(--ease-out) both;
  animation-delay: 400ms;
}

/* ── prefers-reduced-motion — comprehensive override ─────────────── */
@media (prefers-reduced-motion: reduce) {
  /* Existing popup */
  .ra-popup,
  .ra-popup__panel,
  .ra-popup__button,
  .ra-popup__ghost {
    transition: none;
  }

  /* Disable entrance animations */
  .container.centered,
  .stacked-section {
    animation: none;
  }

  /* All remaining hover effects are opacity/color-only — no changes needed */

  /* Nav underline: no wipe — show instantly on hover instead */
  .navigation a.navigation-link::after {
    transition: none;
  }
  .navigation a.navigation-link:hover::after,
  .navigation a.navigation-link:focus-visible::after {
    transform: scaleX(1);
  }
}

/* ── Research timeline (right side) ───────────────────────────────── */
.markdown-body img[src*="projects_graphical_abstract"] {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.5rem 0 2.5rem 0;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

[data-timeline] h3 {
  scroll-margin-top: 2rem;
}

.research-timeline {
  --timeline-accent: #1565c0;
  --timeline-line: rgba(0, 0, 0, 0.12);
  --timeline-bg: #fafafa;
  font-size: 1.35rem;
  line-height: 1.35;
}

.colorscheme-dark .research-timeline {
  --timeline-accent: #42a5f5;
  --timeline-line: rgba(255, 255, 255, 0.16);
  --timeline-bg: #212121;
}

.research-timeline ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.research-timeline li {
  position: relative;
  margin: 0;
}

.research-timeline a {
  display: block;
  overflow: visible;
  color: inherit;
  opacity: 0.6;
  text-decoration: none;
  transition: opacity var(--dur-fast) var(--ease-standard);
}

.research-timeline a:hover,
.research-timeline a:focus-visible,
.research-timeline li.is-active a {
  opacity: 1;
}

.research-timeline__title {
  font-weight: 600;
}

.research-timeline li.is-active .research-timeline__title {
  color: var(--timeline-accent);
}

.research-timeline__meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Desktop: sticky vertical timeline in a right-hand column */
@media (min-width: 900px) {
  .container.page:has(.has-timeline) {
    max-width: 118rem;
  }

  article.has-timeline {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 20rem;
    column-gap: 5rem;
  }

  article.has-timeline > * {
    grid-column: 1;
    min-width: 0;
  }

  /* Pinned to the viewport's vertical center, flush with the right edge
     of the page column; the grid keeps its column free. */
  article.has-timeline > .research-timeline {
    position: fixed;
    top: 50%;
    right: max(2rem, calc((100vw - 118rem) / 2 + 2rem));
    width: 20rem;
    transform: translateY(-50%);
    text-align: right;
    z-index: 10;
  }

  .research-timeline ol {
    border-right: 2px solid var(--timeline-line);
  }

  .research-timeline li {
    padding: 0.6rem 1.6rem 0.6rem 0;
  }

  .research-timeline li::before {
    content: "";
    position: absolute;
    right: -6px;
    top: 1.05rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--timeline-line);
    transition: background var(--dur-base) var(--ease-standard),
      transform var(--dur-base) var(--ease-out);
  }

  .research-timeline li.is-active::before {
    background: var(--timeline-accent);
    transform: scale(1.3);
  }

  .research-timeline__title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}

/* Mobile: sticky horizontal strip under the page title */
@media (max-width: 899px) {
  .research-timeline {
    position: sticky;
    top: 0;
    z-index: 10;
    margin: 0 -2rem 1rem;
    padding: 0 2rem;
    background: var(--timeline-bg);
    border-bottom: 1px solid var(--timeline-line);
  }

  .research-timeline ol {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .research-timeline ol::-webkit-scrollbar {
    display: none;
  }

  .research-timeline li {
    flex: 0 0 auto;
    padding: 1rem 0 0.8rem;
    border-bottom: 2px solid transparent;
  }

  .research-timeline li.is-active {
    border-bottom-color: var(--timeline-accent);
  }

  .research-timeline__title {
    white-space: nowrap;
  }

  .research-timeline__meta {
    display: none;
  }

  [data-timeline] h3 {
    scroll-margin-top: 6rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .research-timeline li::before { transition: none; }
}

/* ── Home hero: scroll-driven Matrix rain ─────────────────────────── */
/* The canvas layer is shifted by --hero-shift (set by
   js/hero-parallax.js), preserving the hero's slower scroll depth. */
.home-hero {
  --hero-speed: 0.4;       /* visual speed relative to scroll (0 = static) */
  --hero-overscale: 1.08;  /* guards against edges during the move */
  --hero-ink: #fff;
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 62vh;
  min-height: 62svh;
  overflow: hidden;
  isolation: isolate;
  color: var(--hero-ink);
  background: #09090b;
}

.home-hero__media {
  position: absolute;
  inset: 0;
  z-index: -2;
  overflow: hidden;
}

.matrix-rain {
  position: absolute;
  inset: 0;
  background: #09090b;
  transform: translate3d(0, var(--hero-shift, 0px), 0) scale(var(--hero-overscale));
  transform-origin: center;
  will-change: transform;
}

.matrix-rain canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.home-hero__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg,
      rgba(9, 9, 11, 0.58) 0%,
      rgba(9, 9, 11, 0.28) 22%,
      rgba(9, 9, 11, 0.28) 70%,
      rgba(9, 9, 11, 0.64) 100%);
}

.home-hero .navigation {
  position: relative;
  z-index: 20;
}

.home-hero__intro.container {
  flex: 1;
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 2rem;
  padding-bottom: 6rem;
}

.home-hero__signature-title {
  display: flex;
  justify-content: center;
}

.home-hero__signature-title img {
  display: block;
  width: min(20rem, 56vw);
  height: auto;
}

.home-hero__role {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-weight: 400;
}

.word-rotate {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;
}

.word-rotate__viewport {
  display: inline-grid;
  position: relative;
  height: 1.55em;
  overflow: hidden;
  padding: 0;
  border: 0;
  border-radius: 0.14em;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.1;
  text-align: left;
  vertical-align: bottom;
  cursor: pointer;
  appearance: none;
}

.word-rotate__viewport:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 0.16em;
}

.word-rotate__sizer {
  display: grid;
  grid-area: 1 / 1;
  visibility: hidden;
}

.word-rotate__sizer-word,
.word-rotate__word {
  grid-area: 1 / 1;
  align-self: center;
  line-height: 1.1;
  white-space: nowrap;
}

.word-rotate__word {
  justify-self: center;
  text-align: center;
  will-change: transform, opacity;
}

.word-rotate__word--undergrad {
  color: #ffd7a0;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 1.22em;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.012em;
  text-shadow: 0 2px 16px rgba(255, 169, 77, 0.28);
}

.word-rotate__word--genome {
  color: #b7f7dc;
  font-family: "Dosis", "Jost", sans-serif;
  font-size: 1.16em;
  font-weight: 600;
  letter-spacing: 0.055em;
  text-shadow: 0 0 14px rgba(110, 231, 183, 0.22);
}

.word-rotate__word--bioinformatics {
  color: #67d8ff;
  font-family: "Courier Prime", "Courier New", monospace;
  font-size: 1em;
  font-weight: 700;
  letter-spacing: 0.015em;
  text-shadow:
    0 0 5px rgba(103, 216, 255, 0.95),
    0 0 16px rgba(14, 165, 233, 0.72),
    0 0 30px rgba(2, 132, 199, 0.38);
}

.word-rotate__word--computational {
  color: #fff;
  font-family: "Sixtyfour Convergence", monospace;
  font-size: 0.7em;
  font-weight: 400;
  letter-spacing: 0;
  text-shadow: none;
}

@media only screen and (max-width: 360px) {
  .word-rotate__word--computational {
    font-size: 0.6em;
  }
}

.home-hero__affiliation {
  display: block;
}

@media (prefers-reduced-motion: reduce) {
  .word-rotate__word {
    will-change: auto;
  }
}

.wrapper > .home-hero .about h1,
.wrapper > .home-hero .about h2,
.wrapper > .home-hero .about ul li a {
  color: var(--hero-ink);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.45);
}

.wrapper > .home-hero .avatar img,
.wrapper > .home-hero .avatar img:hover {
  box-shadow: none;
}

/* Light nav text over the photo; the mobile dropdown keeps its own panel colors */
.wrapper > .home-hero .navigation-title,
.wrapper > .home-hero .navigation .menu-button i {
  color: var(--hero-ink);
}

@media only screen and (min-width: 769px) {
  .wrapper > .home-hero .navigation,
  .wrapper > .home-hero .navigation a,
  .wrapper > .home-hero .navigation span,
  .wrapper > .home-hero .navigation i {
    color: var(--hero-ink);
  }
}

@media only screen and (max-width: 768px) {
  .home-hero {
    --hero-speed: 0.25;
    --hero-overscale: 1.12;
  }

  .home-hero__scrim {
    background:
      linear-gradient(180deg,
        rgba(9, 9, 11, 0.62) 0%,
        rgba(9, 9, 11, 0.34) 30%,
        rgba(9, 9, 11, 0.34) 75%,
        rgba(9, 9, 11, 0.68) 100%);
  }

  .home-hero__intro.container {
    padding-bottom: 4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-hero {
    --hero-speed: 0;
  }

  .matrix-rain {
    transform: scale(var(--hero-overscale));
    will-change: auto;
  }
}

/* ── Left navigation rail (appears once the top nav is out of view) ── */
.nav-rail {
  --rail-accent: #1565c0;
  position: fixed;
  top: 50%;
  left: max(3.2rem, calc((100vw - 90rem) / 2 - 26rem));
  z-index: 30;
  display: none;
  transform: translate(-0.8rem, -50%);
  opacity: 0;
  visibility: hidden;
  transition:
    opacity var(--dur-base) var(--ease-standard),
    transform var(--dur-base) var(--ease-out),
    visibility 0s linear var(--dur-base);
}

.colorscheme-dark .nav-rail {
  --rail-accent: #42a5f5;
}

@media (min-width: 1100px) {
  .nav-rail { display: block; }
}

.nav-rail.is-visible {
  transform: translate(0, -50%);
  opacity: 1;
  visibility: visible;
  transition:
    opacity var(--dur-base) var(--ease-standard),
    transform var(--dur-base) var(--ease-out),
    visibility 0s;
}

.nav-rail ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-rail li {
  margin: 0;
}

.nav-rail a.nav-rail__link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.5rem 0;
  overflow: visible;
  color: inherit;
  opacity: 0.55;
  font-family: "Jost", "Poppins", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  transition: opacity var(--dur-fast) var(--ease-standard), color var(--dur-fast) var(--ease-standard);
}

.nav-rail a.nav-rail__link:hover,
.nav-rail a.nav-rail__link:focus-visible {
  opacity: 1;
}

.nav-rail a.nav-rail__link[aria-current="page"] {
  opacity: 1;
  color: var(--rail-accent);
}

/* Research page is wider (118rem); keep the rail clear of its content,
   and below 1500px only the icons fit in the margin */
body:has(.has-timeline) .nav-rail {
  left: max(1.6rem, calc((100vw - 118rem) / 2 - 16rem));
}

@media (max-width: 1499px) {
  body:has(.has-timeline) .nav-rail {
    left: 1.6rem;
  }
  body:has(.has-timeline) .nav-rail__label {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-rail,
  .nav-rail.is-visible {
    transform: translateY(-50%);
    transition: none;
  }
}
