/* =========================================================
   Yifan Yuan · Homepage
   Layout follows the AcademicPages / WowPage look (sidebar +
   single content column). Palette is sampled from the portrait
   background (#9ea8be) and deepened for readable text.
   ========================================================= */

/* Self-hosted fonts (Google Fonts is unreliable in mainland China):
   Inter for text, Fraunces for headings and venue names, Ma Shan Zheng
   brush calligraphy (subset to the heading characters) for Chinese headings. */
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-semibold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-semibold-italic.woff2") format("woff2");
  font-weight: 600;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Ma Shan Zheng Subset";
  src: url("../fonts/mashanzheng-subset.woff2") format("woff2");
  font-display: swap;
}

:root {
  --text: #494e57;
  --text-muted: #7a8190;
  --text-soft: #5d6370;
  --text-faint: #6b7280;
  --heading: #20242c;
  --photo: #9ea8be;            /* portrait background */
  --accent: #506695;           /* links, active states (5.7:1 on white) */
  --accent-strong: #3d507b;    /* hover */
  --accent-heading: #6278a7;   /* hand-written heading */
  --accent-soft: #f3f5fa;
  --accent-border: #d1d7e6;
  --accent-deep: #3b4c72;      /* text on soft fills */
  --venue: #5c6984;
  --glow: rgba(80, 102, 149, 0.1);
  --border: #eceff4;
  --card-border: #dde2ea;
  --panel: #f5f6f9;
  --card: #f8f9fb;
  --shadow: 0 4px 10px rgba(36, 52, 88, 0.06);
  --shadow-hover: 0 12px 26px rgba(36, 52, 88, 0.12);
  --ease-out: cubic-bezier(0.2, 0.65, 0.3, 1);
  /* MUSE Lab logo colours */
  --muse-navy: #14294a;
  --muse-sky: #aee8f8;
  --muse-orange: #f7923f;
  --muse-orange-deep: #ad4f15;   /* orange text on light fills (4.9:1) */
  --muse-orange-soft: #fff2e6;
  --masthead-h: 70px;
  --font: "Inter", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC",
    "Source Han Sans SC", system-ui, sans-serif;
  --font-display: "Fraunces", "Ma Shan Zheng Subset", "Kaiti SC", "STKaiti", "KaiTi", Georgia, serif;
  --font-brush: "Ma Shan Zheng Subset", "Kaiti SC", "STKaiti", "KaiTi", serif;
  color-scheme: light;
}

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

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background: #fff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* the brush font has a single weight: never fake-bold it */
  font-synthesis-weight: none;
}

/* ---------- bilingual switch ---------- */
.lang-en .zh,
.lang-zh .en {
  display: none !important;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.25s ease;
}

a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
  text-underline-offset: 3px;
}

img {
  max-width: 100%;
}

.icon {
  width: 16px;
  height: 16px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid var(--card-border);
  border-radius: 6px;
}

.skip-link:focus {
  left: 12px;
}

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

/* ---------- masthead ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--masthead-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  transition: box-shadow 0.3s ease;
}

.masthead.is-scrolled {
  box-shadow: 0 6px 22px rgba(31, 45, 77, 0.07);
}

.scroll-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  pointer-events: none;
}

.scroll-progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--photo), var(--accent));
  transform: scaleX(var(--progress, 0));
  transform-origin: left center;
}

.masthead__inner {
  position: relative;
  max-width: 1280px;
  height: 100%;
  margin: 0 auto;
  padding: 0 1em;
  display: flex;
  align-items: center;
}

.site-title {
  margin-right: 2.2rem;
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.site-title:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-nav {
  display: flex;
  align-items: center;
  min-width: 0;
}

.site-nav a {
  position: relative;
  margin: 0 0.9rem;
  padding: 0.5rem 0;
  font-size: 16px;
  color: var(--text-muted);
  white-space: nowrap;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}

.site-nav a:hover,
.site-nav a.is-active {
  color: var(--text);
  text-decoration: none;
}

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

/* the lab entry stands out as an outlined pill */
.site-nav a.nav-lab {
  margin-left: 0.6rem;
  padding: 5px 13px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.site-nav a.nav-lab::after {
  display: none;
}

.site-nav a.nav-lab:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.masthead__tools {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
}

.lang-switch {
  display: inline-flex;
  padding: 3px;
  border: 1px solid #e3e7ee;
  border-radius: 999px;
  background: var(--panel);
}

.lang-switch button {
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.lang-switch button:hover {
  color: var(--text);
}

.lang-en .lang-switch [data-set-lang="en"],
.lang-zh .lang-switch [data-set-lang="zh"] {
  background: var(--accent);
  color: #fff;
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid #e3e7ee;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.masthead.is-open .nav-toggle span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.masthead.is-open .nav-toggle span:nth-child(2) {
  opacity: 0;
}

.masthead.is-open .nav-toggle span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ---------- page layout ---------- */
.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 30px 15px 0;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  column-gap: 45px;
}

.sidebar {
  position: sticky;
  top: calc(var(--masthead-h) + 30px);
  align-self: start;
}

/* Full, uncropped portrait without a frame (tilts gently on hover). */
.author__avatar {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  transition: transform 0.35s var(--ease-out);
  will-change: transform;
}

.author__name {
  margin: 14px 0 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--heading);
}

