/* ========== IMPORTS ========== */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500;600&display=swap');

/* ========== CSS VARIABLES ========== */
:root {
  --bg: #0A0A0A;
  --bg-card: #111111;
  --bg-card-alt: #141414;
  --text-primary: #FFFFFF;
  --text-secondary: #A0A0A0;
  --accent-blue: #3B82F6;
  --accent-orange: #F97316;
  --border-subtle: rgba(255,255,255,0.06);
  --border-blue: rgba(59,130,246,0.3);
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

/* ========== RESET & BASE ========== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: inherit; border: none; background: none; }

/* ========== SCROLL PROGRESS ========== */
#scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--accent-blue); z-index: 10000; transition: width 0.1s linear;
}

/* ========== CUSTOM CURSOR ========== */
.custom-cursor {
  position: fixed; width: 12px; height: 12px; border-radius: 50%;
  background: rgba(59,130,246,0.5); pointer-events: none; z-index: 9999;
  transition: transform 0.15s ease-out; mix-blend-mode: screen;
}
@media (max-width: 768px) { .custom-cursor { display: none; } }

/* ========== LOADING SCREEN ========== */
#loading-screen {
  position: fixed; inset: 0; background: var(--bg); z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.5s ease;
}
#loading-screen.fade-out { opacity: 0; pointer-events: none; }
#loading-text {
  font-family: var(--font-mono); font-size: 1.2rem; color: var(--accent-blue);
  animation: pulse-text 1s ease-in-out infinite alternate;
}
@keyframes pulse-text { from { opacity: 0.5; } to { opacity: 1; } }

/* ========== TOAST ========== */
.toast {
  position: fixed; bottom: 40px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--accent-blue);
  color: var(--text-primary); padding: 14px 28px; border-radius: 50px;
  font-family: var(--font-mono); font-size: 14px; z-index: 99998;
  opacity: 0; transition: opacity 0.3s ease; pointer-events: none;
}
.toast.show { opacity: 1; }

/* ========== NAVBAR ========== */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9000;
  padding: 16px 40px; display: flex; align-items: center; justify-content: space-between;
  transition: background 0.3s ease, backdrop-filter 0.3s ease;
}
#navbar.scrolled {
  background: rgba(10,10,10,0.8); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.nav-logo { font-family: var(--font-heading); font-weight: 700; font-size: 1.5rem; }
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-links a {
  font-family: var(--font-body); font-size: 14px; color: var(--text-secondary);
  transition: color 0.3s ease; letter-spacing: 0.02em;
}
.nav-links a:hover { color: var(--text-primary); }
.dark-toggle {
  position: relative; font-size: 18px; color: var(--text-secondary);
  transition: color 0.3s; cursor: pointer;
}
.dark-toggle:hover { color: var(--text-primary); }
.dark-toggle-tooltip {
  position: absolute; top: 100%; right: 0; margin-top: 8px;
  background: var(--bg-card); border: 1px solid var(--border-subtle);
  padding: 6px 12px; border-radius: 6px; font-size: 12px; color: var(--text-secondary);
  font-family: var(--font-body); white-space: nowrap; opacity: 0;
  pointer-events: none; transition: opacity 0.2s;
}
.dark-toggle:hover .dark-toggle-tooltip { opacity: 1; }
.nav-hamburger { display: none; flex-direction: column; gap: 5px; cursor: pointer; z-index: 9002; }
.nav-hamburger span { width: 24px; height: 2px; background: var(--text-primary); transition: all 0.3s; }
.nav-hamburger.active span:nth-child(1) { transform: rotate(45deg) translate(5px,5px); }
.nav-hamburger.active span:nth-child(2) { opacity: 0; }
.nav-hamburger.active span:nth-child(3) { transform: rotate(-45deg) translate(5px,-5px); }

.mobile-menu {
  position: fixed; inset: 0; background: rgba(10,10,10,0.95); z-index: 9001;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 32px;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.mobile-menu.open { opacity: 1; pointer-events: all; }
.mobile-menu a { font-family: var(--font-heading); font-size: 2rem; color: var(--text-primary); }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-hamburger { display: flex; }
  #navbar { padding: 16px 20px; }
}

