:root {
  --bg: #0a0a0f;
  --bg-elev: #101018;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f4f8;
  --text-soft: #c7c9d6;
  --muted: #8e92a6;
  --accent: #7c5cff;
  --accent-2: #22d3ee;
  --accent-3: #ff6b9d;
  --success: #34d399;
  --gradient: linear-gradient(115deg, #a78bfa 0%, #7c5cff 38%, #22d3ee 100%);
  --shadow: 0 24px 70px -28px rgba(0, 0, 0, 0.75);
  --radius-lg: 26px;
  --radius: 18px;
  --radius-sm: 12px;
  --font-display: 'Sora', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --font-body: 'Inter', 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif;
  --max: 1120px;
  --header-h: 78px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: dark;
}

html[data-theme="light"] {
  --bg: #f7f6f2;
  --bg-elev: #ffffff;
  --surface: rgba(18, 18, 30, 0.035);
  --surface-hover: rgba(18, 18, 30, 0.065);
  --border: rgba(18, 18, 30, 0.1);
  --border-strong: rgba(18, 18, 30, 0.18);
  --text: #16161f;
  --text-soft: #3c3d4d;
  --muted: #6c6e80;
  --accent: #5b3df5;
  --accent-2: #0891b2;
  --accent-3: #db2777;
  --shadow: 0 28px 70px -34px rgba(30, 25, 80, 0.4);
  color-scheme: light;
}

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

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background 0.5s var(--ease), color 0.5s var(--ease);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(124, 92, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 92, 255, 0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(circle at 50% 8%, black 0%, transparent 62%);
  pointer-events: none;
}

::selection { background: rgba(124, 92, 255, 0.35); color: #fff; }

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; display: block; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(var(--accent), var(--accent-2));
  border-radius: 99px;
  border: 3px solid var(--bg);
}

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

/* ---------- ambient ---------- */
.glow {
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.5;
  pointer-events: none;
}
.glow-a {
  width: 520px; height: 520px;
  top: -180px; right: -120px;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.55), transparent 65%);
  animation: drift 16s ease-in-out infinite alternate;
}
.glow-b {
  width: 460px; height: 460px;
  bottom: -200px; left: -160px;
  background: radial-gradient(circle, rgba(34, 211, 238, 0.32), transparent 65%);
  animation: drift 20s ease-in-out infinite alternate-reverse;
}
@keyframes drift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to { transform: translate3d(-40px, 50px, 0) scale(1.12); }
}

/* ---------- scroll progress ---------- */
.scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 200;
  background: transparent;
}
.scroll-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--gradient);
  box-shadow: 0 0 14px rgba(124, 92, 255, 0.8);
}

