/* ============ Variables ============ */
:root {
  --bg: #f7f8fb;
  --bg-alt: #ffffff;
  --surface: #ffffff;
  --text: #1a1d29;
  --text-muted: #5b6072;
  --border: #e6e8f0;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --accent: #06b6d4;
  --gradient: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  --shadow: 0 10px 30px rgba(20, 20, 50, 0.08);
  --shadow-lg: 0 20px 50px rgba(20, 20, 50, 0.12);
  --radius: 16px;
  --header-h: 76px;
  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Inter', sans-serif;
}

[data-theme="dark"] {
  --bg: #0f1117;
  --bg-alt: #161925;
  --surface: #1b1f2e;
  --text: #eef0f6;
  --text-muted: #9aa0b4;
  --border: #2a2f42;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.5);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.4s ease, color 0.4s ease;
  overflow-x: hidden;
}

h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 700; line-height: 1.2; }

.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

a { text-decoration: none; color: inherit; }
a:hover { font-weight: 600; color: blue; transition: all 0.3s ease; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* ============ Scroll Progress ============ */
.scroll-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0%;
  background: var(--gradient); z-index: 2000; transition: width 0.1s ease-out;
}

/* ============ Header ============ */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  height: var(--header-h);
  background: rgba(247, 248, 251, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: all 0.3s ease;
}
[data-theme="dark"] .site-header { background: rgba(15, 17, 23, 0.7); }
.site-header.scrolled {
  border-bottom-color: var(--border);
  box-shadow: 0 2px 20px rgba(0,0,0,0.05);
}

.nav-wrap { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; }

.logo { font-family: var(--font-heading); font-size: 1.6rem; font-weight: 800; color: var(--text); }
.logo span { color: var(--primary); }

.nav { display: flex; gap: 2rem; }
.nav a {
  font-weight: 500; font-size: 0.95rem; color: var(--text-muted);
  position: relative; padding: 6px 0; transition: color 0.25s ease;
}
.nav a::after {
  content: ''; position: absolute; left: 0; bottom: -2px; width: 0; height: 2px;
  background: var(--gradient); transition: width 0.25s ease;
}
.nav a:hover, .nav a.active { color: var(--text); }
.nav a:hover::after, .nav a.active::after { width: 100%; }

.nav-actions { display: flex; align-items: center; gap: 14px; }

.theme-toggle {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); cursor: pointer; font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.3s ease, background 0.3s ease;
}
.theme-toggle:hover { transform: rotate(20deg) scale(1.08); }

.nav-toggle {
  display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 6px;
}
.nav-toggle span { width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: all 0.3s ease; }

/* ============ Hero ============ */
.hero {
  position: relative; min-height: 100vh; display: flex; align-items: center;
  padding-top: var(--header-h); overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 15% 20%, rgba(79,70,229,0.15), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(6,182,212,0.15), transparent 40%);
}
.hero-inner { text-align: center; padding-top: 3rem; padding-bottom: 4rem; }

.hero-eyebrow {
  color: var(--primary); font-weight: 600; letter-spacing: 2px; text-transform: uppercase;
  font-size: 0.85rem; margin-bottom: 0.8rem;
}
.hero-title {
  font-size: clamp(3rem, 8vw, 5.5rem); font-weight: 800;
  background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: 0.5rem;
}
.hero-subtitle {
  font-size: clamp(1.2rem, 3vw, 1.8rem); font-weight: 600; color: var(--text-muted); margin-bottom: 1.5rem;
  min-height: 2.2rem;
}
.cursor { animation: blink 0.9s infinite; color: var(--primary); }
@keyframes blink { 50% { opacity: 0; } }

.hero-desc { max-width: 700px; margin: 0 auto 2.2rem; color: var(--text-muted); font-size: 1.05rem; }

.hero-cta { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 3.5rem; }

.btn {
  padding: 0.85rem 1.8rem; border-radius: 50px; font-weight: 600; font-size: 0.95rem;
  border: 2px solid transparent; cursor: pointer; transition: all 0.3s ease; display: inline-block;
}
.btn-primary { background: var(--gradient); color: #fff; box-shadow: 0 8px 20px rgba(79,70,229,0.35); }
.btn-primary:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(79,70,229,0.45); }
.btn-outline { border-color: var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: #fff; transform: translateY(-3px); }
.btn-ghost { color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-3px); }

.hero-stats { display: flex; justify-content: center; gap: 3rem; flex-wrap: wrap; }
.stat { text-align: center; }
.stat .num, .stat .plus { font-family: var(--font-heading); font-size: 2.4rem; font-weight: 800; color: var(--text); }
.stat .plus { color: var(--primary); }
.stat small { display: block; color: var(--text-muted); font-size: 0.85rem; margin-top: 0.2rem; }

.scroll-down {
  position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%);
  width: 28px; height: 44px; border: 2px solid var(--border); border-radius: 20px;
  display: flex; justify-content: center; padding-top: 8px;
}
.scroll-down span { width: 4px; height: 8px; background: var(--primary); border-radius: 2px; animation: scrollDown 1.6s infinite; }
@keyframes scrollDown {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(14px); }
}

/* ============ Sections ============ */
.section { padding: 7rem 0; }
.section-alt { background: var(--bg-alt); }

.section-head { text-align: center; margin-bottom: 3.5rem; }
.tag {
  display: inline-block; color: var(--primary); font-weight: 600; text-transform: uppercase;
  letter-spacing: 2px; font-size: 0.8rem; margin-bottom: 0.6rem;
}
.section-head h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); }

