:root {
  /* Quiet Editorial — meteor grey, dark mode */
  --paper: #2c2f36;
  --paper-top: #32353d;
  --paper-bottom: #272a30;
  --paper-soft: #3a3d45;
  --paper-deep: #1f2127;
  --ink: #e8eaed;
  --ink-soft: #c8ccd1;
  --muted: #a4aab0;
  --muted-soft: #80848a;
  --rule: #3d4047;
  --rule-strong: #525660;
  --accent: #c8ccd1;

  /* Typography */
  --font-display:
    "Source Serif 4", "Anthropic Serif", "Tiempos Text", Georgia,
    "Times New Roman", "Songti SC", "Noto Serif CJK SC",
    "Source Han Serif SC", serif;
  --font-body:
    "Source Serif 4", "Anthropic Serif", "Tiempos Text", Georgia,
    "Times New Roman", "Songti SC", "Noto Serif CJK SC",
    "Source Han Serif SC", serif;
  --font-ui:
    "Geist", "Söhne", -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono:
    "Geist Mono", "JetBrains Mono", "SF Mono", Menlo, Monaco, Consolas,
    monospace;

  /* 8px grid spacing */
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s5: 48px;
  --s6: 56px;
  --s7: 72px;
  --s8: 96px;

  /* Motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--paper);
  background-image: linear-gradient(
    180deg,
    var(--paper-top) 0%,
    var(--paper-bottom) 100%
  );
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.7;
  font-size: 16px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1;
}

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

::selection {
  background: var(--ink);
  color: var(--paper);
}

/* Loader */
.loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  z-index: 200;
  transition: opacity 240ms var(--ease), visibility 240ms var(--ease);
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  text-align: center;
}

.loader-spinner {
  width: 26px;
  height: 26px;
  margin: 0 auto;
  border-radius: 50%;
  border: 1px solid var(--rule);
  border-top-color: var(--ink);
  animation: spin 0.9s linear infinite;
}

.loader-text {
  margin-top: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Top navigation */
.top-nav {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 100;
  background: rgba(50, 53, 61, 0.85);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--rule);
}

.top-nav-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 32px;
  gap: 24px;
}

.top-nav-mark {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
  transition: color 200ms var(--ease);
}

.top-nav-mark em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
}

.top-nav-mark:hover {
  color: var(--ink);
}

.top-nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.top-nav-links::-webkit-scrollbar {
  display: none;
}

.top-nav-link {
  position: relative;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  color: var(--muted);
  padding: 8px 16px;
  white-space: nowrap;
  transition: color 200ms var(--ease);
}

.top-nav-link::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 2px;
  height: 1px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 280ms var(--ease);
}

.top-nav-link:hover {
  color: var(--ink);
}

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

.top-nav-link.active {
  color: var(--ink);
}

/* Layout */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 120px 40px 96px;
  display: grid;
  grid-template-columns: minmax(260px, 320px) minmax(0, 1fr);
  gap: 64px;
  align-items: start;
}

.sidebar {
  position: sticky;
  top: 104px;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.main-content-wrapper {
  min-width: 0;
}

.main-content {
  display: flex;
  flex-direction: column;
}

/* Profile */
.profile-card {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  align-items: flex-start;
  text-align: left;
}

.profile-photo-wrap {
  width: 160px;
}

.avatar {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  border: 0;
  box-shadow: none;
  filter: grayscale(0.05);
}

.profile-summary {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.name {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.025em;
  color: var(--ink);
  text-align: left;
}

.profile-name-row {
  display: flex;
  align-items: baseline;
  margin-top: 0;
  line-height: 1.4;
}

.chinese-name {
  font-family: var(--font-body);
  font-size: 14px;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 400;
}

.nickname {
  position: relative;
  margin-left: 14px;
  padding-left: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.1em;
  color: var(--muted-soft);
  text-transform: lowercase;
}

.nickname::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 5px;
  height: 1px;
  background: var(--rule-strong);
  transform: translateY(-50%);
}

.profile-location {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.005em;
}

.profile-location i {
  font-size: 11px;
  color: var(--muted-soft);
}

.profile-motto {
  margin-top: 12px;
  padding: 0;
  background: none;
  border: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: 22px;
  line-height: 1.3;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-align: left;
}

.profile-divider {
  display: none;
}

/* Contact */
.contact-section {
  padding-top: var(--s3);
  border-top: 1px solid var(--rule);
  width: 100%;
}

.contact-title {
  display: none;
}

.contact-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 22px;
  margin: 0;
  padding: 0;
}

.contact-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  min-width: 18px;
  height: 18px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 0;
  color: var(--muted);
  font-size: 16px;
  transition: color 200ms var(--ease);
}

.contact-links a:hover {
  color: var(--ink);
  opacity: 1;
}

.contact-links a i {
  width: auto;
  height: auto;
  margin: 0;
  color: currentColor;
  font-size: 16px;
  opacity: 1;
  filter: none;
}

.contact-links a img {
  width: auto;
  height: 14px;
  max-width: 40px;
  margin: 0;
  filter: invert(0.7) grayscale(1);
  opacity: 1;
  transition: filter 200ms var(--ease);
}

