:root {
  --bg: #fbf2fb;
  --panel: rgba(255, 249, 253, 0.88);
  --text: #000000;
  --muted: #000000;
  --strong: #000000;
  --accent: #8b1e78;
  --accent-2: #5a2477;
  --link: #7a1f8a;
  --link-visited: #6b2f8f;
  --link-hover: #ad2a8e;
  --border: #e7c9e5;
  --topbar-bg: rgba(255, 249, 253, 0.92);
  --control-bg: rgba(255, 249, 253, 0.88);
  --control-border: #d8afd7;
  --control-border-hover: #b66aac;
  --menu-hover: #f4d9f0;
  --menu-shadow: rgba(77, 31, 88, 0.18);
  --code-bg: #f6dff1;
  --code-text: #000000;
  --tag-bg: #f2c8e9;
  --tag-text: #000000;
  --news-badge-bg: #ead0ee;
  --news-badge-text: #000000;
  --button-text: #fff7fc;
  --focus-ring: rgba(139, 30, 120, 0.18);
  --background-image-opacity: 0.28;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  isolation: isolate;
  overflow-x: hidden;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: -12vmax;
  z-index: -1;
  pointer-events: none;
  background-image: url("../assets/images/background.jpeg");
  background-position: center;
  background-size: cover;
  filter: blur(18px) saturate(1.08);
  opacity: var(--background-image-opacity);
  transform: translate3d(-2%, -2%, 0) scale(1.12);
  will-change: transform;
  animation: histologyBackgroundDrift 22s ease-in-out infinite alternate;
}

a {
  color: var(--link);
  text-decoration-color: color-mix(in srgb, var(--link) 42%, transparent);
  text-underline-offset: 0.16em;
}

a:visited {
  color: var(--link-visited);
}

a:hover {
  color: var(--link-hover);
  text-decoration-color: currentColor;
}

@keyframes histologyBackgroundDrift {
  0% {
    transform: translate3d(-3%, -2%, 0) scale(1.12);
  }
  35% {
    transform: translate3d(3%, -4%, 0) scale(1.16);
  }
  70% {
    transform: translate3d(-1%, 4%, 0) scale(1.14);
  }
  100% {
    transform: translate3d(4%, 2%, 0) scale(1.16);
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }
}

.container {
  width: min(900px, 92%);
  margin: 0 auto;
}

.topbar {
  position: relative;
  z-index: 40;
  overflow: visible;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 0;
  overflow: visible;
}

.site-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  text-decoration: none;
}

.site-name:visited {
  color: var(--text);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  overflow: visible;
}

.menu-dropdown {
  position: relative;
  z-index: 45;
  overflow: visible;
}

