:root {
  --ink: #111111;
  --muted: #000000;
  --gold: #8c7a5c;
  --bar-gold: #d7b14a;
  --white: #ffffff;
  --line: #d8d8d8;
  --banner-height: 620px;
  --water-x: 0%;
  --water-y: 0px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: var(--white);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
}

.lang-zh,
body[data-lang="zh"] .lang-en {
  display: none;
}

body[data-lang="zh"] .lang-zh {
  display: revert;
}

.page-scrollbar {
  position: fixed;
  top: 0;
  right: 3px;
  bottom: 0;
  z-index: 30;
  width: 7px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.page-scrollbar.is-visible {
  opacity: 1;
}

.page-scrollbar-thumb {
  width: 100%;
  min-height: 44px;
  border-radius: 999px;
  background: rgba(90, 90, 90, 0.72);
  transition:
    background-color 180ms ease,
    height 80ms linear,
    transform 80ms linear;
}

body:not(.is-content-scrolled) .page-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.5);
}

a {
  color: inherit;
  text-underline-offset: 0.18em;
}

.site-header {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 10;
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px clamp(20px, 4vw, 42px);
  color: var(--white);
  background: rgba(0, 0, 0, 0.12);
  transition:
    color 220ms ease,
    background-color 220ms ease,
    box-shadow 220ms ease,
  backdrop-filter 220ms ease;
}

body.is-content-scrolled .site-header {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(12px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--white);
  font-size: clamp(0.92rem, 1.6vw, 1.32rem);
  font-weight: 850;
  letter-spacing: 0.06em;
  text-decoration: none;
  white-space: nowrap;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.brand img {
  display: block;
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.nav-toggle {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.14);
  cursor: pointer;
}

.nav-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: var(--white);
  transition:
    transform 180ms ease,
    opacity 180ms ease,
    background-color 180ms ease;
}

body.is-content-scrolled .nav-toggle {
  border-color: rgba(17, 17, 17, 0.18);
  background: rgba(255, 255, 255, 0.66);
}

body.is-content-scrolled .nav-toggle span {
  background: var(--ink);
}

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

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

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

body.is-content-scrolled .brand {
  color: var(--ink);
  text-shadow: none;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px 14px;
  margin-left: auto;
  font-size: clamp(0.77rem, 1.04vw, 0.98rem);
}

.site-nav a {
  position: relative;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 500;
  text-decoration: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

body.is-content-scrolled .site-nav a {
  color: rgba(17, 17, 17, 0.78);
  text-shadow: none;
}

.site-nav a + a::before {
  margin-right: 14px;
  color: rgba(255, 255, 255, 0.52);
  content: "·";
}

body.is-content-scrolled .site-nav a + a::before {
  color: rgba(17, 17, 17, 0.36);
}

.site-nav a.is-active {
  color: var(--white);
  font-weight: 850;
}

body.is-content-scrolled .site-nav a.is-active {
  color: var(--ink);
}

.language-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.86);
  background: rgba(255, 255, 255, 0.12);
  font: inherit;
  font-weight: 700;
  line-height: inherit;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
  cursor: pointer;
  backdrop-filter: blur(10px);
}

.language-toggle span {
  display: inline-flex;
  min-width: 46px;
  min-height: 26px;
  align-items: center;
  justify-content: center;
  padding: 0 9px;
  border-radius: 999px;
  transition:
    color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.language-toggle::before,
.language-toggle span:first-child::after {
  content: none;
}

body.is-content-scrolled .language-toggle {
  border-color: rgba(17, 17, 17, 0.14);
  color: rgba(17, 17, 17, 0.78);
  background: rgba(255, 255, 255, 0.7);
  text-shadow: none;
}

body[data-lang="en"] .language-toggle span:first-child,
body[data-lang="zh"] .language-toggle span:last-child {
  color: var(--white);
  background: rgba(17, 17, 17, 0.72);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.16);
}

