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

:root {
  --bg: #0b0e14;
  --bg2: #111520;
  --bg3: #181d2a;
  --card: #141929;
  --border: rgba(255,255,255,0.07);
  --border2: rgba(255,255,255,0.13);
  --text: #e8eaf0;
  --muted: #6b7280;
  --accent: #3b82f6;
  --accent2: #06b6d4;
  --accent3: #8b5cf6;
  --green: #10b981;
  --amber: #f59e0b;
  --red: #ef4444;
  --nav-bg: rgba(11,14,20,0.85);
  --mono: 'Space Mono', monospace;
  --sans: 'Syne', sans-serif;
  --grid-line: rgba(59,130,246,0.03);
  --stroke-outline: rgba(255,255,255,0.25);
}

[data-theme="light"] {
  --bg: #f5f6fa;
  --bg2: #eceef5;
  --bg3: #e4e7f0;
  --card: #ffffff;
  --border: rgba(0,0,0,0.07);
  --border2: rgba(0,0,0,0.14);
  --text: #111827;
  --muted: #6b7280;
  --accent: #2563eb;
  --accent2: #0891b2;
  --accent3: #7c3aed;
  --green: #059669;
  --amber: #d97706;
  --red: #dc2626;
  --nav-bg: rgba(245,246,250,0.90);
  --grid-line: rgba(59,130,246,0.05);
  --stroke-outline: rgba(0,0,0,0.18);
}

[data-theme="light"] .stat-card,
[data-theme="light"] .project-card,
[data-theme="light"] .contact-link {
  box-shadow:
    0 2px 10px rgba(0,0,0,0.08),
    0 0 16px rgba(37,99,235,0.06);
}

[data-theme="light"] .stat-card:hover,
[data-theme="light"] .project-card:hover,
[data-theme="light"] .contact-link:hover {
  box-shadow:
    0 4px 20px rgba(0,0,0,0.12),
    0 0 24px rgba(37,99,235,0.14);
}

[data-theme="light"] .project-card.featured {
  box-shadow:
    0 0 18px rgba(37,99,235,0.14),
    0 4px 16px rgba(0,0,0,0.10);
}

[data-theme="light"] .skills-grid {
  box-shadow:
    0 2px 12px rgba(0,0,0,0.08),
    0 0 20px rgba(37,99,235,0.05);
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.25s, color 0.25s;
}

body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 48px 48px;
  pointer-events: none;
  z-index: 0;
}

/* ── NAV ── */
nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 2rem;
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(59,130,246,0.25);
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
  box-shadow:
    0 1px 0 rgba(59,130,246,0.15),
    0 4px 24px rgba(0,0,0,0.40),
    0 8px 48px rgba(59,130,246,0.12),
    0 0 80px rgba(59,130,246,0.07);
  animation: nav-glow 4s ease-in-out infinite;
}

@keyframes nav-glow {
  0%, 100% {
    box-shadow:
      0 1px 0 rgba(59,130,246,0.15),
      0 4px 24px rgba(0,0,0,0.40),
      0 8px 48px rgba(59,130,246,0.12),
      0 0 80px rgba(59,130,246,0.07);
  }
  50% {
    box-shadow:
      0 1px 0 rgba(59,130,246,0.30),
      0 4px 24px rgba(0,0,0,0.40),
      0 8px 60px rgba(59,130,246,0.22),
      0 0 100px rgba(59,130,246,0.12);
  }
}

[data-theme="light"] nav {
  border-bottom-color: rgba(37,99,235,0.20);
  box-shadow:
    0 1px 0 rgba(37,99,235,0.12),
    0 4px 20px rgba(0,0,0,0.08),
    0 8px 40px rgba(37,99,235,0.10),
    0 0 60px rgba(37,99,235,0.05);
  animation: nav-glow-light 4s ease-in-out infinite;
}

@keyframes nav-glow-light {
  0%, 100% {
    box-shadow:
      0 1px 0 rgba(37,99,235,0.12),
      0 4px 20px rgba(0,0,0,0.08),
      0 8px 40px rgba(37,99,235,0.10),
      0 0 60px rgba(37,99,235,0.05);
  }
  50% {
    box-shadow:
      0 1px 0 rgba(37,99,235,0.22),
      0 4px 20px rgba(0,0,0,0.10),
      0 8px 50px rgba(37,99,235,0.18),
      0 0 80px rgba(37,99,235,0.09);
  }
}

