:root {
  --bg: #0a0e17;
  --bg-alt: #111827;
  --bg-card: #1a2234;
  --bg-card-hover: #1f2a40;
  --text: #e8edf5;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #3b82f6;
  --accent-light: #60a5fa;
  --accent-glow: rgba(59, 130, 246, 0.25);
  --gradient-start: #3b82f6;
  --gradient-end: #8b5cf6;
  --border: rgba(148, 163, 184, 0.12);
  --tag-bg: rgba(59, 130, 246, 0.12);
  --tag-border: rgba(59, 130, 246, 0.3);
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);
  --font: 'Inter', 'Noto Sans SC', system-ui, sans-serif;
  --nav-height: 56px;
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-height) + 20px);
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body.lang-zh {
  font-family: 'Noto Sans SC', 'Inter', system-ui, sans-serif;
}

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

/* Language Switcher */
.lang-switcher {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1000;
  display: flex;
  gap: 2px;
  background: rgba(26, 34, 52, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
  box-shadow: var(--shadow);
}

.lang-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: var(--transition);
  letter-spacing: 0.02em;
}

.lang-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.lang-btn.active {
  background: var(--accent);
  color: #fff;
}

/* Hero */
.hero {
  position: relative;
  padding: 80px 0 60px;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(59, 130, 246, 0.18) 0%, transparent 60%),
    radial-gradient(ellipse 50% 40% at 90% 80%, rgba(139, 92, 246, 0.12) 0%, transparent 50%);
  pointer-events: none;
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 40px;
  align-items: center;
}

.hero-photo-wrap {
  position: relative;
}

.hero-photo-wrap::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  z-index: 0;
}

.hero-photo {
  position: relative;
  z-index: 1;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--bg);
  display: block;
}

.hero-name {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--text) 0%, var(--accent-light) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.hero-title {
  font-size: 1.15rem;
  color: var(--accent-light);
  font-weight: 500;
  margin-bottom: 20px;
}

.hero-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-bottom: 16px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color var(--transition);
}

a.contact-item:hover {
  color: var(--accent-light);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 0.875rem;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.hero-meta span {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hero-positions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.position-tag {
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--tag-bg);
  border: 1px solid var(--tag-border);
  color: var(--accent-light);
}

.hero-qr {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.qrcode {
  background: #fff;
  padding: 10px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.qrcode canvas,
.qrcode img {
  display: block;
}

.qr-label {
  font-size: 0.75rem;
  color: var(--text-dim);
  text-align: center;
}

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-inner::-webkit-scrollbar {
  display: none;
}

.nav-link {
  white-space: nowrap;
  padding: 8px 14px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  transition: var(--transition);
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

/* Sections */
.section {
  padding: 64px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 32px;
  letter-spacing: -0.02em;
  position: relative;
  padding-bottom: 12px;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 48px;
  height: 3px;
  background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
  border-radius: 2px;
}

/* Skills */
.skills-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.skill-tag {
  font-size: 0.82rem;
  padding: 6px 14px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: var(--transition);
}

.skill-tag:hover {
  border-color: var(--accent);
  color: var(--accent-light);
  background: var(--tag-bg);
}

/* About */
.about-text p {
  color: var(--text-muted);
  margin-bottom: 16px;
  font-size: 1rem;
  max-width: 860px;
}

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

/* Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 32px;
}

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

.section-alt .company-block {
  background: var(--bg);
}

.company-block:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 0 0 1px var(--accent-glow);
}

.company-header {
  margin-bottom: 20px;
}

.company-name {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.company-desc {
  font-size: 0.875rem;
  color: var(--text-dim);
  font-style: italic;
}

.company-period {
  font-size: 0.85rem;
  color: var(--accent-light);
  margin-top: 8px;
  font-weight: 500;
}

.role-block {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.role-block:first-of-type {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.role-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.role-period {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.project-block {
  margin-top: 16px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}

.project-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--accent-light);
  margin-bottom: 12px;
}

.project-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-list li {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
}

.project-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
  font-size: 0.75rem;
}

.project-tech {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.project-tech strong {
  color: var(--text-muted);
}

.prototypes-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.85rem;
}

.prototypes-table th,
.prototypes-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.prototypes-table th {
  color: var(--text-muted);
  font-weight: 600;
  background: rgba(0, 0, 0, 0.15);
}

.prototypes-table td {
  color: var(--text-dim);
}

.prototypes-table tr:last-child td {
  border-bottom: none;
}

/* Achievements */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.achievement-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: var(--transition);
}

.section-alt .achievement-card {
  background: var(--bg);
}

.achievement-card:hover {
  transform: translateY(-2px);
  border-color: rgba(59, 130, 246, 0.3);
}

.achievement-card h3 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-light);
  margin-bottom: 14px;
}

.achievement-card ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.achievement-card li {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-left: 14px;
  position: relative;
}

.achievement-card li::before {
  content: '•';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Stack Table */
.stack-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.stack-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.stack-table tr {
  border-bottom: 1px solid var(--border);
}

.stack-table tr:last-child {
  border-bottom: none;
}

.stack-table tr:hover {
  background: rgba(59, 130, 246, 0.04);
}

.stack-table td {
  padding: 14px 20px;
  vertical-align: top;
}

.stack-table td:first-child {
  font-weight: 600;
  color: var(--accent-light);
  white-space: nowrap;
  width: 200px;
}

.stack-table td:last-child {
  color: var(--text-muted);
}

/* Publications */
.publications-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.publication-item {
  padding: 20px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}

.section-alt .publication-item {
  background: var(--bg);
}

.publication-item:hover {
  border-color: rgba(59, 130, 246, 0.3);
}

.publication-item p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.publication-item a {
  color: var(--accent-light);
  text-decoration: none;
  word-break: break-all;
}

.publication-item a:hover {
  text-decoration: underline;
}

/* Education */
.education-content {
  display: flex;
  flex-direction: column;
  gap: 24px;
  margin-bottom: 32px;
}

.edu-block h3 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.edu-block ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.edu-block li {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
}

.edu-block li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
}

.certificates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.cert-card {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: var(--transition);
  cursor: pointer;
}

.cert-card:hover {
  transform: scale(1.02);
  border-color: var(--accent);
}

.cert-card img {
  width: 100%;
  height: auto;
  display: block;
}

.cert-caption {
  padding: 10px 14px;
  font-size: 0.78rem;
  color: var(--text-dim);
  background: var(--bg-card);
}

/* Languages & Additional */
.languages-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 32px;
}

.languages-list li {
  font-size: 0.9rem;
  color: var(--text-muted);
}

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

.additional ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.additional li {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding-left: 16px;
  position: relative;
}

.additional li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
}

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

.footer p {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.github-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--transition);
}

.github-link:hover {
  color: var(--accent-light);
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: pointer;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Responsive */
@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    gap: 24px;
  }

  .hero-photo-wrap {
    margin: 0 auto;
  }

  .hero-contacts,
  .hero-meta,
  .hero-positions {
    justify-content: center;
  }

  .hero-qr {
    order: -1;
  }

  .hero {
    padding-top: 70px;
  }
}

@media (max-width: 600px) {
  .section {
    padding: 48px 0;
  }

  .company-block {
    padding: 20px;
  }

  .lang-switcher {
    top: 10px;
    left: 10px;
  }

  .hero-photo {
    width: 140px;
    height: 140px;
  }
}

@media print {
  .lang-switcher,
  .nav,
  .hero-qr {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }

  .section-alt {
    background: #f5f5f5;
  }
}
