:root {
  --bg: #f4efe5;
  --paper: rgba(255, 252, 246, 0.82);
  --paper-strong: rgba(255, 253, 249, 0.94);
  --ink: #17211f;
  --muted: #66685f;
  --line: rgba(23, 33, 31, 0.14);
  --accent: #8f6b43;
  --accent-2: #60746d;
  --deep: #263331;
  --sage: #dfe3d6;
  --shadow: 0 26px 80px rgba(24, 31, 29, 0.13);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --mouse-x: 50%;
  --mouse-y: 20%;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(115deg, #f7efe3 0%, #eff2eb 42%, #e8edf1 100%);
  background-attachment: fixed;
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -4;
  pointer-events: none;
  opacity: 0.34;
  background-image:
    linear-gradient(rgba(23, 33, 31, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(23, 33, 31, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 22%, black, transparent 76%);
}

body::after {
  content: "";
  position: fixed;
  inset: -10%;
  pointer-events: none;
  z-index: -3;
  background:
    radial-gradient(circle at var(--mouse-x) var(--mouse-y), rgba(255, 255, 255, 0.82), transparent 18%),
    radial-gradient(circle at calc(var(--mouse-x) + 12%) calc(var(--mouse-y) + 10%), rgba(144, 165, 156, 0.24), transparent 24%);
  transition: background-position 0.2s ease;
}

.particle-field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
  pointer-events: none;
  opacity: 0.5;
}

.scroll-progress {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 20;
  width: 100%;
  height: 3px;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.ambient-glow {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(14px);
  z-index: -1;
  opacity: 0.68;
  animation: drift 16s ease-in-out infinite alternate;
}

.glow-one {
  width: 520px;
  height: 520px;
  left: -180px;
  top: 12%;
  background: rgba(232, 192, 150, 0.24);
}

.glow-two {
  width: 620px;
  height: 620px;
  right: -220px;
  top: -120px;
  background: rgba(133, 158, 150, 0.22);
  animation-duration: 20s;
}

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(24px, -18px, 0) scale(1.08);
  }
}

h1,
h2,
h3 {
  font-family: "Baskerville", "Iowan Old Style", "Songti SC", serif;
  text-wrap: pretty;
}

.site-frame {
  width: min(1380px, calc(100% - 64px));
  margin: 28px auto;
  padding: 28px 34px 42px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.46)),
    rgba(255, 255, 255, 0.52);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 38px;
}

.brand {
  color: var(--ink);
  font-size: 1.32rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

nav {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  margin-left: auto;
}

nav a,
.entry a,
.quick-links a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.18s ease, opacity 0.18s ease;
}

nav a:hover,
.entry a:hover,
.quick-links a:hover {
  color: var(--accent);
}

.site-switch-link {
  border: 1px solid rgba(152, 128, 92, 0.28);
  border-radius: 999px;
  padding: 0.45rem 0.82rem;
  background: rgba(152, 128, 92, 0.09);
  color: var(--accent) !important;
}

.lang-toggle {
  min-width: 54px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.lang-toggle:hover {
  transform: translateY(-1px);
  border-color: rgba(143, 107, 67, 0.42);
}

.layout {
  display: grid;
  grid-template-columns: 370px minmax(0, 1fr);
  gap: clamp(38px, 5vw, 76px);
  align-items: start;
}

.profile-card {
  position: sticky;
  top: 24px;
  padding: 10px 0 0 8px;
}

.portrait-wrap {
  position: relative;
  width: min(100%, 305px);
  isolation: isolate;
}

.portrait-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border: 1px solid rgba(143, 107, 67, 0.35);
  border-radius: 18px;
  pointer-events: none;
}

.portrait-wrap::after {
  content: "";
  position: absolute;
  inset: 16px -18px -18px 18px;
  z-index: -1;
  border: 1px solid rgba(96, 116, 109, 0.28);
  border-radius: 18px;
}

.portrait-orbit span {
  position: absolute;
  z-index: 2;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 8px rgba(143, 107, 67, 0.12);
  animation: pulse 3s ease-in-out infinite;
}

.portrait-orbit span:nth-child(1) {
  right: -4px;
  top: 18%;
}

.portrait-orbit span:nth-child(2) {
  left: 22px;
  bottom: 18px;
  animation-delay: 0.7s;
}

.portrait-orbit span:nth-child(3) {
  right: 34px;
  bottom: -4px;
  background: var(--accent-2);
  animation-delay: 1.3s;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.86;
  }
  50% {
    transform: scale(1.28);
    opacity: 0.52;
  }
}

.avatar {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center 28%;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 54px rgba(25, 29, 28, 0.18);
}

.eyebrow {
  margin: 30px 0 10px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.6;
  text-transform: uppercase;
}