/* ========== SECTION COMMON ========== */
section { padding: 100px 24px; position: relative; }
.container { max-width: 1200px; margin: 0 auto; }
.container-sm { max-width: 1000px; margin: 0 auto; }
.section-label {
  font-family: var(--font-mono); font-size: 12px; color: var(--accent-blue);
  text-transform: uppercase; letter-spacing: 0.15em; margin-bottom: 12px;
}
.section-heading {
  font-family: var(--font-heading); font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700; color: var(--text-primary); line-height: 1.1; margin-bottom: 16px;
}
.section-subtext { font-size: 16px; color: var(--text-secondary); max-width: 600px; }
.text-center { text-align: center; }
.mx-auto { margin-left: auto; margin-right: auto; }

/* ========== ANIMATIONS ========== */
.animate-on-scroll { opacity: 0; transform: translateY(30px); transition: opacity 0.6s ease, transform 0.6s ease; }
.animate-on-scroll.visible { opacity: 1; transform: translateY(0); }
.stagger-1 { transition-delay: 0.1s; } .stagger-2 { transition-delay: 0.2s; }
.stagger-3 { transition-delay: 0.3s; } .stagger-4 { transition-delay: 0.4s; }
.stagger-5 { transition-delay: 0.5s; } .stagger-6 { transition-delay: 0.6s; }
.stagger-7 { transition-delay: 0.7s; }

/* ========== HERO ========== */
#hero {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  text-align: center; position: relative; overflow: hidden;
}
#particle-canvas { position: absolute; inset: 0; z-index: 0; }
.hero-content { position: relative; z-index: 1; }
.hero-name {
  font-family: var(--font-heading); font-weight: 700; text-transform: uppercase;
  font-size: clamp(3rem, 8vw, 7rem); letter-spacing: -0.03em; line-height: 1.05;
}
.hero-typewriter {
  font-family: var(--font-mono); font-size: clamp(1rem, 2.5vw, 1.3rem);
  color: var(--accent-blue); height: 2em; margin-top: 16px;
  display: flex; align-items: center; justify-content: center;
}
.hero-typewriter .cursor { display: inline-block; width: 2px; height: 1.2em; background: var(--accent-blue); margin-left: 4px; animation: blink 0.8s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

.hero-cta {
  display: inline-block; margin-top: 24px; padding: 14px 32px;
  border: 1px solid var(--accent-blue); border-radius: 50px; color: var(--text-primary);
  font-family: var(--font-body); font-size: 16px; background: transparent;
  transition: all 0.3s ease;
}
.hero-cta:hover {
  background: var(--accent-blue); box-shadow: 0 0 20px rgba(59,130,246,0.4);
}
.hero-bottom {
  position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
  text-align: center; z-index: 1;
}
.hero-bottom p { font-size: 14px; color: var(--text-secondary); font-style: italic; }
.chevron-down { animation: bounce 2s infinite; display: block; margin: 0 auto 8px; font-size: 20px; color: var(--text-secondary); }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(8px); } }

/* ========== ABOUT ========== */
#about .about-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; }
.about-avatar {
  aspect-ratio: 4/5; border-radius: 16px; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #111, #1a1a2e);
  border: 2px solid transparent;
  background-clip: padding-box;
  display: flex; align-items: center; justify-content: center; font-size: 6rem;
}
.about-avatar::before {
  content: ''; position: absolute; inset: -2px; border-radius: 18px; z-index: -1;
  background: linear-gradient(135deg, var(--accent-blue), var(--accent-orange));
}
.about-avatar-inner {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0d1117, #111827, #0d1117);
  background-size: 200% 200%; animation: gradient-shift 6s ease infinite; border-radius: 14px;
}
@keyframes gradient-shift { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

.about-body { font-size: 18px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 24px; }
.badge-row { display: flex; flex-wrap: wrap; gap: 10px; }
.badge {
  padding: 8px 16px; border-radius: 50px; font-family: var(--font-mono); font-size: 13px;
  background: rgba(59,130,246,0.1); border: 1px solid var(--border-blue); color: var(--text-primary);
  transition: all 0.3s ease; white-space: nowrap;
}
.badge:hover { border-color: var(--accent-blue); transform: scale(1.05); }

@media (max-width: 768px) {
  #about .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .about-avatar { max-width: 300px; margin: 0 auto; }
}

/* ========== SERVICES ========== */
.services-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 48px; }
.service-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 16px;
  padding: 40px 32px; transition: all 0.3s ease; display: flex; flex-direction: column;
}
.service-card:hover {
  border-color: var(--accent-blue); transform: translateY(-4px);
  box-shadow: 0 8px 30px rgba(59,130,246,0.1);
}
.service-icon { font-size: 48px; margin-bottom: 20px; }
.service-title { font-family: var(--font-heading); font-size: 1.4rem; font-weight: 700; margin-bottom: 4px; }
.service-subtitle { font-family: var(--font-mono); font-size: 13px; color: var(--accent-blue); margin-bottom: 16px; }
.service-body { font-size: 15px; color: var(--text-secondary); line-height: 1.7; flex: 1; }
.service-stats {
  display: flex; gap: 16px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  font-family: var(--font-mono); font-size: 13px; color: var(--text-primary);
}
.service-tag {
  display: inline-block; margin-top: 20px; padding: 6px 14px; border-radius: 50px;
  font-family: var(--font-mono); font-size: 12px;
}
.service-tag.orange { background: rgba(249,115,22,0.15); color: var(--accent-orange); border: 1px solid rgba(249,115,22,0.3); }
.service-tag.blue { background: rgba(59,130,246,0.15); color: var(--accent-blue); border: 1px solid var(--border-blue); }

