/* ============================================
   Xiaoyang Chen — Personal Website
   Design: Dark theme, engineering aesthetic
   Brand: #C69CF9 (primary), #CAFF72 (accent)
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-primary: #09090b;
  --bg-secondary: #111115;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;
  --accent: #C69CF9;
  --accent-dim: rgba(198, 156, 249, 0.15);
  --accent-strong: #d4b5ff;
  --accent2: #CAFF72;
  --accent2-dim: rgba(202, 255, 114, 0.1);
  --radius: 12px;
  --radius-lg: 20px;
  --font-heading: 'Sora', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-body);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* --- Background Canvas --- */
#bg-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
}

/* --- Navigation --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: rgba(9, 9, 11, 0.7);
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}

.nav.scrolled {
  background: rgba(9, 9, 11, 0.9);
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.nav-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.3px;
  transition: var(--transition);
}

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

.nav-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-links {
  display: flex;
  gap: 28px;
}

.nav-links a {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text-primary);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--accent);
  transition: width var(--transition);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

/* --- Language Toggle --- */
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all var(--transition);
}

.lang-toggle:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.05);
}

.lang-option {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 3px 7px;
  border-radius: 100px;
  transition: all var(--transition);
  line-height: 1;
}

.lang-option.active {
  color: #0a0a0a;
  background: var(--accent);
}

.lang-divider {
  font-size: 11px;
  color: var(--border);
  user-select: none;
}

/* --- Section Common --- */
.section {
  position: relative;
  z-index: 1;
  padding: 100px 0;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 40px;
}

/* --- Hero --- */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 120px 24px 80px;
  overflow: hidden;
}

.hero-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 40%, black 30%, transparent 70%);
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 640px;
}

.hero-greeting {
  font-family: var(--font-heading);
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 12px;
  letter-spacing: 1px;
}

.hero-name {
  font-family: var(--font-heading);
  font-size: clamp(40px, 8vw, 72px);
  font-weight: 700;
  letter-spacing: -2px;
  line-height: 1.1;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--text-primary) 0%, var(--accent) 60%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-tagline {
  font-family: var(--font-heading);
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  letter-spacing: 0.5px;
}

.hero-desc {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 40px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  color: #0a0a0a;
  background: var(--accent);
  padding: 14px 32px;
  border-radius: 100px;
  text-decoration: none;
  transition: all var(--transition);
  box-shadow: 0 0 40px rgba(198, 156, 249, 0.25);
  position: relative;
  overflow: hidden;
}

.hero-cta::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  opacity: 0;
  transition: opacity var(--transition);
}

.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 60px rgba(198, 156, 249, 0.4);
}

.hero-cta:hover::before {
  opacity: 1;
}

.hero-cta span,
.hero-cta svg {
  position: relative;
  z-index: 1;
}

.hero-cta svg {
  transition: transform var(--transition);
}

.hero-cta:hover svg {
  transform: translateX(3px);
}

/* --- About --- */
.about {
  border-top: 1px solid var(--border);
}

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

.about-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  transition: all var(--transition);
}

.about-card:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.about-icon {
  font-size: 28px;
  margin-bottom: 16px;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.about-card h3 {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

.about-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* --- Projects --- */
.projects {
  border-top: 1px solid var(--border);
}

/* Featured Project (NavoPath) */
.project-featured {
  position: relative;
  border: 1px solid rgba(198, 156, 249, 0.2);
  border-radius: var(--radius-lg);
  padding: 48px;
  margin-bottom: 32px;
  background: linear-gradient(135deg, rgba(198, 156, 249, 0.06), rgba(202, 255, 114, 0.03));
  overflow: hidden;
  transition: all var(--transition-slow);
}

.project-featured:hover {
  border-color: rgba(198, 156, 249, 0.35);
  transform: translateY(-2px);
}

.project-featured-glow {
  position: absolute;
  top: -100px;
  right: -100px;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(198, 156, 249, 0.12), transparent 70%);
  pointer-events: none;
}

.project-featured-content {
  position: relative;
  z-index: 1;
}

.project-featured-tag {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 4px 12px;
  border-radius: 100px;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

.project-featured h3 {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -1px;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.project-featured-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 20px;
  max-width: 640px;
}

.project-featured-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.project-featured-tags span {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 6px;
}

.project-featured-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  transition: all var(--transition);
  padding: 10px 24px;
  border: 1px solid rgba(198, 156, 249, 0.25);
  border-radius: 100px;
}

.project-featured-link:hover {
  background: var(--accent-dim);
  border-color: rgba(198, 156, 249, 0.4);
  gap: 12px;
}

.project-featured-link svg {
  transition: transform var(--transition);
}

.project-featured-link:hover svg {
  transform: translateX(3px);
}

/* Project Cards Grid */
.project-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all var(--transition);
  cursor: default;
}

.project-card:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.project-card-bar {
  height: 3px;
}

.project-card-body {
  padding: 24px;
}

.project-card-body h4 {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.project-card-body p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 14px;
}

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

.project-card-tags span {
  font-size: 11px;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  padding: 3px 10px;
  border-radius: 4px;
}

/* --- Links --- */
.links {
  border-top: 1px solid var(--border);
}

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

.link-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all var(--transition);
}

.link-card:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.link-card-icon {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: var(--transition);
  flex-shrink: 0;
}

.link-card:hover .link-card-icon {
  border-color: var(--border-hover);
}

.link-card-label {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 600;
}

.link-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

/* --- Contact --- */
.contact {
  border-top: 1px solid var(--border);
}

.contact-text {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 32px;
  max-width: 480px;
}

.contact-methods {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.contact-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: 100px;
  text-decoration: none;
  transition: all var(--transition);
}

.contact-btn:hover {
  border-color: var(--border-hover);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.contact-btn svg {
  opacity: 0.6;
  transition: opacity var(--transition);
}

.contact-btn:hover svg {
  opacity: 1;
}

/* --- Footer --- */
.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 32px 0;
}

.footer .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.footer-top {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.footer-top:hover {
  color: var(--text-secondary);
}

/* --- Reveal Animations --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.reveal-delay-1 { transition-delay: 0.05s; }
.reveal-delay-2 { transition-delay: 0.1s; }
.reveal-delay-3 { transition-delay: 0.15s; }
.reveal-delay-4 { transition-delay: 0.2s; }
.reveal-delay-5 { transition-delay: 0.25s; }

/* --- Responsive --- */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .lang-toggle {
    padding: 3px 6px;
  }

  .lang-option {
    font-size: 10px;
    padding: 3px 5px;
  }

  .hero-name {
    font-size: 36px;
    letter-spacing: -1px;
  }

  .hero-desc {
    font-size: 14px;
  }

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

  .project-featured {
    padding: 32px 24px;
  }

  .project-featured h3 {
    font-size: 28px;
  }

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

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

  .section {
    padding: 64px 0;
  }

  .project-featured-desc {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .hero-name {
    font-size: 30px;
  }

  .hero-cta {
    padding: 12px 24px;
    font-size: 14px;
  }

  .contact-methods {
    flex-direction: column;
  }
}
