/* ---------- Base ---------- */
:root {
  --bg: #ffffff;
  --text: #2b2b2b;
  --muted: #6b6b6b;
  --accent: #2f5f8f;
  --border: #e6e6e6;
  --nav-bg: #fafafa;
  --max-width: 760px;

  /* Micro-interactions */
  --link-blue: #2f5f8f;
  --link-blue-dark: #1f4568;
  --soft-blue-border: rgba(47, 95, 143, 0.35);
  --soft-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  --soft-shadow-hover: 0 8px 22px rgba(0, 0, 0, 0.1);
  --transition-fast: 250ms ease;
  --transition-medium: 300ms ease;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    "Georgia", serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

a {
  color: #2f5f8f;
  text-decoration: none;
}

a:hover {
  color: #1f4568;
  text-decoration: underline;
}

/* ---------- Navigation ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--nav-bg);
}

.nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.25rem;
  position: relative;
}

.nav-links {
  list-style: none;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1.75rem;
  margin: 0;
  padding: 1rem 0;
}

.nav-links a {
  position: relative;
  color: var(--text);
  font-size: 1rem;
  letter-spacing: 0.02em;
  transition: color var(--transition-medium);
}

/* Sliding underline micro-interaction (nav links only) */
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -0.35rem;
  width: 100%;
  height: 2px;
  background: var(--link-blue);
  border-radius: 999px;
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--transition-medium);
}

.nav-links a:hover {
  color: var(--link-blue-dark);
  text-decoration: none;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  transform: scaleX(1);
}

.nav-links a.active {
  color: var(--accent);
  font-weight: 600;
}

/* Hamburger toggle (hidden on desktop) */
.nav-toggle,
.nav-toggle-label {
  display: none;
}

/* ---------- Layout ---------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.25rem;
}

/* ---------- Home: two-column layout ---------- */
.home-layout {
  max-width: 1150px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

/* Main content is first in the HTML, placed visually on the right */
.home-main {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
}

.home-sidebar {
  grid-column: 1;
  grid-row: 1;
  text-align: center;
}

/* Sidebar */
.profile-photo {
  width: 150px;
  height: 150px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  transition: transform var(--transition-medium), box-shadow var(--transition-medium);
  will-change: transform;
}

.profile-photo:hover {
  transform: scale(1.03);
  box-shadow: var(--soft-shadow-hover);
}

.sidebar-name {
  margin: 1rem 0 0.2rem;
  font-size: 1.3rem;
  font-weight: 600;
}

.sidebar-title {
  margin-top: 0.6rem;
  margin-bottom: 1.2rem;
  color: #555;
  font-size: 0.95rem;
  line-height: 1.45;
}

.sidebar-title p {
  margin: 0.25rem 0;
}

.sidebar-links {
  margin-top: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  /* center the link block within the sidebar */
  width: 100%;
  max-width: 200px;
  margin-left: auto;
  margin-right: auto;
}

/* Each link is its own row: icon pinned left, label centered */
.sidebar-links a {
  position: relative;
  display: block;
  width: 100%;
  padding: 0 1.7rem;
  text-align: center;
  color: #2f5f8f;
  font-size: 0.95rem;
  line-height: 1.5;
  transition: color var(--transition-fast);
}

.sidebar-links a:hover {
  color: var(--link-blue-dark);
  text-decoration: underline;
}

.link-icon {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  color: #2f5f8f;
  transition: transform var(--transition-fast), color var(--transition-fast);
}

/* Nudge only the icon to the right on hover (keeps text aligned) */
.sidebar-links a:hover .link-icon {
  transform: translateY(-50%) translateX(2px);
  color: var(--link-blue-dark);
}

.link-icon svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentColor;
  display: block;
}

/* Biography */
.bio-section h1 {
  margin: 0 0 0.3rem;
  font-size: 2rem;
  font-weight: 600;
}

