/* Clean compact personal homepage */
:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-2: #f0f5f3;
  --text: #17212b;
  --muted: #5f6f7a;
  --faint: #8b99a2;
  --line: #dde6ea;
  --line-strong: #c7d5db;
  --blue: #2563eb;
  --green: #157a6e;
  --gold: #a56a16;
  --blue-soft: #e9f1ff;
  --green-soft: #e6f3ef;
  --shadow: 0 8px 24px rgba(23, 33, 43, 0.06);
  --radius: 8px;
  --font-sans: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: 'Noto Serif SC', Georgia, serif;
}

html[data-theme="dark"] {
  --bg: #0f151a;
  --surface: #151d23;
  --surface-2: #1a2528;
  --text: #e8eef1;
  --muted: #adbbc2;
  --faint: #7c8b94;
  --line: #26343c;
  --line-strong: #354751;
  --blue: #83b4ff;
  --green: #70d5c1;
  --gold: #e4bd68;
  --blue-soft: #14243d;
  --green-soft: #11332d;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.26);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 72px;
  background: var(--bg);
}

body {
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.74), rgba(245,247,248,0.94) 360px, var(--bg)),
    var(--bg);
  font-family: var(--font-sans);
  line-height: 1.58;
  overflow-x: hidden;
}

html[data-theme="dark"] body {
  background: linear-gradient(180deg, #111b22, var(--bg) 420px);
}

body::before {
  content: "";
  position: fixed;
  right: -34px;
  top: 78px;
  z-index: 0;
  width: 170px;
  height: 330px;
  background: none;
  filter: hue-rotate(158deg) saturate(0.38) brightness(0.92) contrast(0.92);
  opacity: 0.12;
  pointer-events: none;
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.container,
.nav-inner,
.hero-content {
  width: min(100%, 1080px);
  margin: 0 auto;
  padding-left: 22px;
  padding-right: 22px;
}

main,
.nav,
.footer,
.back-to-top {
  position: relative;
  z-index: 1;
}

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

html[data-theme="dark"] .nav {
  background: rgba(21, 29, 35, 0.88);
}

.nav.scrolled {
  box-shadow: 0 6px 18px rgba(23, 33, 43, 0.06);
}

.nav-inner {
  min-height: 54px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
}

.nav-logo,
.theme-toggle {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--green);
}

.nav-logo {
  font-family: var(--font-serif);
  font-weight: 700;
  text-decoration: none;
}

.nav-links {
  list-style: none;
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  flex-wrap: wrap;
}

.nav-links a {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 9px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--blue);
  background: var(--blue-soft);
}

.theme-toggle {
  cursor: pointer;
}

.theme-toggle-icon {
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 50%;
  box-shadow: 6px -4px 0 -3px currentColor;
}

/* Hero */
.hero {
  position: relative;
  padding: 34px 0 20px;
}

.hero-bg,
.hero-scroll,
.section-ornament,
.timeline::before,
.timeline-dot {
  display: none;
}

.hero-content {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 28px;
  align-items: center;
  min-height: 310px;
}

.hero-content::after {
  content: "";
  width: 220px;
  height: 220px;
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, var(--surface), var(--surface-2));
  filter: hue-rotate(158deg) saturate(0.45) brightness(0.98);
  opacity: 0.82;
}

.hero-greeting {
  display: inline-flex;
  width: fit-content;
  min-height: 25px;
  align-items: center;
  padding: 0 10px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green);
  background: var(--green-soft);
  font-size: 12px;
  font-weight: 700;
}

.hero-name {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: clamp(42px, 7vw, 76px);
  line-height: 1;
  letter-spacing: 0;
  margin-bottom: 10px;
}