/* ---------- header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  transition: background 0.4s var(--ease), border-color 0.4s var(--ease), backdrop-filter 0.4s;
  border-bottom: 1px solid transparent;
}
.site-header.scrolled {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom-color: var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; gap: 24px; }

.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; letter-spacing: -0.02em; }
.logo-mark {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 11px;
  background: var(--gradient);
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  box-shadow: 0 8px 24px -8px rgba(124, 92, 255, 0.75);
  transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.logo:hover .logo-mark { transform: rotate(-8deg) scale(1.06); box-shadow: 0 12px 30px -8px rgba(124, 92, 255, 0.9); }
.logo-text { font-size: 17px; }
.dot { color: var(--accent); }

.nav-links { display: flex; align-items: center; gap: 6px; }
.nav-link {
  position: relative;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 99px;
  transition: color 0.25s, background 0.25s;
}
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--text); }
.nav-link.active::after {
  content: '';
  position: absolute;
  left: 50%; bottom: 1px;
  width: 4px; height: 4px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.nav-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 11px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-soft);
  transition: color 0.25s, border-color 0.25s, background 0.25s, transform 0.25s;
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface-hover); transform: translateY(-1px); }
.icon-btn svg { width: 18px; height: 18px; }

.icon-moon { display: none; }
html[data-theme="light"] .icon-sun { display: none; }
html[data-theme="light"] .icon-moon { display: block; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 48px;
  padding: 0 24px;
  border-radius: 99px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: var(--font-display);
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s, border-color 0.3s;
}
.btn svg { width: 17px; height: 17px; transition: transform 0.3s var(--ease); }
.btn:hover svg { transform: translateX(3px); }
.btn-primary {
  background: var(--gradient);
  color: #fff;
  box-shadow: 0 14px 34px -14px rgba(124, 92, 255, 0.9);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -14px rgba(124, 92, 255, 1); }
.btn-ghost {
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
}
.btn-ghost:hover { background: var(--surface-hover); transform: translateY(-2px); border-color: rgba(124, 92, 255, 0.5); }
.btn-sm { height: 40px; padding: 0 18px; font-size: 13.5px; }
.btn-block { width: 100%; }

.menu-toggle { display: none; flex-direction: column; gap: 4px; }
.menu-toggle span { width: 17px; height: 1.8px; background: currentColor; border-radius: 2px; transition: transform 0.35s var(--ease), opacity 0.25s; }
.menu-toggle.open span:nth-child(1) { transform: translateY(5.8px) rotate(45deg); }
.menu-toggle.open span:nth-child(2) { opacity: 0; }
.menu-toggle.open span:nth-child(3) { transform: translateY(-5.8px) rotate(-45deg); }

/* ---------- hero ---------- */
.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  align-items: center;
  gap: 48px;
  padding-top: calc(var(--header-h) + 48px);
  padding-bottom: 48px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px 7px 11px;
  border: 1px solid var(--border);
  border-radius: 99px;
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: 0.02em;
}
.pulse-dot {
  position: relative;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.15);
}
.pulse-dot::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid var(--success);
  animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.5); opacity: 0.9; }
  100% { transform: scale(1.9); opacity: 0; }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(42px, 6vw, 76px);
  line-height: 1.06;
  letter-spacing: -0.045em;
  font-weight: 700;
  margin: 24px 0 16px;
}
.gradient-text {
  background: var(--gradient);
  background-size: 180% 180%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradientShift 8s ease infinite;
}
@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.hero-role {
  font-family: var(--font-display);
  font-size: clamp(17px, 2vw, 21px);
  font-weight: 500;
  color: var(--text-soft);
  min-height: 34px;
}
.typed-wrap { color: var(--text); font-weight: 600; }
.caret {
  display: inline-block;
  width: 2px; height: 1.05em;
  margin-left: 2px;
  background: var(--accent-2);
  vertical-align: -0.15em;
  animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.hero-desc {
  max-width: 490px;
  margin-top: 18px;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.85;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.hero-socials { display: flex; align-items: center; gap: 10px; margin-top: 34px; }
.social-link {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  transition: color 0.25s, border-color 0.25s, transform 0.3s var(--ease), background 0.25s;
}
.social-link svg { width: 17px; height: 17px; }
.social-link:hover { color: var(--text); border-color: rgba(124, 92, 255, 0.55); background: rgba(124, 92, 255, 0.12); transform: translateY(-3px); }
.social-divider { width: 1px; height: 22px; background: var(--border); margin: 0 6px; }
.social-note { font-size: 12.5px; color: var(--muted); letter-spacing: 0.02em; }

/* hero visual */
.hero-visual {
  position: relative;
  min-height: 520px;
  display: grid;
  place-items: center;
}
.orbit {
  position: absolute;
  width: min(470px, 100%);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px dashed rgba(124, 92, 255, 0.25);
  animation: spin 50s linear infinite;
}
.orbit::before, .orbit::after {
  content: '';
  position: absolute;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 18px var(--accent-2);
}
.orbit::before { top: 8%; left: 22%; }
.orbit::after { bottom: 12%; right: 18%; background: var(--accent-3); box-shadow: 0 0 18px var(--accent-3); }
@keyframes spin { to { transform: rotate(360deg); } }

.code-card {
  position: relative;
  z-index: 2;
  width: min(430px, 100%);
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  overflow: hidden;
  transform: rotate(-2.4deg);
  transition: transform 0.6s var(--ease);
}
.hero-visual:hover .code-card { transform: rotate(0deg) translateY(-4px); }

.code-top {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.dot { width: 9px; height: 9px; border-radius: 50%; }
.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }
.code-file { margin-left: auto; font-size: 11.5px; color: var(--muted); font-family: 'SFMono-Regular', Consolas, monospace; }

.code-body {
  padding: 22px 20px;
  font-family: 'SFMono-Regular', 'JetBrains Mono', Consolas, monospace;
  font-size: 12.4px;
  line-height: 1.95;
  color: var(--text-soft);
  overflow-x: auto;
}
.c-keyword { color: #c792ea; }
.c-name { color: #82aaff; }
.c-string { color: #c3e88d; }
.c-bool { color: #ff9cac; }
html[data-theme="light"] .c-keyword { color: #8250df; }
html[data-theme="light"] .c-name { color: #0550ae; }
html[data-theme="light"] .c-string { color: #1a7f37; }
html[data-theme="light"] .c-bool { color: #cf222e; }

.code-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  color: var(--muted);
  background: var(--surface);
}
.status-line { display: inline-flex; align-items: center; gap: 6px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 8px var(--success); }
.code-time { font-family: monospace; opacity: 0.7; }

.avatar-ring {
  position: absolute;
  z-index: 3;
  right: 3%; bottom: 6%;
  width: 92px; height: 92px;
  border-radius: 50%;
  padding: 3px;
  background: var(--gradient);
  box-shadow: 0 18px 40px -12px rgba(124, 92, 255, 0.8);
  animation: floatY 6s ease-in-out infinite;
}
.avatar-inner {
  width: 100%; height: 100%;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg-elev);
}
.avatar-mono {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.float-card {
  position: absolute;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border-strong);
  background: color-mix(in srgb, var(--bg-elev) 86%, transparent);
  backdrop-filter: blur(14px);
  box-shadow: 0 16px 40px -18px rgba(0, 0, 0, 0.6);
  animation: floatY 7s ease-in-out infinite;
}
.float-a { top: 6%; left: 0; animation-delay: -1.5s; }
.float-b { bottom: 2%; left: 1%; animation-delay: -3.5s; }
.float-icon {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: rgba(124, 92, 255, 0.16);
  color: #a78bfa;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
}
.float-card strong { display: block; font-size: 12.5px; font-weight: 600; line-height: 1.2; }
.float-card small { font-size: 10.5px; color: var(--muted); }

/* ---------- stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 8px;
}
.stat {
  background: var(--bg);
  padding: 28px 24px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px;
  transition: background 0.3s;
}
.stat:hover { background: var(--bg-elev); }
.stat-num, .stat-suffix {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
}
.stat-suffix { color: var(--accent); font-size: 22px; }
.stat-label { flex-basis: 100%; margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* ---------- sections ---------- */
.section { padding: 110px 0 0; }
.section-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 44px;
}
.section-index {
  font-family: 'SFMono-Regular', Consolas, monospace;
  font-size: 12px;
  color: var(--accent-2);
  letter-spacing: 0.08em;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.1;
}
.section-line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--border-strong), transparent); }

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 0.86fr 1.14fr;
  gap: 48px;
  align-items: start;
}
.about-card {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 14px;
  transition: border-color 0.3s, transform 0.5s var(--ease);
}
.about-card:hover { border-color: var(--border-strong); transform: translateY(-4px); }
.portrait {
  position: relative;
  aspect-ratio: 4 / 4.2;
  border-radius: 18px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 30% 22%, rgba(124, 92, 255, 0.5), transparent 55%),
    radial-gradient(circle at 75% 78%, rgba(34, 211, 238, 0.32), transparent 55%),
    linear-gradient(150deg, #16131f, #0d1117);
}
.portrait::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at 50% 50%, black, transparent 78%);
}
.portrait::after {
  content: '';
  position: absolute;
  width: 220px; height: 220px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 34px rgba(255, 255, 255, 0.035), 0 0 0 68px rgba(255, 255, 255, 0.02);
}
.portrait-mono {
  position: relative;
  z-index: 2;
  font-family: var(--font-display);
  font-size: clamp(76px, 9vw, 112px);
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 1;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 12px 30px rgba(124, 92, 255, 0.5));
}
.portrait-badge {
  position: absolute;
  z-index: 3;
  left: 14px; bottom: 14px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(10, 10, 15, 0.55);
  backdrop-filter: blur(10px);
  color: #e8e8f0;
  font-size: 11px;
}
.about-meta { padding: 18px 6px 6px; display: grid; gap: 2px; }
.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 4px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.meta-row:last-child { border-bottom: 0; }
.meta-row span { color: var(--muted); }
.meta-row strong { font-weight: 500; text-align: right; }
.meta-row .accent { color: var(--success); }

