/* ================= THEME ================= */
:root {
  --bg: #07070d;
  --bg-2: #0e0e18;
  --nav-bg: rgba(7, 7, 13, 0.72);
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.07);
  --border: rgba(255, 255, 255, 0.08);
  --grid: rgba(255, 255, 255, 0.035);
  --text: #ececf4;
  --muted: #9a9ab2;
  --accent-1: #7c5cff;
  --accent-2: #00d4ff;
  --accent-3: #ff4ecd;
  --gradient: linear-gradient(135deg, var(--accent-1), var(--accent-2) 50%, var(--accent-3));
  --radius: 20px;
  --shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.7);
  --nav-h: 76px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f5f6fb;
  --bg-2: #ffffff;
  --nav-bg: rgba(245, 246, 251, 0.78);
  --surface: rgba(20, 20, 60, 0.035);
  --surface-2: rgba(20, 20, 60, 0.07);
  --border: rgba(20, 20, 60, 0.1);
  --grid: rgba(20, 20, 60, 0.05);
  --text: #12121e;
  --muted: #5b5b72;
  --shadow: 0 30px 80px -35px rgba(30, 30, 80, 0.3);
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s, color 0.4s;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 0%, #000 15%, transparent 70%);
  mask-image: radial-gradient(ellipse at 50% 0%, #000 15%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

main, footer { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }
strong { color: var(--text); }
code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  padding: 0.1em 0.4em;
  border-radius: 6px;
  background: var(--surface-2);
}

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

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

.container { width: min(1180px, 92%); margin-inline: auto; }

section { padding: 130px 0; position: relative; }

.gradient-text {
  background: var(--gradient);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 6s linear infinite;
}

@keyframes shine { to { background-position: 200% center; } }

/* ================= FX LAYERS ================= */
#bg-canvas { position: fixed; inset: 0; z-index: 0; pointer-events: none; }

.scroll-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient);
  transform: scaleX(0);
  transform-origin: left;
  z-index: 200;
}

.cursor-glow {
  position: fixed;
  top: -300px; left: -300px;
  width: 600px; height: 600px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.13), transparent 60%);
  pointer-events: none;
  z-index: 0;
  will-change: transform;
}

/* ================= BUTTONS ================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.95rem 1.6rem;
  border-radius: 14px;
  font-weight: 600;
  font-size: 0.98rem;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.25s var(--ease), box-shadow 0.25s, background 0.25s, border-color 0.25s;
}
.btn svg { width: 18px; height: 18px; transition: transform 0.25s var(--ease); }
.btn:hover svg { transform: translateX(4px); }

.btn-primary {
  background: var(--gradient);
  background-size: 150% auto;
  color: #fff;
  box-shadow: 0 12px 35px -12px rgba(124, 92, 255, 0.7);
}
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 18px 45px -12px rgba(124, 92, 255, 0.85); background-position: right center; }

.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { transform: translateY(-3px); border-color: var(--accent-1); background: var(--surface-2); }
.btn-ghost:hover svg { transform: translateY(3px); }

.btn-block { width: 100%; }

.icon-btn {
  width: 44px; height: 44px;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.25s, border-color 0.25s, color 0.25s;
}
.icon-btn:hover { transform: translateY(-3px); background: var(--surface-2); border-color: var(--accent-1); color: var(--accent-2); }
.icon-btn svg { width: 20px; height: 20px; }

/* ================= NAV ================= */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  z-index: 100;
  border-bottom: 1px solid transparent;
  transition: background 0.3s, border-color 0.3s;
}
.nav.scrolled {
  background: var(--nav-bg);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  backdrop-filter: blur(18px) saturate(160%);
  border-color: var(--border);
}
.nav .container { height: 100%; display: flex; align-items: center; justify-content: space-between; }

