/* === Design tokens: colors, shadows, radii, layout variables === */
:root {
  --bg: #dffaff;
  --paper: #f3fdff;
  --text: #0b1724;
  --muted: #496476;
  --muted-2: #7690a0;
  --line: rgba(8, 47, 73, 0.14);
  --accent: #0891b2;
  --accent-dark: #0e7490;
  --accent-deep: #164e63;
  --accent-soft: rgba(8, 145, 178, 0.12);
  --accent-cyan: #06b6d4;
  --accent-blue: #2563eb;
  --card: rgba(255, 255, 255, 0.72);
  --shadow: 0 28px 80px rgba(8, 47, 73, 0.16);
  --radius: 28px;
  --max: 1120px;
}

/* Dark theme variables and adjustments */
html.dark {
  --bg: #071022;
  --paper: #0b1622;
  --text: #e6f6ff;
  --muted: #9fb0c0;
  --muted-2: #7f98a8;
  --line: rgba(255, 255, 255, 0.06);
  --accent: #06b6d4;
  --accent-dark: #0891b2;
  --accent-deep: #67e8f9;
  --accent-soft: rgba(8, 145, 178, 0.06);
  --accent-cyan: #38bdf8;
  --accent-blue: #60a5fa;
  --card: rgba(10, 18, 26, 0.64);
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.6);
}

html.dark body {
  background: linear-gradient(180deg, #071022 0%, #071a2a 100%);
  color: var(--text);
}

/* Tweak translucent UI in dark mode */
html.dark .nav-inner {
  background: rgba(10, 18, 26, 0.64);
  border-color: rgba(255, 255, 255, 0.04);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.6);
}
html.dark .nav-action {
  background: var(--accent);
  color: var(--text);
}

/* Keep profile name and focus text black even in dark mode per preference */
html.dark .profile-name,
html.dark .profile-item strong {
  color: #0b1724;
}

/* Make the small profile label (the `strong` next to the name) black in both themes */
.profile-head > div > strong {
  color: var(--text);
  font-weight: 700;
}
html.dark .profile-head > div > strong {
  color: #0b1724;
}

/* Disable hover effect on the profile card (no visual change on hover) */
.profile-card {
  transition: none !important;
}
.profile-card:hover {
  /* keep exactly the same visual state on hover */
  transform: translateY(-80px) !important;
  background: rgba(255, 255, 255, 0.72) !important;
  box-shadow: var(--shadow) !important;
}
html.dark .profile-card:hover {
  transform: translateY(-80px) !important;
  background: rgba(10, 18, 26, 0.64) !important;
  box-shadow: var(--shadow) !important;
}

/* Reduce hover brightness for translucent cards in dark mode */
html.dark .card:hover,
html.dark .project:hover,
html.dark .contact-card:hover,
html.dark .experience-item:hover,
html.dark .profile-card:hover,
html.dark .friend-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
}

/* Theme toggle button */
#theme-toggle {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  transition: 180ms ease;
}

#theme-toggle:hover {
  transform: translateY(-1px);
  color: var(--text);
  background: rgba(255, 255, 255, 0.94);
}

html.dark #theme-toggle {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted-2);
  border-color: rgba(255, 255, 255, 0.06);
}

/* Reset and base rules */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Page background and typography */
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% -4%, rgba(6, 182, 212, 0.34), transparent 28rem),
    radial-gradient(circle at 92% 2%, rgba(37, 99, 235, 0.24), transparent 30rem),
    radial-gradient(circle at 50% 44%, rgba(14, 116, 144, 0.12), transparent 34rem),
    linear-gradient(180deg, #effdff 0%, #d7f7ff 42%, #bfeeff 100%);
}

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

.container {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
}

/* Navigation */
.nav {
  position: sticky;
  top: 18px;
  z-index: 20;
  padding-top: 18px;
}

.nav-inner {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 16px 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(243, 253, 255, 0.84);
  backdrop-filter: blur(18px);
  box-shadow: 0 16px 50px rgba(8, 47, 73, 0.12);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(135deg, var(--accent-deep), var(--accent-cyan));
  font-size: 13px;
  font-weight: 800;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-links a {
  padding: 10px 12px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  transition: 180ms ease;
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(8, 145, 178, 0.10);
}

.nav-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  color: #fff;
  background: var(--text);
  font-size: 14px;
  font-weight: 700;
  transition: 180ms ease;
}

.nav-action:hover {
  transform: translateY(-1px);
  background: var(--accent-dark);
}