.author__title {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.45;
}

.title-sep {
  display: none;
}

/* personal motto in brush calligraphy (shown in both languages, glossed in English) */
.author__bio {
  margin: 10px 0 0;
  line-height: 1.4;
}

.author__motto {
  display: block;
  font-family: var(--font-brush);
  font-size: 19px;
  letter-spacing: 0.08em;
  color: var(--accent-heading);
}

.author__motto-en {
  display: block;
  margin-top: 1px;
  font-family: var(--font-display);
  font-size: 12px;
  font-style: italic;
  color: var(--text-muted);
}

.follow-btn {
  display: none;
}

.author__urls {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
}

.author__urls li {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 9px;
  font-size: 13px;
  line-height: 1.4;
}

.author__urls a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: inherit;
  transition: color 0.2s ease, translate 0.2s ease;
}

.author__urls a:hover {
  color: var(--accent);
  text-decoration: none;
  translate: 3px 0;
}

.author__urls .icon--accent {
  color: var(--accent);
}

.author__urls .icon--szu {
  color: #a3174a;
}

/* ---------- content ---------- */
.page__content {
  min-width: 0;
  padding-bottom: 2.5em;
}

.page__content p {
  margin: 0 0 1.1em;
}

.section {
  scroll-margin-top: calc(var(--masthead-h) + 12px);
}

.page__content h2 {
  position: relative;
  margin: 1.8em 0 0.8em;
  padding-bottom: 0.45em;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-display);
  font-size: 1.45em;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0.005em;
  color: var(--heading);
}

.page__content h2::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -2px;
  width: 46px;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--photo));
  transform-origin: left center;
  transition: transform 0.9s var(--ease-out) 0.25s;
}

.main-heading {
  margin: 0 0 0.2em;
  font-family: var(--font-display);
  font-size: 2em;
  font-style: italic;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.005em;
  text-align: center;
  color: var(--accent-heading);
}

.main-heading .zh {
  font-style: normal;
  letter-spacing: 0.04em;
}

.wave {
  display: inline-block;
  transform-origin: 70% 70%;
  animation: wave 2.6s ease-in-out infinite;
}

@keyframes wave {
  0%, 60%, 100% { transform: rotate(0deg); }
  10%, 30% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(-4deg); }
  50% { transform: rotate(10deg); }
}

/* tagline under the greeting; the keyword gets a highlighter stroke that draws in */
.page__content .tagline {
  margin: 0 0 1.4em;
  text-align: center;
  font-size: 15px;
  color: var(--text-muted);
}

.hl {
  padding: 0 3px;
  background: linear-gradient(transparent 58%, rgba(158, 168, 190, 0.42) 58%) no-repeat 0 0 / 100% 100%;
  font-weight: 700;
  color: var(--accent);
}

.js-reveal .tagline .hl {
  transition: background-size 0.9s var(--ease-out) 0.55s;
}

.js-reveal .tagline:not(.is-visible) .hl {
  background-size: 0% 100%;
}

/* ---------- news ---------- */
.news-box {
  max-height: 312px;
  overflow-y: auto;
  margin-bottom: 20px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--panel);
  scrollbar-width: thin;
  scrollbar-color: rgba(80, 102, 149, 0.35) transparent;
}

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