body.is-content-scrolled[data-lang="en"] .language-toggle span:first-child,
body.is-content-scrolled[data-lang="zh"] .language-toggle span:last-child {
  color: var(--white);
  background: var(--ink);
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 22px max(clamp(22px, 5vw, 52px), calc((100vw - 1460px) / 2));
  border-top: 1px solid var(--line);
  color: rgba(17, 17, 17, 0.68);
  background: var(--white);
}

.site-footer p {
  margin: 0;
  color: inherit;
  font-size: clamp(0.72rem, 0.92vw, 0.82rem);
}

.back-to-top {
  position: fixed;
  right: clamp(18px, 3vw, 34px);
  bottom: clamp(18px, 3vw, 34px);
  z-index: 20;
  display: inline-flex;
  min-width: 72px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    background-color 180ms ease;
  cursor: pointer;
  backdrop-filter: blur(12px);
}

.back-to-top span[aria-hidden="true"] {
  font-size: 1rem;
  line-height: 1;
}

body.is-content-scrolled .back-to-top {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: rgba(255, 255, 255, 0.92);
}

.water-stage {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  z-index: 0;
  height: calc(var(--banner-height) * 1.1);
  background-color: #000000;
  background-image:
    linear-gradient(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.18)),
    url("materials/water.jpg");
  background-repeat: no-repeat;
  background-size: 190vw auto;
  background-position: var(--water-x, 0%) center;
  transform: translateY(var(--water-y));
  transition: background-position 1200ms cubic-bezier(0.16, 0.84, 0.24, 1);
  will-change: background-position, transform;
}

main {
  position: relative;
  z-index: 1;
  display: flex;
  width: 500vw;
  height: 100svh;
  overflow: hidden;
  transform: translateX(calc(var(--active-index, 0) * -100vw));
  transition: transform 720ms cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

.page-section {
  width: 100vw;
  min-width: 100vw;
  height: 100svh;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-margin-top: 0;
  scrollbar-width: none;
  overscroll-behavior: contain;
}

.page-section::-webkit-scrollbar {
  display: none;
}

.page-banner {
  display: grid;
  height: var(--banner-height);
  min-height: var(--banner-height);
  place-items: center;
  color: var(--white);
  background: transparent;
}

.home-hero,
.banner-title {
  display: grid;
  justify-items: center;
  text-align: center;
}

.home-hero {
  gap: 18px;
  padding-top: 40px;
}

.banner-title {
  gap: 18px;
}

.profile-photo {
  display: block;
  width: min(320px, 80vw);
  height: auto;
  border: 0;
  border-radius: 0;
  object-fit: contain;
  object-position: center;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  color: var(--white);
  font-size: clamp(2.4rem, 4.8vw, 4rem);
  font-weight: 760;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
}

.hero-name-zh {
  letter-spacing: 0.5em;
  margin-right: -0.5em;
}

body[data-lang="zh"] .hero-name-zh {
  display: inline-block;
}

h2 {
  margin: 0 0 40px;
  color: var(--gold);
  font-size: clamp(1.6rem, 2.72vw, 2.4rem);
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: 0;
}

h3 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: clamp(0.88rem, 1.6vw, 1.08rem);
  line-height: 1.25;
}

p,
li {
  color: var(--muted);
  font-size: clamp(0.8rem, 1.16vw, 0.94rem);
}