.hero-location {
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.hero-tagline {
  max-width: 620px;
  color: var(--text);
  font-size: clamp(17px, 2.2vw, 24px);
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 5px;
}

.hero-sub {
  color: var(--muted);
  font-size: 14px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.hero-actions a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.hero-actions a:first-child {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.hero-actions a:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* Sections */
.about,
.education,
.now,
.skills,
.projects,
.links,
.notes,
.contact {
  padding: 24px 0;
}

.contact {
  padding-bottom: 48px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.section-title-cn {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 700;
}

.section-title-en {
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.about-content,
.timeline-card,
.now-card,
.skill-card,
.project-card,
.link-card,
.note-list,
.contact-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(23, 33, 43, 0.035);
}

.timeline-card:hover,
.now-card:hover,
.skill-card:hover,
.project-card:hover,
.link-card:hover,
.contact-card:hover,
.about-content:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

/* About */
.about-content {
  display: block;
  padding: 16px;
}

.about-avatar {
  display: none;
}

.avatar-placeholder {
  width: 72px;
  height: 72px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-family: var(--font-serif);
  font-size: 26px;
  font-weight: 700;
}

.about-text p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.62;
  margin-bottom: 8px;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-text strong {
  color: var(--text);
}

/* Education */
.timeline {
  display: grid;
  gap: 10px;
}

.timeline-card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 118px;
  padding: 16px;
}

.timeline-card-content {
  position: relative;
  z-index: 1;
  max-width: 72%;
}

.timeline-emblem {
  position: absolute;
  right: -20px;
  top: 50%;
  width: 150px;
  height: 150px;
  transform: translateY(-50%);
  opacity: 0.14;
  pointer-events: none;
}

.timeline-emblem-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: saturate(0.88) contrast(1.04);
}

html[data-theme="dark"] .timeline-emblem-img[src*="changjun-emblem"] {
  filter: brightness(1.7) saturate(1.45) contrast(1.12);
}

.timeline-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 8px;
  margin-bottom: 6px;
  border-radius: 6px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.timeline-card h3,
.skill-card h3,
.project-card h3,
.now-card h3 {
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 16px;
  line-height: 1.35;
  margin-bottom: 4px;
}

.timeline-sub {
  color: var(--faint);
  font-size: 12px;
  margin-bottom: 5px;
}

.timeline-card p,
.now-card p,
.project-card p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.58;
}

/* Dense grids */
.now-grid,
.skills-grid,
.projects-grid,
.link-grid,
.contact-links {
  display: grid;
  gap: 10px;
}

.now-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.skills-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.projects-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.link-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.contact-links {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.now-card,
.skill-card,
.project-card,
.link-card,
.contact-card {
  padding: 15px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.now-card {
  border-top: 3px solid var(--green-soft);
}

.now-meta {
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* Skills */
.skill-icon,
.link-card-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--green-soft);
  color: var(--green);
  font-size: 17px;
  margin-bottom: 10px;
}

.skill-tags,
.project-card-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.skill-tags span,
.project-tag {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11px;
}

/* Projects */
.project-card {
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: inherit;
  text-decoration: none;
}

a.project-card {
  cursor: pointer;
}

.project-card-bottom {
  margin-top: 12px;
}

/* Links */
.link-card {
  min-height: 76px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.link-card-icon {
  margin-bottom: 0;
}

.link-card-body {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.link-card-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-card-desc {
  color: var(--faint);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.link-card-arrow {
  color: var(--faint);
  font-size: 13px;
}

/* Notes */
.note-list {
  display: grid;
  overflow: hidden;
}

.note-list a {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 14px;
  align-items: baseline;
  padding: 12px 16px;
  color: inherit;
  text-decoration: none;
}

.note-list a + a {
  border-top: 1px solid var(--line);
}

.note-list a:hover {
  background: var(--surface-2);
}

.note-list span {
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
}

.note-list small {
  color: var(--faint);
  font-size: 12px;
}

/* Contact */
.contact-intro {
  max-width: 640px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.contact-card {
  min-height: 64px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.contact-icon {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: var(--green);
}

/* Footer and utilities */
.footer {
  padding: 26px 0;
  border-top: 1px solid var(--line);
  text-align: center;
}

.footer-text,
.footer-sub {
  color: var(--faint);
  font-size: 12px;
}

.footer-sub {
  margin-top: 4px;
}

.back-to-top {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 99;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  box-shadow: var(--shadow);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: 0.18s ease;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.fade-in {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Note page */
.note-page {
  width: min(100%, 880px);
  margin: 0 auto;
  padding: 38px 22px 72px;
}

.note-article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: clamp(22px, 4vw, 38px);
  box-shadow: var(--shadow);
}

.note-article h1,
.note-article h2,
.note-article h3 {
  color: var(--text);
  font-family: var(--font-serif);
  line-height: 1.35;
}

.note-article h1 {
  font-size: clamp(28px, 5vw, 40px);
  margin-bottom: 18px;
}

.note-article h2 {
  font-size: 22px;
  margin: 28px 0 10px;
}

.note-article h3 {
  font-size: 17px;
  margin: 22px 0 8px;
}

.note-article p,
.note-article li {
  color: var(--muted);
  font-size: 15px;
}

.note-article p {
  margin: 12px 0;
}

.note-article ul,
.note-article ol {
  margin: 12px 0 12px 1.4em;
}

.note-article a {
  color: var(--blue);
  text-underline-offset: 3px;
}

.note-article code {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 2px 6px;
  background: var(--surface-2);
  color: var(--blue);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.92em;
}

.note-article pre {
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: #0d1117;
}

.note-article pre code {
  border: 0;
  padding: 0;
  background: transparent;
}

.note-article .hljs {
  color: #e6edf3;
  background: transparent;
}

.code-keyword { color: #ff7b72; }
.code-string { color: #a5d6ff; }
.code-number { color: #79c0ff; }
.code-comment { color: #8b949e; }

.math-block {
  overflow-x: auto;
  margin: 18px 0;
  padding: 8px 0;
}

.note-loading {
  color: var(--faint);
}

/* Responsive */
@media (max-width: 980px) {
  .projects-grid,
  .link-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .skills-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body::before {
    opacity: 0.06;
    width: 120px;
  }

  .nav-inner {
    grid-template-columns: auto auto;
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .nav-links {
    grid-column: 1 / -1;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .nav-links a {
    white-space: nowrap;
  }

  .hero {
    padding-top: 24px;
  }

  .hero-content {
    display: block;
    min-height: 0;
  }

  .hero-content::after {
    display: none;
  }

  .hero-name {
    font-size: clamp(42px, 16vw, 66px);
  }

  .about,
  .education,
  .now,
  .skills,
  .projects,
  .links,
  .notes,
  .contact {
    padding: 20px 0;
  }

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

  .timeline-card-content {
    max-width: 100%;
  }

  .timeline-emblem {
    opacity: 0.07;
  }

  .now-grid,
  .projects-grid,
  .link-grid,
  .contact-links {
    grid-template-columns: 1fr;
  }

  .note-list a {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

@media (max-width: 520px) {
  .container,
  .nav-inner,
  .hero-content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .section-title {
    align-items: baseline;
  }

  .section-title-cn {
    font-size: 18px;
  }

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

  .hero-actions a {
    flex: 1;
  }
}

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

/* Visual refresh: editorial personal homepage */
:root {
  --bg: #edf3f1;
  --surface: #fbfcfb;
  --surface-2: #eef5f2;
  --surface-3: #f7faf8;
  --text: #132026;
  --muted: #52666d;
  --faint: #83949a;
  --line: #d5e0df;
  --line-strong: #aebfbd;
  --blue: #255f95;
  --green: #0d766d;
  --gold: #9a6a22;
  --blue-soft: #e3eff8;
  --green-soft: #dff0eb;
  --gold-soft: #f4ead7;
  --shadow: 0 18px 48px rgba(19, 32, 38, 0.1);
}

html[data-theme="dark"] {
  --bg: #0d1416;
  --surface: #131d20;
  --surface-2: #17272a;
  --surface-3: #102024;
  --text: #edf4f3;
  --muted: #b0c0c2;
  --faint: #7f9295;
  --line: #26383b;
  --line-strong: #3a5256;
  --blue: #8fc5ff;
  --green: #72d9c9;
  --gold: #e1bd70;
  --blue-soft: #14283a;
  --green-soft: #12352f;
  --gold-soft: #352a17;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
}

body {
  background:
    linear-gradient(90deg, rgba(37, 95, 149, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(13, 118, 109, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, #f8fbfa 0, #edf3f1 560px, var(--bg) 100%);
  background-size: 48px 48px, 48px 48px, auto;
}

html[data-theme="dark"] body {
  background:
    linear-gradient(90deg, rgba(143, 197, 255, 0.045) 1px, transparent 1px),
    linear-gradient(180deg, rgba(114, 217, 201, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, #101b1f 0, #0d1416 620px, var(--bg) 100%);
  background-size: 48px 48px, 48px 48px, auto;
}

body::before {
  right: max(18px, calc((100vw - 1080px) / 2 - 86px));
  top: 104px;
  width: 220px;
  height: 430px;
  opacity: 0.1;
  filter: saturate(0.55) hue-rotate(145deg) brightness(0.96);
}

.container,
.nav-inner,
.hero-content {
  width: min(100%, 1120px);
}

.nav {
  border-bottom-color: color-mix(in srgb, var(--line), transparent 20%);
}

.nav-inner {
  min-height: 64px;
}

.nav-logo,
.theme-toggle {
  width: 38px;
  height: 38px;
  border-color: color-mix(in srgb, var(--line), transparent 15%);
  background: color-mix(in srgb, var(--surface), transparent 4%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72) inset;
}

.nav-logo {
  color: var(--green);
}

.nav-links {
  gap: 7px;
}

.nav-links a {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  font-size: 13px;
}

.nav-links a:hover,
.nav-links a.active {
  border-color: color-mix(in srgb, var(--blue), transparent 72%);
  background: color-mix(in srgb, var(--blue-soft), transparent 8%);
}

.hero {
  min-height: calc(100vh - 64px);
  display: grid;
  align-items: center;
  padding: 54px 0 44px;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 32px 22px auto;
  height: 74%;
  max-height: 650px;
  border: 1px solid color-mix(in srgb, var(--line), transparent 28%);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--surface), transparent 4%), color-mix(in srgb, var(--surface-2), transparent 18%));
  opacity: 0.88;
  pointer-events: none;
}

.hero-content {
  grid-template-columns: minmax(0, 1fr) minmax(270px, 380px);
  gap: clamp(32px, 6vw, 76px);
  min-height: 560px;
  padding-top: 42px;
  padding-bottom: 42px;
}

.hero-content::after {
  width: min(36vw, 360px);
  height: min(36vw, 360px);
  border: 1px solid color-mix(in srgb, var(--line), transparent 6%);
  border-radius: 50%;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.36), transparent 42%),
    url("../images/pku_emblem.png") center / 58% auto no-repeat,
    radial-gradient(circle at 50% 45%, var(--surface), var(--surface-2));
  box-shadow:
    0 22px 70px rgba(13, 118, 109, 0.13),
    inset 0 0 0 18px color-mix(in srgb, var(--surface), transparent 40%);
  filter: none;
  opacity: 0.78;
}

.hero-greeting {
  min-height: 30px;
  padding: 0 12px;
  margin-bottom: 18px;
  border-color: color-mix(in srgb, var(--green), transparent 68%);
  background: color-mix(in srgb, var(--green-soft), transparent 12%);
  letter-spacing: 0;
}

.hero-name {
  max-width: 760px;
  font-size: clamp(58px, 10vw, 118px);
  letter-spacing: 0;
  margin-bottom: 18px;
}

.hero-name::after {
  content: "";
  display: block;
  width: 116px;
  height: 4px;
  margin-top: 18px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), var(--blue), var(--gold));
}

.hero-location {
  margin-bottom: 12px;
  color: var(--green);
  font-size: 14px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.hero-tagline {
  max-width: 660px;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: clamp(22px, 3vw, 36px);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 10px;
}

.hero-sub {
  max-width: 580px;
  color: var(--muted);
  font-size: 16px;
}

.hero-actions {
  gap: 10px;
  margin-top: 28px;
}

.hero-actions a {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  font-size: 14px;
}

.hero-actions a:first-child {
  background: linear-gradient(135deg, var(--green), var(--blue));
  border-color: transparent;
  box-shadow: 0 12px 28px rgba(37, 95, 149, 0.22);
}

.hero-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
}

.hero-highlights span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid color-mix(in srgb, var(--line), transparent 18%);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface), transparent 8%);
  color: var(--muted);
  font-size: 13px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.68) inset;
}

.hero-highlights strong {
  margin-right: 6px;
  color: var(--text);
}

.hero-mark {
  position: absolute;
  right: 24px;
  bottom: 54px;
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--gold);
  font-family: var(--font-serif);
  font-size: 14px;
  letter-spacing: 0.18em;
  writing-mode: vertical-rl;
}

.hero-mark img {
  width: 72px;
  height: auto;
  opacity: 0.54;
  filter: saturate(0.7) hue-rotate(140deg);
}

.about,
.education,
.now,
.skills,
.projects,
.links,
.notes,
.contact {
  padding: 42px 0;
}

.section-title {
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom-color: color-mix(in srgb, var(--line), transparent 8%);
}

.section-title-cn {
  font-size: 25px;
}

.section-title-en {
  color: var(--gold);
  font-size: 12px;
}

.about-content,
.timeline-card,
.now-card,
.skill-card,
.project-card,
.link-card,
.note-list,
.contact-card {
  border-color: color-mix(in srgb, var(--line), transparent 10%);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.38), transparent 64px),
    color-mix(in srgb, var(--surface), transparent 0%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.72) inset, 0 12px 34px rgba(19, 32, 38, 0.045);
}

.timeline-card:hover,
.now-card:hover,
.skill-card:hover,
.project-card:hover,
.link-card:hover,
.contact-card:hover,
.about-content:hover {
  border-color: color-mix(in srgb, var(--green), var(--line) 54%);
  box-shadow: var(--shadow);
  transform: translateY(-3px);
}

.about-content {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 26px;
  padding: 28px;
}

.about-avatar {
  display: block;
}

.avatar-placeholder {
  width: 96px;
  height: 96px;
  border-color: color-mix(in srgb, var(--green), transparent 70%);
  background: var(--green-soft);
  color: transparent;
}

.about-text p {
  font-size: 15px;
  line-height: 1.78;
}

.timeline {
  gap: 14px;
}

.timeline-card {
  min-height: 150px;
  padding: 24px;
}

.timeline-card-content {
  max-width: 70%;
}

.timeline-emblem {
  right: 28px;
  width: 210px;
  height: 210px;
  opacity: 0.2;
}

.timeline-badge {
  min-height: 24px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--blue-soft), transparent 4%);
}

.timeline-card h3,
.skill-card h3,
.project-card h3,
.now-card h3 {
  font-size: 18px;
}

.timeline-card p,
.now-card p,
.project-card p {
  font-size: 14px;
  line-height: 1.68;
}

.now-grid,
.skills-grid,
.projects-grid,
.link-grid,
.contact-links {
  gap: 16px;
}

.now-card,
.skill-card,
.project-card,
.link-card,
.contact-card {
  padding: 22px;
}

.now-card {
  border-top: 0;
  min-height: 178px;
}

.now-card:nth-child(1) {
  box-shadow: inset 0 3px 0 var(--green), 0 12px 34px rgba(19, 32, 38, 0.045);
}

.now-card:nth-child(2) {
  box-shadow: inset 0 3px 0 var(--blue), 0 12px 34px rgba(19, 32, 38, 0.045);
}

.now-card:nth-child(3) {
  box-shadow: inset 0 3px 0 var(--gold), 0 12px 34px rgba(19, 32, 38, 0.045);
}

.skill-icon,
.link-card-icon {
  width: 42px;
  height: 42px;
  border-color: color-mix(in srgb, var(--green), transparent 70%);
  background: var(--green-soft);
  font-size: 20px;
}

.skill-tags,
.project-card-bottom {
  gap: 8px;
}

.skill-tags span,
.project-tag {
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
}

.projects-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.project-card {
  min-height: 218px;
}

.project-card:nth-child(1),
.project-card:nth-child(2),
.project-card:nth-child(3) {
  min-height: 240px;
}

.project-card h3 {
  margin-bottom: 10px;
}

.link-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.link-card {
  min-height: 96px;
  gap: 16px;
}

.link-card-title {
  font-size: 15px;
}

.link-card-desc {
  font-size: 12px;
}

.link-card-arrow {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--green);
}

.note-list a {
  grid-template-columns: 220px minmax(0, 1fr);
  padding: 18px 22px;
}

.note-list span {
  font-size: 15px;
}

.note-list small {
  font-size: 13px;
}

.contact-intro {
  font-size: 15px;
  margin-bottom: 18px;
}

.contact-card {
  min-height: 86px;
}

.footer {
  padding: 34px 0;
}

@media (max-width: 980px) {
  .hero-content {
    grid-template-columns: minmax(0, 1fr) 260px;
    min-height: 520px;
  }

  .hero-content::after {
    width: 250px;
    height: 250px;
  }

  .hero-mark {
    display: none;
  }

  .now-grid,
  .skills-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body::before,
  .hero::before {
    display: none;
  }

  .nav-inner {
    min-height: 60px;
  }

  .hero {
    min-height: 0;
    padding: 42px 0 22px;
  }

  .hero-content {
    display: block;
    min-height: 0;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .hero-name {
    font-size: clamp(52px, 18vw, 76px);
  }

  .hero-tagline {
    font-size: clamp(22px, 7vw, 30px);
  }

  .hero-highlights {
    display: grid;
    grid-template-columns: 1fr;
  }

  .about-content {
    grid-template-columns: 1fr;
    padding: 22px;
  }

  .about-avatar {
    display: none;
  }

  .timeline-card-content {
    max-width: 100%;
  }

  .timeline-emblem {
    right: -30px;
    width: 190px;
    height: 190px;
    opacity: 0.08;
  }

  .projects-grid,
  .link-grid,
  .now-grid,
  .skills-grid,
  .contact-links {
    grid-template-columns: 1fr;
  }

  .note-list a {
    grid-template-columns: 1fr;
    gap: 4px;
  }
}

@media (max-width: 520px) {
  .section-title-cn {
    font-size: 22px;
  }

  .hero-actions a {
    flex: 0 1 auto;
  }

  .now-card,
  .skill-card,
  .project-card,
  .link-card,
  .contact-card {
    padding: 18px;
  }
}

/* PKU-inspired portal layout */
:root {
  --bg: #f6f3ef;
  --surface: #fffdf9;
  --surface-2: #f3eee7;
  --surface-3: #faf7f1;
  --text: #221714;
  --muted: #665a52;
  --faint: #9a8f86;
  --line: #e2d8cb;
  --line-strong: #c6b6a5;
  --blue: #244c73;
  --green: #7a1f1f;
  --gold: #a27735;
  --blue-soft: #e8eef4;
  --green-soft: #f4e7e4;
  --gold-soft: #f4ead7;
  --pku-red: #8f1d22;
  --pku-red-dark: #651318;
  --shadow: 0 16px 42px rgba(46, 26, 18, 0.1);
}

html[data-theme="dark"] {
  --bg: #150f0e;
  --surface: #211816;
  --surface-2: #2a201d;
  --surface-3: #1c1513;
  --text: #f5eee7;
  --muted: #c7b9ae;
  --faint: #93857c;
  --line: #3a2c28;
  --line-strong: #54413a;
  --blue: #9fc4e5;
  --green: #e0a1a1;
  --gold: #dfbe80;
  --blue-soft: #17283a;
  --green-soft: #351b1c;
  --gold-soft: #372916;
  --pku-red: #c8494f;
  --pku-red-dark: #8f252b;
}

body {
  background:
    linear-gradient(180deg, rgba(143, 29, 34, 0.06), transparent 360px),
    linear-gradient(180deg, #fbf8f2 0, var(--bg) 620px);
  background-size: auto;
}

html[data-theme="dark"] body {
  background:
    linear-gradient(180deg, rgba(200, 73, 79, 0.12), transparent 420px),
    linear-gradient(180deg, #1b1312 0, var(--bg) 620px);
}

body::before {
  display: none;
}

.top-strip {
  display: none;
}

.top-strip-inner {
  width: min(100%, 1120px);
  min-height: 34px;
  margin: 0 auto;
  padding: 0 22px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 22px;
}

.nav {
  top: 0;
  border-bottom: 0;
  background:
    linear-gradient(90deg, rgba(255, 253, 249, 0.96), rgba(255, 253, 249, 0.9)),
    url("../images/xiangyun.png") center bottom / auto 86px repeat-x,
    var(--surface);
  box-shadow: 0 1px 0 var(--line), 0 8px 24px rgba(46, 26, 18, 0.05);
}

html[data-theme="dark"] .nav {
  background:
    linear-gradient(90deg, rgba(33, 24, 22, 0.96), rgba(33, 24, 22, 0.9)),
    url("../images/xiangyun.png") center bottom / auto 86px repeat-x,
    var(--surface);
}

.nav-inner {
  min-height: 88px;
}

.nav-logo {
  width: 46px;
  height: 46px;
  border: 2px solid var(--pku-red);
  border-radius: 0;
  background: var(--pku-red);
  color: #fff;
  font-size: 24px;
}

.theme-toggle {
  border-radius: 0;
}

.nav-links a {
  min-height: 38px;
  border-radius: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
}

.nav-links a:hover,
.nav-links a.active {
  border-color: transparent;
  background: transparent;
  color: var(--pku-red);
  box-shadow: inset 0 -3px 0 var(--pku-red);
}

.hero {
  min-height: calc(100vh - 88px);
  padding: 0;
  background:
    linear-gradient(90deg, rgba(101, 19, 24, 0.84), rgba(101, 19, 24, 0.55) 46%, rgba(101, 19, 24, 0.08)),
    url("../images/pku_emblem.png") right 10% center / min(42vw, 520px) auto no-repeat,
    linear-gradient(135deg, var(--pku-red-dark), var(--pku-red) 52%, #d8c5a3);
}

.hero::before,
.hero::after,
.hero-content::after,
.hero-mark {
  display: none;
}

.hero-content {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 88px);
  display: grid;
  align-content: center;
  grid-template-columns: minmax(0, 760px);
  color: #fff;
}

.hero-greeting {
  border: 1px solid rgba(255, 255, 255, 0.38);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.9);
}

.hero-name {
  color: #fff;
  font-size: clamp(62px, 10vw, 112px);
}

.hero-name::after {
  background: #fff;
  width: 92px;
}

.hero-location {
  color: rgba(255, 255, 255, 0.78);
}

.hero-tagline {
  color: #fff;
  font-size: clamp(24px, 3vw, 38px);
  max-width: 720px;
}

.hero-sub {
  color: rgba(255, 255, 255, 0.78);
}

.hero-actions a {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.hero-actions a:first-child {
  background: #fff;
  color: var(--pku-red-dark);
  box-shadow: none;
}

.hero-highlights span {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.8);
}

.hero-highlights strong {
  color: #fff;
}

.about,
.education,
.now,
.skills,
.projects,
.links,
.notes,
.contact {
  padding: 52px 0;
}

.section-title {
  align-items: flex-end;
  margin-bottom: 24px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--line);
}

.section-title-cn {
  font-size: 30px;
  color: var(--text);
}

.section-title-cn::before {
  content: "";
  display: inline-block;
  width: 5px;
  height: 26px;
  margin-right: 12px;
  vertical-align: -4px;
  background: var(--pku-red);
}

.section-title-en {
  color: var(--pku-red);
  letter-spacing: 0.14em;
}

.about-content,
.timeline-card,
.now-card,
.skill-card,
.project-card,
.link-card,
.note-list,
.contact-card {
  border-radius: 0;
  border-color: var(--line);
  background: var(--surface);
  box-shadow: none;
}

.timeline-card:hover,
.now-card:hover,
.skill-card:hover,
.project-card:hover,
.link-card:hover,
.contact-card:hover,
.about-content:hover {
  border-color: var(--pku-red);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}

.about-content {
  grid-template-columns: 150px minmax(0, 1fr);
  padding: 34px;
  border-top: 4px solid var(--pku-red);
}

.avatar-placeholder {
  border-radius: 0;
  border-color: var(--line);
  background: var(--surface-2);
}

.timeline-card {
  min-height: 166px;
  padding: 28px;
  border-left: 5px solid var(--pku-red);
  display: block;
  color: inherit;
  text-decoration: none;
}

.timeline-card:focus-visible {
  outline: 2px solid var(--pku-red);
  outline-offset: 4px;
}

.timeline-emblem {
  opacity: 0.16;
}

.timeline-card .timeline-emblem {
  right: 40px;
  width: 520px;
  height: 520px;
  opacity: 0.18;
}

.timeline-card .timeline-emblem-img {
  filter: saturate(0.9) contrast(1.06);
}

.timeline-badge,
.skill-tags span,
.project-tag {
  border-radius: 0;
  background: var(--green-soft);
  color: var(--pku-red);
}

.now-card {
  min-height: 190px;
  border-top: 4px solid var(--pku-red);
}

.now-card:nth-child(1),
.now-card:nth-child(2),
.now-card:nth-child(3) {
  box-shadow: none;
}

.now-meta {
  color: var(--pku-red);
}

.skills-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.skill-icon,
.link-card-icon {
  border-radius: 0;
  color: var(--pku-red);
  background: var(--green-soft);
}

.projects-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.project-card,
.project-card:nth-child(1),
.project-card:nth-child(2),
.project-card:nth-child(3) {
  min-height: 260px;
}

.project-card {
  border-top: 4px solid transparent;
}

.project-card:nth-child(1),
.project-card:nth-child(2),
.project-card:nth-child(3) {
  border-top-color: var(--pku-red);
}

.link-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.link-card {
  min-height: 110px;
}

.link-card-arrow {
  border-radius: 0;
  color: var(--pku-red);
}

.note-list a:hover {
  background: var(--green-soft);
}

.footer {
  border-top: 4px solid var(--pku-red);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 128px;
  display: grid;
  align-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 44%),
    linear-gradient(135deg, var(--pku-red-dark), #74171c 58%, #4f1014);
}

.footer::before,
.footer::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image: url("../images/footer-pattern.png");
  background-repeat: repeat;
  background-size: 74px 110px;
}

.footer::before {
  opacity: 0.34;
  background-position: center top;
}

.footer::after {
  opacity: 0.18;
  transform: translate(37px, 55px);
  filter: brightness(0.72) saturate(0.7);
}

.footer .container {
  position: relative;
  z-index: 1;
}

.footer-text,
.footer-sub {
  color: rgba(255, 255, 255, 0.76);
}

.back-to-top {
  border-radius: 0;
  bottom: 112px;
}

.signature-band {
  padding: 14px 0 4px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--surface-soft), transparent 54%));
}

.signature-band-inner {
  display: flex;
  justify-content: flex-end;
}

.scroll-signature {
  position: relative;
  width: fit-content;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) rotate(-2deg);
  transition: opacity 0.28s ease, transform 0.28s ease, filter 0.28s ease;
  filter:
    drop-shadow(0 1px 0 rgba(255, 255, 255, 0.48))
    drop-shadow(0 8px 18px rgba(46, 26, 18, 0.12));
}