.news-list li {
  margin-bottom: 10px;
  line-height: 1.5;
}

.news-list li:last-child {
  margin-bottom: 0;
}

.news-date {
  display: inline-block;
  min-width: 70px;
  font-style: italic;
  color: var(--accent);
}

/* ---------- MUSE Lab entry ---------- */
/* painting & music backdrop drawn by the inline .lab-art SVG */
.lab-banner {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 20px;
  margin: 4px 0 22px;
  padding: 20px 22px;
  border: 1px solid #e5ecf3;
  border-radius: 16px;
  background: linear-gradient(115deg, #fffaf2 0%, #fdfdfb 42%, #eef8fd 100%);
  box-shadow: var(--shadow);
  transition: transform 0.25s ease, box-shadow 0.3s ease;
}

.lab-banner:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}

.lab-art {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  /* fade the artwork out behind the text, full strength on the right */
  -webkit-mask-image: linear-gradient(90deg, transparent 18%, rgba(0, 0, 0, 0.35) 42%, #000 68%);
  mask-image: linear-gradient(90deg, transparent 18%, rgba(0, 0, 0, 0.35) 42%, #000 68%);
}

.lab-banner > :not(.lab-art) {
  position: relative;
  z-index: 1;
}

.lab-art__wash circle {
  opacity: 0.6;
  transform-box: fill-box;
  transform-origin: center;
  animation: wash-drift 11s ease-in-out infinite alternate;
}

.lab-art__wash circle:nth-child(2) { animation-delay: -3s; }
.lab-art__wash circle:nth-child(3) { animation-delay: -6s; }
.lab-art__wash circle:nth-child(4) { animation-delay: -8s; }

@keyframes wash-drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-14px, 8px) scale(1.12); }
}

.lab-art__notes use {
  transform-box: fill-box;
  transform-origin: center;
  animation: note-float 3.8s ease-in-out infinite;
}

.lab-art__notes .n2 { animation-delay: -0.8s; }
.lab-art__notes .n3 { animation-delay: -1.6s; }
.lab-art__notes .n4 { animation-delay: -2.4s; }
.lab-art__notes .n5 { animation-delay: -3.1s; }

@keyframes note-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-7px) rotate(-6deg); }
}

.lab-art__sparks path {
  transform-box: fill-box;
  transform-origin: center;
  animation: twinkle 2.6s ease-in-out infinite;
}

.lab-art__sparks .sp2 { animation-delay: -0.9s; }
.lab-art__sparks .sp3 { animation-delay: -1.7s; }

@keyframes twinkle {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.5); opacity: 0.4; }
}

.lab-banner__logo {
  flex: none;
  width: 96px;
  height: auto;
  filter: drop-shadow(0 6px 10px rgba(20, 41, 74, 0.12));
  transition: transform 0.5s var(--ease-out);
}

.lab-banner:hover .lab-banner__logo {
  transform: rotate(-6deg) scale(1.07);
}

.lab-banner__text {
  flex: 1;
  min-width: 0;
  max-width: 560px;
  margin-right: auto;
}

.lab-banner__text strong {
  font-family: var(--font-display);
  font-size: 1.35em;
  font-weight: 600;
  color: var(--muse-navy);
}

.lab-banner__full {
  display: block;
  margin: 1px 0 6px;
  font-size: 13px;
  font-style: italic;
  color: var(--text-faint);
}

.page__content .lab-banner__text p {
  margin: 0;
  font-size: 14px;
  color: var(--text-soft);
}

.lab-banner__btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: 999px;
  background: var(--accent);
  font-size: 14px;
  color: #fff;
  box-shadow: 0 6px 14px rgba(80, 102, 149, 0.28);
  transition: background-color 0.25s ease, color 0.25s ease;
}

.lab-banner__btn:hover {
  background: var(--muse-orange);
  color: var(--muse-navy);
  text-decoration: none;
}

.lab-banner__btn .arrow {
  transition: transform 0.25s ease;
}

.lab-banner__btn:hover .arrow {
  transform: translateX(4px);
}

/* ---------- research themes ---------- */
.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 4px 0 14px;
}

