:root {
  --white: #ffffff;
  --cream: #f7f1e8;
  --cream-soft: #fbf7f0;
  --ink: #1f1f1d;
  --muted: #6f6a62;
  --line: #e7ded2;
  --earth: #6f543f;
  --earth-deep: #4f3a2b;
  --clay: #a87655;
  --shadow: 0 24px 70px rgba(31, 31, 29, 0.08);
  --header: 72px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header) + 20px);
}

body {
  margin: 0;
  background: var(--white);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  line-height: 1.72;
}

body.nav-open {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select {
  font: inherit;
}

:focus-visible {
  outline: 2px solid rgba(154, 106, 69, 0.45);
  outline-offset: 4px;
}

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

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  min-height: var(--header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 54px);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  order: 1;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50% 50% 46% 54%;
  background: var(--cream);
  color: var(--earth-deep);
  box-shadow: inset 0 0 0 1px rgba(111, 84, 63, 0.22);
  font-size: 1.05rem;
  font-weight: 780;
  transform: rotate(-6deg);
}

.brand-mark::after {
  content: "";
  width: 16px;
  height: 1px;
  margin-top: -6px;
  background: currentColor;
  opacity: 0.55;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 0.78rem;
}

.site-nav {
  order: 4;
  display: none;
  position: fixed;
  inset: var(--header) 14px auto;
  padding: 10px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.site-nav.is-open {
  display: grid;
}

.site-nav a {
  padding: 11px 13px;
  color: var(--muted);
  font-weight: 650;
}

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

.language-switcher {
  order: 2;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(247, 241, 232, 0.76);
  box-shadow: inset 0 0 0 1px rgba(111, 84, 63, 0.12);
}

.language-button {
  min-width: 30px;
  height: 28px;
  padding: 0 8px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.72rem;
  font-weight: 720;
}

.language-button[aria-pressed="true"] {
  background: var(--white);
  color: var(--earth-deep);
  box-shadow: 0 6px 18px rgba(79, 58, 43, 0.1);
}

.menu-toggle {
  order: 3;
  display: grid;
  gap: 5px;
  width: 42px;
  height: 42px;
  place-content: center;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.menu-toggle span:not(.sr-only) {
  width: 22px;
  height: 2px;
  background: var(--ink);
}

.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-items: end;
  padding: calc(var(--header) + 40px) clamp(20px, 6vw, 72px) 72px;
  overflow: hidden;
  background: var(--cream);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(247, 241, 232, 0.96) 0%, rgba(247, 241, 232, 0.74) 40%, rgba(247, 241, 232, 0.16) 74%),
    linear-gradient(0deg, rgba(247, 241, 232, 0.72), transparent 44%);
  pointer-events: none;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 56% 44%;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 690px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--clay);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 20px;
  color: var(--earth-deep);
  font-size: clamp(3.2rem, 11vw, 7rem);
  font-weight: 760;
  line-height: 0.98;
}

h1 span {
  display: inline-block;
  color: var(--ink);
  font-size: 0.38em;
  font-weight: 430;
  line-height: 1.22;
}

h2 {
  max-width: 780px;
  color: var(--ink);
  font-size: clamp(1.8rem, 4.2vw, 3rem);
  font-weight: 680;
  line-height: 1.2;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.18rem;
  font-weight: 680;
}

.hero-lede {
  max-width: 600px;
  color: #36322d;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
}

.hero-actions,
.contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 28px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--earth-deep);
  font-weight: 720;
}

.text-link::after {
  content: "→";
  transition: transform 180ms ease;
}

.text-link:hover::after {
  transform: translateX(4px);
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  border: 1px solid transparent;
  background: var(--cream-soft);
  color: var(--ink);
  cursor: pointer;
  font-weight: 680;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.button:hover {
  transform: translateY(-1px);
  background: var(--cream);
}

.button.primary {
  background: var(--earth-deep);
  color: var(--white);
}

.section {
  padding: 88px clamp(20px, 6vw, 72px);
}

.section:nth-of-type(odd):not(.hero) {
  background: var(--cream-soft);
}

.section-heading {
  max-width: 960px;
  margin: 0 auto 34px;
}

.about-grid,
.teaching-layout,
.contact-grid {
  max-width: 960px;
  margin: 0 auto;
}

.about-grid {
  display: grid;
  gap: 36px;
}

.about-copy {
  max-width: 760px;
  font-size: 1.08rem;
}

.about-copy p {
  margin-bottom: 18px;
}

.metrics {
  display: grid;
  gap: 18px;
}

.photo-essay {
  position: relative;
  min-height: 78svh;
  display: grid;
  align-items: start;
  padding: clamp(28px, 6vw, 72px);
  overflow: hidden;
  background: var(--cream);
}

.photo-essay::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(31, 31, 29, 0.34) 0%, rgba(31, 31, 29, 0.1) 34%, transparent 62%),
    linear-gradient(90deg, rgba(31, 31, 29, 0.2), transparent 48%);
  pointer-events: none;
}