.nav-logo {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.nav-links a {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--text); }

/* ── THEME TOGGLE ── */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
  cursor: pointer;
  border: 1px solid var(--border2);
  background: transparent;
  padding: 5px 12px;
  border-radius: 2px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  white-space: nowrap;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(59,130,246,0.07);
}

.theme-toggle svg {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  transition: opacity 0.2s;
}

/* icon visibility per theme */
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
[data-theme="light"] .icon-sun { display: block; }
[data-theme="light"] .icon-moon { display: none; }

/* ── SECTIONS ── */
section {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 5rem 2rem;
}

/* ── HERO ── */
#hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-top: 6rem;
}

.hero-eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hero-eyebrow::before {
  content: '';
  display: inline-block;
  width: 32px;
  height: 1px;
  background: var(--accent);
}

h1 {
  font-size: clamp(3rem, 8vw, 6.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin-bottom: 1.5rem;
  text-shadow:
    0 0 18px rgba(59, 130, 246, 0.75),
    0 0 40px rgba(59, 130, 246, 0.45),
    0 0 80px rgba(59, 130, 246, 0.25);
  animation: name-glow 3s ease-in-out infinite;
}

h1 .line2 {
  color: transparent;
  -webkit-text-stroke: 1px var(--stroke-outline);
  text-shadow:
    0 0 18px rgba(139, 92, 246, 0.70),
    0 0 40px rgba(139, 92, 246, 0.40),
    0 0 80px rgba(139, 92, 246, 0.20);
}

@keyframes name-glow {
  0%, 100% {
    text-shadow:
      0 0 18px rgba(59, 130, 246, 0.75),
      0 0 40px rgba(59, 130, 246, 0.45),
      0 0 80px rgba(59, 130, 246, 0.25);
  }
  50% {
    text-shadow:
      0 0 25px rgba(59, 130, 246, 0.95),
      0 0 60px rgba(59, 130, 246, 0.60),
      0 0 110px rgba(59, 130, 246, 0.35);
  }
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 480px;
  margin-bottom: 2.5rem;
  line-height: 1.7;
}

.hero-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 3rem;
}

.tag {
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid var(--border2);
  border-radius: 2px;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.tag.accent { border-color: rgba(59,130,246,0.4); color: var(--accent); }
.tag.accent2 { border-color: rgba(6,182,212,0.4); color: var(--accent2); }
.tag.accent3 { border-color: rgba(139,92,246,0.4); color: var(--accent3); }

.cta-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 10px 22px;
  border-radius: 2px;
  text-decoration: none;
  transition: all 0.2s;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
}

.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }

.btn-outline {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border2);
}

.btn-outline:hover { color: var(--text); border-color: rgba(127,127,127,0.4); }

/* ── SECTION TITLES ── */
@keyframes section-title-pulse {
  0%, 100% {
    opacity: 0.65;
    text-shadow: 0 0 0px transparent;
    letter-spacing: 0.15em;
  }
  50% {
    opacity: 1;
    text-shadow: 0 0 8px var(--accent), 0 0 18px color-mix(in srgb, var(--accent) 40%, transparent);
    letter-spacing: 0.20em;
  }
}

@keyframes section-line-pulse {
  0%, 100% {
    opacity: 0.25;
    background: var(--border);
    height: 1px;
    box-shadow: none;
  }
  50% {
    opacity: 1;
    background: var(--accent);
    height: 1px;
    box-shadow: 0 0 6px var(--accent), 0 0 14px color-mix(in srgb, var(--accent) 35%, transparent);
  }
}

.section-title {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: section-title-pulse 3s ease-in-out infinite;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
  animation: section-line-pulse 3s ease-in-out infinite;
}

/* Staggered delays so each section pulses at a different phase */
#about    .section-title,
#about    .section-title::after { animation-delay: 0s; }
#skills   .section-title,
#skills   .section-title::after { animation-delay: 0.75s; }
#projects .section-title,
#projects .section-title::after { animation-delay: 1.5s; }
#contact  .section-title,
#contact  .section-title::after { animation-delay: 2.25s; }