/* three tinted cards whose colours hint at the theme (mist blue: vision,
   sage: trust, blush: emotion); paper tiles jump to the paper below */
.theme-card {
  --tc-bg: var(--card);
  --tc-border: #e3e8ef;
  --tc-accent: var(--accent);
  --tc-seal: var(--photo);
  display: flex;
  flex-direction: column;
  padding: 18px 16px 16px;
  border: 1px solid var(--tc-border);
  border-radius: 14px;
  background-color: var(--tc-bg);
  box-shadow: var(--shadow);
}

.theme-card--visual {
  --tc-bg: #eef5f8;
  --tc-border: #d5e6ed;
  --tc-accent: #44707f;
  --tc-seal: #6d97a8;
  --glow: rgba(68, 112, 127, 0.13);
}

.theme-card--trust {
  --tc-bg: #eff4ee;
  --tc-border: #d8e5d6;
  --tc-accent: #4a6f4f;
  --tc-seal: #7b9d7c;
  --glow: rgba(74, 111, 79, 0.13);
}

.theme-card--affect {
  --tc-bg: #f9eff1;
  --tc-border: #eed9de;
  --tc-accent: #94525f;
  --tc-seal: #bd8492;
  --glow: rgba(148, 82, 95, 0.12);
}

.theme-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

/* seal stamp with a brush-written character */
.theme-seal {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--tc-seal);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.5), 0 6px 14px rgba(36, 52, 88, 0.1);
  font-family: var(--font-brush);
  font-size: 31px;
  line-height: 1;
  color: #fff;
  transform: rotate(-6deg);
  transition: transform 0.4s var(--ease-out);
}

.theme-card:hover .theme-seal {
  transform: rotate(0deg) scale(1.06);
}

.page__content .theme-card__title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.3;
  color: var(--heading);
  text-wrap: balance;
}

.lang-zh .page__content .theme-card__title {
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.page__content .theme-card p {
  margin: 0 0 4px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-soft);
}

/* paper tags: each one jumps to the paper below */
.theme-card__refs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
}

