:root {
  --bg: #0a192f;
  --bg-alt: #112240;
  --card: #112240;
  --text: #ccd6f6;
  --text-muted: #8892b0;
  --heading: #e6f1ff;
  --accent: #64ffda;
  --accent-dim: rgba(100, 255, 218, 0.1);
  --border: #233554;
  --shadow: rgba(2, 12, 27, 0.7);
}

[data-theme="light"] {
  --bg: #f5f8fc;
  --bg-alt: #eaf0f8;
  --card: #ffffff;
  --text: #33415c;
  --text-muted: #5b6b85;
  --heading: #10192e;
  --accent: #0d7d68;
  --accent-dim: rgba(13, 125, 104, 0.08);
  --border: #d4deec;
  --shadow: rgba(16, 25, 46, 0.12);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  font-family: "Inter", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.3s ease, color 0.3s ease;
}

h1, h2, h3 { color: var(--heading); font-weight: 700; }

.container { width: min(1100px, 90%); margin-inline: auto; }
.accent { color: var(--accent); }
.muted { color: var(--text-muted); font-size: 0.85rem; }

/* Progress bar */
.progress-bar {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  background: linear-gradient(90deg, var(--accent), #4c9aff);
  z-index: 1001;
}

/* Navbar */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1000;
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease;
}
.navbar.scrolled { border-bottom-color: var(--border); box-shadow: 0 4px 20px var(--shadow); }
.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 70px; }
.logo { font-family: "Fira Code", monospace; font-size: 1.35rem; font-weight: 700; color: var(--heading); text-decoration: none; }
.logo span { color: var(--accent); }
.nav-links { display: flex; gap: 2rem; list-style: none; }
.nav-links a { color: var(--text); text-decoration: none; font-size: 0.95rem; position: relative; }
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -4px; height: 2px; width: 0;
  background: var(--accent); transition: width 0.25s ease;
}
.nav-links a:hover::after { width: 100%; }
.nav-actions { display: flex; align-items: center; gap: 0.75rem; }
.theme-toggle {
  background: none; border: none; cursor: pointer; font-size: 1.2rem;
  width: 40px; height: 40px; border-radius: 50%;
}
.theme-toggle:hover { background: var(--accent-dim); }
.hamburger { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; }
.hamburger span { display: block; width: 24px; height: 2px; background: var(--heading); transition: transform 0.3s, opacity 0.3s; }
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Hero */
.hero {
  min-height: 100vh; display: flex; flex-direction: column;
  justify-content: center; position: relative; overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(circle at 20% 30%, var(--accent-dim) 0%, transparent 40%),
    radial-gradient(circle at 80% 70%, rgba(76, 154, 255, 0.08) 0%, transparent 45%);
}
.hero-greeting { font-family: "Fira Code", monospace; color: var(--accent); margin-bottom: 0.5rem; }
.hero h1 { font-size: clamp(2.8rem, 8vw, 5rem); line-height: 1.05; }
.typing-wrap { font-size: clamp(1.4rem, 4vw, 2.2rem); color: var(--text-muted); font-weight: 600; margin-top: 0.5rem; }
.typing { color: var(--accent); }
.cursor { animation: blink 1s step-end infinite; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.hero-sub { max-width: 560px; margin-top: 1.25rem; color: var(--text-muted); }
.hero-cta { display: flex; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }
.socials { display: flex; gap: 1.25rem; margin-top: 2.5rem; }
.socials a { color: var(--text-muted); transition: color 0.2s, transform 0.2s; }
.socials a:hover { color: var(--accent); transform: translateY(-4px); }

.btn {
  display: inline-block; padding: 0.8rem 1.6rem; border-radius: 8px;
  font-weight: 600; text-decoration: none; cursor: pointer; border: none;
  font-size: 0.95rem; transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.btn-primary {
  background: transparent; color: var(--accent);
  border: 1px solid var(--accent);
}
.btn-primary:hover { background: var(--accent-dim); transform: translateY(-3px); }
.btn-outline { color: var(--text); border: 1px solid var(--border); background: transparent; }
.btn-outline:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-3px); }

.scroll-hint { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); }
.mouse {
  display: block; width: 26px; height: 42px; border: 2px solid var(--text-muted);
  border-radius: 14px; position: relative;
}
.wheel {
  position: absolute; left: 50%; top: 8px; width: 4px; height: 8px;
  background: var(--accent); border-radius: 2px; transform: translateX(-50%);
  animation: wheel 1.6s infinite;
}
@keyframes wheel {
  0% { opacity: 1; top: 8px; } 100% { opacity: 0; top: 22px; }
}

/* Sections */
.section { padding: 110px 0; }
.section-alt { background: var(--bg-alt); }
.section-title { font-size: clamp(1.6rem, 3.5vw, 2.2rem); margin-bottom: 3rem; position: relative; }
.section-title .accent { font-family: "Fira Code", monospace; font-size: 0.75em; margin-right: 0.5rem; }

/* About */
.about-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 3rem; align-items: center; }
.about-text p { margin-bottom: 1rem; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.5rem 1rem; text-align: center; transition: transform 0.25s, box-shadow 0.25s;
}
.stat-card:hover { transform: translateY(-6px); box-shadow: 0 10px 30px var(--shadow); }
.stat-num, .stat-plus {
  font-size: 2.2rem; font-weight: 800; color: var(--accent);
  font-family: "Fira Code", monospace;
}
.stat-card p { color: var(--text-muted); font-size: 0.9rem; }