.tagline {
  margin: 0;
  color: var(--white);
  font-size: clamp(0.96rem, 1.84vw, 1.24rem);
  font-weight: 850;
  line-height: 1.1;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

.gold-rule {
  width: 130px;
  height: 10px;
  background: var(--bar-gold);
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 18px;
}

.social-links a {
  display: block;
  width: 56px;
  height: 56px;
  text-decoration: none;
  transition: transform 180ms ease;
}

.social-links img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.social-links a:hover {
  transform: translateY(-2px);
}

.hiring-ad {
  display: grid;
  min-height: 66px;
  place-items: center;
  padding: 10px 24px;
  background: #b7153f;
}

.hiring-ad a {
  display: inline-flex;
  max-width: min(1020px, 100%);
  min-height: 34px;
  align-items: center;
  justify-content: center;
  padding: 6px 16px;
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: 4px;
  color: var(--white);
  font-size: clamp(0.8rem, 1.12vw, 0.96rem);
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
}

.content-section {
  width: 100%;
  margin: 0;
  padding: clamp(56px, 8vw, 92px) clamp(22px, 5vw, 52px);
  background: var(--white);
}

.about-content {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(340px, 1.15fr);
  gap: clamp(40px, 7vw, 96px);
  align-items: start;
}

.about-content,
.research-content,
.contact-content,
.news-content,
.publications-content,
.teaching-content,
.openings-content {
  padding-right: max(clamp(22px, 5vw, 52px), calc((100vw - 1460px) / 2));
  padding-left: max(clamp(22px, 5vw, 52px), calc((100vw - 1460px) / 2));
}

.text-block p {
  max-width: 660px;
  text-align: justify;
}

.focus-diagram {
  display: block;
  width: min(680px, 100%);
  height: auto;
  margin: 62px auto 0;
}

.news-content h2 + ul {
  margin-bottom: clamp(70px, 8vw, 112px);
}

ul,
ol {
  margin: 0 0 28px;
  padding-left: 1.35rem;
}

li {
  margin-bottom: 16px;
}

.publications-content {
  width: 100%;
}

.publications-content article + article {
  margin-top: 36px;
}

.publications-content h3 {
  text-decoration: underline;
}

.research-content {
  border-top: 1px solid var(--line);
}

.research-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(46px, 6vw, 86px) clamp(36px, 6vw, 82px);
}

.research-card {
  display: grid;
  gap: 16px;
  align-content: start;
  text-align: center;
}

.research-card img {
  display: block;
  width: 100%;
  height: min(26vw, 320px);
  object-fit: contain;
  object-position: center;
}

.research-card h3 {
  max-width: 520px;
  margin: 0 auto;
  color: var(--ink);
  font-size: clamp(0.96rem, 1.68vw, 1.32rem);
  font-weight: 850;
}

.contact-content {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) minmax(280px, 0.72fr);
  gap: clamp(28px, 5vw, 64px);
  align-items: center;
  border-top: 1px solid var(--line);
}

.contact-details h2 {
  display: flex;
  align-items: center;
  gap: 18px;
}

.contact-details h2 span {
  color: var(--gold);
  font-size: 0.44em;
}

.contact-content address {
  color: var(--muted);
  font-style: normal;
}

.contact-content address p {
  margin: 0 0 22px;
  font-size: clamp(1rem, 1.6vw, 1.32rem);
  line-height: 1.42;
}

.contact-content address strong {
  font-weight: 850;
}

.contact-content address span {
  display: block;
}

.contact-content address .lang-zh,
body[data-lang="zh"] .contact-content address .lang-en {
  display: none;
}

body[data-lang="zh"] .contact-content address .lang-zh {
  display: block;
}

.cv-button {
  align-self: center;
  justify-self: center;
  width: min(280px, 100%) !important;
  height: 56px;
  min-height: 0;
  padding: 0 28px;
  font-size: clamp(1rem, 1.44vw, 1.2rem);
}