.theme-card__refs a {
  padding: 2px 10px;
  border: 1px solid var(--tc-border);
  border-radius: 999px;
  background: #fff;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--tc-accent);
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.theme-card__refs a:hover {
  border-color: var(--tc-accent);
  background: var(--tc-accent);
  color: #fff;
  text-decoration: none;
}

.applications {
  font-size: 14px;
  color: var(--text-soft);
}

.applications strong {
  color: var(--text);
}

/* ---------- experience ---------- */
.experience-container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.experience-card {
  display: flex;
  align-items: center;
  padding: 16px;
  border-radius: 12px;
  background-color: var(--card);
  box-shadow: var(--shadow);
}

/* every logo sits on a small white tile */
.experience-logo {
  flex: none;
  box-sizing: border-box;
  width: 60px;
  height: 60px;
  margin-right: 20px;
  padding: 5px;
  border: 1px solid #e3e7ee;
  border-radius: 10px;
  background: #fff;
  object-fit: contain;
}

.experience-info {
  font-family: "Segoe UI", var(--font);
}

.experience-info strong {
  font-size: 1.1em;
  color: var(--text);
}

.experience-info em,
.experience-info a {
  color: var(--text);
}

/* ---------- shared card interactions ---------- */
.theme-card,
.experience-card,
.publication-card {
  transition: transform 0.25s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.theme-card:hover,
.experience-card:hover,
.publication-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

/* soft light that follows the pointer (coordinates set in main.js) */
.spotlight {
  background-image: radial-gradient(420px circle at var(--mx, -999px) var(--my, -999px), var(--glow), transparent 62%);
}

/* ---------- publications ---------- */
.pub-button-container {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 20px 0 12px;
}

.pub-button {
  padding: 8px 16px;
  border: 1px solid #cfd5e0;
  border-radius: 20px;
  background: #f1f3f7;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.pub-button:hover {
  background: #e4e8ef;
}

.pub-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.pub-legend {
  font-size: 14px;
}

.publication-view[hidden] {
  display: none !important;
}

.publication-view {
  animation: view-in 0.45s var(--ease-out) both;
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.publication-card {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding: 6px;
  border: 1.5px solid var(--card-border);
  border-radius: 10px;
  background-color: #fff;
  color: var(--text-soft);
  scroll-margin-top: calc(var(--masthead-h) + 20px);
}

.publication-card:hover {
  border-color: var(--accent-border);
}

.pub-media {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 280px;
  height: 158px;
  margin-right: 20px;
  padding: 6px;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.pub-media img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  transition: transform 0.45s var(--ease-out);
}

.publication-card:hover .pub-media img {
  transform: scale(1.04);
}

/* Placeholder tile for papers without a figure (see README). */
.venue-tile {
  flex-direction: column;
  gap: 2px;
  background:
    radial-gradient(circle at 1px 1px, rgba(80, 102, 149, 0.17) 1px, transparent 1.3px) 0 0 / 12px 12px,
    linear-gradient(135deg, #f3f5fa 0%, #dfe5f0 100%);
  color: var(--accent-deep);
  text-align: center;
  user-select: none;
}

.venue-tile__name {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 28px;
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.venue-tile--long .venue-tile__name {
  font-size: 21px;
}

.venue-tile__year {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.3em;
  opacity: 0.85;
}

.pub-body {
  min-width: 0;
  padding: 8px 12px 8px 0;
}

.pub-title {
  display: block;
  font-size: 15px;
  line-height: 1.4;
  color: var(--heading);
}

.pub-authors {
  margin: 4px 0;
  font-size: 13px;
  font-style: italic;
  color: var(--text-faint);
}

.pub-authors .me,
.pub-list-authors .me {
  font-weight: 700;
  color: var(--accent);
}

.page__content .pub-desc {
  margin: 6px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-soft);
}

.pub-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
  margin-top: 6px;
}

/* venue names stand out in the logo's orange, set in Fraunces italic */
.pub-venue {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 1px 11px 2px 9px;
  border: 1px solid #f6cba3;
  border-radius: 7px;
  background: linear-gradient(120deg, #fff6ee 0%, var(--muse-orange-soft) 100%);
  font-family: var(--font-display);
  font-size: 15px;
  font-style: italic;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--muse-orange-deep);
}

.pub-venue::before {
  content: "\2726";
  font-style: normal;
  font-size: 12px;
  color: var(--muse-orange);
}

.pub-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  padding: 2px 8px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.01em;
  color: var(--accent-deep);
  white-space: nowrap;
}

.pub-badge::before {
  content: "";
  width: 0.45em;
  height: 0.45em;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.75;
}

#full-publications {
  max-height: 460px;
  overflow-y: auto;
  margin-bottom: 24px;
  padding-right: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(80, 102, 149, 0.4) var(--accent-soft);
}

#full-publications::-webkit-scrollbar,
.news-box::-webkit-scrollbar {
  width: 8px;
}

#full-publications::-webkit-scrollbar-track {
  border-radius: 999px;
  background: var(--accent-soft);
}

#full-publications::-webkit-scrollbar-thumb,
.news-box::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(80, 102, 149, 0.4);
}

.full-publication-list,
.grant-list {
  margin: 0;
  padding-left: 1.6rem;
  font-size: 15px;
  line-height: 1.55;
  color: var(--text-soft);
}

.grant-list {
  list-style: none;
  padding-left: 0;
}

.full-publication-list li,
.grant-list li {
  margin-bottom: 14px;
  padding-left: 2px;
  border-radius: 6px;
  scroll-margin-top: 20px;
}

.full-publication-list li::marker {
  font-size: 13px;
  color: var(--text-muted);
}

.pub-list-badge {
  display: inline-block;
  margin-right: 6px;
  padding: 2px 8px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  color: var(--accent-deep);
  vertical-align: 1px;
  white-space: nowrap;
}

.pub-list-badge--muted {
  border-color: #e3e6ea;
  background: #f4f5f7;
  color: var(--text-faint);
}

