/* ===== Reset & Variables ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0f172a;
  --bg-alt: #1e293b;
  --card: #1e293b;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --primary: #6366f1;
  --primary-light: #818cf8;
  --accent: #22d3ee;
  --border: #334155;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --nav-h: 68px;
  --transition: .3s ease;
}

html { scroll-behavior: smooth; scroll-padding-top: var(--nav-h); }

body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

.container { width: min(1140px, 92%); margin-inline: auto; }

/* ===== Navbar ===== */
.navbar {
  position: fixed; inset: 0 0 auto 0; z-index: 1000;
  height: var(--nav-h);
  background: rgba(15, 23, 42, .85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: var(--transition);
}
.navbar.scrolled { border-bottom-color: var(--border); box-shadow: 0 4px 20px rgba(0,0,0,.3); }

.nav-container {
  width: min(1140px, 92%); margin-inline: auto; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
}

.nav-logo { font-weight: 800; font-size: 1.25rem; letter-spacing: -.5px; }
.nav-logo span { color: var(--primary-light); }

.nav-menu { display: flex; align-items: center; gap: 1.75rem; }
.nav-link {
  font-size: .95rem; font-weight: 500; color: var(--text-muted);
  position: relative; transition: color var(--transition);
}
.nav-link:hover, .nav-link.active { color: var(--text); }
.nav-link:not(.nav-cta)::after {
  content: ""; position: absolute; left: 0; bottom: -6px;
  width: 0; height: 2px; background: var(--primary-light);
  transition: width var(--transition);
}
.nav-link:hover::after, .nav-link.active::after { width: 100%; }

.nav-cta {
  background: var(--primary); color: #fff !important;
  padding: .5rem 1.1rem; border-radius: 999px;
  transition: background var(--transition), transform var(--transition);
}
.nav-cta:hover { background: var(--primary-light); transform: translateY(-1px); }

.hamburger { display: none; background: none; border: 0; cursor: pointer; padding: 6px; }
.hamburger .bar {
  display: block; width: 26px; height: 3px; margin: 5px 0;
  background: var(--text); border-radius: 2px; transition: var(--transition);
}
.hamburger.open .bar:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.hamburger.open .bar:nth-child(2) { opacity: 0; }
.hamburger.open .bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

/* ===== Hero ===== */
.hero {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  gap: 3rem; padding: calc(var(--nav-h) + 2rem) 4% 4rem; position: relative;
  flex-wrap: wrap;
}
.hero-content { max-width: 560px; }
.hero-greeting { color: var(--accent); font-weight: 600; margin-bottom: .5rem; }
.hero-name {
  font-size: clamp(2.5rem, 6vw, 4rem); line-height: 1.1; font-weight: 800;
  background: linear-gradient(90deg, #fff, var(--primary-light));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero-title { font-size: clamp(1.2rem, 3vw, 1.6rem); margin: .75rem 0; color: var(--text-muted); font-weight: 600; }
.typed { color: var(--primary-light); }
.cursor { animation: blink 1s step-end infinite; color: var(--primary-light); font-weight: 400; }
@keyframes blink { 50% { opacity: 0; } }

.hero-tagline { color: var(--text-muted); margin-bottom: 1.75rem; }
.hero-buttons { display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.75rem; }

.btn {
  display: inline-block; padding: .8rem 1.7rem; border-radius: 999px;
  font-weight: 600; font-size: .95rem; border: 2px solid transparent;
  cursor: pointer; transition: var(--transition);
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-light); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(99,102,241,.35); }
.btn-outline { border-color: var(--primary); color: var(--primary-light); }
.btn-outline:hover { background: var(--primary); color: #fff; transform: translateY(-2px); }
.btn-full { width: 100%; }

.hero-socials { display: flex; gap: 1rem; }
.hero-socials a {
  display: grid; place-items: center; width: 42px; height: 42px;
  border: 1px solid var(--border); border-radius: 50%; color: var(--text-muted);
  transition: var(--transition);
}
.hero-socials a:hover { color: #fff; border-color: var(--primary); background: var(--primary); transform: translateY(-3px); }

/* Hero visual */
.hero-visual { position: relative; }
.blob {
  position: absolute; inset: -40px; z-index: -1;
  background: radial-gradient(circle at 30% 30%, rgba(99,102,241,.35), transparent 60%),
              radial-gradient(circle at 70% 70%, rgba(34,211,238,.25), transparent 60%);
  filter: blur(40px);
}
.code-card {
  background: #0b1120; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1rem 1.25rem 1.25rem; box-shadow: var(--shadow);
  animation: float 5s ease-in-out infinite;
}
@keyframes float { 50% { transform: translateY(-12px); } }
.code-dots { display: flex; gap: 6px; margin-bottom: .8rem; }
.code-dots i { width: 11px; height: 11px; border-radius: 50%; background: #ef4444; }
.code-dots i:nth-child(2) { background: #f59e0b; }
.code-dots i:nth-child(3) { background: #10b981; }
.code-card pre { font-family: "Fira Code", Consolas, monospace; font-size: .85rem; color: #cbd5e1; }
.c-key { color: #c084fc; } .c-var { color: #7dd3fc; } .c-str { color: #86efac; } .c-num { color: #fbbf24; }

.scroll-hint { position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%); }
.mouse {
  display: block; width: 24px; height: 40px; border: 2px solid var(--text-muted);
  border-radius: 14px; position: relative;
}
.mouse::after {
  content: ""; position: absolute; top: 7px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 8px; border-radius: 4px; background: var(--text-muted);
  animation: scrolldot 1.6s ease infinite;
}
@keyframes scrolldot { 60% { transform: translate(-50%, 12px); opacity: 0; } 100% { transform: translate(-50%, 0); opacity: 0; } }

/* ===== Sections generic ===== */
.section { padding: 5.5rem 0; }
.section-kicker {
  text-align: center; color: var(--accent); font-weight: 600;
  text-transform: uppercase; letter-spacing: 2px; font-size: .8rem;
}
.section-title {
  text-align: center; font-size: clamp(1.8rem, 4vw, 2.5rem);
  margin: .3rem 0 3rem; font-weight: 800;
}
.section-title::after {
  content: ""; display: block; width: 64px; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  margin: .8rem auto 0;
}

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(34px); transition: opacity .7s ease, transform .7s ease; }
.reveal.visible { opacity: 1; transform: none; }

/* ===== About ===== */
.about { background: var(--bg-alt); }
.about-grid { display: grid; grid-template-columns: 1fr 1.6fr; gap: 3.5rem; align-items: center; }
.avatar-frame {
  width: min(300px, 100%); aspect-ratio: 1; margin-inline: auto;
  border-radius: 24px; padding: 6px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
}
.avatar-placeholder {
  width: 100%; height: 100%; border-radius: 20px; background: var(--bg);
  display: grid; place-items: center; font-size: 4.5rem; font-weight: 800;
  color: var(--primary-light);
}
.about-text p { color: var(--text-muted); margin-bottom: 1.1rem; }
.about-text strong { color: var(--text); }
.about-stats { display: flex; gap: 2.5rem; margin: 1.6rem 0 2rem; flex-wrap: wrap; }
.stat { text-align: center; }
.stat-num { font-size: 2.2rem; font-weight: 800; color: var(--primary-light); display: block; }
.stat-num::after { content: "+"; color: var(--accent); }
.stat-label { color: var(--text-muted); font-size: .85rem; }

/* ===== Skills ===== */
.skills-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.75rem; }
.skill-category {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.75rem; transition: var(--transition);
}
.skill-category:hover { transform: translateY(-5px); border-color: var(--primary); }
.skill-category h3 { margin-bottom: 1.4rem; font-size: 1.1rem; }
.skill { margin-bottom: 1.1rem; }
.skill-info { display: flex; justify-content: space-between; font-size: .88rem; margin-bottom: .45rem; color: var(--text-muted); }
.bar { height: 8px; background: var(--bg); border-radius: 6px; overflow: hidden; }
.bar-fill {
  height: 100%; width: 0; border-radius: 6px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 1.2s cubic-bezier(.22,.61,.36,1);
}
.tech-badges { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: 2.5rem; }
.tech-badges span {
  padding: .45rem 1rem; font-size: .85rem; border-radius: 999px;
  background: var(--card); border: 1px solid var(--border); color: var(--text-muted);
  transition: var(--transition);
}
.tech-badges span:hover { color: #fff; border-color: var(--primary); background: var(--primary); transform: translateY(-2px); }

/* ===== Projects ===== */
.projects { background: var(--bg-alt); }
.project-filters { display: flex; justify-content: center; gap: .7rem; flex-wrap: wrap; margin-bottom: 2.5rem; }
.filter-btn {
  padding: .5rem 1.3rem; border-radius: 999px; border: 1px solid var(--border);
  background: transparent; color: var(--text-muted); font-weight: 600;
  cursor: pointer; transition: var(--transition);
}
.filter-btn:hover, .filter-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }

.projects-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.75rem; }
.project-card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition), opacity .35s, scale .35s;
}
.project-card:hover { transform: translateY(-7px); border-color: var(--primary); box-shadow: var(--shadow); }
.project-card.hide { display: none; }
.project-thumb {
  height: 150px; display: grid; place-items: center; font-size: 3.2rem;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 25%, var(--bg)), var(--bg-alt));
}
.project-body { padding: 1.4rem; display: flex; flex-direction: column; gap: .7rem; flex: 1; }
.project-body h3 { font-size: 1.15rem; }
.project-body p { color: var(--text-muted); font-size: .92rem; flex: 1; }
.project-tags { display: flex; flex-wrap: wrap; gap: .45rem; }
.project-tags span {
  font-size: .74rem; padding: .25rem .7rem; border-radius: 999px;
  background: rgba(99,102,241,.15); color: var(--primary-light); font-weight: 600;
}
.project-links { display: flex; gap: 1.2rem; padding-top: .4rem; }
.project-links a { font-size: .88rem; font-weight: 600; color: var(--accent); transition: var(--transition); }
.project-links a:hover { color: #fff; }

/* ===== Timeline ===== */
.timeline { position: relative; max-width: 760px; margin-inline: auto; padding-left: 8px; }
.timeline::before {
  content: ""; position: absolute; left: 19px; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(var(--primary), var(--accent));
  border-radius: 2px;
}
.timeline-item { position: relative; padding: 0 0 2.4rem 60px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
  position: absolute; left: 10px; top: 6px; width: 21px; height: 21px;
  border-radius: 50%; background: var(--bg); border: 4px solid var(--primary);
  transition: var(--transition);
}
.timeline-item:hover .timeline-dot { background: var(--primary); box-shadow: 0 0 0 6px rgba(99,102,241,.2); }
.timeline-content {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem 1.6rem; transition: var(--transition);
}
.timeline-item:hover .timeline-content { border-color: var(--primary); transform: translateX(4px); }
.timeline-date {
  display: inline-block; font-size: .78rem; font-weight: 700; color: var(--accent);
  background: rgba(34,211,238,.1); padding: .25rem .8rem; border-radius: 999px; margin-bottom: .6rem;
}
.timeline-content h3 { font-size: 1.1rem; }
.timeline-content h4 { color: var(--primary-light); font-size: .92rem; font-weight: 600; margin: .15rem 0 .55rem; }
.timeline-content p { color: var(--text-muted); font-size: .92rem; }

/* ===== Contact ===== */
.contact { background: var(--bg-alt); }
.contact-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 3rem; }
.contact-info h3 { font-size: 1.5rem; margin-bottom: .8rem; }
.contact-info > p { color: var(--text-muted); margin-bottom: 1.6rem; }
.contact-details li { display: flex; align-items: center; gap: .8rem; margin-bottom: .9rem; color: var(--text-muted); }
.contact-icon { font-size: 1.2rem; }
.contact-socials { margin-top: 1.6rem; }

.contact-form {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2rem;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: .88rem; font-weight: 600; margin-bottom: .4rem; }
.form-group input, .form-group textarea {
  width: 100%; padding: .8rem 1rem; border-radius: 10px;
  background: var(--bg-alt); border: 1px solid var(--border); color: var(--text);
  font: inherit; transition: border-color var(--transition), box-shadow var(--transition);
  resize: vertical;
}
.form-group input:focus, .form-group textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.2);
}
.form-group.invalid input, .form-group.invalid textarea { border-color: #ef4444; }
.error-msg { display: block; color: #f87171; font-size: .78rem; margin-top: .3rem; min-height: 1em; }
.form-status { text-align: center; margin-top: 1rem; font-weight: 600; min-height: 1.4em; }
.form-status.ok { color: #34d399; }
.form-status.err { color: #f87171; }

/* ===== Footer ===== */
.footer { border-top: 1px solid var(--border); padding: 1.6rem 0; }
.footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer p { color: var(--text-muted); font-size: .9rem; }
.back-to-top {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
  background: var(--primary); color: #fff; font-size: 1.2rem; transition: var(--transition);
}
.back-to-top:hover { background: var(--primary-light); transform: translateY(-3px); }

/* ===== Responsive ===== */
@media (max-width: 992px) {
  .skills-grid, .projects-grid { grid-template-columns: repeat(2, 1fr); }
  .about-grid { grid-template-columns: 1fr; text-align: center; }
  .about-stats { justify-content: center; }
  .contact-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .hamburger { display: block; z-index: 1001; }
  .nav-menu {
    position: fixed; top: var(--nav-h); right: -100%;
    flex-direction: column; gap: 0; width: min(320px, 78vw);
    height: calc(100vh - var(--nav-h));
    background: rgba(15, 23, 42, .98); backdrop-filter: blur(14px);
    border-left: 1px solid var(--border);
    padding: 2rem 1.6rem; align-items: flex-start;
    transition: right .35s ease;
  }
  .nav-menu.open { right: 0; }
  .nav-menu li { width: 100%; }
  .nav-link { display: block; padding: .9rem 0; font-size: 1.05rem; width: 100%; }
  .nav-cta { text-align: center; margin-top: 1rem; }
  .hero { text-align: center; }
  .hero-buttons, .hero-socials { justify-content: center; }
  .hero-visual { display: none; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .skills-grid, .projects-grid { grid-template-columns: 1fr; }
  .section { padding: 4rem 0; }
  .timeline::before { left: 15px; }
  .timeline-dot { left: 6px; }
  .timeline-item { padding-left: 48px; }
  .footer-inner { justify-content: center; text-align: center; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