.contact-links a:hover img {
  filter: invert(1) grayscale(1);
}

.contact-wordmark {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1;
  color: currentColor;
  white-space: nowrap;
  transform: none;
}

.nav-bar,
.nav-bar a {
  display: none !important;
}

/* Sections — flat, hairline divided */
.section {
  padding: var(--s6) 0;
  border-top: 1px solid var(--rule-strong);
  scroll-margin-top: 96px;
  background: none;
  border-radius: 0;
  box-shadow: none;
}

.section:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 22px;
  margin-bottom: var(--s4);
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--ink);
  border: 0;
  padding: 0;
}

.section-title::before {
  display: none;
}

.section-title::after {
  display: none;
}

/* About */
.about-content {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
  color: var(--ink-soft);
  max-width: 760px;
  background: none;
  border: 0;
  padding: 0;
  border-radius: 0;
}

.about-content p + p {
  margin-top: var(--s2);
}

.about-content em {
  font-style: italic;
  color: var(--ink);
}

.about-content a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--rule-strong);
  text-underline-offset: 4px;
  transition:
    color 200ms var(--ease),
    text-decoration-color 200ms var(--ease);
}

.about-content a:hover {
  color: var(--ink);
  text-decoration-color: var(--ink);
}

/* Inline link underline animation (outside .about-content) */
.education-org a,
.experience-title a,
.experience-org a,
.experience-desc a,
.project-members a,
.reading-note-title a {
  position: relative;
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: no-repeat;
  background-position: 0 100%;
  background-size: 0 1px;
  padding-bottom: 1px;
  transition:
    background-size 280ms var(--ease),
    color 200ms var(--ease);
}

.education-org a:hover,
.experience-title a:hover,
.experience-org a:hover,
.experience-desc a:hover,
.project-members a:hover,
.reading-note-title a:hover {
  background-size: 100% 1px;
  color: var(--ink);
}

/* Education — flat, no card */
.education-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s4) var(--s4);
}

.education-item {
  display: flex;
  gap: var(--s2);
  align-items: flex-start;
  background: none;
  padding: 0;
  border: 0;
  border-radius: 0;
}

.education-logo {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
  align-self: flex-start;
  filter: grayscale(0.1);
}

.education-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.education-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.education-org {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.4;
  color: var(--ink-soft);
  font-weight: 400;
}

.education-org a {
  color: var(--ink-soft);
}

.education-date {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
  line-height: 1;
}

.education-desc {
  margin-top: 6px;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}

/* Experience — flat */
.experience-list {
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.experience-item {
  display: flex;
  align-items: flex-start;
  gap: var(--s3);
  background: none;
  padding: 0;
  border: 0;
  border-radius: 0;
}

.experience-badge {
  width: 100px;
  height: 100px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--paper-soft);
  box-shadow: none;
}

.experience-logo {
  width: 100%;
  max-width: 80px;
  height: auto;
  display: block;
  object-fit: contain;
}

.experience-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.experience-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.experience-title a {
  color: var(--ink);
  border-bottom: 0;
}

.experience-org {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink-soft);
  font-weight: 400;
}

.experience-org .experience-date {
  display: inline;
  margin-left: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.experience-desc {
  margin-top: 4px;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* Publications */
.publications-content {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
  font-style: italic;
  padding: 0;
}

/* Projects — hairline divided list */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

.project-item {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--s4);
  align-items: start;
  background: none;
  padding: var(--s4) 0;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
}

.project-item:first-child {
  padding-top: 0;
}

.project-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.project-demo {
  width: 100%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border-radius: 4px;
  background: var(--paper-deep);
  border: 0;
}

.project-demo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(0.06);
  transition:
    filter 400ms var(--ease),
    transform 700ms var(--ease);
}

.project-item:hover .project-demo img {
  filter: grayscale(0);
  transform: scale(1.025);
}

.project-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.018em;
  color: var(--ink);
}

.project-desc {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--ink-soft);
}

.project-members,
.project-advisor {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}

.project-members strong {
  color: var(--ink);
  font-weight: 600;
}

.project-members a {
  color: var(--ink-soft);
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.project-links a {
  color: var(--ink);
  border-bottom: 0;
  transition: color 200ms var(--ease);
}

.project-links a:hover {
  color: var(--muted);
  border-bottom: 0;
}

/* Reading notes — hairline divided list */
.reading-notes-intro {
  margin-bottom: var(--s4);
  padding: 0;
  display: block;
}

.reading-notes-intro p {
  margin: 0;
  max-width: none;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  font-style: italic;
  color: var(--muted);
}

.reading-notes-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  margin: 0;
}

.reading-note-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s3);
  padding: var(--s3) 0;
  border-bottom: 1px solid var(--rule);
  background: none;
  border-radius: 0;
}

.reading-note-item:first-child {
  padding-top: 0;
}

.reading-note-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.reading-note-item::before {
  display: none;
}

.reading-note-num {
  display: none;
}

.reading-note-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.reading-note-title {
  display: block;
  margin: 0;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.012em;
  color: var(--ink);
}