.teaching-content {
  display: grid;
  grid-template-columns: minmax(280px, 0.88fr) minmax(280px, 1.12fr);
  gap: clamp(32px, 5vw, 58px);
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.teaching-content img {
  display: block;
  width: 100%;
  height: auto;
}

.teaching-quote {
  grid-column: 1 / -1;
  margin-top: clamp(42px, 6vw, 76px);
  margin-bottom: 0;
  text-align: center;
}

.quote-mark {
  display: block;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 900;
  line-height: 1;
  color: var(--ink);
}

.teaching-note {
  margin: clamp(28px, 4vw, 48px) 0;
  text-align: left;
  font-size: clamp(1rem, 1.6vw, 1.28rem);
}

.button {
  display: inline-flex;
  width: min(520px, 100%);
  min-height: 46px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 0;
  border-radius: 4px;
  color: var(--white);
  background: var(--gold);
  font-size: clamp(0.8rem, 1.12vw, 0.93rem);
  font-weight: 640;
  text-decoration: none;
}

.openings-content {
  display: grid;
  justify-items: center;
  gap: clamp(36px, 5vw, 68px);
  min-height: 500px;
}

.openings-content p {
  justify-self: start;
  max-width: 1120px;
  font-size: clamp(0.92rem, 1.36vw, 1.08rem);
}

.flyer-button {
  width: min(520px, 100%);
}

.flyer-frame {
  width: min(1320px, 100%);
  height: min(1180px, 82vh);
  border: 0;
  background: #1f1f1f;
}

@media (max-width: 960px) {
  :root {
    --banner-height: 540px;
  }

  .site-header {
    align-items: center;
    gap: 16px;
    min-height: 64px;
  }

  .nav-toggle {
    display: inline-flex;
    order: 3;
  }

  .language-toggle {
    order: 2;
    margin-left: auto;
  }

  .site-nav {
    order: 4;
    position: absolute;
    top: calc(100% - 2px);
    right: clamp(18px, 4vw, 42px);
    left: clamp(18px, 4vw, 42px);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 6px;
    background: rgba(12, 12, 12, 0.84);
    box-shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition:
      opacity 180ms ease,
      transform 180ms ease;
    backdrop-filter: blur(14px);
  }

  body.is-content-scrolled .site-nav {
    border-color: rgba(17, 17, 17, 0.12);
    background: rgba(255, 255, 255, 0.9);
  }

  body.is-nav-open .site-nav {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .site-nav a {
    min-height: 38px;
    padding: 7px 10px;
    border-radius: 4px;
  }

  .site-nav a.is-active {
    background: rgba(255, 255, 255, 0.12);
  }

  body.is-content-scrolled .site-nav a.is-active {
    background: rgba(17, 17, 17, 0.06);
  }

  .site-nav a + a::before {
    content: none;
  }

  .page-banner {
    padding-top: 72px;
  }

  .water-stage {
    background-size: auto 180%;
  }

  .about-content,
  .teaching-content,
  .contact-content {
    grid-template-columns: 1fr;
  }

  .research-grid {
    grid-template-columns: 1fr;
  }

  .research-card img {
    height: auto;
    max-height: 300px;
  }

  .focus-diagram {
    margin-top: 12px;
  }

  .site-footer {
    flex-direction: column;
    gap: 6px;
  }
}

@media (max-width: 620px) {
  :root {
    --banner-height: clamp(480px, 68svh, 560px);
  }

  .site-header {
    gap: 10px;
    padding: 10px 12px;
  }

  .brand {
    gap: 6px;
    flex: 1 1 auto;
    min-width: 0;
    font-size: clamp(0.66rem, 2.8vw, 0.88rem);
    letter-spacing: 0.03em;
  }

  .brand span {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand img {
    width: 28px;
    height: 28px;
  }

  .language-toggle {
    flex: 0 0 auto;
    font-size: 0.68rem;
  }

  .language-toggle span {
    min-width: 36px;
    min-height: 24px;
    padding: 0 7px;
  }

  .site-nav {
    grid-template-columns: 1fr;
    font-size: 0.74rem;
  }

  .nav-toggle {
    flex: 0 0 40px;
  }

  .profile-photo {
    width: min(220px, 78vw);
  }

  .home-banner {
    place-items: start center;
    align-content: start;
  }

  .home-hero {
    gap: 6px;
    padding-top: 36px;
  }

  .tagline {
    max-width: min(360px, 94vw);
    font-size: clamp(0.96rem, 5.2vw, 1.18rem);
  }

  .social-links {
    gap: 10px;
  }

  .social-links a {
    width: 42px;
    height: 42px;
  }
}