.about-text .lead { font-size: 18px; line-height: 1.75; color: var(--text); font-weight: 400; letter-spacing: -0.01em; }
.about-text p + p { margin-top: 18px; color: var(--muted); font-size: 15px; }
.about-list { margin: 28px 0; display: grid; gap: 12px; }
.about-list li { display: flex; align-items: center; gap: 11px; font-size: 14.5px; color: var(--text-soft); }
.about-list svg { width: 17px; height: 17px; flex: none; padding: 3px; border-radius: 50%; background: rgba(52, 211, 153, 0.14); color: var(--success); }
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--accent-2);
  border-bottom: 1px solid transparent;
  transition: gap 0.3s var(--ease), border-color 0.3s;
}
.text-link svg { width: 16px; height: 16px; }
.text-link:hover { gap: 13px; border-bottom-color: var(--accent-2); }

/* ---------- skills ---------- */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.skill-card {
  position: relative;
  padding: 28px 24px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(160deg, var(--surface), transparent 70%);
  overflow: hidden;
  transition: transform 0.5s var(--ease), border-color 0.3s, background 0.3s;
}
.skill-card::after {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 140px; height: 140px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.2), transparent 70%);
  opacity: 0;
  transition: opacity 0.4s;
}
.skill-card:hover { transform: translateY(-6px); border-color: rgba(124, 92, 255, 0.38); }
.skill-card:hover::after { opacity: 1; }
.skill-icon {
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: rgba(124, 92, 255, 0.1);
  color: #a78bfa;
  margin-bottom: 20px;
}
.skill-icon svg { width: 22px; height: 22px; }
.skill-card h3 { font-family: var(--font-display); font-size: 18px; font-weight: 600; letter-spacing: -0.02em; }
.skill-card p { margin-top: 8px; font-size: 13.5px; color: var(--muted); line-height: 1.7; }
.tags { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.tag {
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 11.5px;
  color: var(--text-soft);
  font-weight: 500;
  transition: border-color 0.25s, color 0.25s, background 0.25s;
}
.tag:hover { border-color: rgba(34, 211, 238, 0.4); color: var(--text); background: rgba(34, 211, 238, 0.08); }

.skill-bars {
  margin-top: 30px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 48px;
  padding: 30px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.bar-row { display: grid; gap: 9px; }
.bar-label { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-soft); font-weight: 500; }
.bar-pct { color: var(--muted); font-family: monospace; font-size: 12px; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-hover); overflow: hidden; }
.bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--gradient);
  transition: width 1.4s var(--ease);
}
.skill-bars.in-view .bar span { width: var(--w); }

