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

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

/* CSS Variables */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f8fafc;
  --bg-tertiary: #f1f5f9;
  --bg-nav: #0f172a;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --accent-light: #818cf8;
  --border: #e2e8f0;
  --max-width: 1100px;
  --section-padding: 100px;
  --font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}

body {
  font-family: var(--font-family);
  color: var(--text-primary);
  line-height: 1.75;
  background: var(--bg-primary);
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

/* Focus styles for keyboard users */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Skip link — visible only on focus */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 14px;
  z-index: 2000;
  transition: top 0.2s;
}

.skip-link:focus {
  top: 12px;
  color: #fff;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Navigation */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: var(--bg-nav);
  z-index: 1000;
  transition: box-shadow 0.3s;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
}

.nav-logo {
  color: #fff;
  font-size: 20px;
  font-weight: 700;
}

.nav-logo:hover {
  color: #fff;
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: 28px;
}

.nav-link {
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: #fff;
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
}

.lang-switch {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  color: #fff;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
  font-family: inherit;
}

.lang-switch:hover {
  border-color: #fff;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: #fff;
  transition: all 0.3s;
}

.nav-toggle.active span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* Hero */
.hero {
  padding-top: 160px;
  padding-bottom: 120px;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 40%, #312e81 100%);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse 600px 400px at 15% 85%, rgba(99,102,241,0.18) 0%, transparent 60%),
    radial-gradient(ellipse 500px 350px at 85% 15%, rgba(139,92,246,0.12) 0%, transparent 60%);
  pointer-events: none;
}

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

.hero-name {
  font-size: 64px;
  font-weight: 800;
  margin-bottom: 16px;
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 60px rgba(99,102,241,0.35), 0 2px 4px rgba(0,0,0,0.2);
}

.hero-title {
  font-size: 20px;
  color: rgba(255,255,255,0.88);
  margin-bottom: 20px;
  font-weight: 500;
  letter-spacing: 1px;
}

.hero-desc {
  font-size: 17px;
  color: rgba(255,255,255,0.65);
  max-width: 640px;
  margin: 0 auto;
  line-height: 1.9;
  font-weight: 400;
}

/* Section Common */
.section {
  padding: var(--section-padding) 0;
  position: relative;
}

.section:nth-of-type(2n) {
  background: var(--bg-primary);
}

.section:nth-of-type(2n+1) {
  background: var(--bg-secondary);
}

.section-header {
  margin-bottom: 48px;
  text-align: center;
}

.section-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 12px;
  padding: 4px 12px;
  background: rgba(79,70,229,0.08);
  border-radius: 4px;
}

.section-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

/* About stats — 3 highlighted numbers above the narrative */
.about-stats {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 760px;
  margin: 0 auto 40px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 22px 16px;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(15,23,42,0.04);
}

.stat-num {
  font-size: 32px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -1px;
  line-height: 1.1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* About */
.about-content {
  text-align: center;
}

.about-content p {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 16px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.skill-card,
.project-card {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 32px;
  transition: box-shadow 0.3s, transform 0.3s, border-color 0.3s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.skill-card:hover,
.project-card:hover {
  box-shadow: 0 12px 40px rgba(79,70,229,0.1);
  transform: translateY(-6px);
  border-color: rgba(79,70,229,0.15);
}

.skill-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text-primary);
}

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

/* Timeline */
.timeline {
  position: relative;
  max-width: 720px;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border);
}

.timeline-item {
  position: relative;
  padding-left: 40px;
  padding-bottom: 40px;
}

.timeline-marker {
  position: absolute;
  left: 0;
  top: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--bg-primary);
  box-shadow: 0 0 0 4px rgba(79,70,229,0.15);
}

.timeline-date {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  display: block;
  margin-bottom: 6px;
}

.timeline-content h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 4px;
}

.timeline-company {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 10px;
  font-weight: 500;
}