.profile-card h1 {
  margin: 0 0 8px;
  font-size: clamp(2.45rem, 5vw, 4.45rem);
  letter-spacing: 0.02em;
  line-height: 0.95;
}

.role,
.school {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.signal-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: min(100%, 330px);
  margin: 22px 0 24px;
}

.signal-panel div {
  padding: 12px 10px;
  border: 1px solid rgba(23, 33, 31, 0.1);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.48);
}

.signal-panel strong {
  display: block;
  font-family: "Iowan Old Style", "Times New Roman", serif;
  font-size: 1.3rem;
  line-height: 1;
}

.signal-panel span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 22px 0 28px;
}

.quick-links a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.link-icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
}

.mail {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2398805c' d='M4 5h16a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2Zm8 7 8-5H4l8 5Zm0 2L4 9v8h16V9l-8 5Z'/%3E%3C/svg%3E");
}

.github {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2398805c' d='M12 .5A12 12 0 0 0 8.2 23.9c.6.1.8-.3.8-.6v-2.1c-3.3.7-4-1.4-4-1.4-.5-1.3-1.3-1.7-1.3-1.7-1.1-.8.1-.8.1-.8 1.2.1 1.8 1.2 1.8 1.2 1.1 1.8 2.8 1.3 3.5 1 .1-.8.4-1.3.7-1.6-2.6-.3-5.4-1.3-5.4-5.8 0-1.3.5-2.3 1.2-3.2-.1-.3-.5-1.5.1-3.1 0 0 1-.3 3.3 1.2a11.4 11.4 0 0 1 6 0c2.3-1.5 3.3-1.2 3.3-1.2.6 1.6.2 2.8.1 3.1.8.9 1.2 1.9 1.2 3.2 0 4.5-2.8 5.5-5.4 5.8.4.3.8 1 .8 2v3c0 .3.2.7.8.6A12 12 0 0 0 12 .5Z'/%3E%3C/svg%3E");
}

.cv {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%2398805c' d='M6 2h9l5 5v15H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm8 1.5V8h4.5L14 3.5ZM8 12h8v2H8v-2Zm0 4h8v2H8v-2Zm0-8h3v2H8V8Z'/%3E%3C/svg%3E");
}

.mini-block {
  padding-top: 22px;
  margin-top: 22px;
  border-top: 1px solid var(--line);
}

.mini-block h2 {
  margin: 0 0 14px;
  font-size: 1.08rem;
}

.mini-block ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

.mini-block li {
  color: var(--muted);
  line-height: 2;
}

.story-map {
  display: grid;
  gap: 8px;
  margin: 24px 0 0;
}

.story-map a {
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(100%, 320px);
  padding: 8px 0;
  color: var(--muted);
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}

.story-map span {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  font-size: 0.72rem;
}

.story-map a.active {
  color: var(--ink);
}

.story-map a.active span {
  color: white;
  border-color: var(--deep);
  background: var(--deep);
}

.motto {
  padding: 16px 0 0;
  margin: 24px 0 0;
  border-top: 1px solid var(--line);
  color: var(--accent);
  font-family: "Iowan Old Style", "Times New Roman", serif;
  font-style: italic;
  line-height: 1.7;
}

main {
  min-width: 0;
}

.story {
  position: relative;
}

.story::before {
  content: "";
  position: absolute;
  top: 26px;
  bottom: 38px;
  left: -34px;
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(143, 107, 67, 0.42), rgba(96, 116, 109, 0.22), transparent);
}

.content-section {
  position: relative;
  opacity: 0;
  transform: translateY(28px);
  transition:
    opacity 0.8s var(--ease),
    transform 0.8s var(--ease),
    filter 0.8s var(--ease);
  filter: blur(5px);
}

.content-section.is-visible {
  opacity: 1;
  transform: translateY(0);
  filter: blur(0);
}

.content-section + .content-section {
  margin-top: clamp(48px, 8vw, 98px);
}

.story-scene::before {
  content: attr(data-scene);
  position: absolute;
  left: -55px;
  top: 8px;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(143, 107, 67, 0.28);
  border-radius: 50%;
  color: var(--accent);
  background: rgba(255, 252, 246, 0.88);
  font-size: 0.78rem;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(30, 34, 32, 0.08);
}

.scene-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 14px;
  color: var(--accent-2);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scene-kicker span:first-child {
  color: var(--accent);
}

.content-section h2 {
  margin: 0 0 18px;
  font-size: clamp(1.8rem, 3vw, 2.55rem);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  margin-left: 6px;
  background: linear-gradient(90deg, rgba(143, 107, 67, 0.4), transparent);
}

.section-title h2 {
  margin: 0;
}

.section-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.view-all {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.03em;
  text-decoration: none;
}

.view-all:hover {
  opacity: 0.75;
}