.hero {
  padding: 112px 0 82px;
}

.hero-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 56px;
  align-items: end;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 34px;
  height: 1px;
  background: currentColor;
  opacity: 0.55;
}

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

.hero-title {
  font-family: Montserrat, Inter, system-ui, sans-serif;
  /* Reduced to ~2/3 of previous size for a less imposing hero */
  font-size: clamp(38px, 5.7vw, 70px);
  line-height: 1.08;
  letter-spacing: 0.02em;
  font-weight: 700;
  white-space: nowrap;
  margin-top: 14px; /* nudge title slightly downward */
}

.homepage-label {
  display: inline-flex;
  margin-top: 24px;
  padding: 12px 18px;
  border: 1px solid rgba(8, 145, 178, 0.24);
  border-radius: 999px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  font-family: Montserrat, Inter, system-ui, sans-serif;
  font-size: clamp(17px, 2vw, 24px);
  font-weight: 600;
  letter-spacing: 0.025em;
}

.hero-summary {
  margin-top: 34px;
  max-width: 780px;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.78;
  letter-spacing: -0.02em;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 50px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 15px;
  font-weight: 700;
  transition: transform 200ms cubic-bezier(.2,.9,.2,1), box-shadow 200ms cubic-bezier(.2,.9,.2,1), background 180ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button.primary {
  color: white;
  background: linear-gradient(135deg, var(--accent-dark), var(--accent-cyan));
  border-color: transparent;
  box-shadow: 0 18px 44px rgba(8, 145, 178, 0.24);
}

.button.secondary {
  background: rgba(255, 255, 255, 0.62);
}

.button.secondary:hover {
  background: rgba(255, 255, 255, 0.94);
}

/* Primary button micro-interactions */
.button.primary:hover {
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 28px 64px rgba(8, 145, 178, 0.22);
}
.button.primary:active {
  transform: translateY(-1px) scale(0.995);
}
.button:focus-visible {
  outline: 3px solid rgba(6,182,212,0.16);
  outline-offset: 4px;
}

@media (prefers-reduced-motion: reduce) {
  .button { transition: none; transform: none !important; }
  .repo-link { transition: none; transform: none !important; }
}

.profile-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  transform: translateY(-80px);
  transition: transform 180ms ease;
}

.profile-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.avatar {
  width: 76px;
  height: 76px;
  flex: 0 0 auto;
  object-fit: cover;
  border-radius: 22px;
  border: 1px solid rgba(8, 47, 73, 0.12);
  box-shadow: 0 14px 32px rgba(8, 47, 73, 0.16);
}

.profile-name {
  font-family: Montserrat, Inter, system-ui, sans-serif;
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 0.002em;
  line-height: 1.16;
}

.profile-role {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.45;
  font-size: 14px;
}

.profile-list {
  display: grid;
  gap: 16px;
  padding-top: 20px;
}

.profile-item span {
  display: block;
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.profile-item strong {
  display: block;
  font-size: 15px;
  line-height: 1.45;
  letter-spacing: -0.02em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 22px;
}

.stat {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.58);
}

.stat strong {
  display: block;
  font-family: Montserrat, Inter, system-ui, sans-serif;
  font-size: 22px;
  color: var(--accent-deep);
  margin-bottom: 5px;
}

.stat span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

section {
  padding: 76px 0;
}

.section-head {
  display: grid;
  grid-template-columns: 0.85fr 1fr;
  gap: 56px;
  align-items: end;
  margin-bottom: 34px;
}

.section-kicker {
  margin-bottom: 13px;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h2 {
  font-family: Montserrat, Inter, system-ui, sans-serif;
  font-size: clamp(34px, 4.3vw, 56px);
  line-height: 1.12;
  letter-spacing: -0.012em;
  font-weight: 700;
}

.section-note {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: -0.015em;
}

.about-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.card, .timeline-item, .project, .skill-panel, .contact-card, .experience-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 18px 60px rgba(8, 47, 73, 0.075);
}

.card {
  min-height: 235px;
  padding: 26px;
  transition: 180ms ease;
}

.card:hover, .project:hover, .contact-card:hover, .experience-item:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 70px rgba(8, 47, 73, 0.12);
}

.card-number {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  margin-bottom: 26px;
  border-radius: 50%;
  color: var(--accent-dark);
  background: var(--accent-soft);
  font-size: 14px;
  font-weight: 800;
}