h2.big {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

/* ── ABOUT ── */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.about-text p {
  color: var(--muted);
  margin-bottom: 1rem;
  line-height: 1.8;
}

.about-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.25rem;
  transition: background 0.25s, border-color 0.25s, box-shadow 0.25s;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.35),
    0 0 20px rgba(59,130,246,0.08);
}

.stat-card:hover {
  box-shadow:
    0 0 14px rgba(59,130,246,0.28),
    0 6px 24px rgba(0,0,0,0.40),
    0 0 40px rgba(59,130,246,0.12);
  border-color: rgba(59,130,246,0.25);
}

.stat-num {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  margin-bottom: 0.25rem;
}

.stat-num span { color: var(--accent); }

.stat-label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.05em;
}

/* ── SKILLS ── */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  box-shadow:
    0 4px 20px rgba(0,0,0,0.30),
    0 0 30px rgba(59,130,246,0.07);
}

.skill-item {
  background: var(--card);
  padding: 1.25rem 1.5rem;
  transition: background 0.2s;
}

.skill-item:hover { background: var(--bg3); }

.skill-name {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.skill-cat {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.skill-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
}

/* ── PROJECTS ── */
.projects-filter {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 2rem;
}

.filter-btn {
  font-family: var(--mono);
  font-size: 11px;
  padding: 5px 14px;
  border-radius: 2px;
  border: 1px solid var(--border2);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  letter-spacing: 0.05em;
  transition: all 0.15s;
}

.filter-btn:hover, .filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.project-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1.5rem;
  transition: border-color 0.2s, transform 0.2s, background 0.25s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.30),
    0 0 18px rgba(59,130,246,0.07);
}

.project-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
  box-shadow:
    0 0 16px rgba(59,130,246,0.28),
    0 8px 28px rgba(0,0,0,0.40),
    0 0 50px rgba(59,130,246,0.12);
}

.project-card.featured {
  border-color: rgba(59,130,246,0.3);
  background: linear-gradient(135deg, var(--card) 0%, rgba(59,130,246,0.05) 100%);
  box-shadow:
    0 0 20px rgba(59,130,246,0.20),
    0 4px 20px rgba(0,0,0,0.35),
    0 0 50px rgba(59,130,246,0.10);
}

.project-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.project-icon {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.project-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  display: block;
  margin-bottom: 2px;
}

.project-title:hover { color: var(--accent); }

.project-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  flex: 1;
}

.project-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.project-lang {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 5px;
}

.lang-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.project-link {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: 0.05em;
  transition: opacity 0.2s;
}

.project-link:hover { opacity: 0.7; }

.badge {
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 2px;
  letter-spacing: 0.05em;
}

.badge-blue { background: rgba(59,130,246,0.15); color: var(--accent); }
.badge-green { background: rgba(16,185,129,0.15); color: var(--green); }
.badge-purple { background: rgba(139,92,246,0.15); color: var(--accent3); }
.badge-amber { background: rgba(245,158,11,0.15); color: var(--amber); }

/* ── CONTACT ── */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: start;
}

.contact-text p {
  color: var(--muted);
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.contact-link {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-decoration: none;
  transition: border-color 0.2s, background 0.25s, box-shadow 0.2s;
  box-shadow:
    0 4px 16px rgba(0,0,0,0.30),
    0 0 18px rgba(59,130,246,0.07);
}

.contact-link:hover {
  border-color: var(--border2);
  box-shadow:
    0 0 14px rgba(59,130,246,0.28),
    0 6px 24px rgba(0,0,0,0.38),
    0 0 40px rgba(59,130,246,0.12);
}

.contact-link-icon {
  width: 32px; height: 32px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(59,130,246,0.1);
  font-size: 14px;
}

.contact-link-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: block;
}

.contact-link-sub {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* ── FOOTER ── */
footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

footer p {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.05em;
}

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0;
  position: relative;
  z-index: 1;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  nav { padding: 1rem; }
  .nav-links { display: none; }
  .theme-toggle span { display: none; }
  .about-grid, .contact-grid { grid-template-columns: 1fr; gap: 2rem; }
  .about-stats { grid-template-columns: 1fr 1fr; }
  .projects-grid { grid-template-columns: 1fr; }
}