.doodle {
  display: inline-block;
  width: 28px;
  height: 28px;
  background-repeat: no-repeat;
  background-size: contain;
}

.coffee {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath fill='%2398805c' d='M14 20h30v18c0 9-7 16-16 16S14 47 14 38V20Zm30 5h6a8 8 0 0 1 0 16h-6v-6h5a2 2 0 1 0 0-4h-5v-6ZM20 12c0-5 5-6 5-10h5c0 6-5 7-5 12h-5Zm12 0c0-5 5-6 5-10h5c0 6-5 7-5 12h-5Z'/%3E%3C/svg%3E");
}

.book {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath fill='%2398805c' d='M10 12h18c7 0 12 2 14 5 2-3 7-5 14-5h-2v40H40c-5 0-8 1-10 3-2-2-5-3-10-3H10V12Zm8 8v24h8c4 0 7 1 10 3V23c-2-2-5-3-10-3h-8Zm28 0c-5 0-8 1-10 3v24c3-2 6-3 10-3h2V20h-2Z'/%3E%3C/svg%3E");
}

.robot {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath fill='%2398805c' d='M29 6h6v8h9a10 10 0 0 1 10 10v18a10 10 0 0 1-10 10H20A10 10 0 0 1 10 42V24a10 10 0 0 1 10-10h9V6Zm-9 16a4 4 0 0 0-4 4v14a4 4 0 0 0 4 4h24a4 4 0 0 0 4-4V26a4 4 0 0 0-4-4H20Zm5 8h6v6h-6v-6Zm14 0h6v6h-6v-6ZM6 28h4v12H6V28Zm48 0h4v12h-4V28Z'/%3E%3C/svg%3E");
}

.star {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath fill='%2398805c' d='m32 6 7 16 17 2-13 12 4 18-15-9-15 9 4-18L8 24l17-2 7-16Z'/%3E%3C/svg%3E");
}

.about p {
  max-width: 880px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.12rem);
  line-height: 2;
  text-wrap: pretty;
}

.research-thread {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.research-thread span {
  padding: 9px 12px;
  border: 1px solid rgba(96, 116, 109, 0.22);
  border-radius: 999px;
  color: var(--deep);
  background: rgba(223, 227, 214, 0.38);
  font-size: 0.84rem;
}

.entry {
  position: relative;
  overflow: hidden;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0.68)),
    var(--paper);
  box-shadow: 0 12px 28px rgba(30, 34, 32, 0.06);
  transition:
    transform 0.24s var(--ease),
    box-shadow 0.24s var(--ease),
    border-color 0.24s var(--ease);
}

.entry::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at 16% 20%, rgba(143, 107, 67, 0.12), transparent 34%);
  transition: opacity 0.24s ease;
}

.entry:hover {
  transform: translateY(-4px);
  border-color: rgba(143, 107, 67, 0.36);
  box-shadow: 0 20px 42px rgba(30, 34, 32, 0.12);
}

.entry:hover::after {
  opacity: 1;
}

.featured-entry {
  padding: 30px;
  background:
    linear-gradient(135deg, rgba(255, 252, 246, 0.98), rgba(231, 235, 224, 0.72)),
    var(--paper-strong);
}

.entry + .entry {
  margin-top: 14px;
}

.entry h3 {
  position: relative;
  z-index: 1;
  margin: 0 0 8px;
  font-size: 1.18rem;
  line-height: 1.45;
}

.entry p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.entry .meta {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.92rem;
}

.entry h3 a {
  color: var(--ink);
  text-decoration: none;
}

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

.subpage .full-width {
  width: 100%;
}

.compact-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.project-card:hover,
.experience-card:hover {
  border-color: rgba(96, 116, 109, 0.34);
}

.experience-list {
  display: grid;
  gap: 16px;
}

.experience-card p + p {
  margin-top: 8px;
}

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

  .content-section {
    opacity: 1;
    transform: none;
    filter: none;
  }
}

@media (max-width: 980px) {
  .site-frame {
    width: min(100% - 24px, 1360px);
    padding: 22px;
    border-radius: 14px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 18px;
  }

  nav {
    gap: 18px;
    margin-left: 0;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 38px;
  }

  .profile-card {
    position: static;
    max-width: 520px;
  }

  .story::before,
  .story-scene::before {
    display: none;
  }

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

@media (max-width: 620px) {
  .site-frame {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 18px;
    border-right: 0;
    border-left: 0;
    border-radius: 0;
  }

  .brand {
    font-size: 1rem;
  }

  nav {
    gap: 12px 16px;
    font-size: 0.92rem;
  }

  .portrait-wrap {
    width: min(100%, 270px);
  }

  .section-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .signal-panel {
    grid-template-columns: 1fr;
  }

  .entry,
  .featured-entry {
    padding: 18px;
  }
}
