/* ===== CSS Variables ===== */
:root {
  --bg-primary: #f7f8fc;
  --bg-secondary: #eef1f8;
  --bg-card: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --border-hover: rgba(14, 165, 233, 0.45);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent-cyan: #0284c7;
  --accent-purple: #6366f1;
  --accent-gradient: linear-gradient(135deg, #0ea5e9, #6366f1);
  --spotlight-color: rgba(14, 165, 233, 0.12);
  --header-bg: rgba(247, 248, 252, 0.85);
  --nav-mobile-bg: rgba(247, 248, 252, 0.98);
  --font-sans: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius: 12px;
  --radius-lg: 16px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --header-height: 64px;
  --container-width: 1100px;
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-cyan);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: #0369a1;
}

img {
  max-width: 100%;
  display: block;
}

ul {
  list-style: none;
}

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Header / Nav ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.header.scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.nav-logo {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  gap: 32px;
}

.nav-link {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  position: relative;
  transition: color var(--transition);
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent-gradient);
  transition: width var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
}

.nav-link:hover::after,
.nav-link.active::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: var(--transition);
}

.nav-toggle.open span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  padding-top: var(--header-height);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(14, 165, 233, 0.18), transparent),
    radial-gradient(ellipse 60% 40% at 80% 60%, rgba(99, 102, 241, 0.12), transparent);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-greeting {
  font-size: 1rem;
  color: var(--accent-cyan);
  font-weight: 500;
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeUp 0.6s ease forwards;
}

.hero-name {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 16px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  opacity: 0;
  animation: fadeUp 0.6s ease 0.1s forwards;
}

.hero-title {
  font-size: clamp(1rem, 2.5vw, 1.25rem);
  color: var(--text-secondary);
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeUp 0.6s ease 0.2s forwards;
}

.hero-location {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-bottom: 32px;
  opacity: 0;
  animation: fadeUp 0.6s ease 0.3s forwards;
}

.btn {
  display: inline-flex;
  align-items: center;
  padding: 12px 28px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: var(--transition);
  opacity: 0;
  animation: fadeUp 0.6s ease 0.4s forwards;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  border: none;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.3);
  color: #fff;
}

/* ===== Sections ===== */
.section {
  padding: 96px 0;
}

.section-alt {
  background: var(--bg-secondary);
}

.section-title {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  margin-bottom: 48px;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  width: 48px;
  height: 3px;
  background: var(--accent-gradient);
  border-radius: 2px;
}

.loading {
  color: var(--text-muted);
  text-align: center;
  padding: 48px;
}

.error-msg {
  color: #ff6b6b;
  text-align: center;
  padding: 48px;
}

/* ===== About ===== */
.about-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  align-items: start;
}

.about-avatar-wrap {
  position: relative;
}

.about-avatar {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
  object-position: center top;
  margin: 0 auto;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.2);
}

.about-main h3 {
  font-size: 1.1rem;
  color: var(--accent-cyan);
  margin-bottom: 12px;
  font-weight: 600;
}

.about-education {
  margin-bottom: 24px;
  padding: 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.about-education .school {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.about-education .meta {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.about-education .courses {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.bio-list {
  margin-bottom: 24px;
}

.bio-list li {
  color: var(--text-secondary);
  margin-bottom: 12px;
  padding-left: 16px;
  position: relative;
}

.bio-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 10px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-cyan);
}

.about-block {
  margin-bottom: 24px;
}

.about-block h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  display: inline-block;
  padding: 4px 12px;
  font-size: 0.8rem;
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.22);
  border-radius: 20px;
  color: var(--accent-cyan);
}

.contact-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-list a,
.contact-list span {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.contact-list a:hover {
  color: var(--accent-cyan);
}

/* ===== Spotlight Card ===== */
.spotlight-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04);
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  --mouse-x: 50%;
  --mouse-y: 50%;
  --spotlight-opacity: 0;
}

.spotlight-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(
    400px circle at var(--mouse-x) var(--mouse-y),
    var(--spotlight-color),
    transparent 40%
  );
  opacity: var(--spotlight-opacity);
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 0;
}

.spotlight-card:hover {
  border-color: var(--border-hover);
  box-shadow: 0 8px 28px rgba(14, 165, 233, 0.12);
}

.spotlight-card > * {
  position: relative;
  z-index: 1;
}

@media (hover: hover) {
  .spotlight-card:hover {
    --spotlight-opacity: 1;
  }
}

/* ===== Timeline (Internships) ===== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 20px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent-cyan), var(--accent-purple));
  opacity: 0.3;
}

.timeline-item {
  position: relative;
  padding: 28px 28px 28px 56px;
  margin-left: 0;
}

.timeline-item::after {
  content: '';
  position: absolute;
  left: 14px;
  top: 36px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: 3px solid var(--bg-secondary);
  z-index: 2;
  pointer-events: none;
}

.section:not(.section-alt) .timeline-item::after {
  border-color: var(--bg-primary);
}

.timeline-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
}

.timeline-company {
  font-size: 1.1rem;
  font-weight: 600;
}

.timeline-role {
  color: var(--accent-cyan);
  font-size: 0.9rem;
}

.timeline-period {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.timeline-highlights {
  margin: 16px 0;
}

.timeline-highlights li {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 8px;
  padding-left: 16px;
  position: relative;
}

.timeline-highlights li::before {
  content: '›';
  position: absolute;
  left: 0;
  color: var(--accent-cyan);
  font-weight: 700;
}

/* ===== Projects Grid ===== */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 24px;
}

.project-card {
  display: flex;
  flex-direction: column;
}

.project-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: var(--radius) var(--radius) 0 0;
  background: var(--bg-secondary);
}

.project-body {
  padding: 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.project-type {
  font-size: 0.75rem;
  color: var(--accent-cyan);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.project-period {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.project-title {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.project-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 16px;
  flex: 1;
}

/* ===== Campus ===== */
.campus-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.campus-card {
  padding: 28px;
}

.campus-org {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.campus-role {
  color: var(--accent-cyan);
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.campus-period {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.campus-summary {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.honors-card {
  padding: 28px;
}

.honors-card h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.honors-list li {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 10px;
  padding-left: 20px;
  position: relative;
}

.honors-list li::before {
  content: '★';
  position: absolute;
  left: 0;
  color: var(--accent-purple);
  font-size: 0.75rem;
  top: 2px;
}

/* ===== Footer ===== */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  background: var(--bg-secondary);
}

.footer-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.footer-text {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-contact {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
}

.footer-contact a {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.footer-contact a:hover {
  color: var(--accent-cyan);
}

/* ===== Scroll Reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ===== Animations ===== */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--nav-mobile-bg);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding: 16px 0;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: var(--transition);
  }

  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-links li {
    padding: 0;
  }

  .nav-link {
    display: block;
    padding: 12px 24px;
  }

  .about-grid {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .about-avatar {
    margin: 0 auto 24px;
  }

  .about-education .courses {
    justify-content: center;
  }

  .tag-list {
    justify-content: center;
  }

  .contact-list {
    align-items: center;
  }

  .timeline::before {
    left: 12px;
  }

  .timeline-item {
    padding-left: 44px;
  }

  .timeline-item::after {
    left: 6px;
  }

  .timeline-header {
    flex-direction: column;
    gap: 4px;
  }

  .timeline-period {
    margin-left: 0;
  }

  .campus-grid {
    grid-template-columns: 1fr;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .section {
    padding: 64px 0;
  }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }
}