.photo-essay img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 52% 42%;
}

.photo-essay-copy {
  position: relative;
  z-index: 1;
  max-width: 500px;
  margin-top: clamp(52px, 8vw, 112px);
  color: var(--white);
  text-shadow: 0 2px 22px rgba(31, 31, 29, 0.28);
}

.photo-essay-copy .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.photo-essay-copy p:last-child {
  margin: 0;
  font-size: clamp(1.18rem, 2.45vw, 2rem);
  font-weight: 620;
  line-height: 1.28;
}

.metric {
  padding-top: 18px;
}

.metric strong {
  display: block;
  color: var(--earth-deep);
  font-size: clamp(1.8rem, 5vw, 3.2rem);
  line-height: 1;
}

.metric span {
  color: var(--muted);
}

.research-scroll {
  max-width: 1040px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.research-panel {
  min-height: 58vh;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: clamp(22px, 5vw, 64px);
  align-items: center;
  padding: clamp(28px, 6vw, 72px) 0;
  border-top: 1px solid rgba(231, 222, 210, 0.8);
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 560ms ease, transform 560ms ease;
}

.research-panel.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.panel-number {
  color: var(--clay);
  font-size: clamp(1.2rem, 3vw, 2rem);
  font-weight: 700;
}

.research-panel h3 {
  color: var(--earth-deep);
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  line-height: 1.1;
}

.research-question {
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 680;
}

.soft-links {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.92rem;
}

.publication-layout {
  max-width: 1180px;
  margin: 0 auto;
  display: grid;
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}

.publication-list {
  min-width: 0;
}

.publication-item {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: clamp(18px, 4vw, 48px);
  padding: 26px 0;
  border-top: 1px solid rgba(231, 222, 210, 0.85);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.publication-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.publication-item time {
  color: var(--clay);
  font-weight: 720;
}

.publication-type {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 0.88rem;
}

.publication-item h3 {
  color: var(--earth-deep);
  line-height: 1.35;
}

.publication-item p {
  margin-bottom: 6px;
}

.publication-graph {
  min-width: 0;
}

.graph-heading {
  margin-bottom: 14px;
}

.graph-heading h3 {
  margin: 0;
  color: var(--earth-deep);
}

.obsidian-map {
  position: relative;
  min-height: 430px;
  overflow: hidden;
  background:
    radial-gradient(circle at 52% 48%, rgba(168, 118, 85, 0.08), transparent 34%),
    var(--cream-soft);
}

.obsidian-map::after {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 50%;
  border: 1px solid rgba(111, 84, 63, 0.08);
  pointer-events: none;
}

.map-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-lines line {
  stroke: rgba(111, 84, 63, 0.22);
  stroke-width: 0.34;
  transition: opacity 180ms ease, stroke 180ms ease, stroke-width 180ms ease;
}

.map-lines line.is-active {
  stroke: rgba(79, 58, 43, 0.58);
  stroke-width: 0.58;
}

.map-node {
  position: absolute;
  z-index: 1;
  max-width: 112px;
  min-width: 34px;
  min-height: 34px;
  padding: 7px 9px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--earth-deep);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 720;
  line-height: 1.18;
  text-align: center;
  box-shadow: 0 0 0 1px rgba(111, 84, 63, 0.14), 0 10px 22px rgba(31, 31, 29, 0.05);
  transform: translate(-50%, -50%);
  animation: graphFloat 5.4s ease-in-out infinite;
  animation-delay: var(--delay);
  transition: opacity 180ms ease, transform 180ms ease, background 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.map-node::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  background: rgba(168, 118, 85, 0.12);
  opacity: 0;
  transform: scale(0.72);
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: -1;
}

.map-node:hover,
.map-node:focus,
.map-node.is-active {
  transform: translate(-50%, -50%) scale(1.06);
}

.map-node.is-active {
  background: var(--earth-deep);
  color: var(--white);
  box-shadow: 0 0 0 1px rgba(79, 58, 43, 0.2), 0 18px 34px rgba(31, 31, 29, 0.15);
}

.map-node.is-active::before,
.map-node:hover::before,
.map-node:focus::before {
  opacity: 1;
  transform: scale(1);
}

.map-node.is-muted {
  opacity: 0.32;
}

.map-node-theme {
  min-width: 72px;
  min-height: 42px;
  font-size: 0.82rem;
}

.map-node-concept {
  color: var(--clay);
}

.map-node-work {
  background: rgba(247, 241, 232, 0.92);
  color: var(--muted);
  font-size: 0.7rem;
}

.graph-note {
  min-height: 5.5em;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

@keyframes graphFloat {
  0%,
  100% {
    margin-top: 0;
  }
  50% {
    margin-top: -5px;
  }
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}

.tab-button {
  min-height: 40px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 680;
}

.tab-button[aria-selected="true"] {
  background: var(--cream);
  color: var(--earth-deep);
}

.tab-panel {
  max-width: 720px;
  padding: 28px 0;
}

.timeline {
  max-width: 880px;
  margin: 0 auto;
}

.timeline-item {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 26px;
  padding: 20px 0;
  border-top: 1px solid rgba(231, 222, 210, 0.85);
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 520ms ease, transform 520ms ease;
}

.timeline-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-year {
  color: var(--clay);
  font-weight: 720;
}

.timeline-item p,
.timeline-item span {
  color: var(--muted);
}

.contact-grid {
  display: grid;
  gap: clamp(28px, 6vw, 72px);
  align-items: start;
}

.contact-invitation {
  max-width: 680px;
}

.contact-invitation > p {
  color: var(--ink);
  font-size: clamp(1.18rem, 2.3vw, 1.72rem);
  line-height: 1.58;
}

.collab-list {
  display: grid;
  gap: 10px;
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
  color: var(--earth-deep);
  font-weight: 680;
}

.collab-list li {
  padding: 12px 0;
  border-top: 1px solid rgba(231, 222, 210, 0.85);
}

.email-link {
  display: inline-flex;
  align-items: center;
  color: var(--earth-deep);
  font-size: clamp(1.15rem, 2.2vw, 1.65rem);
  font-weight: 720;
}

.email-link::after {
  content: "→";
  margin-left: 10px;
  transition: transform 180ms ease;
}

.email-link:hover::after {
  transform: translateX(4px);
}

.contact-meta {
  color: var(--muted);
}

.contact-list {
  display: grid;
  gap: 18px;
  padding: 0;
  list-style: none;
}

.contact-list li {
  display: grid;
  gap: 2px;
}

.contact-list strong {
  color: var(--muted);
  font-size: 0.9rem;
}

.contact-list a {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.contact-list a:hover {
  color: var(--earth-deep);
}

.copy-status {
  min-height: 1.5em;
  color: var(--earth-deep);
  font-weight: 680;
}

.site-footer {
  padding: 30px clamp(20px, 6vw, 72px);
  color: var(--muted);
  text-align: center;
}

.site-footer p {
  margin: 4px 0;
}

.back-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 18;
  width: 42px;
  height: 42px;
  border: 0;
  background: var(--earth-deep);
  color: var(--white);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 520ms ease, transform 520ms ease;
}

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

@media (max-width: 720px) {
  .site-header {
    gap: 10px;
  }

  .brand {
    min-width: 0;
  }

  .brand small {
    font-size: 0.72rem;
  }

  .language-button {
    min-width: 28px;
    padding: 0 7px;
  }

  .hero {
    min-height: 92svh;
    align-items: end;
    padding-bottom: 48px;
  }

  .hero::after {
    background:
      linear-gradient(0deg, rgba(247, 241, 232, 0.96) 0%, rgba(247, 241, 232, 0.82) 42%, rgba(247, 241, 232, 0.18) 78%),
      linear-gradient(90deg, rgba(247, 241, 232, 0.42), transparent);
  }

  .hero-bg {
    object-position: 52% 22%;
  }

  .research-panel,
  .publication-item,
  .timeline-item {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .research-panel {
    min-height: auto;
    padding: 42px 0;
  }
}

@media (min-width: 760px) {
  .metrics {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .contact-grid,
  .teaching-layout {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  }

  .publication-layout {
    grid-template-columns: minmax(0, 0.95fr) minmax(320px, 0.85fr);
  }

  .publication-graph {
    position: sticky;
    top: 96px;
  }
}

@media (min-width: 900px) {
  .site-nav,
  .site-nav.is-open {
    order: 2;
    position: static;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .menu-toggle {
    display: none;
  }

  .language-switcher {
    order: 3;
    margin-left: -6px;
  }

  .research-panel {
    position: sticky;
    top: 92px;
    background: var(--white);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }

  .reveal,
  .research-panel,
  .publication-item,
  .timeline-item {
    opacity: 1;
    transform: none;
  }

  .map-node {
    animation: none;
  }
}