/* ---------- projects ---------- */
.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; }
.project-card {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.5s var(--ease), border-color 0.3s, box-shadow 0.5s var(--ease);
}
.project-card:hover { transform: translateY(-6px); border-color: var(--border-strong); box-shadow: var(--shadow); }
.project-card.featured { grid-column: span 2; flex-direction: row; }
.project-card.featured .project-thumb { flex: 1.05; min-height: 340px; }
.project-card.featured .project-info { flex: 0.95; justify-content: center; padding: 40px 38px; }

.project-thumb {
  position: relative;
  min-height: 235px;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.thumb-a { background: linear-gradient(145deg, #17122e 0%, #1b2a3a 55%, #0d1620 100%); }
.thumb-b { background: linear-gradient(145deg, #1a1224 0%, #2a1630 60%, #12101c 100%); }
.thumb-c { background: linear-gradient(145deg, #0e1a24 0%, #10202a 55%, #0b1218 100%); }
.project-thumb::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(circle at 50% 40%, black, transparent 82%);
}
.thumb-tag {
  position: absolute;
  z-index: 4;
  top: 16px; left: 16px;
  padding: 5px 11px;
  border-radius: 99px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(8, 8, 14, 0.45);
  backdrop-filter: blur(8px);
  color: #d9dbe8;
  font-size: 10.5px;
  letter-spacing: 0.03em;
}

.thumb-mock {
  position: relative;
  z-index: 2;
  width: min(82%, 380px);
  transform: translateY(14px);
  transition: transform 0.6s var(--ease);
}
.project-card:hover .thumb-mock { transform: translateY(4px) scale(1.02); }

.mock-dashboard {
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(14, 14, 24, 0.82);
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}
.mock-bar { display: flex; gap: 5px; padding: 9px 12px; border-bottom: 1px solid rgba(255, 255, 255, 0.07); }
.mock-bar span { width: 7px; height: 7px; border-radius: 50%; background: rgba(255, 255, 255, 0.18); }
.mock-body { display: flex; min-height: 190px; }
.mock-side { width: 58px; border-right: 1px solid rgba(255, 255, 255, 0.07); background: rgba(255, 255, 255, 0.025); }
.mock-main { flex: 1; padding: 16px; display: grid; gap: 16px; align-content: start; }
.mock-row { display: flex; gap: 8px; align-items: center; }
.mock-block { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.14); }
.mock-block.w40 { width: 40%; }
.mock-block.w20 { width: 18%; }
.mock-block.accent { background: var(--gradient); }
.mock-chart { display: flex; align-items: flex-end; gap: 8px; height: 110px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.06); }
.mock-chart i {
  flex: 1;
  height: var(--h);
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #8b6dff, rgba(34, 211, 238, 0.35));
  opacity: 0.85;
}

.mock-chat { display: grid; gap: 10px; width: min(76%, 330px); }
.chat-bubble {
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
}
.chat-bubble.left { width: 82%; border-bottom-left-radius: 4px; }
.chat-bubble.right {
  width: 66%;
  justify-self: end;
  border-bottom-right-radius: 4px;
  background: linear-gradient(120deg, rgba(124, 92, 255, 0.45), rgba(34, 211, 238, 0.28));
  border-color: rgba(167, 139, 250, 0.35);
}
.chat-bubble.short { width: 48%; }
.chat-input {
  margin-top: 4px;
  height: 38px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  display: flex;
  align-items: center;
  padding: 0 8px;
}
.chat-input span {
  display: block;
  width: 24px; height: 24px;
  margin-left: auto;
  border-radius: 7px;
  background: var(--gradient);
}

.mock-code {
  display: grid;
  gap: 11px;
  width: min(78%, 330px);
  padding: 22px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(8, 12, 16, 0.7);
  box-shadow: 0 24px 50px -20px rgba(0, 0, 0, 0.8);
}
.mock-code .line { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, 0.14); }
.mock-code .w70 { width: 70%; }
.mock-code .w45 { width: 45%; }
.mock-code .w85 { width: 85%; }
.mock-code .w55 { width: 55%; }
.mock-code .w65 { width: 65%; }
.mock-code .w30 { width: 30%; }
.mock-code .accent { background: rgba(167, 139, 250, 0.7); }
.mock-code .accent-2 { background: rgba(34, 211, 238, 0.6); }

.project-info { padding: 24px; display: flex; flex-direction: column; flex: 1; }
.project-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.project-top h3 { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.project-year { font-family: monospace; font-size: 11.5px; color: var(--muted); }
.project-info > p { margin-top: 9px; font-size: 13.5px; color: var(--muted); line-height: 1.75; }
.project-info .tags { margin-top: 15px; }
.project-links { display: flex; gap: 18px; margin-top: auto; padding-top: 20px; }
.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--accent-2);
  transition: gap 0.25s var(--ease), color 0.25s;
}
.project-link svg { width: 15px; height: 15px; }
.project-link:hover { gap: 10px; }
.project-link.muted { color: var(--muted); }
.project-link.muted:hover { color: var(--text); }

/* ---------- timeline ---------- */
.timeline { position: relative; display: grid; gap: 8px; padding-left: 26px; }
.timeline::before {
  content: '';
  position: absolute;
  left: 5px; top: 10px; bottom: 10px;
  width: 1px;
  background: linear-gradient(180deg, var(--accent), rgba(34, 211, 238, 0.35), transparent);
}
.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 32px;
  padding: 24px 0;
  border-bottom: 1px solid var(--border);
}
.timeline-item:last-child { border-bottom: 0; }
.timeline-dot {
  position: absolute;
  left: -26px; top: 34px;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.12), 0 0 16px rgba(124, 92, 255, 0.6);
  transform: translateX(-0.5px);
}
.timeline-date {
  font-family: monospace;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.02em;
  padding-top: 4px;
}
.timeline-body h3 { font-family: var(--font-display); font-size: 17px; font-weight: 600; letter-spacing: -0.015em; }
.company { color: var(--accent-2); font-weight: 500; }
.timeline-body p { margin-top: 7px; font-size: 13.5px; color: var(--muted); max-width: 620px; }
.timeline-body .tags { margin-top: 13px; }