@media (max-width: 900px) { .services-grid { grid-template-columns: 1fr; } }

/* ========== STATS ========== */
#stats { background: linear-gradient(180deg, var(--bg) 0%, #0F172A 50%, var(--bg) 100%); }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 40px; margin-top: 48px; }
.stat-item { text-align: center; }
.stat-number { font-family: var(--font-heading); font-size: clamp(2.2rem,4vw,3.5rem); font-weight: 700; }
.stat-number.blue { color: var(--accent-blue); }
.stat-label { font-size: 14px; color: var(--text-secondary); margin-top: 8px; }
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .stats-grid { grid-template-columns: 1fr; } }

/* ========== PROJECTS ========== */
.project-card {
  display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: center;
  margin-bottom: 60px; padding: 40px; background: var(--bg-card); border: 1px solid var(--border-subtle);
  border-radius: 20px; transition: border-color 0.3s;
}
.project-card:hover { border-color: rgba(59,130,246,0.2); }
.project-card.reverse { direction: rtl; }
.project-card.reverse > * { direction: ltr; }
.project-label { font-family: var(--font-mono); font-size: 48px; color: rgba(59,130,246,0.2); font-weight: 700; }
.project-title { font-family: var(--font-heading); font-size: 2rem; font-weight: 700; margin: 4px 0; }
.project-subtitle { font-size: 16px; color: var(--accent-blue); margin-bottom: 16px; }
.project-body { font-size: 15px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 20px; }
.project-quote {
  font-style: italic; font-size: 15px; color: var(--text-primary);
  border-left: 2px solid var(--accent-blue); padding-left: 16px;
}

/* Project visuals */
.project-visual {
  background: var(--bg); border: 1px solid var(--border-subtle); border-radius: 12px;
  padding: 32px; min-height: 240px; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.pipeline { display: flex; align-items: center; gap: 0; flex-wrap: wrap; justify-content: center; }
.pipeline-node {
  padding: 8px 12px; border: 1px solid var(--accent-blue); border-radius: 8px;
  font-family: var(--font-mono); font-size: 11px; color: var(--accent-blue); white-space: nowrap;
}
.pipeline-arrow { color: var(--accent-blue); margin: 0 6px; font-size: 16px; animation: flow 1.5s ease infinite; }
@keyframes flow { 0%,100% { opacity: 0.3; } 50% { opacity: 1; } }

.timeline { display: flex; flex-direction: column; gap: 20px; width: 100%; padding: 16px; }
.timeline-item { display: flex; align-items: center; gap: 12px; }
.timeline-dot {
  width: 12px; height: 12px; border-radius: 50%; background: var(--accent-blue);
  animation: glow-pulse 2s ease-in-out infinite; flex-shrink: 0;
}
@keyframes glow-pulse { 0%,100% { box-shadow: 0 0 4px var(--accent-blue); } 50% { box-shadow: 0 0 16px var(--accent-blue); } }
.timeline-label { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }
.timeline-line { width: 2px; height: 16px; background: rgba(59,130,246,0.3); margin-left: 5px; }

.radar-chart { width: 200px; height: 200px; }

@media (max-width: 768px) {
  .project-card, .project-card.reverse { grid-template-columns: 1fr; direction: ltr; }
  .project-visual { min-height: 180px; }
}

/* ========== ARSENAL ========== */
.arsenal-group { margin-bottom: 32px; }
.arsenal-category {
  font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary);
  margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.1em;
}
.arsenal-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.locked-section { margin-top: 48px; }
.locked-pill {
  padding: 10px 18px; border-radius: 50px; font-family: var(--font-mono); font-size: 13px;
  background: rgba(255,255,255,0.03); border: 1px dashed rgba(255,255,255,0.15);
  color: rgba(255,255,255,0.4); transition: all 0.3s; cursor: default;
}
.locked-pill:hover { animation: glitch 0.5s; border-color: rgba(255,255,255,0.4); }
@keyframes glitch {
  0%,100% { transform: translate(0); } 20% { transform: translate(-2px,1px); }
  40% { transform: translate(2px,-1px); } 60% { transform: translate(-1px,2px); }
  80% { transform: translate(1px,-2px); }
}