.menu-button {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.menu-button {
  gap: 0.45rem;
  background: var(--control-bg);
  border: 1px solid var(--control-border);
  border-radius: 0.5rem;
  padding: 0.45rem 0.7rem;
}

.menu-button:hover {
  border-color: var(--control-border-hover);
}

.menu-button[aria-expanded="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--focus-ring);
}

.menu-list {
  list-style: none;
  position: absolute;
  right: 0;
  top: calc(100% + 0.5rem);
  z-index: 60;
  min-width: 11rem;
  margin: 0;
  padding: 0.35rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  box-shadow: 0 12px 28px var(--menu-shadow);
  pointer-events: auto;
}

.menu-list * {
  pointer-events: auto;
}

.menu-list[hidden] {
  display: none;
}

.menu-list a {
  display: block;
  padding: 0.45rem 0.55rem;
  color: var(--link);
  text-decoration: none;
  border-radius: 0.45rem;
}

.menu-list a:hover {
  color: var(--link-hover);
  background: var(--menu-hover);
}

.hero {
  padding: 4rem 0 3rem;
}

.hero-layout {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 2rem;
}

.hero-copy {
  min-width: 0;
}

.tag {
  display: inline-block;
  margin: 0 0 0.75rem;
  background: var(--tag-bg);
  color: var(--tag-text);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
}

.subtitle {
  margin-top: 1rem;
  color: var(--muted);
  max-width: 65ch;
}

.about-contact {
  margin-top: 0.9rem;
}

.about-contact-title {
  margin: 0 0 0.25rem;
  font-weight: 600;
}

.about-contact p {
  margin: 0;
  color: var(--muted);
}

.news-section {
  margin-top: 1.4rem;
}

.news-section h2 {
  margin: 0 0 0.75rem;
  font-size: 1.15rem;
}

.news-scroll {
  max-height: 14.5rem;
  overflow-y: auto;
  padding-right: 0.35rem;
  scrollbar-width: thin;
  scrollbar-color: var(--control-border) transparent;
}

.news-scroll::-webkit-scrollbar {
  width: 7px;
}

.news-scroll::-webkit-scrollbar-thumb {
  background: var(--control-border);
  border-radius: 999px;
}

.news-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.news-item + .news-item {
  margin-top: 0.95rem;
}

.news-date {
  display: inline-block;
  padding: 0.05rem 0.35rem;
  border-radius: 0.2rem;
  background: var(--news-badge-bg);
  color: var(--news-badge-text);
  font-weight: 600;
}

.news-item p {
  margin: 0;
  line-height: 1.45;
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.35rem;
  align-items: start;
}

.news-text {
  display: block;
  min-width: 0;
}

.news-item p:not(.news-date) {
  color: var(--muted);
}

.news-more {
  margin: 0.75rem 0 0;
}

.news-main {
  padding-top: 1.6rem;
  padding-bottom: 4rem;
}

.news-page .news-section {
  margin-top: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.news-page-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.85rem;
}

.news-page-heading h1 {
  margin: 0;
  color: var(--strong);
}

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

.news-page .news-scroll {
  max-height: none;
  overflow: visible;
  padding-right: 0;
  padding-left: 1rem;
  position: relative;
}

.news-page .news-scroll::before {
  content: "";
  position: absolute;
  left: 0.28rem;
  top: 0.15rem;
  bottom: 0.15rem;
  width: 1px;
  background: var(--control-border-hover);
}

.news-page .news-item {
  position: relative;
}

.news-page .news-item::before {
  content: "";
  position: absolute;
  left: -0.84rem;
  top: 0.55rem;
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--bg);
}

.news-page .news-item-image,
.news-page .news-item-gif {
  display: block;
  width: min(100%, 30rem);
  height: auto;
  margin-top: 0.55rem;
  border-radius: 0.5rem;
  border: 1px solid var(--border);
}

.news-empty {
  color: var(--muted);
}

.social-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.2rem;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text);
  text-decoration: none;
}

.social-link:visited {
  color: var(--text);
}

.social-link:hover {
  color: var(--text);
}

.social-link-logo {
  line-height: 0;
}

.tia-logo {
  display: block;
  width: 1.75rem;
  height: 1.75rem;
  object-fit: contain;
}

.profile-pic {
  display: block;
  width: clamp(165px, 24vw, 240px);
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--panel);
  box-shadow: 0 10px 24px var(--menu-shadow);
  margin: 0;
}

.button {
  display: inline-block;
  margin-top: 1.25rem;
  padding: 0.6rem 1rem;
  border-radius: 0.5rem;
  text-decoration: none;
  background: var(--accent);
  color: var(--button-text);
  font-weight: 600;
}

.button:hover {
  background: var(--accent-2);
}

main {
  padding-bottom: 4rem;
}

section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  padding: 1.2rem 1.3rem;
  margin-bottom: 1rem;
}

.cv-main {
  padding-top: 1.6rem;
  padding-bottom: 4rem;
}

.cv-section {
  background: transparent;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 0.15rem 0;
}

.cv-section + .cv-section {
  margin-top: 1.45rem;
  padding-top: 1.35rem;
  border-top: 1px solid var(--border);
}

.cv-section h2 {
  margin: 0 0 0.95rem;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.15;
  color: var(--strong);
}

.cv-section p {
  margin: 0;
}

.cv-section p + p {
  margin-top: 0.3rem;
}

.cv-li-entry {
  display: grid;
  grid-template-columns: 2.9rem 1fr;
  gap: 0.8rem;
  align-items: start;
  margin-top: 0;
}

.cv-li-entry-no-logo {
  grid-template-columns: 2.9rem 1fr;
}

.cv-li-entry-no-logo::before {
  content: "";
  display: block;
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--panel) 75%, transparent);
  border: 1px dashed var(--control-border);
}

.cv-li-entry + .cv-li-entry {
  margin-top: 1rem;
}

.cv-li-logo {
  display: block;
  width: 2.9rem;
  height: 2.9rem;
  object-fit: contain;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--panel) 75%, transparent);
  border: 1px solid var(--border);
  padding: 0.25rem;
}

.cv-li-content p {
  margin: 0;
}