.scroll-signature.visible {
  opacity: 1;
  transform: translateY(0) rotate(-2deg);
}

.signature-svg {
  display: block;
  width: clamp(170px, 20vw, 250px);
  height: auto;
  overflow: visible;
}

.signature-img {
  opacity: 0.9;
}

html[data-theme="dark"] .signature-img {
  filter: invert(1) brightness(1.16) opacity(0.82);
}

.signature-mask-path {
  fill: none;
  stroke: white;
  stroke-width: 74;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: var(--signature-path-length, 1);
  stroke-dashoffset: var(--signature-path-length, 1);
}

.signature-mask-path:nth-of-type(2) {
  stroke-width: 62;
}

.signature-mask-path:nth-of-type(3) {
  stroke-width: 48;
}

.signature-mask-path:nth-of-type(4) {
  stroke-width: 34;
}

.scroll-signature.drawn .signature-mask-path {
  animation: signatureWrite 1.1s cubic-bezier(0.62, 0, 0.22, 1) forwards;
}

.scroll-signature.drawn .signature-mask-path:nth-of-type(2) {
  animation-duration: 1.55s;
  animation-delay: 0.72s;
}

.scroll-signature.drawn .signature-mask-path:nth-of-type(3) {
  animation-duration: 0.78s;
  animation-delay: 2.05s;
}