.timeline-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Speaking */
.speaking-list {
  max-width: 720px;
}

.speaking-item {
  display: flex;
  gap: 24px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}

.speaking-item:last-child {
  border-bottom: none;
}

.speaking-date {
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  white-space: nowrap;
  min-width: 70px;
}

.speaking-content h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  line-height: 1.5;
}

.speaking-content p {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Projects */
.projects-grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  grid-template-rows: auto auto;
  gap: 24px;
}

.project-card {
  position: relative;
}

.project-card.featured {
  grid-row: span 2;
  background: linear-gradient(160deg, var(--bg-primary) 0%, #faf9ff 100%);
  border-color: rgba(79,70,229,0.18);
  box-shadow: 0 4px 24px rgba(79,70,229,0.06);
}

.project-card.featured:hover {
  box-shadow: 0 16px 48px rgba(79,70,229,0.16);
}

.project-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 14px;
}

.project-card h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 14px;
}

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

.project-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 20px;
}

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

/* Clients — Brand-color logo wall */
.logo-wall {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.logo-group h4 {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.logo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
  justify-content: center;
  max-width: 800px;
  margin: 0 auto;
}

.logo-card {
  height: 64px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
  transition: transform 0.25s, box-shadow 0.25s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  padding: 0 12px;
  text-align: center;
  line-height: 1.2;
}

.logo-card.has-text {
  color: var(--brand-color);
}

.logo-card.has-logo img {
  height: 36px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

.logo-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

/* Contact */
.contact-content {
  text-align: center;
  font-style: normal;
}

.contact-desc {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
}

.contact-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--text-primary);
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.2s;
  background: var(--bg-primary);
}

a.contact-link:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 8px 24px rgba(79,70,229,0.1);
  transform: translateY(-3px);
}

.contact-link--static {
  cursor: default;
  user-select: text;
}

.contact-icon {
  font-size: 18px;
}

/* Tags */
.tag {
  font-size: 12px;
  padding: 5px 12px;
  background: rgba(79,70,229,0.06);
  border-radius: 6px;
  color: var(--accent);
  font-weight: 500;
  border: 1px solid rgba(79,70,229,0.1);
  transition: all 0.2s;
}

.tag:hover {
  background: var(--accent);
  color: #fff;
}

/* Footer */
.footer {
  background: var(--bg-nav);
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 24px 0;
  font-size: 14px;
}

/* Reduced motion — disable transform/hover lifts */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .skill-card:hover,
  .project-card:hover,
  .client-tag:hover,
  a.contact-link:hover {
    transform: none;
  }
}

/* Mobile Navigation */
@media (max-width: 768px) {
  .nav-toggle {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-nav);
    flex-direction: column;
    padding: 16px 24px;
    gap: 0;
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s;
  }

  .nav-menu.active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }

  .nav-menu li {
    border-bottom: 1px solid rgba(255,255,255,0.1);
  }

  .nav-menu li:last-child {
    border-bottom: none;
  }

  .nav-link {
    display: block;
    padding: 12px 0;
  }

  .nav-link.active::after {
    display: none;
  }

  /* Hero mobile */
  .hero-name {
    font-size: 36px;
  }

  .hero-title {
    font-size: 16px;
  }

  /* Stats mobile — collapse to single column */
  .about-stats {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Grid mobile */
  .skills-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .project-card.featured {
    grid-row: auto;
  }

  /* Section padding mobile */
  .section {
    padding: 40px 0;
  }

  .hero {
    padding-top: 100px;
    padding-bottom: 40px;
  }

  /* Timeline mobile */
  .timeline-item {
    padding-left: 32px;
  }

  /* Logo wall mobile */
  .logo-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .logo-card {
    height: 56px;
    font-size: 13px;
  }

  .logo-card.has-logo img {
    height: 32px;
  }

  /* Contact links mobile */
  .contact-links {
    flex-direction: column;
    align-items: center;
  }
}