.logo { font-weight: 800; font-size: 1.5rem; letter-spacing: -0.03em; }
.logo span { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

.nav-links { display: flex; gap: 2.2rem; list-style: none; }
.nav-links a { position: relative; font-size: 0.95rem; font-weight: 500; color: var(--muted); transition: color 0.2s; }
.nav-links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -6px;
  width: 100%; height: 2px;
  border-radius: 2px;
  background: var(--gradient);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.3s var(--ease);
}
.nav-links a:hover, .nav-links a.active { color: var(--text); }
.nav-links a:hover::after, .nav-links a.active::after { transform: scaleX(1); }

.nav-actions { display: flex; gap: 0.75rem; align-items: center; }

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

.menu-toggle { display: none; flex-direction: column; justify-content: center; align-items: center; gap: 4px; }
.palette-btn { display: inline-flex; width: auto; gap: 0.5rem; padding: 0 0.75rem; }
.palette-btn svg { width: 18px; height: 18px; }
.menu-toggle span { display: block; width: 18px; height: 2px; border-radius: 2px; background: currentColor; transition: transform 0.3s, opacity 0.3s; }
.menu-toggle.active span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.menu-toggle.active span:nth-child(2) { opacity: 0; }
.menu-toggle.active span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ================= HERO ================= */
.hero { min-height: 100vh; display: flex; align-items: center; padding-top: calc(var(--nav-h) + 40px); }
.hero-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 4rem; align-items: center; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 1.6rem;
}
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; animation: pulse 2s infinite; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
  70%, 100% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
}

.hero h1 { font-size: clamp(2.7rem, 6.2vw, 4.8rem); line-height: 1.04; letter-spacing: -0.04em; font-weight: 800; }
.hero .lead { font-size: clamp(1.15rem, 2.2vw, 1.45rem); margin: 1.4rem 0 1rem; color: var(--muted); min-height: 1.6em; }
.typed { color: var(--text); font-weight: 600; }
.caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 3px; vertical-align: -0.15em; background: var(--accent-2); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

.desc { max-width: 560px; color: var(--muted); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 1rem; margin: 2.2rem 0; }
.socials { display: flex; gap: 0.75rem; align-items: center; }
.meta-pill { display: inline-flex; align-items: center; gap: 0.45rem; height: 44px; padding: 0 1rem; border-radius: 13px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 0.9rem; }
.meta-pill svg { width: 18px; height: 18px; color: var(--accent-2); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; margin-top: 3rem; max-width: 540px; }
.stat strong {
  display: block;
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1.1;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat span { font-size: 0.84rem; color: var(--muted); line-height: 1.4; display: block; margin-top: 0.3rem; }

.hero-visual { position: relative; }
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: 0.55; z-index: -1; animation: drift 12s ease-in-out infinite alternate; }
.orb-1 { width: 280px; height: 280px; background: var(--accent-1); top: -40px; right: -30px; }
.orb-2 { width: 220px; height: 220px; background: var(--accent-3); bottom: -50px; left: -20px; animation-delay: -6s; }
@keyframes drift { to { transform: translate(30px, -30px) scale(1.15); } }

.code-card {
  position: relative;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background:
    linear-gradient(var(--bg-2), var(--bg-2)) padding-box,
    var(--gradient) border-box;
  box-shadow: var(--shadow), 0 0 90px -25px rgba(124, 92, 255, 0.55);
  overflow: hidden;
  animation: float 6s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-16px); } }

