/* Reset + base */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  color: var(--text);
  background: radial-gradient(1200px 600px at 20% -100px, rgba(120, 120, 255, 0.08), transparent 60%), #0d1220;
}
:root {
  --bg-900: #0d1220;
  --bg-800: #131a2a;
  --bg-700: #0f172a;
  --text: #e6edf3;
  --text-dim: #9fb2c7;
  --primary: #7c3aed;
  --primary-600: #6d28d9;
  --card: #0f1a2f;
  --border: #1e2a44;
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
}

[data-theme="light"] {
  --bg-900: #e8eef7;
  --bg-800: #e0e8f0;
  --bg-700: #d8dff0;
  --text: #0f0f1e;
  --text-dim: #3a3a5a;
  --primary: #6d28d9;
  --primary-600: #5b21b6;
  --card: #f8f9fd;
  --border: #c8d0e8;
  --shadow: 0 4px 20px rgba(109, 40, 217, 0.12);
}

[data-theme="light"] body {
  background: linear-gradient(135deg, #e8eef7 0%, #e0e8f0 100%);
  background-attachment: fixed;
}

[data-theme="light"] body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(232, 238, 247, 0.95);
  z-index: -1;
}

[data-theme="light"] .site-header {
  background: rgba(248, 249, 253, 0.98);
  border-bottom: 1px solid #c8d0e8;
  box-shadow: 0 2px 12px rgba(109, 40, 217, 0.08);
}

[data-theme="light"] .hero {
  background: linear-gradient(to bottom, rgba(109, 40, 217, 0.06) 0%, rgba(139, 92, 246, 0.02) 60%);
}

[data-theme="light"] .stats-section {
  background: linear-gradient(135deg, rgba(109, 40, 217, 0.04) 0%, rgba(139, 92, 246, 0.02) 100%);
  border-top: 1px solid #c8d0e8;
  border-bottom: 1px solid #c8d0e8;
}

[data-theme="light"] .about-section {
  background: rgba(139, 92, 246, 0.02);
}

[data-theme="light"] #skills {
  background: linear-gradient(135deg, rgba(109, 40, 217, 0.03) 0%, rgba(139, 92, 246, 0.01) 100%);
}

[data-theme="light"] .stat-card {
  background: rgba(109, 40, 217, 0.08);
  border: 2px solid rgba(109, 40, 217, 0.25);
}

[data-theme="light"] .stat-number {
  color: #5b21b6;
}

[data-theme="light"] .card {
  background: #f8f9fd;
  border: 1px solid #c8d0e8;
  box-shadow: 0 2px 12px rgba(109, 40, 217, 0.08);
}

[data-theme="light"] .skill-category {
  background: #f8f9fd;
  border: 1px solid #c8d0e8;
}

[data-theme="light"] .skill-tag {
  background: rgba(109, 40, 217, 0.1);
  border: 1px solid rgba(109, 40, 217, 0.2);
  color: #5b21b6;
}

/* Layout helpers */
.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}
.section { 
  padding: 80px 0 64px;
  scroll-margin-top: 80px;
}
section[id] {
  scroll-margin-top: 80px;
}
#skills {
  padding-top: 100px;
}
#projects {
  padding-top: 100px;
}
#about {
  padding-top: 100px;
}
#contact {
  padding-top: 100px;
}
.section h2 {
  font-size: 2.25rem;
  margin: 0 0 40px;
  text-align: center;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary) 0%, #a78bfa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(140%) blur(6px);
  background: linear-gradient(to bottom, rgba(19, 26, 42, 0.95), rgba(19, 26, 42, 0.80));
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0;
}
.brand {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.2px;
}
.nav { display: flex; gap: 28px; list-style: none; padding: 0; margin: 0; }
.nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-weight: 600;
}
.nav a:hover { 
  color: var(--primary);
  transform: translateY(-2px);
}
.nav a {
  transition: all 0.3s ease;
  position: relative;
}
.nav-link.active {
  color: var(--primary);
  position: relative;
}
.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--primary);
  border-radius: 2px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    width: 0;
    left: 50%;
  }
  to {
    width: 100%;
    left: 0;
  }
}

/* Theme Toggle */
.theme-toggle {
  background: var(--primary);
  border: none;
  border-radius: 25px;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-left: 16px;
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
}
.theme-toggle:hover {
  background: var(--primary-600);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}
.theme-icon {
  font-size: 1.1rem;
  transition: transform 0.3s ease;
}
.theme-toggle:hover .theme-icon {
  transform: rotate(20deg) scale(1.1);
}
.theme-label {
  font-size: 0.85rem;
  letter-spacing: 0.3px;
}