/* ========== QUALIFICATIONS ========== */
.achievements-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-top: 48px; }
.achievement-card {
  display: flex; gap: 16px; padding: 24px; border-radius: 12px;
  background: linear-gradient(135deg, #111111, #1a1a2e);
  border: 1px solid rgba(59,130,246,0.15); transition: all 0.3s;
}
.achievement-card:hover { border-color: var(--accent-blue); transform: scale(1.02); background: linear-gradient(135deg, #161622, #1e1e36); }
.achievement-icon { font-size: 40px; flex-shrink: 0; }
.achievement-title { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 700; margin-bottom: 4px; }
.achievement-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.6; }

.hobbies-section { margin-top: 64px; }
.hobbies-heading { font-family: var(--font-heading); font-size: 1.3rem; margin-bottom: 32px; text-align: center; }
.hobbies-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.hobby-card { text-align: center; padding: 24px; }
.hobby-icon { font-size: 48px; margin-bottom: 12px; }
.hobby-title { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 600; margin-bottom: 8px; }
.hobby-desc { font-size: 14px; color: var(--text-secondary); }

@media (max-width: 768px) {
  .achievements-grid, .hobbies-grid { grid-template-columns: 1fr; }
}

/* ========== CONTACT ========== */
#contact { position: relative; }
#contact::before {
  content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 600px; height: 400px; background: radial-gradient(ellipse, rgba(59,130,246,0.08), transparent 70%);
  pointer-events: none;
}
.contact-body { font-size: 18px; color: var(--text-secondary); max-width: 700px; margin: 0 auto 40px; text-align: center; line-height: 1.7; }
.contact-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; max-width: 800px; margin: 0 auto; }
.contact-card {
  background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 12px;
  padding: 28px 24px; text-align: center; transition: all 0.3s; display: block;
}
.contact-card:hover { border-color: var(--accent-blue); transform: translateY(-2px); }
.contact-card-icon { font-size: 32px; margin-bottom: 12px; }
.contact-card-title { font-family: var(--font-heading); font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.contact-card-sub { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }
.contact-note { text-align: center; margin-top: 24px; font-size: 14px; color: var(--text-secondary); font-style: italic; }

@media (max-width: 768px) { .contact-cards { grid-template-columns: 1fr; } }

/* ========== FOOTER ========== */
footer {
  border-top: 1px solid var(--border-subtle); padding: 60px 24px; text-align: center;
}
.footer-logo { font-family: var(--font-heading); font-weight: 700; font-size: 24px; margin-bottom: 24px; }
.footer-links { display: flex; justify-content: center; gap: 24px; flex-wrap: wrap; margin-bottom: 32px; }
.footer-links a { color: var(--text-secondary); font-size: 14px; transition: color 0.3s; display: flex; align-items: center; gap: 6px; }
.footer-links a:hover { color: var(--text-primary); }
.footer-tagline { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; max-width: 600px; margin-left: auto; margin-right: auto; }
.footer-copy { font-size: 13px; color: rgba(255,255,255,0.3); }

/* ========== FLASH ========== */
#flash-overlay {
  position: fixed; inset: 0; background: white; z-index: 100000;
  opacity: 0; pointer-events: none; transition: opacity 0.15s;
}
#flash-overlay.flash { opacity: 1; }

/* ========== DRAGON EASTER EGG ========== */
.flying-dragon {
  position: fixed; top: 30%; z-index: 99997; font-size: 64px;
  animation: fly-across 3s linear forwards; pointer-events: none;
}
@keyframes fly-across { from { left: -100px; transform: rotateY(0); } to { left: 110vw; transform: rotateY(0); } }