.bio-section .subtitle {
  margin: 0 0 1.5rem;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

/* Research interest tags — pill chips */
.research-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.9rem;
  margin-bottom: 1.5rem;
  max-width: 680px;
}

.research-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.34rem 0.72rem;
  border: 1px solid rgba(47, 95, 143, 0.24);
  border-radius: 999px;
  background: linear-gradient(
    180deg,
    rgba(47, 95, 143, 0.075),
    rgba(47, 95, 143, 0.035)
  );
  color: #2f5f8f;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.035);
  transition:
    transform 220ms ease,
    box-shadow 220ms ease,
    border-color 220ms ease,
    background-color 220ms ease;
}

.research-tag:hover {
  transform: translateY(-1px);
  border-color: rgba(47, 95, 143, 0.42);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.065);
  background: rgba(47, 95, 143, 0.075);
}

@media (max-width: 600px) {
  .research-tags {
    gap: 0.4rem;
  }

  .research-tag {
    font-size: 0.78rem;
    padding: 0.3rem 0.62rem;
  }
}

.bio-section p {
  margin: 0 0 1.1rem;
  text-align: justify;
}

/* News — announcement feed */
.news-section {
  margin-top: 2.5rem;
  margin-bottom: 2.8rem;
}

.news-section h2 {
  font-size: 1.35rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border);
}

.news-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.news-item {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fafafa;
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast),
    background-color var(--transition-fast);
}

.news-item:hover {
  transform: translateY(-1px);
  border-color: var(--soft-blue-border);
  box-shadow: var(--soft-shadow-hover);
  background-color: #ffffff;
}

.news-date {
  color: #666;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  padding-top: 0.1rem;
}

.news-content {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.96rem;
  line-height: 1.55;
}

.news-emoji {
  flex: 0 0 auto;
  font-size: 1.05rem;
  line-height: 1.45;
}

.news-content a {
  margin-left: 0.25rem;
  font-weight: 500;
}

/* Education */
.education-section {
  margin-top: 2.5rem;
}