h3 {
  font-family: Montserrat, Inter, system-ui, sans-serif;
  font-size: 22px;
  line-height: 1.32;
  letter-spacing: -0.006em;
  font-weight: 650;
}

.card p, .timeline-item p, .project p, .experience-item p {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.72;
  letter-spacing: -0.01em;
}

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

.timeline-item, .experience-item {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 32px;
  padding: 28px;
}

.timeline-time, .experience-time {
  color: var(--accent-dark);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.meta-line {
  margin-top: 8px;
  color: var(--muted-2);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.5;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.project {
  min-height: 245px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 26px;
  transition: 180ms ease;
}

.project-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.repo-link {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  color: var(--accent-deep);
  background: var(--accent-soft);
  font-size: 12px;
  font-weight: 800;
}

/* Repo link micro-interaction */
.repo-link {
  transition: transform 180ms cubic-bezier(.2,.9,.2,1), color 160ms ease, box-shadow 200ms ease;
}
.repo-link:hover {
  transform: translateY(-3px);
  color: var(--accent-blue);
  box-shadow: 0 10px 30px rgba(8, 145, 178, 0.08);
}
.repo-link:active { transform: translateY(-1px); }

html.dark .repo-link:hover {
  box-shadow: 0 8px 22px rgba(0,0,0,0.6);
  color: var(--accent-cyan);
}

.tags, .skill-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tags {
  margin-top: 24px;
}

.tag, .skill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--muted);
  background: rgba(8, 145, 178, 0.10);
  font-size: 12px;
  font-weight: 700;
}

.skills-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.skill-panel {
  padding: 28px;
}

.skill-cloud {
  margin-top: 20px;
}

.skill {
  min-height: 36px;
  border-radius: 14px;
  color: var(--text);
  font-size: 13px;
}

.statement {
  padding: 44px;
  border-radius: 36px;
  color: #fff;
  background: linear-gradient(135deg, #0f172a, #164e63, #0891b2, #06b6d4);
  box-shadow: 0 30px 90px rgba(8, 145, 178, 0.26);
}

.statement p {
  max-width: 850px;
  font-family: Montserrat, Inter, system-ui, sans-serif;
  font-size: clamp(30px, 4.2vw, 52px);
  line-height: 1.16;
  letter-spacing: -0.008em;
  font-weight: 700;
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.contact-card {
  padding: 24px;
  transition: 180ms ease;
}

.contact-card span {
  display: block;
  margin-bottom: 11px;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.contact-card strong {
  display: block;
  font-size: 17px;
  line-height: 1.45;
  word-break: break-word;
}

footer {
  padding: 46px 0 38px;
  color: var(--muted);
  font-size: 14px;
}

/* Smaller, subtle link for Peking University in the footer */
.footer-inner .pku-link {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
}
.footer-inner .pku-link:hover {
  color: var(--text);
  text-decoration: underline;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

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

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

@media (max-width: 980px) {
  .nav-links {
    display: none;
  }

  .hero-top,
  .section-head,
  .skills-grid {
    grid-template-columns: 1fr;
  }

  .profile-card {
    max-width: 560px;
  }

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

@media (max-width: 720px) {
  .container {
    width: min(var(--max), calc(100% - 24px));
  }

  .hero {
    padding: 72px 0 54px;
  }

  .hero-title {
    white-space: normal;
    font-size: clamp(52px, 17vw, 82px);
  }

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

  .timeline-item,
  .experience-item {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .profile-head {
    align-items: flex-start;
    flex-direction: column;
  }

    .profile-card {
      transform: none;
    }

  .statement {
    padding: 30px;
  }
}
/* Friends grid (links to peers) */
.friends-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.friend-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 18px 60px rgba(8, 47, 73, 0.075);
  transition: 180ms ease;
}

.friend-card:hover {
  transform: translateY(-4px);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 24px 70px rgba(8, 47, 73, 0.12);
}

.friend-card.rose {
  background: linear-gradient(180deg, rgba(255, 242, 246, 0.98), rgba(255, 235, 241, 0.96));
}

.friend-card.rose:hover {
  background: linear-gradient(180deg, rgba(255, 238, 243, 0.98), rgba(255, 229, 237, 0.96));
}

.friend-card span {
  display: block;
  margin-bottom: 11px;
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.friend-card strong {
  display: block;
  font-size: 19px;
  line-height: 1.45;
}

.friend-card p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}

@media (max-width: 720px) {
  .friends-grid {
    grid-template-columns: 1fr;
  }
}