.cv-li-title {
  font-weight: 700;
  color: var(--strong);
  line-height: 1.3;
}

.cv-li-org {
  color: var(--text);
}

.cv-award-body {
  font-style: italic;
}

.cv-li-meta {
  color: var(--muted);
  font-size: 0.92rem;
  --cv-date-height: 1.35em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.cv-date-badge {
  display: inline-flex;
  align-items: center;
  min-height: var(--cv-date-height);
  padding: 0 0.48rem;
  border-radius: 0.2rem;
  background: var(--news-badge-bg);
  color: var(--news-badge-text);
  font-weight: 600;
  line-height: 1.15;
}

.cv-flag {
  display: inline-block;
  width: auto;
  height: var(--cv-date-height);
  margin-left: 0;
  vertical-align: middle;
  transform: none;
  border-radius: 0.12rem;
}

.cv-li-bullets {
  margin: 0.04rem 0 0;
  padding-left: 1.1rem;
}

.cv-li-bullets li {
  color: var(--muted);
}

.cv-li-bullets li + li {
  margin-top: 0.02rem;
}

.cv-list {
  margin: 0;
  padding-left: 1.2rem;
}

.cv-list li + li {
  margin-top: 0.35rem;
}

.project-list {
  display: grid;
  gap: 1rem;
}

.project-item-link {
  text-decoration: none;
  color: inherit;
}

.project-item {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  align-items: start;
  padding: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 0.85rem;
  background: var(--panel);
  transition: background-color 140ms ease, border-color 140ms ease;
}

.project-item-link:hover .project-item {
  background: var(--menu-hover);
  border-color: var(--control-border-hover);
}

.project-item img {
  width: 100%;
  height: auto;
  border-radius: 0.6rem;
  border: 1px solid var(--border);
}

.project-item h2 {
  margin: 0 0 0.35rem;
}

.project-item p {
  margin: 0 0 0.5rem;
  color: var(--muted);
}

.project-detail-image {
  width: 100%;
  height: auto;
  border-radius: 0.7rem;
  border: 1px solid var(--border);
}

.project-banner-image {
  height: clamp(120px, 19vw, 185px);
  object-fit: cover;
  object-position: center;
}

.project-gallery {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 0.8rem;
}

.project-gallery img {
  width: 100%;
  height: auto;
  border-radius: 0.65rem;
  border: 1px solid var(--border);
}

.project-note {
  color: var(--muted);
  font-style: italic;
}

.publications-page .pub-main {
  padding-top: 2.4rem;
  padding-bottom: 4rem;
}

.pub-section {
  background: transparent;
  border: 0;
  border-radius: 0;
  margin: 0;
  padding: 0;
}

.pub-heading h1 {
  margin: 0;
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1.15;
  color: var(--strong);
}

.pub-heading hr {
  margin: 0.8rem 0 1.2rem;
  border: 0;
  border-top: 1px solid var(--border);
}

.pub-key-carousel {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.2rem;
}

.pub-arrow {
  width: 2.1rem;
  height: 2.1rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--link);
  cursor: pointer;
}

.pub-arrow:hover {
  color: var(--link-hover);
}

.pub-key-track-wrap {
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.pub-key-track-wrap::-webkit-scrollbar {
  display: none;
}

.pub-key-track {
  display: flex;
  gap: 0.95rem;
  padding: 0.1rem;
}

.pub-key-item {
  flex: 0 0 clamp(170px, 21vw, 240px);
  border-radius: 0.55rem;
  overflow: hidden;
  border: 1px solid var(--border);
  text-decoration: none;
  transition: transform 150ms ease, border-color 150ms ease;
}

.pub-key-item:hover {
  transform: translateY(-2px);
  border-color: var(--control-border-hover);
}

.pub-key-item img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.pub-tags {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 0;
  margin-bottom: 1rem;
}

.pub-tag-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  padding: 0.32rem 0.55rem;
  border-radius: 0.3rem;
  cursor: pointer;
}

.pub-tag-btn:hover {
  background: var(--menu-hover);
  color: var(--text);
}

.pub-tag-btn.is-active {
  color: var(--strong);
  font-weight: 600;
  background: var(--menu-hover);
}

.pub-filter-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.pub-search {
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 23rem;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  overflow: hidden;
  background: var(--panel);
}

.pub-search-input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  padding: 0.5rem 0.65rem;
  min-width: 0;
}

.pub-search-input:focus {
  outline: none;
}

.pub-search-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0.45rem 0.6rem;
  cursor: pointer;
}