.pub-list-badge--solid {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.pub-list-title {
  font-weight: 700;
  line-height: 1.45;
  color: var(--heading);
}

.pub-list-authors {
  font-size: 13px;
  font-style: italic;
  color: var(--text-faint);
}

.pub-list-note {
  font-size: 13px;
  font-style: italic;
  font-weight: 700;
  color: var(--venue);
}

.pub-list-links a {
  margin-left: 4px;
  font-size: 13px;
  font-weight: 700;
}

.flash {
  animation: flash 1.8s ease;
}

@keyframes flash {
  0%, 100% { box-shadow: 0 0 0 0 rgba(80, 102, 149, 0); }
  25% { box-shadow: 0 0 0 4px rgba(80, 102, 149, 0.4); }
}

/* ---------- grants ---------- */
.grant-more {
  margin-top: 4px;
  border-top: 1px dashed #e1e5ec;
  padding-top: 12px;
}

.grant-more summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.grant-more summary:hover {
  color: var(--accent);
}

.grant-more[open] summary {
  margin-bottom: 12px;
}

/* ---------- back to top ---------- */
.to-top {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--accent-border);
  border-radius: 50%;
  background: #fff;
  color: var(--accent);
  box-shadow: 0 8px 20px rgba(36, 52, 88, 0.14);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  translate: 0 14px;
  transition: opacity 0.3s ease, translate 0.3s var(--ease-out), background-color 0.2s ease, color 0.2s ease;
}

.to-top.is-shown {
  opacity: 1;
  pointer-events: auto;
  translate: 0 0;
}

.to-top:hover {
  background: var(--accent);
  color: #fff;
}

/* edit button: only on a device signed in at admin/ (see the script at the end of index.html) */
.edit-entry {
  position: fixed;
  bottom: 22px;
  left: 22px;
  z-index: 40;
  padding: 10px 16px;
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  font: 600 13.5px/1 var(--font);
  color: var(--accent-deep);
  box-shadow: 0 8px 20px rgba(36, 52, 88, 0.14);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.edit-entry:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.to-top .icon {
  width: 18px;
  height: 18px;
}

/* ---------- scroll reveal ----------
   html.js-reveal is set before first paint only when JS, IntersectionObserver
   and motion are available; main.js adds .is-visible as blocks enter view. */
.js-reveal :is(.author > *, .main-heading, .tagline, .page__content > p, .section > h2, .section > p,
  .news-list li, .lab-banner, .theme-card, .applications, .pub-button-container, .pub-legend,
  #core-publications .publication-card, .experience-card, .grant-list > li, .grant-more, #service li) {
  transition: opacity 0.75s var(--ease-out) var(--reveal-delay, 0s), translate 0.75s var(--ease-out) var(--reveal-delay, 0s),
    transform 0.25s ease, box-shadow 0.3s ease, border-color 0.3s ease, color 0.25s ease;
}

.js-reveal :is(.author > *, .main-heading, .tagline, .page__content > p, .section > h2, .section > p,
  .news-list li, .lab-banner, .theme-card, .applications, .pub-button-container, .pub-legend,
  #core-publications .publication-card, .experience-card, .grant-list > li, .grant-more, #service li):not(.is-visible) {
  opacity: 0;
  translate: 0 24px;
}

.js-reveal .section > h2:not(.is-visible)::after {
  transform: scaleX(0);
}

/* the seal is "stamped" once its card has floated up
   (uses scale/opacity so the hover transform keeps its own timing) */
.js-reveal .theme-card .theme-seal {
  transition: transform 0.4s var(--ease-out),
    scale 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) calc(var(--reveal-delay, 0s) + 0.3s),
    opacity 0.3s ease calc(var(--reveal-delay, 0s) + 0.3s);
}

.js-reveal .theme-card:not(.is-visible) .theme-seal {
  scale: 1.7;
  opacity: 0;
}


/* ---------- 404 button ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--accent);
  font-size: 14px;
  color: #fff;
  box-shadow: 0 4px 10px rgba(80, 102, 149, 0.3);
}

.btn:hover {
  background: var(--accent-strong);
  color: #fff;
  text-decoration: none;
}

/* ---------- footer ---------- */
.page__footer {
  margin-top: 2em;
  border-top: 1px solid var(--border);
  background: #f9fafc;
  color: var(--text-muted);
}

.page__footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.6em 1em 2em;
  font-size: 12px;
}

.page__footer a {
  color: var(--text-muted);
}

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