.reading-note-title a {
  color: var(--ink);
}

.reading-note-meta {
  display: block;
  margin: 0;
  font-family: var(--font-body);
  font-size: 13px;
  font-style: italic;
  line-height: 1.4;
  color: var(--muted);
}

.reading-note-status {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
  background: none;
  padding: 5px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 999px;
  min-width: 0;
  white-space: nowrap;
}

.reading-note-status.is-updating {
  color: var(--ink);
  border-color: var(--ink-soft);
}

.reading-note-status.is-completed {
  color: var(--muted);
  border-color: var(--rule-strong);
}

/* Update time */
.update-time {
  margin-top: var(--s7);
  padding-top: var(--s3);
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: left;
}

.update-time p {
  margin: 0;
}

/* Back to top */
#backToTop {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--rule-strong) !important;
  background: var(--paper-soft) !important;
  color: var(--ink) !important;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 400;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 0 !important;
  box-shadow: none !important;
  outline: none;
  transition:
    background 200ms var(--ease),
    color 200ms var(--ease),
    transform 200ms var(--ease),
    border-color 200ms var(--ease);
}

#backToTop.is-visible {
  display: inline-flex;
}

#backToTop:hover {
  background: var(--ink) !important;
  color: var(--paper) !important;
  border-color: var(--ink) !important;
  transform: translateY(-1px);
  box-shadow: none !important;
}

.section:target {
  box-shadow: none;
}

/* Entrance animation */
@keyframes editorial-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.sidebar > *,
.section,
.update-time {
  animation: editorial-rise 600ms var(--ease) both;
}

.sidebar > *:nth-child(1) {
  animation-delay: 0ms;
}
.sidebar > *:nth-child(2) {
  animation-delay: 80ms;
}

.section:nth-of-type(1) {
  animation-delay: 0ms;
}
.section:nth-of-type(2) {
  animation-delay: 60ms;
}
.section:nth-of-type(3) {
  animation-delay: 120ms;
}
.section:nth-of-type(4) {
  animation-delay: 180ms;
}
.section:nth-of-type(5) {
  animation-delay: 240ms;
}
.section:nth-of-type(6) {
  animation-delay: 300ms;
}

.update-time {
  animation-delay: 360ms;
}

@media (prefers-reduced-motion: reduce) {
  .sidebar > *,
  .section,
  .update-time {
    animation: none;
  }
  html {
    scroll-behavior: auto;
  }
  .project-item:hover .project-demo img {
    transform: none;
  }
}

/* Responsive */
@media (max-width: 1080px) {
  .container {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
    gap: 48px;
    padding: 110px 28px 72px;
  }

  .top-nav-inner {
    padding: 14px 24px;
  }

  .top-nav-link {
    padding: 7px 12px;
  }

  .education-list {
    grid-template-columns: 1fr;
    gap: var(--s3);
  }

  .name {
    font-size: 32px;
  }

  .section-title {
    font-size: 28px;
  }

  .profile-photo-wrap {
    width: 144px;
  }

  .profile-motto {
    font-size: 20px;
  }
}

@media (max-width: 880px) {
  .top-nav-inner {
    padding: 12px 20px;
    gap: 12px;
  }

  .top-nav-mark {
    display: none;
  }

  .top-nav-links {
    flex: 1;
    justify-content: flex-start;
  }

  .top-nav-link {
    font-size: 13px;
    padding: 6px 10px;
  }

  .container {
    display: flex;
    flex-direction: column;
    gap: var(--s5);
    padding: 84px 20px 56px;
  }

  .sidebar {
    position: static;
    top: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: var(--s4);
    width: 100%;
  }

  .profile-card {
    flex: 1 1 280px;
    min-width: 0;
  }

  .profile-photo-wrap {
    width: 132px;
  }

  .contact-section {
    flex: 0 0 auto;
    border-top: 0;
    padding-top: 0;
    align-self: flex-end;
    width: auto;
  }

  .section {
    padding: var(--s6) 0;
  }

  .section-title {
    font-size: 26px;
    margin-bottom: var(--s3);
    gap: 14px;
  }

  .name {
    font-size: 30px;
  }

  .project-item {
    grid-template-columns: 1fr;
    gap: var(--s2);
  }

  .project-demo {
    max-width: 320px;
  }
}

@media (max-width: 560px) {
  .name {
    font-size: 28px;
  }

  .section-title {
    font-size: 24px;
  }

  .about-content {
    font-size: 16px;
  }

  .profile-motto {
    font-size: 19px;
  }

  .reading-note-item {
    grid-template-columns: 1fr;
    gap: 6px;
    padding: var(--s2) 0;
  }

  .reading-note-num {
    display: none;
  }

  .reading-note-status {
    justify-self: start;
  }

  .top-nav-link {
    font-size: 12px;
    padding: 6px 10px;
  }

  .container {
    padding: 76px 18px 48px;
  }

  .sidebar {
    flex-direction: column;
    gap: var(--s3);
  }

  .contact-section {
    width: 100%;
    align-self: flex-start;
    border-top: 1px solid var(--rule);
    padding-top: var(--s3);
  }
}