.education-section h2 {
  font-size: 1.35rem;
  font-weight: 600;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

.education-item {
  margin-bottom: 1.4rem;
}

.education-item:last-child {
  margin-bottom: 0;
}

.education-item h3 {
  margin: 0 0 0.2rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
}

.education-place {
  margin: 0;
}

.education-date {
  margin: 0.1rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.education-detail {
  margin: 0.2rem 0 0;
  font-size: 0.95rem;
}

/* Home: stack on mobile, sidebar first for readability */
@media (max-width: 800px) {
  .home-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 2rem 1.25rem;
  }

  .home-sidebar {
    grid-column: 1;
    grid-row: 1;
  }

  .home-main {
    grid-column: 1;
    grid-row: 2;
  }

  .bio-section p {
    text-align: left;
  }

  .news-item {
    grid-template-columns: 1fr;
    gap: 0.35rem;
    padding: 0.85rem;
  }

  .news-date {
    font-size: 0.88rem;
  }

  .news-content {
    gap: 0.45rem;
  }
}

/* ---------- Inner page titles ---------- */
.page-title {
  text-align: center;
  font-size: 2rem;
  font-weight: 600;
  margin: 0;
}

/* ---------- Fun Fact (page-scoped: every rule starts with .funfact-page) ---------- */
.funfact-page {
  max-width: 980px;
}

/* One-time staggered entrance for the page sections (transform/opacity only) */
@keyframes funfactRise {
  from {
    opacity: 0;
    transform: translate3d(0, 16px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

.funfact-page > section {
  opacity: 0;
  animation: funfactRise 560ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.funfact-page > section:nth-child(1) { animation-delay: 60ms; }
.funfact-page > section:nth-child(2) { animation-delay: 140ms; }
.funfact-page > section:nth-child(3) { animation-delay: 220ms; }
.funfact-page > section:nth-child(4) { animation-delay: 300ms; }
.funfact-page > section:nth-child(5) { animation-delay: 380ms; }

@keyframes funfactFloat {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(0, -4px, 0) rotate(-4deg); }
}

.funfact-page .funfact-hero {
  position: relative;
  margin-top: 1rem;
  padding: 2rem;
  border: 1px solid rgba(47, 95, 143, 0.18);
  border-radius: 20px;
  background:
    radial-gradient(circle at top left, rgba(47, 95, 143, 0.12), transparent 32%),
    linear-gradient(180deg, #ffffff, #fafafa);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

/* Decorative sparkle/robot stickers in the hero corner (emoji, pure CSS) */
.funfact-page .funfact-hero::after {
  content: "🤖✨";
  position: absolute;
  top: 1rem;
  right: 1.15rem;
  font-size: 1.4rem;
  opacity: 0.55;
  pointer-events: none;
  transform-origin: center;
  will-change: transform;
  animation: funfactFloat 4.5s ease-in-out infinite;
}

.funfact-page .funfact-kicker {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.55rem;
}

.funfact-page .funfact-hero h1 {
  margin: 0 0 0.75rem;
  font-size: 2rem;
  line-height: 1.2;
}

.funfact-page .funfact-lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.funfact-page .funfact-body {
  margin-top: 1.5rem;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.045);
}

.funfact-page .funfact-body p {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  line-height: 1.75;
}

.funfact-page .funfact-body strong {
  color: var(--accent);
  font-weight: 600;
}

.funfact-page .funfact-workflow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.5rem;
}

.funfact-page .workflow-step {
  position: relative;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.045);
  cursor: pointer;
  will-change: transform;
  transition:
    transform 280ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 280ms ease,
    border-color 280ms ease,
    background-color 280ms ease;
}

.funfact-page .workflow-step:hover {
  transform: translateY(-4px);
  border-color: var(--soft-blue-border);
  box-shadow: var(--soft-shadow-hover);
  background-color: #ffffff;
}

.funfact-page .workflow-step:active {
  transform: translateY(-2px) scale(0.99);
}

/* Step number badge */
.funfact-page .workflow-step::before {
  content: attr(data-step);
  position: absolute;
  top: 0.85rem;
  right: 1rem;
  color: rgba(47, 95, 143, 0.3);
  font-size: 0.95rem;
  font-weight: 700;
  transition: color 280ms ease;
}

.funfact-page .workflow-step:hover::before {
  color: var(--accent);
}

.funfact-page .workflow-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  margin-bottom: 0.7rem;
  border-radius: 999px;
  background: rgba(47, 95, 143, 0.08);
  font-size: 1.15rem;
  transition: transform 320ms cubic-bezier(0.34, 1.56, 0.64, 1), background-color 280ms ease;
}

/* Icon springs and rotates a touch when its card is hovered */
.funfact-page .workflow-step:hover .workflow-icon {
  transform: scale(1.12) rotate(-6deg);
  background: rgba(47, 95, 143, 0.14);
}

.funfact-page .workflow-step h2 {
  margin: 0 0 0.45rem;
  font-size: 1.05rem;
}

.funfact-page .workflow-step p {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.6;
}

.funfact-page .workflow-step.is-pulsing {
  animation: funfactPulse 460ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes funfactPulse {
  0% {
    transform: translateY(-4px) scale(1);
  }
  40% {
    transform: translateY(-4px) scale(1.04);
  }
  70% {
    transform: translateY(-4px) scale(0.99);
  }
  100% {
    transform: translateY(-4px) scale(1);
  }
}

.funfact-page .funfact-loop {
  margin-top: 1.75rem;
  padding: 1.35rem;
  border-radius: 16px;
  border: 1px dashed rgba(47, 95, 143, 0.3);
  background: rgba(47, 95, 143, 0.035);
}

.funfact-page .funfact-loop h2 {
  margin: 0 0 0.8rem;
  font-size: 1.1rem;
}

.funfact-page .loop-chain {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  align-items: center;
}

.funfact-page .loop-chain span {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: #ffffff;
  border: 1px solid rgba(47, 95, 143, 0.22);
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 200ms ease, background-color 200ms ease, box-shadow 200ms ease;
  /* a soft highlight travels along the chain to suggest the repeating loop */
  animation: funfactLoopGlow 4.8s ease-in-out infinite;
}

.funfact-page .loop-chain span:nth-child(1) { animation-delay: 0s; }
.funfact-page .loop-chain span:nth-child(2) { animation-delay: 0.5s; }
.funfact-page .loop-chain span:nth-child(3) { animation-delay: 1s; }
.funfact-page .loop-chain span:nth-child(4) { animation-delay: 1.5s; }

@keyframes funfactLoopGlow {
  0%, 100% {
    background: #ffffff;
    box-shadow: none;
  }
  12% {
    background: rgba(47, 95, 143, 0.1);
    box-shadow: 0 2px 10px rgba(47, 95, 143, 0.14);
  }
  24% {
    background: #ffffff;
    box-shadow: none;
  }
}

.funfact-page .loop-chain span:hover {
  transform: translateY(-2px);
  background: rgba(47, 95, 143, 0.07);
}

.funfact-page .loop-chain span:not(:last-child)::after {
  content: "→";
  margin-left: 0.55rem;
  color: var(--muted);
}

.funfact-page .funfact-note {
  margin-top: 1.75rem;
  padding: 1rem 1.1rem;
  border-left: 4px solid var(--accent);
  background: #fafafa;
  border-radius: 10px;
}

.funfact-page .funfact-note p {
  margin: 0;
  color: var(--text);
  line-height: 1.6;
}

@media (max-width: 700px) {
  .funfact-page .funfact-hero {
    padding: 1.35rem;
  }

  .funfact-page .funfact-hero h1 {
    font-size: 1.65rem;
  }

  .funfact-page .funfact-workflow {
    grid-template-columns: 1fr;
  }

  .funfact-page .loop-chain {
    flex-direction: column;
    align-items: flex-start;
  }

  .funfact-page .loop-chain span:not(:last-child)::after {
    content: "";
    margin-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .funfact-page > section,
  .funfact-page .funfact-hero::after,
  .funfact-page .workflow-step,
  .funfact-page .workflow-step.is-pulsing,
  .funfact-page .workflow-icon,
  .funfact-page .loop-chain span {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- Publications ---------- */
.publication-section {
  margin-top: 3rem;
}

.publication-section > h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.25rem;
}

/* .publication-item handles only spacing/border (never transformed), so the
   flex columns keep a stable width before and after scrolling. */
.publication-item {
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
}

.publication-item:last-child {
  border-bottom: none;
}

/* The inner wrapper is the flex container AND the transformed parallax element.
   It reads --parallax-y inherited from the article. */
.publication-motion-inner {
  display: flex;
  gap: 1.25rem;
  transform: translate3d(0, var(--parallax-y, 0px), 0);
  will-change: transform;
}

/* .parallax-reveal handles only opacity reveal — no transform here. */
.parallax-reveal {
  --parallax-y: 0px;
  opacity: 1;
  will-change: opacity;
}

/* JS adds this only after page load to items below the initial viewport */
.parallax-reveal.is-prepared {
  opacity: 0;
}

/* Reveal offset lives on the inner wrapper, composed with --parallax-y */
.parallax-reveal.is-prepared .publication-motion-inner {
  transform: translate3d(0, calc(var(--parallax-y, 0px) + 28px), 0);
}

/* Triggered when the user scrolls the item into view */
.parallax-reveal.is-visible {
  opacity: 1;
  transition: opacity 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.parallax-reveal.is-visible:not(.is-parallax) .publication-motion-inner {
  transform: translate3d(0, var(--parallax-y, 0px), 0);
  transition: transform 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* After reveal is complete, JS drives --parallax-y live (no transition) */
.parallax-reveal.is-parallax .publication-motion-inner {
  transition: none;
}


.publication-meta {
  flex: 0 0 4.5rem;
}

.publication-year {
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  padding-top: 0.15rem;
}

.publication-body {
  flex: 1 1 auto;
  min-width: 0;
}

.publication-body h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
}

.authors {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.venue {
  margin: 0 0 0.25rem;
  font-size: 0.9rem;
  color: var(--text);
}

.links {
  margin: 0.5rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.links a {
  display: inline-block;
  font-size: 0.85rem;
  padding: 0.15rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--accent);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    border-color var(--transition-fast),
    background-color var(--transition-fast),
    color var(--transition-fast);
}

.links a:hover {
  transform: translateY(-1px);
  border-color: var(--soft-blue-border);
  box-shadow: var(--soft-shadow);
  background-color: #ffffff;
  color: var(--link-blue-dark);
  text-decoration: none;
}

/* ---------- Academic Service ---------- */
.service-section {
  margin-top: 3.25rem;
}

.service-section > h2 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.service-group {
  margin-bottom: 1.6rem;
}

.service-group:last-child {
  margin-bottom: 0;
}

/* Reviewer: emphasize conference names */
.service-venue {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
}

.service-venue a {
  color: var(--text);
}

.service-venue a:hover {
  color: var(--accent);
}

/* Organization: CV-style role headings */
.service-role {
  margin: 0 0 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.service-list {
  margin: 0;
  padding-left: 1.25rem;
  list-style: disc;
}

.service-list li {
  margin: 0.3rem 0;
  line-height: 1.55;
}

.service-years {
  color: var(--muted);
  font-size: 0.92rem;
}

/* Invited Talks: horizontal cards */
.talk-card {
  display: flex;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}

.talk-card:last-child {
  margin-bottom: 0;
}

.talk-title {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.4;
}

.talk-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.9rem;
}

.talk-type {
  color: var(--accent);
  font-weight: 600;
}

.talk-date {
  color: var(--muted);
}

.talk-body .links {
  margin-top: 0.7rem;
}

/* ---------- Academic Service: vertical timeline ---------- */
.timeline-section {
  margin-top: 2.75rem;
  margin-bottom: 3.5rem;
}

.timeline {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  padding: 0.5rem 0 1rem;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  transform: translateX(-50%);
  background: linear-gradient(
    to bottom,
    transparent 0%,
    rgba(47, 95, 143, 0.18) 4%,
    rgba(47, 95, 143, 0.30) 50%,
    rgba(47, 95, 143, 0.18) 96%,
    transparent 100%
  );
}

.timeline-year {
  position: relative;
  z-index: 3;
  width: fit-content;
  margin: 1.6rem auto 1.25rem;
  padding: 0.36rem 0.95rem;
  border: 1px solid rgba(47, 95, 143, 0.28);
  border-radius: 999px;
  background: #ffffff;
  color: #2f5f8f;
  font-size: 0.95rem;
  font-weight: 700;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.045);
}

.timeline-item {
  position: relative;
  width: 50%;
  margin-bottom: 1.35rem;
}

.timeline-left {
  left: 0;
  padding-right: 2.2rem;
  text-align: right;
}

.timeline-right {
  left: 50%;
  padding-left: 2.2rem;
  text-align: left;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 1.25rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #2f5f8f;
  border: 3px solid #ffffff;
  box-shadow: 0 0 0 4px rgba(47, 95, 143, 0.13);
  z-index: 3;
}

.timeline-left::before {
  right: -8px;
}

.timeline-right::before {
  left: -8px;
}

.timeline-card {
  position: relative;
  padding: 1rem 1.05rem;
  border: 1px solid #e5e8ec;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.045);
  transition:
    transform 250ms ease,
    box-shadow 250ms ease,
    border-color 250ms ease;
}

.timeline-card:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 95, 143, 0.28);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.08);
}

.timeline-date {
  display: block;
  margin-bottom: 0.35rem;
  color: #666;
  font-size: 0.82rem;
  font-weight: 600;
}

.timeline-type {
  display: inline-flex;
  margin-bottom: 0.45rem;
  padding: 0.18rem 0.52rem;
  border-radius: 999px;
  background: rgba(47, 95, 143, 0.075);
  color: #2f5f8f;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.timeline-card h3 {
  margin: 0 0 0.45rem;
  color: #222;
  font-size: 1rem;
  line-height: 1.35;
}

.timeline-card p {
  margin: 0.25rem 0;
  color: #333;
  line-height: 1.55;
}

.timeline-card ul {
  margin: 0.45rem 0 0;
  padding-left: 1.1rem;
}

.timeline-left .timeline-card ul {
  direction: ltr;
  display: inline-block;
  text-align: left;
}

.timeline-card li {
  margin-bottom: 0.25rem;
  line-height: 1.5;
}

/* One-time reveal on scroll */
.reveal-on-scroll {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 400ms ease, transform 400ms ease;
}

.reveal-on-scroll.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 800px) {
  .timeline {
    padding-left: 0.5rem;
  }

  .timeline::before {
    left: 12px;
  }

  .timeline-year {
    margin-left: 0;
    margin-right: auto;
  }

  .timeline-item,
  .timeline-left,
  .timeline-right {
    width: 100%;
    left: 0;
    padding-left: 2.2rem;
    padding-right: 0;
    text-align: left;
  }

  .timeline-left::before,
  .timeline-right::before {
    left: 4px;
    right: auto;
  }

  .timeline-left .timeline-card ul {
    display: block;
  }
}

/* Activity Gallery — Masonry */
.gallery-section {
  margin-top: 3rem;
}

.masonry-gallery {
  column-count: 3;
  column-gap: 1rem;
  max-width: 1100px;
  margin: 0 auto;
}

.masonry-item {
  break-inside: avoid;
  margin: 0 0 1rem;
  border-radius: 12px;
  overflow: hidden;
  background: #f5f5f5;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.masonry-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 12px;
  transition: transform 300ms ease;
  will-change: transform;
}

/* Hover-only zoom */
.masonry-item:hover img {
  transform: scale(1.03);
}

/* Lightbox modal */
.gallery-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.82);
  z-index: 9999;
}