.code-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.95rem 1.2rem; border-bottom: 1px solid var(--border); }
.code-head i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; }
.code-head i:nth-child(2) { background: #febc2e; }
.code-head i:nth-child(3) { background: #28c840; }
.code-head span { margin-left: auto; font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; color: var(--muted); }

.code-card pre { padding: 1.5rem; font-family: 'JetBrains Mono', monospace; font-size: 0.86rem; line-height: 1.8; overflow-x: auto; color: var(--text); }
.code-card code { padding: 0; background: none; font-size: inherit; }
.k { color: #c792ea; } .t { color: #82aaff; } .s { color: #c3e88d; } .f { color: #ffcb6b; } .a { color: #f78c6c; }
[data-theme="light"] .k { color: #7c3aed; }
[data-theme="light"] .t { color: #2563eb; }
[data-theme="light"] .s { color: #15803d; }
[data-theme="light"] .f { color: #b45309; }
[data-theme="light"] .a { color: #dc2626; }

.scroll-hint {
  position: absolute;
  bottom: 32px; left: 50%;
  translate: -50% 0;
  width: 26px; height: 42px;
  border: 2px solid var(--border);
  border-radius: 20px;
}
.scroll-hint span {
  position: absolute;
  top: 8px; left: 50%;
  width: 4px; height: 8px;
  margin-left: -2px;
  border-radius: 4px;
  background: var(--accent-2);
  animation: scrollDot 1.8s ease-in-out infinite;
}
@keyframes scrollDot { 0% { opacity: 0; transform: translateY(0); } 40% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }

/* ================= SECTION HEAD ================= */
.section-head { max-width: 700px; margin-bottom: 4rem; }
.section-tag { font-family: 'JetBrains Mono', monospace; font-size: 0.88rem; color: var(--accent-2); letter-spacing: 0.04em; }
.section-head h2 { font-size: clamp(2.1rem, 4.6vw, 3.3rem); line-height: 1.1; letter-spacing: -0.035em; margin: 0.6rem 0 1rem; }
.section-head p { color: var(--muted); font-size: 1.06rem; }

/* ================= CARD ================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
}
.card:hover { border-color: rgba(124, 92, 255, 0.45); background: var(--surface-2); box-shadow: 0 20px 50px -30px rgba(124, 92, 255, 0.6); }

.hl-icon {
  width: 48px; height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--accent-2);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.18), rgba(0, 212, 255, 0.12));
  border: 1px solid rgba(124, 92, 255, 0.25);
  margin-bottom: 1.2rem;
}
.hl-icon svg { width: 22px; height: 22px; }

/* ================= ABOUT ================= */
.about-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 3.5rem; align-items: start; }
.about-text p { color: var(--muted); font-size: 1.06rem; margin-bottom: 1.2rem; }
.highlights { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
.highlight h3 { font-size: 1.08rem; margin-bottom: 0.4rem; }
.highlight p { color: var(--muted); font-size: 0.92rem; }

/* ================= SKILLS ================= */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 1.4rem; }
.skill-card h3 { font-size: 1.15rem; margin-bottom: 0.4rem; }
.skill { margin-top: 1.15rem; }
.skill-top { display: flex; justify-content: space-between; font-size: 0.92rem; }
.skill-top span:last-child { font-family: 'JetBrains Mono', monospace; font-size: 0.8rem; color: var(--muted); }
.skill-bar { height: 8px; margin-top: 0.5rem; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.skill-fill {
  position: relative;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--gradient);
  transition: width 1.6s var(--ease);
}
.skill-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  transform: translateX(-100%);
  animation: sheen 2.8s ease-in-out infinite;
}
@keyframes sheen { to { transform: translateX(100%); } }

.marquee {
  margin-top: 4rem;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track { display: flex; gap: 1rem; width: max-content; animation: marquee 40s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(calc(-50% - 0.5rem)); } }
.chip {
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85rem;
  white-space: nowrap;
  transition: border-color 0.2s, color 0.2s;
}
.chip:hover { border-color: var(--accent-2); color: var(--accent-2); }

/* ================= TIMELINE ================= */
.timeline { position: relative; padding-left: 2.6rem; }
.timeline::before {
  content: "";
  position: absolute;
  left: 9px; top: 8px; bottom: 8px;
  width: 2px;
  background: linear-gradient(var(--accent-1), var(--accent-2), transparent);
}
.tl-item { position: relative; margin-bottom: 2rem; }
.tl-item::before {
  content: "";
  position: absolute;
  left: calc(-2.6rem + 3px);
  top: 2.2rem;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent-2);
  box-shadow: 0 0 0 6px rgba(0, 212, 255, 0.12), 0 0 20px rgba(0, 212, 255, 0.6);
}
.tl-meta { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.6rem; }
.tl-meta h3 { font-size: 1.3rem; }
.tl-date {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  color: var(--accent-2);
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  background: rgba(0, 212, 255, 0.08);
  border: 1px solid rgba(0, 212, 255, 0.22);
}
.tl-org { color: var(--muted); font-weight: 500; margin: 0.3rem 0 1.1rem; }
.tl-list { list-style: none; display: grid; gap: 0.7rem; }
.tl-list li { position: relative; padding-left: 1.5rem; color: var(--muted); }
.tl-list li::before { content: "▹"; position: absolute; left: 0; color: var(--accent-1); font-weight: 700; }

.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.3rem; }
.tag {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  padding: 0.32rem 0.75rem;
  border-radius: 8px;
  color: #b9a8ff;
  background: rgba(124, 92, 255, 0.12);
  border: 1px solid rgba(124, 92, 255, 0.25);
}
[data-theme="light"] .tag { color: #5b3fd9; }

/* ================= PROJECTS ================= */
.projects-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
.projects-grid article { height: 100%; }
.project-inner {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.25s ease-out, border-color 0.3s, background 0.3s, box-shadow 0.3s;
  will-change: transform;
}
.project-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(124, 92, 255, 0.18), transparent 45%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.project-inner:hover::before { opacity: 1; }
.project-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.6rem; }
.project-meta { font-family: 'JetBrains Mono', monospace; font-size: 0.74rem; color: var(--muted); text-align: right; }
.folder { width: 52px; height: 52px; border-radius: 15px; display: grid; place-items: center; color: #fff; background: var(--gradient); box-shadow: 0 10px 30px -10px rgba(124, 92, 255, 0.7); }
.folder svg { width: 24px; height: 24px; }
.project-links { display: flex; gap: 0.8rem; }
.project-links a { color: var(--muted); transition: color 0.2s, transform 0.2s; }
.project-links a:hover { color: var(--accent-2); transform: translateY(-2px); }
.project-links svg { width: 22px; height: 22px; }
.project-inner h3 { font-size: 1.32rem; margin-bottom: 0.7rem; letter-spacing: -0.01em; }
.project-inner p { color: var(--muted); flex: 1; }

/* ================= EDUCATION ================= */
.edu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.edu-card h3 { font-size: 1.25rem; margin: 1rem 0 0.2rem; }
.edu-card .tl-org { margin-bottom: 0.8rem; }
.edu-card p:last-child { color: var(--muted); font-size: 0.95rem; }
.award-list { list-style: none; display: grid; gap: 0.7rem; margin-top: 1rem; }
.award-list li { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; }
.award-list b { font-family: 'JetBrains Mono', monospace; background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

.sub-head { font-size: 1.5rem; margin: 4rem 0 1.5rem; letter-spacing: -0.02em; }
.cert-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); gap: 1.2rem; }
.cert { display: flex; gap: 1rem; align-items: flex-start; padding: 1.5rem; }
.cert-dot { width: 12px; height: 12px; margin-top: 0.45rem; border-radius: 50%; background: var(--gradient); flex-shrink: 0; box-shadow: 0 0 14px rgba(0, 212, 255, 0.7); }
.cert h4 { font-size: 1.02rem; }
.cert p { color: var(--muted); font-size: 0.88rem; }

/* ================= CONTACT ================= */
.contact-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 2rem; align-items: start; }
.contact-info { display: grid; gap: 1.1rem; }
.contact-item { display: flex; align-items: center; gap: 1.1rem; padding: 1.4rem 1.6rem; }
.contact-item .hl-icon { margin-bottom: 0; }
.contact-item h4 { font-size: 1rem; }
.contact-item p { color: var(--muted); font-size: 0.92rem; word-break: break-word; }

.field { position: relative; margin-bottom: 1.2rem; }
.field input, .field textarea {
  width: 100%;
  padding: 1.55rem 1rem 0.6rem;
  border-radius: 13px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  outline: none;
  resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.field label {
  position: absolute;
  left: 1rem; top: 1.05rem;
  font-size: 0.95rem;
  color: var(--muted);
  pointer-events: none;
  transition: top 0.2s var(--ease), font-size 0.2s var(--ease), color 0.2s;
}
.field input:focus, .field textarea:focus { border-color: var(--accent-1); box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.16); background: var(--surface-2); }
.field input:focus + label, .field input:not(:placeholder-shown) + label,
.field textarea:focus + label, .field textarea:not(:placeholder-shown) + label { top: 0.4rem; font-size: 0.72rem; color: var(--accent-2); }
.field.invalid input, .field.invalid textarea { border-color: #ef4444; }

.form-status { margin-top: 1rem; font-size: 0.9rem; min-height: 1.3em; color: var(--accent-2); text-align: center; }
.form-status.error { color: #ef4444; }

/* ================= IMPACT ================= */
.impact-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.2rem; margin-bottom: 1.5rem; }
.impact-tile { text-align: center; padding: 1.9rem 1rem; }
.impact-tile strong {
  display: block;
  font-size: clamp(2.1rem, 4vw, 2.9rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.03em;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.impact-tile span { color: var(--muted); font-size: 0.9rem; }

.heatmap-card { padding: 1.8rem; }
.hm-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.3rem; }
.hm-top h3 { font-size: 1.1rem; }
.hm-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.hm-tab {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8rem;
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.hm-tab:hover { color: var(--text); border-color: var(--accent-1); }
.hm-tab[aria-selected="true"] { background: var(--gradient); color: #fff; border-color: transparent; }
.hm-scroll { overflow-x: auto; padding-bottom: 0.4rem; }
.hm { width: max-content; margin-inline: auto; }
.hm-months, .hm-grid { display: grid; grid-auto-flow: column; grid-auto-columns: 13px; gap: 3px; }
.hm-months { height: 18px; font-size: 0.7rem; color: var(--muted); }
.hm-months span { white-space: nowrap; }
.hm-grid { grid-template-rows: repeat(7, 13px); }
.hm-cell, .hm-legend i { width: 13px; height: 13px; border-radius: 3px; background: var(--surface-2); }
.hm-cell.pad { visibility: hidden; }
.hm-cell.future { opacity: 0.35; }
.hm-cell { transition: transform 0.15s; }
.hm-cell:hover { transform: scale(1.35); outline: 1px solid var(--accent-2); }
.l1 { background: rgba(124, 92, 255, 0.4) !important; }
.l2 { background: rgba(124, 92, 255, 0.7) !important; }
.l3 { background: #6a8dff !important; }
.l4 { background: var(--accent-2) !important; box-shadow: 0 0 8px rgba(0, 212, 255, 0.7); }
.heatmap-card.visible .hm-cell { animation: cellIn 0.5s var(--ease) both; animation-delay: calc(var(--i, 0) * 12ms); }
@keyframes cellIn { from { opacity: 0; transform: scale(0.3); } }
.hm-legend { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: 1rem; font-size: 0.75rem; color: var(--muted); }
.hm-legend span { margin: 0 0.3rem; }

/* ================= ARCHITECTURE ================= */
.arch { margin-top: 5.5rem; text-align: center; }
.arch h3 { font-size: clamp(1.3rem, 2.6vw, 1.75rem); letter-spacing: -0.02em; margin: 0.5rem 0 2.2rem; }
.arch-flow { display: flex; align-items: stretch; }
.arch-node { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 1.4rem 0.8rem; }
.arch-node .hl-icon { margin-bottom: 0.8rem; }
.arch-node h4 { font-size: 0.98rem; }
.arch-node p { font-family: 'JetBrains Mono', monospace; font-size: 0.74rem; color: var(--muted); }
.arch-link { position: relative; flex: 0 0 44px; align-self: center; height: 2px; background: linear-gradient(90deg, var(--accent-1), var(--accent-2)); opacity: 0.6; }
.arch-link i {
  position: absolute;
  top: 50%; left: 0;
  width: 8px; height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--accent-2);
  box-shadow: 0 0 12px var(--accent-2);
  animation: packet 1.6s linear infinite;
}
@keyframes packet { from { left: 0; opacity: 0; } 15%, 85% { opacity: 1; } to { left: calc(100% - 8px); opacity: 0; } }
@keyframes packetV { from { top: 0; opacity: 0; } 15%, 85% { opacity: 1; } to { top: calc(100% - 8px); opacity: 0; } }
.arch-side { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; margin-top: 1.8rem; }

/* ================= TERMINAL ================= */
.terminal {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-2);
  box-shadow: var(--shadow), 0 0 90px -35px rgba(0, 212, 255, 0.45);
  overflow: hidden;
  font-family: 'JetBrains Mono', monospace;
}
.term-body { height: 400px; overflow-y: auto; padding: 1.2rem 1.4rem; font-size: 0.86rem; line-height: 1.7; cursor: text; }
.term-line { white-space: pre-wrap; word-break: break-word; }
.term-line.cmd { color: var(--text); }
.term-line.out { color: var(--muted); }
.term-line.accent { color: var(--accent-2); }
.term-line.ok { color: #28c840; }
.term-line.err { color: #ff6b6b; }
.term-line.ascii {
  white-space: pre;
  line-height: 1.2;
  font-weight: 700;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  overflow-x: auto;
  margin-bottom: 0.8rem;
}
.term-input-row { display: flex; align-items: center; gap: 0.6rem; }
.term-prompt, .term-line.cmd .p { color: #28c840; white-space: nowrap; }
#term-input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); font: inherit; caret-color: var(--accent-2); }

/* ================= COMMAND PALETTE ================= */
.palette { position: fixed; inset: 0; z-index: 500; display: grid; place-items: start center; padding-top: 14vh; }
.palette[hidden] { display: none; }
.palette-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); animation: fadeIn 0.2s ease; }
.palette-box {
  position: relative;
  width: min(600px, 92vw);
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(124, 92, 255, 0.25);
  overflow: hidden;
  animation: popIn 0.25s var(--ease);
}
#palette-input { width: 100%; padding: 1.2rem 1.4rem; border: 0; border-bottom: 1px solid var(--border); outline: none; background: transparent; color: var(--text); font: inherit; font-size: 1.05rem; }
#palette-list { list-style: none; max-height: 340px; overflow-y: auto; padding: 0.5rem; }
#palette-list li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.75rem 1rem; border-radius: 10px; color: var(--muted); cursor: pointer; }
#palette-list li small { font-family: 'JetBrains Mono', monospace; font-size: 0.72rem; opacity: 0.75; }
#palette-list li.active { background: var(--surface-2); color: var(--text); box-shadow: inset 3px 0 0 var(--accent-1); }
#palette-list li.empty { justify-content: center; cursor: default; }
.palette-foot { display: flex; gap: 1.2rem; padding: 0.7rem 1.2rem; border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--muted); }
.palette-foot kbd { margin-right: 0.2rem; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(-12px) scale(0.98); } }

/* ================= TOAST & PARTY ================= */
.toast {
  position: fixed;
  left: 50%; bottom: 28px;
  z-index: 600;
  translate: -50% 20px;
  opacity: 0;
  pointer-events: none;
  padding: 0.8rem 1.3rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  box-shadow: var(--shadow);
  font-size: 0.92rem;
  transition: opacity 0.3s, translate 0.3s var(--ease);
}
.toast.show { opacity: 1; translate: -50% 0; }
.party main, .party #bg-canvas { animation: hue 3s linear infinite; }
@keyframes hue { to { filter: hue-rotate(360deg); } }

/* ================= FOOTER ================= */
.footer { padding: 2.5rem 0; border-top: 1px solid var(--border); text-align: center; color: var(--muted); font-size: 0.92rem; }

.back-to-top {
  position: fixed;
  right: 24px; bottom: 24px;
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  translate: 0 20px;
  transition: opacity 0.3s, translate 0.3s, transform 0.25s, background 0.25s, border-color 0.25s;
}
.back-to-top.show { opacity: 1; pointer-events: auto; translate: 0 0; }

/* ================= PRELOADER ================= */
body.is-loading { overflow: hidden; }
.preloader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  background: var(--bg);
  transition: opacity 0.7s var(--ease), visibility 0.7s;
}
.preloader.done { opacity: 0; visibility: hidden; }
.pl-inner { text-align: center; }
.pl-logo { font-size: 3.6rem; font-weight: 800; letter-spacing: -0.04em; animation: plPulse 1.4s ease-in-out infinite; }
.pl-logo span { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
@keyframes plPulse { 50% { opacity: 0.55; transform: scale(0.96); } }
.pl-bar { width: 220px; height: 3px; margin: 1.4rem auto 0.8rem; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.pl-bar i { display: block; height: 100%; width: 0; background: var(--gradient); transition: width 0.25s linear; }
.pl-count { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; color: var(--muted); }

/* ================= CUSTOM CURSOR ================= */
.cursor-dot, .cursor-ring {
  position: fixed;
  top: 0; left: 0;
  z-index: 999;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  will-change: transform;
}
.has-cursor .cursor-dot, .has-cursor .cursor-ring { opacity: 1; }
.cursor-dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); }
.cursor-ring {
  width: 36px; height: 36px;
  margin: -18px 0 0 -18px;
  border: 1.5px solid rgba(124, 92, 255, 0.65);
  transition: opacity 0.3s, width 0.25s var(--ease), height 0.25s var(--ease), margin 0.25s var(--ease), background 0.25s, border-color 0.25s;
}
.cursor-ring.hover { width: 64px; height: 64px; margin: -32px 0 0 -32px; background: rgba(124, 92, 255, 0.1); border-color: var(--accent-2); }
.has-cursor, .has-cursor a, .has-cursor button, .has-cursor [data-tilt] { cursor: none; }
.has-cursor input, .has-cursor textarea { cursor: text; }

kbd {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  padding: 0.12rem 0.42rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
}

/* ================= REVEAL ================= */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 0.9s var(--ease) var(--d, 0s), transform 0.9s var(--ease) var(--d, 0s);
}
.reveal.visible { opacity: 1; transform: none; }

/* ================= RESPONSIVE ================= */
@media (max-width: 960px) {
  section { padding: 100px 0; }
  .hero-grid, .about-grid, .contact-grid { grid-template-columns: 1fr; }
  .hero-grid { gap: 3.5rem; }
  .edu-grid { grid-template-columns: 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
  .impact-grid { grid-template-columns: repeat(2, 1fr); }
  .palette-btn kbd { display: none; }
  .palette-btn { width: 44px; padding: 0; }
  .arch-flow { flex-direction: column; }
  .arch-link { flex: 0 0 36px; width: 2px; height: auto; background: linear-gradient(var(--accent-1), var(--accent-2)); }
  .arch-link i { top: 0; left: 50%; margin: 0 0 0 -4px; animation-name: packetV; }
  .scroll-hint { display: none; }

  .menu-toggle { display: flex; }
  .nav { background: var(--nav-bg); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
  .nav-links {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem 4% 1.2rem;
    background: var(--nav-bg);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--border);
    opacity: 0;
    transform: translateY(-12px);
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s var(--ease);
  }
  .nav-links.open { opacity: 1; transform: none; pointer-events: auto; }
  .nav-links a { display: block; padding: 0.85rem 0; font-size: 1.05rem; }
  .nav-links a::after { display: none; }
}

@media (max-width: 560px) {
  .highlights { grid-template-columns: 1fr; }
  .stats { gap: 1rem; }
  .stat strong { font-size: 1.8rem; }
  .card { padding: 1.5rem; }
  .code-card pre { font-size: 0.72rem; padding: 1.1rem; }
  .timeline { padding-left: 2rem; }
  .tl-item::before { left: calc(-2rem + 3px); }
  .term-body { height: 340px; font-size: 0.78rem; padding: 1rem; }
  .term-line.ascii { font-size: 0.6rem; }
  .impact-tile { padding: 1.4rem 0.6rem; }
}

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