/* ---------- contact ---------- */
.contact-section { padding-bottom: 0; }
.contact-card {
  position: relative;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 56px;
  padding: 56px;
  border-radius: 32px;
  border: 1px solid var(--border-strong);
  background: linear-gradient(150deg, rgba(124, 92, 255, 0.1), var(--surface) 42%, rgba(34, 211, 238, 0.06));
  overflow: hidden;
}
.contact-glow {
  position: absolute;
  top: -140px; left: -100px;
  width: 380px; height: 380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.35), transparent 65%);
  filter: blur(40px);
  pointer-events: none;
}
.contact-copy { position: relative; }
.contact-title {
  font-family: var(--font-display);
  font-size: clamp(34px, 4.2vw, 54px);
  line-height: 1.06;
  letter-spacing: -0.045em;
  font-weight: 700;
  margin: 20px 0 16px;
}
.contact-copy > p { color: var(--muted); font-size: 14.5px; max-width: 400px; }
.contact-copy .btn { margin-top: 26px; }
.contact-socials { display: flex; flex-wrap: wrap; gap: 20px; margin-top: 26px; }
.contact-socials a {
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  transition: color 0.25s, border-color 0.25s;
}
.contact-socials a:hover { color: var(--text); border-color: var(--accent); }

.contact-form {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 28px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  backdrop-filter: blur(10px);
}
.field { display: grid; gap: 7px; }
.field label { font-size: 12px; font-weight: 500; color: var(--text-soft); letter-spacing: 0.02em; }
.field input, .field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  outline: none;
  resize: vertical;
  transition: border-color 0.25s, box-shadow 0.25s, background 0.25s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: 0.7; }