.gallery-modal.active {
  display: flex;
}

.gallery-modal img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
}

.gallery-modal-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  border: none;
  background: transparent;
  color: white;
  font-size: 2.5rem;
  line-height: 1;
  cursor: pointer;
}

/* Masonry: 2 columns on tablets */
@media (max-width: 900px) {
  .masonry-gallery {
    column-count: 2;
  }
}

/* ---------- Mobile ---------- */
@media (max-width: 600px) {
  .nav-toggle-label {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    height: 48px;
    cursor: pointer;
  }

  .nav-toggle-label span {
    display: block;
    width: 26px;
    height: 2px;
    background: var(--text);
  }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 0;
    padding: 0 0 0.75rem;
  }

  .nav-links li {
    width: 100%;
    text-align: center;
  }

  .nav-links a {
    display: block;
    padding: 0.65rem 0;
  }

  .nav-toggle:checked ~ .nav-links {
    display: flex;
  }

  .profile-image {
    width: 150px;
    height: 150px;
  }

  .publication-motion-inner {
    flex-direction: column;
    gap: 0.35rem;
  }

  .publication-meta {
    flex-basis: auto;
  }

  .publication-year {
    padding-top: 0;
  }

  .masonry-gallery {
    column-count: 1;
  }

  .gallery-modal {
    padding: 1rem;
  }
}

/* ---------- Accessibility: respect reduced-motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }

  /* Keep reveal content visible without motion */
  .reveal-on-scroll {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .parallax-reveal,
  .parallax-reveal.is-prepared,
  .parallax-reveal.is-visible,
  .parallax-reveal.is-parallax {
    opacity: 1 !important;
    transition: none !important;
  }

  .publication-motion-inner {
    transform: none !important;
    transition: none !important;
  }

  .masonry-item img,
  .gallery-item img,
  .timeline-card,
  .research-tag {
    transition: none;
  }
}