.scroll-signature.drawn .signature-mask-path:nth-of-type(4) {
  animation-duration: 0.32s;
  animation-delay: 2.56s;
}

@media (max-width: 980px) {
  .projects-grid,
  .link-grid,
  .skills-grid,
  .now-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .hero {
    min-height: 0;
    background:
      linear-gradient(180deg, rgba(101, 19, 24, 0.88), rgba(101, 19, 24, 0.72)),
      url("../images/pku_emblem.png") right -80px center / 260px auto no-repeat,
      var(--pku-red-dark);
  }

  .hero-content {
    min-height: 560px;
  }

  .about-content,
  .projects-grid,
  .link-grid,
  .skills-grid,
  .now-grid,
  .contact-links {
    grid-template-columns: 1fr;
  }
}

/* Final header correction: single red xiangyun header */
.nav {
  background:
    linear-gradient(90deg, rgba(101, 19, 24, 0.94), rgba(143, 29, 34, 0.88)),
    url("../images/xiangyun.png") center bottom / auto 92px repeat-x,
    var(--pku-red-dark);
  border-bottom: 0;
  box-shadow: 0 8px 22px rgba(46, 26, 18, 0.16);
}

html[data-theme="dark"] .nav {
  background:
    linear-gradient(90deg, rgba(101, 19, 24, 0.96), rgba(143, 29, 34, 0.9)),
    url("../images/xiangyun.png") center bottom / auto 92px repeat-x,
    var(--pku-red-dark);
}

.nav-inner {
  min-height: 88px;
}

.nav-logo,
.theme-toggle {
  border-color: rgba(255, 255, 255, 0.62);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-links a {
  color: rgba(255, 255, 255, 0.92);
}

.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: inset 0 -3px 0 #fff;
}

.hero,
.hero-content {
  min-height: calc(100vh - 88px);
}

@media (max-width: 760px) {
  .nav-inner {
    min-height: 84px;
  }

  .nav-links {
    background: rgba(101, 19, 24, 0.12);
  }

  .hero-content {
    min-height: 560px;
  }

  .signature-band {
    padding-top: 10px;
  }

  .signature-band-inner {
    justify-content: center;
  }

  .signature-svg {
    width: 170px;
  }

  .timeline-card .timeline-emblem {
    right: -150px;
    width: 300px;
    height: 300px;
    opacity: 0.08;
  }
}

@keyframes signatureWrite {
  to {
    stroke-dashoffset: 0;
  }
}