.page__footer-follow {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.page__footer-follow a {
  margin-left: 10px;
}

/* ---------- responsive ---------- */
@media (max-width: 1320px) {
  .site-nav a {
    margin: 0 0.6rem;
    font-size: 15.5px;
  }

  .site-title {
    margin-right: 1.2rem;
  }

  .theme-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .theme-card:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 1100px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    display: none;
    position: absolute;
    top: var(--masthead-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    padding: 6px 0 12px;
    background: #fff;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 12px 24px rgba(31, 45, 77, 0.08);
  }

  .masthead.is-open .site-nav {
    display: flex;
  }

  .site-nav a {
    margin: 0;
    padding: 11px 22px;
    font-size: 16px;
  }

  .site-nav a::after {
    left: 0;
    right: auto;
    top: 10px;
    bottom: 10px;
    width: 3px;
    height: auto;
    transform: scaleY(0);
  }

  .site-nav a:hover::after,
  .site-nav a.is-active::after {
    transform: scaleY(1);
  }

  .site-nav a.nav-lab {
    align-self: flex-start;
    margin: 6px 22px 0;
    padding: 7px 14px;
  }
}

@media (max-width: 1024px) {
  .layout {
    display: block;
    padding: 18px 16px 0;
  }

  .sidebar {
    position: relative;
    top: 0;
    z-index: 20;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
  }

  .author {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr) auto;
    column-gap: 14px;
    align-items: center;
  }

  .author__avatar {
    width: 72px;
    border-radius: 6px;
  }

  .author__name {
    margin: 0;
  }

  .author__title {
    margin-top: 2px;
    font-size: 11.5px;
  }

  .author__title br {
    display: none;
  }

  .title-sep {
    display: inline;
  }

  .author__bio {
    margin-top: 2px;
  }

  .author__urls-wrapper {
    position: relative;
  }

  .follow-btn {
    display: inline-block;
    padding: 6px 14px;
    border: 1px solid #d5dae3;
    border-radius: 999px;
    background: #fff;
    font: inherit;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
  }

  .author__urls-wrapper.is-open .follow-btn {
    border-color: var(--accent);
    color: var(--accent);
  }

  .author__urls {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    min-width: 250px;
    margin: 0;
    padding: 14px 16px 6px;
    border: 1px solid #e3e7ee;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 28px rgba(31, 45, 77, 0.14);
  }

  .author__urls-wrapper.is-open .author__urls {
    display: block;
  }
}

@media (max-width: 720px) {
  .site-title {
    font-size: 16px;
  }

  .main-heading {
    font-size: 1.4em;
  }

  .lab-banner {
    flex-wrap: wrap;
    gap: 14px;
  }

  .lab-banner__logo {
    width: 70px;
  }

  /* on phones the artwork becomes a band along the bottom edge */
  .lab-art {
    top: auto;
    height: 130px;
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 55%);
    mask-image: linear-gradient(180deg, transparent 0%, #000 55%);
  }

  .lab-banner__text {
    flex-basis: calc(100% - 80px);
  }

  .theme-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .experience-card {
    align-items: flex-start;
    padding: 14px;
  }

  .experience-logo {
    width: 46px;
    height: 46px;
    margin-right: 14px;
  }

  .publication-card {
    flex-direction: column;
    align-items: stretch;
    padding: 8px;
  }

  .pub-media {
    width: 100%;
    height: auto;
    margin: 0 0 10px;
  }

  .pub-media img {
    width: 100%;
  }

  .venue-tile {
    flex-direction: row;
    gap: 10px;
    height: 64px;
  }

  .venue-tile__name,
  .venue-tile--long .venue-tile__name {
    font-size: 21px;
  }

  .pub-body {
    padding: 0 4px 4px;
  }

  .full-publication-list {
    padding-left: 1.2rem;
  }

  .to-top {
    right: 14px;
    bottom: 14px;
  }
}

@media (max-width: 420px) {
  .lang-switch button {
    padding: 6px 9px;
  }

  .site-title {
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .wave,
  .flash,
  .publication-view,
  .lab-art * {
    animation: none !important;
  }

  * {
    transition: none !important;
  }
}

@media print {
  .masthead,
  .follow-btn,
  .pub-button-container,
  .to-top,
  .edit-entry,
  .page__footer {
    display: none !important;
  }

  .layout {
    display: block;
  }

  .sidebar {
    position: static;
  }

  #full-publications {
    max-height: none;
  }

  .js-reveal * {
    opacity: 1 !important;
    translate: none !important;
  }
}