.pub-search-btn:hover {
  color: var(--text);
}

.pub-reset-btn {
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  padding: 0.45rem 0.8rem;
  font: inherit;
  color: var(--text);
  background: transparent;
  cursor: pointer;
}

.pub-reset-btn:hover {
  background: var(--menu-hover);
}

.pub-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pub-item {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 0.8rem;
  background: var(--panel);
}

.pub-cover-link {
  display: block;
  border-radius: 0.55rem;
  overflow: hidden;
  border: 1px solid var(--border);
}

.pub-cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
}

.pub-item-body {
  min-width: 0;
}

.pub-item-title {
  display: inline-block;
  color: var(--link);
  font-weight: 700;
  text-decoration: none;
  line-height: 1.35;
}

.pub-item-title:hover {
  color: var(--link-hover);
}

.pub-item-authors {
  margin: 0.32rem 0 0;
  color: var(--muted);
}

.pub-item-publisher {
  margin: 0.35rem 0 0;
  color: var(--text);
  font-style: italic;
}

.pub-citation-count {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  width: fit-content;
  margin-top: 0.42rem;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.2;
}

.pub-item-links {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.55rem;
}

.pub-link-btn {
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 0.45rem;
  padding: 0.24rem 0.55rem;
  color: var(--link);
  background: transparent;
  font-size: 0.9rem;
}

.pub-link-btn:hover {
  background: var(--menu-hover);
  color: var(--link-hover);
  border-color: var(--control-border-hover);
}

.pub-empty {
  padding: 0.8rem 0;
  color: var(--muted);
}

h2 {
  margin-top: 0;
}

pre {
  margin: 0.75rem 0 0;
  padding: 0.8rem;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 0.5rem;
  overflow-x: auto;
}

code {
  font-family: "SFMono-Regular", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: 0.9rem 0;
  color: var(--muted);
  background: var(--topbar-bg);
}

.site-footer p {
  margin: 0;
  text-align: center;
  font-size: 0.9rem;
}

@media (max-width: 720px) {
  .topbar-inner {
    padding: 0.65rem 0;
  }

  .site-name {
    font-size: 1rem;
  }

  .topbar-actions {
    gap: 0.45rem;
  }

  .menu-button {
    padding: 0.4rem 0.6rem;
  }

  .menu-list {
    min-width: 9.5rem;
    max-width: min(88vw, 14rem);
  }

  .hero {
    padding: 2.4rem 0 2rem;
  }

  .hero-layout {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }

  .profile-pic {
    justify-self: center;
    width: clamp(150px, 46vw, 220px);
  }

  .news-section {
    margin-top: 1.1rem;
  }

  .news-scroll {
    max-height: 12.25rem;
    padding-right: 0.2rem;
  }

  .news-page-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.2rem;
  }

  .social-links {
    gap: 0.85rem;
  }

  .site-footer p {
    font-size: 0.82rem;
    line-height: 1.45;
  }

  .project-item {
    grid-template-columns: 1fr;
  }

  .publications-page .pub-main {
    padding-top: 1.5rem;
  }

  .pub-key-carousel {
    gap: 0.35rem;
    margin-bottom: 1rem;
  }

  .pub-arrow {
    width: 1.85rem;
    height: 1.85rem;
  }

  .pub-key-item {
    flex-basis: clamp(160px, 36vw, 220px);
  }

  .pub-filter-row {
    flex-direction: column;
    align-items: stretch;
  }

  .pub-search {
    max-width: none;
  }

  .pub-item {
    grid-template-columns: 110px 1fr;
    gap: 0.75rem;
  }

  .cv-main {
    padding-top: 1.15rem;
  }

  .cv-section + .cv-section {
    margin-top: 1.2rem;
    padding-top: 1.1rem;
  }

  .cv-li-entry {
    grid-template-columns: 2.5rem 1fr;
    gap: 0.6rem;
    margin-top: 0;
  }

  .cv-li-entry-no-logo::before {
    width: 2.5rem;
    height: 2.5rem;
  }

  .cv-li-logo {
    width: 2.5rem;
    height: 2.5rem;
  }
}

@media (max-width: 420px) {
  .container {
    width: min(900px, 94%);
  }

  .pub-item {
    grid-template-columns: 1fr;
  }

  .pub-cover-link {
    max-width: 180px;
  }

  .menu-button {
    padding: 0.4rem;
  }

  .menu-button span {
    display: none;
  }
}