.field input:focus, .field textarea:focus {
  border-color: rgba(124, 92, 255, 0.65);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.14);
  background: var(--surface-hover);
}
.field input.invalid, .field textarea.invalid { border-color: rgba(255, 107, 157, 0.7); }
.form-note { font-size: 11px; color: var(--muted); text-align: center; }

/* ---------- footer ---------- */
.site-footer { margin-top: 100px; border-top: 1px solid var(--border); background: var(--bg-elev); }
.footer-inner {
  padding: 36px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.footer-note { font-size: 13px; color: var(--muted); }
.footer-copy { font-size: 12px; color: var(--muted); opacity: 0.8; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 300;
  transform: translate(-50%, 24px);
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elev);
  box-shadow: var(--shadow);
  font-size: 13px;
  color: var(--text);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s, transform 0.45s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
.reveal.in-view { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .hero { grid-template-columns: 1fr; gap: 40px; padding-top: calc(var(--header-h) + 40px); }
  .hero-visual { min-height: 460px; }
  .hero-copy { max-width: 640px; }
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
  .about-card { max-width: 460px; }
  .skills-grid { grid-template-columns: 1fr 1fr; }
  .contact-card { grid-template-columns: 1fr; gap: 36px; padding: 40px; }
}

@media (max-width: 760px) {
  .container { width: calc(100% - 36px); }
  :root { --header-h: 68px; }
  .nav-links {
    position: fixed;
    inset: var(--header-h) 0 auto;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 14px 18px 22px;
    background: color-mix(in srgb, var(--bg) 94%, transparent);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    transform: translateY(-14px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, transform 0.4s var(--ease), visibility 0.3s;
  }
  .nav-links.open { opacity: 1; visibility: visible; transform: none; }
  .nav-link { padding: 12px 8px; font-size: 15px; border-radius: 8px; }
  .nav-link.active::after { left: auto; right: 12px; bottom: 50%; transform: translateY(50%); }
  .menu-toggle { display: flex; }
  .nav-cta { display: none; }

  .hero { min-height: auto; padding-top: calc(var(--header-h) + 48px); padding-bottom: 32px; }
  .hero-title { font-size: clamp(38px, 11vw, 54px); }
  .hero-desc { font-size: 14.5px; }
  .hero-socials { flex-wrap: wrap; }
  .social-note { flex-basis: 100%; margin-top: 2px; order: 5; }
  .social-divider { display: none; }
  .hero-visual { min-height: 400px; margin-top: 8px; }
  .code-card { transform: none; width: 100%; max-width: 420px; }
  .code-body { font-size: 11px; padding: 18px 16px; }
  .orbit { width: 330px; }
  .float-a { top: 0; left: -6px; }
  .float-b { display: none; }
  .avatar-ring { width: 76px; height: 76px; right: 0; bottom: 0; }

  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding: 22px 18px; }
  .stat-num { font-size: 27px; }
  .section { padding-top: 80px; }
  .section-head { margin-bottom: 32px; gap: 12px; }
  .skills-grid { grid-template-columns: 1fr; }
  .skill-bars { grid-template-columns: 1fr; padding: 24px; }
  .projects-grid { grid-template-columns: 1fr; }
  .project-card.featured { grid-column: span 1; flex-direction: column; }
  .project-card.featured .project-thumb { min-height: 250px; }
  .project-card.featured .project-info { padding: 24px; }
  .timeline { padding-left: 22px; }
  .timeline-item { grid-template-columns: 1fr; gap: 8px; padding: 20px 0; }
  .timeline-dot { left: -22px; top: 30px; }
  .contact-card { padding: 26px 20px; border-radius: 24px; }
  .contact-form { padding: 22px 18px; }
  .contact-copy .btn { width: 100%; }
  .footer-inner { flex-direction: column; align-items: flex-start; gap: 12px; }
  .site-footer { margin-top: 70px; }
}

@media (max-width: 420px) {
  .hero-actions .btn { flex: 1; padding: 0 18px; }
  .float-card { padding: 8px 11px; }
  .float-card small { display: none; }
  .avatar-ring { display: none; }
  .hero-visual { min-height: 360px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1; transform: none; }
}