/* Skills */
.skills-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.25rem;
}
.skill-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.25rem; text-align: center; transition: transform 0.25s, border-color 0.25s;
}
.skill-card:hover { transform: translateY(-6px); border-color: var(--accent); }
.skill-icon { font-size: 2rem; display: block; margin-bottom: 0.5rem; }
.skill-name { font-weight: 600; color: var(--heading); }
.skill-level {
  height: 6px; border-radius: 3px; background: var(--border);
  margin-top: 0.75rem; overflow: hidden;
}
.skill-level-fill {
  display: block; height: 100%; width: 0; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), #4c9aff);
  transition: width 1.2s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Projects */
.filters { display: flex; gap: 0.75rem; margin-bottom: 2.5rem; flex-wrap: wrap; }
.filter-btn {
  background: none; border: 1px solid var(--border); color: var(--text);
  padding: 0.5rem 1.25rem; border-radius: 999px; cursor: pointer;
  font-size: 0.9rem; transition: all 0.2s;
}
.filter-btn:hover { border-color: var(--accent); color: var(--accent); }
.filter-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.projects-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.75rem;
}
.project-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.25s, box-shadow 0.25s, opacity 0.3s;
}
.project-card:hover { transform: translateY(-8px); box-shadow: 0 16px 40px var(--shadow); }
.project-card.hidden { display: none; }
.project-media {
  height: 170px; display: flex; align-items: center; justify-content: center;
  font-size: 3.5rem; position: relative;
  background:
    radial-gradient(circle at 30% 20%, var(--accent-dim) 0%, transparent 60%),
    linear-gradient(135deg, rgba(76,154,255,0.12), transparent);
  border-bottom: 1px solid var(--border);
}
.project-body { padding: 1.5rem; flex: 1; display: flex; flex-direction: column; }
.project-title { font-size: 1.15rem; margin-bottom: 0.4rem; }
.project-desc { color: var(--text-muted); font-size: 0.92rem; flex: 1; }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.tags span {
  font-family: "Fira Code", monospace; font-size: 0.72rem;
  color: var(--accent); background: var(--accent-dim);
  padding: 0.2rem 0.6rem; border-radius: 999px;
}
.project-links { display: flex; gap: 1rem; margin-top: 1rem; }
.project-links a { color: var(--heading); transition: color 0.2s, transform 0.2s; display: inline-flex; }
.project-links a:hover { color: var(--accent); transform: translateY(-2px); }

/* Timeline */
.timeline { position: relative; max-width: 760px; margin-inline: auto; padding-left: 2rem; }
.timeline::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 2.75rem; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: -2rem; top: 6px; width: 14px; height: 14px;
  border-radius: 50%; background: var(--accent);
  transform: translateX(-6px); box-shadow: 0 0 0 4px var(--accent-dim);
}
.timeline-card {
  background: var(--card); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.5rem; transition: transform 0.25s, box-shadow 0.25s;
}
.timeline-card:hover { transform: translateX(6px); box-shadow: 0 10px 30px var(--shadow); }
.timeline-date {
  font-family: "Fira Code", monospace; font-size: 0.78rem; color: var(--accent);
}
.timeline-card h3 { margin: 0.35rem 0 0.75rem; font-size: 1.05rem; }
.timeline-card ul { padding-left: 1.1rem; color: var(--text-muted); font-size: 0.92rem; }
.timeline-card li { margin-bottom: 0.3rem; }

/* Contact */
.contact-section { text-align: center; }
.contact-sub { max-width: 560px; margin: -1.5rem auto 2.5rem; color: var(--text-muted); }
.contact-form { max-width: 640px; margin-inline: auto; text-align: left; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.contact-form input,
.contact-form textarea {
  width: 100%; background: var(--card); border: 1px solid var(--border);
  color: var(--heading); border-radius: 10px; padding: 0.9rem 1rem;
  font-family: inherit; font-size: 0.95rem; margin-bottom: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.contact-form input:focus,
.contact-form textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.contact-form textarea { resize: vertical; }
.form-status { margin-top: 0.75rem; font-size: 0.9rem; min-height: 1.2em; }
.form-status.ok { color: var(--accent); }
.form-status.err { color: #ff6b6b; }
.contact-form input.invalid,
.contact-form textarea.invalid { border-color: #ff6b6b; }

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

/* Back to top */
#backToTop {
  position: fixed; right: 25px; bottom: 25px; width: 46px; height: 46px;
  border-radius: 50%; border: 1px solid var(--accent); background: var(--card);
  color: var(--accent); font-size: 1.2rem; cursor: pointer; opacity: 0;
  visibility: hidden; transform: translateY(12px); z-index: 999;
  transition: all 0.3s ease;
}
#backToTop.show { opacity: 1; visibility: visible; transform: translateY(0); }
#backToTop:hover { background: var(--accent-dim); }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(28px); transition: opacity 0.7s ease, transform 0.7s ease; }
.reveal.visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* Responsive */
@media (max-width: 850px) {
  .about-grid { grid-template-columns: 1fr; gap: 2rem; }
  .section { padding: 80px 0; }
}

@media (max-width: 700px) {
  .nav-links {
    position: fixed; inset: 70px 0 auto 0; flex-direction: column; gap: 0;
    background: var(--bg-alt); border-bottom: 1px solid var(--border);
    max-height: 0; overflow: hidden; transition: max-height 0.35s ease;
  }
  .nav-links.open { max-height: 320px; }
  .nav-links li { text-align: center; }
  .nav-links a { display: block; padding: 1rem; }
  .hamburger { display: flex; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