/* Hero */
.hero {
  background: linear-gradient(to bottom, #0f1a2f 0%, #0d1220 60%);
  padding: 112px 0 96px;
}
.hero h1 {
  font-size: clamp(2.5rem, 5vw + 1rem, 4rem);
  line-height: 1.1;
  margin: 0 0 18px;
}
.subtitle { color: var(--text-dim); font-size: 1.125rem; }
.actions { margin-top: 28px; display: flex; gap: 12px; flex-wrap: wrap; }

h1, h2, h3, h4, h5, h6 { color: var(--text); }
p { color: var(--text-dim); }

/* Stats Section */
.stats-section {
  padding: 70px 0;
  background: rgba(15, 26, 47, 0.4);
  border-top: 1px solid rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  margin: 50px 0 0;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  text-align: center;
}
.stat-card {
  padding: 20px;
  background: rgba(124, 58, 237, 0.1);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 12px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.2);
}
.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}
.stat-label {
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* Skills Section */
#skills { background: rgba(15, 26, 47, 0.3); }
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}
.skill-category {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
}
.skill-category h3 {
  margin: 0 0 16px;
  color: var(--primary);
  font-size: 1.1rem;
}
.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.skill-tag {
  padding: 6px 12px;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.4);
  border-radius: 20px;
  font-size: 0.875rem;
  color: #c7d2fe;
  transition: all 0.2s ease;
}
.skill-tag:hover {
  background: rgba(124, 58, 237, 0.25);
  transform: scale(1.05);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 18px;
  border-radius: 12px;
  background: #1f2937;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.btn.primary {
  background: var(--primary);
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  box-shadow: none;
}
.btn:hover {
  filter: brightness(1.08);
}
.btn:active { transform: translateY(1px); }

/* Cards and grid */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 24px;
  margin-top: 0;
}
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.card p { color: var(--text-dim); }
.card h3 { margin: 0 0 8px; }
.card .link { 
  color: #a5b4fc; 
  text-decoration: none; 
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.2s ease;
}
.card .link:hover { 
  color: #c7d2fe;
  gap: 8px;
}

/* Project Filters */
.project-filters {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 0 0 48px;
}
.filter-btn {
  padding: 10px 24px;
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 25px;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
}
.filter-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.2);
}
.filter-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.4);
}

/* Project Cards */
.project-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.project-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.4);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}
.project-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag {
  padding: 4px 10px;
  background: rgba(74, 222, 128, 0.15);
  border: 1px solid rgba(74, 222, 128, 0.3);
  border-radius: 12px;
  font-size: 0.75rem;
  color: #86efac;
  font-weight: 600;
}

/* About Section */
.about-section { background: rgba(15, 26, 47, 0.2); }
.about-content {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
}
.about-text p { line-height: 1.7; margin-bottom: 16px; }
.about-text strong { color: var(--primary); }
.education-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  height: fit-content;
}
.education-card h3 { margin: 0 0 16px; color: var(--primary); }
.edu-item { margin-top: 12px; }
.edu-title { font-weight: 600; color: var(--text); margin-bottom: 4px; }
.edu-school { color: var(--text-dim); font-size: 0.95rem; margin-bottom: 4px; }
.edu-year { color: var(--text-dim); font-size: 0.875rem; }
.achievements h3 { color: var(--primary); margin-bottom: 16px; }
.achievement-list {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 12px;
}
.achievement-list li {
  padding: 12px 16px;
  background: var(--card);
  border-left: 3px solid var(--primary);
  border-radius: 8px;
  color: var(--text-dim);
}

.stack { color: var(--text-dim); margin-top: 10px; }

/* Simple fade-in animations */
.stats-section,
#skills,
#projects,
#about,
#contact {
  animation: fadeInUp 0.8s ease-out both;
}

#skills { animation-delay: 0.2s; }
#projects { animation-delay: 0.3s; }
#about { animation-delay: 0.4s; }
#contact { animation-delay: 0.5s; }

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Project cards staggered animation */
.project-card {
  animation: fadeInScale 0.5s ease-out both;
}
.project-card:nth-child(1) { animation-delay: 0.1s; }
.project-card:nth-child(2) { animation-delay: 0.2s; }
.project-card:nth-child(3) { animation-delay: 0.3s; }
.project-card:nth-child(4) { animation-delay: 0.4s; }
.project-card:nth-child(5) { animation-delay: 0.5s; }
.project-card:nth-child(6) { animation-delay: 0.6s; }

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(20px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Project Card Filter Transitions */
.project-card.hidden {
  display: none !important;
  opacity: 0;
  pointer-events: none;
}

/* Back to Top Button */
.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
  opacity: 0;
  transform: translateY(100px) scale(0);
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 1000;
}
.back-to-top.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.back-to-top:hover {
  background: var(--primary-600);
  transform: translateY(-5px) scale(1.1);
  box-shadow: 0 8px 30px rgba(124, 58, 237, 0.6);
}
.back-to-top:active {
  transform: translateY(-2px) scale(1.05);
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.back-to-top.visible:hover {
  animation: bounce 1s infinite;
}

/* Footer */
.site-footer { border-top: 1px solid rgba(255,255,255,0.08); padding: 30px 0; background: var(--bg-800); }
.site-footer p { color: var(--text-dim); margin: 0; text-align: center; }

/* Responsive tweaks */
@media (max-width: 900px) {
  .about-content {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .header-inner { padding: 14px 0; }
  .nav { gap: 16px; }
  .hero { padding: 88px 0 72px; }
  .actions { justify-content: center; }
  .stats-grid { grid-template-columns: 1fr; }
  .skills-grid { grid-template-columns: 1fr; }
  .grid { grid-template-columns: 1fr; }
  .theme-toggle { padding: 6px 12px; margin-left: 8px; }
  .theme-label { display: none; }
  .project-filters { gap: 8px; }
  .filter-btn { padding: 6px 16px; font-size: 0.9rem; }
  .back-to-top {
    width: 45px;
    height: 45px;
    bottom: 20px;
    right: 20px;
  }
}