/* ============ About ============ */
.about-grid { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 3rem; align-items: start; }
.about-text p { color: var(--text-muted); margin-bottom: 1.2rem; }
.about-info {
  display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1.5rem;
  padding: 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.about-info div { font-size: 0.92rem; }

.about-card {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem; box-shadow: var(--shadow); overflow: hidden;
}
.card-glow {
  position: absolute; width: 200px; height: 200px; background: var(--gradient); filter: blur(80px); opacity: 0.25;
  top: -60px; right: -60px;
}
.about-card h3 { margin-bottom: 1.2rem; }
.do-list li { padding: 0.55rem 0; color: var(--text-muted); border-bottom: 1px dashed var(--border); font-size: 0.95rem; }
.do-list li:last-child { border-bottom: none; }

/* ============ Skills ============ */
.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.6rem; }
.skill-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.6rem; box-shadow: var(--shadow); transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.skill-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.skill-card .icon { font-size: 1.8rem; margin-bottom: 0.6rem; }
.skill-card h4 { margin-bottom: 0.8rem; font-size: 1.05rem; }
.skill-tags { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.skill-tags span {
  background: rgba(79,70,229,0.1); color: var(--primary); padding: 0.3rem 0.7rem;
  border-radius: 50px; font-size: 0.8rem; font-weight: 600;
}
[data-theme="dark"] .skill-tags span { background: rgba(79,70,229,0.22); }

/* ============ Timeline ============ */
.timeline { position: relative; max-width: 800px; margin: 0 auto; padding-left: 2rem; border-left: 2px solid var(--border); }
.timeline-item { position: relative; margin-bottom: 2rem; }
.timeline-dot {
  position: absolute; left: -2.46rem; top: 0.3rem; width: 16px; height: 16px; border-radius: 50%;
  background: var(--gradient); box-shadow: 0 0 0 5px rgba(79,70,229,0.15);
}
.timeline-content {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.8rem; box-shadow: var(--shadow);
}
.timeline-content h3 { margin-bottom: 0.3rem; }
.timeline-role { color: var(--primary); font-weight: 600; font-size: 0.9rem; }
.timeline-content ul { margin-top: 1rem; }
.timeline-content li {
  position: relative; padding-left: 1.3rem; margin-bottom: 0.6rem; color: var(--text-muted); font-size: 0.95rem;
}
.timeline-content li::before { content: '▹'; position: absolute; left: 0; color: var(--accent); }

/* ============ Projects ============ */
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.8rem; }
.project-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.8rem; box-shadow: var(--shadow); transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex; flex-direction: column; gap: 0.8rem;
}
.project-card:hover { transform: translateY(-8px); box-shadow: var(--shadow-lg); }
.project-icon { font-size: 2rem; }
.project-card h3 { font-size: 1.15rem; }
.project-card p { color: var(--text-muted); font-size: 0.92rem; flex-grow: 1; }
.project-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.project-tags span {
  font-size: 0.75rem; font-weight: 600; padding: 0.25rem 0.6rem; border-radius: 6px;
  background: rgba(6,182,212,0.12); color: var(--accent);
}

/* ============ Education ============ */
.education-card {
  max-width: 700px; margin: 0 auto; display: flex; align-items: center; gap: 1.6rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 2rem; box-shadow: var(--shadow);
}
.edu-icon { font-size: 3rem; }
.education-card h3 { margin-bottom: 0.3rem; }
.education-card p { color: var(--text-muted); margin-bottom: 0.5rem; }
.edu-loc { color: var(--primary); font-weight: 600; font-size: 0.9rem; }

/* ============ Contact ============ */
.contact-grid { display: grid; gap: 3rem; }
.contact-info p { color: var(--text-muted); margin-bottom: 1.5rem; }
.contact-item { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 1rem; font-weight: 500; }

.contact-form { display: flex; flex-direction: column; gap: 1rem; }
.form-row { display: flex; gap: 1rem; }
.contact-form input, .contact-form textarea {
  width: 100%; padding: 0.9rem 1.1rem; border-radius: 10px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-family: var(--font-body); font-size: 0.95rem;
  transition: border-color 0.25s ease;
}
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--primary); }
.contact-form button { align-self: flex-start; }
.form-note { color: var(--accent); font-size: 0.9rem; min-height: 1.2rem; }

/* ============ Footer ============ */
.site-footer { padding: 2rem 0; border-top: 1px solid var(--border); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.footer-inner p { color: var(--text-muted); font-size: 0.9rem; }
.back-top { color: var(--primary); font-weight: 600; font-size: 0.9rem; }

/* ============ Reveal Animation ============ */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ============ Responsive ============ */
@media (max-width: 900px) {
  .about-grid, .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .nav { position: fixed; top: var(--header-h); left: 0; right: 0; background: var(--bg-alt);
    flex-direction: column; padding: 1.5rem 2rem; gap: 1.2rem; border-bottom: 1px solid var(--border);
    transform: translateY(-150%); opacity: 0; transition: all 0.35s ease; box-shadow: var(--shadow);
  }
  .nav.open { transform: translateY(0); opacity: 1; }
  .nav-toggle { display: flex; }
  .form-row { flex-direction: column; }
  .hero-stats { gap: 1.8rem; }
  .timeline { padding-left: 1.5rem; }
  .timeline-dot { left: -1.96rem; }
}
