:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --text: #1b2430;
  --muted: #5b6880;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --accent: #7c3aed;
  --accent-2: #06b6d4;
  --gradient: linear-gradient(120deg, #2563eb 0%, #7c3aed 55%, #06b6d4 100%);
  --border: #e5eaf2;
  --shadow: 0 10px 25px rgba(37, 99, 235, 0.15);
}

body.dark {
  --bg: #0f172a;
  --surface: #162238;
  --text: #ebf1ff;
  --muted: #b3c0da;
  --primary: #60a5fa;
  --primary-2: #3b82f6;
  --accent: #a78bfa;
  --accent-2: #22d3ee;
  --gradient: linear-gradient(120deg, #60a5fa 0%, #a78bfa 55%, #22d3ee 100%);
  --border: #24324f;
  --shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Poppins', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

.container { width: min(1120px, 92%); margin: auto; }
.section { padding: 84px 0; }
.section-alt { background: color-mix(in oklab, var(--surface) 68%, var(--bg)); }

.hero {
  background:
    radial-gradient(circle at 85% 20%, color-mix(in oklab, var(--accent) 22%, transparent) 0%, transparent 35%),
    radial-gradient(circle at 15% 10%, color-mix(in oklab, var(--accent-2) 25%, transparent) 0%, transparent 40%);
}

.section-title {
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  margin-bottom: 1rem;
  position: relative;
  padding-bottom: .35rem;
}
.section-title::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 70px; height: 4px;
  border-radius: 99px;
  background: var(--gradient);
}
.section-text { max-width: 760px; color: var(--muted); }

/* Navbar */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: color-mix(in oklab, var(--surface) 90%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-wrapper {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .8rem;
}
.logo {
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text);
}
.logo span { color: var(--primary); }

.nav-links { display: flex; gap: 1rem; }
.nav-links a {
  text-decoration: none;
  color: var(--text);
  font-weight: 500;
  border-radius: 8px;
  padding: .3rem .45rem;
  transition: .2s ease;
}
.nav-links a:hover {
  color: var(--primary);
  background: color-mix(in oklab, var(--accent) 16%, transparent);
}

.menu-btn, .theme-btn {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.theme-btn:hover, .menu-btn:hover { color: var(--primary); border-color: var(--primary); }
.menu-btn { display: none; }

/* Hero */
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 2rem;
  align-items: center;
}
.tag { color: var(--primary); font-weight: 600; }
.hero h1 { font-size: clamp(2rem, 4.2vw, 3.1rem); line-height: 1.2; }
.hero h2 { margin: .5rem 0 1rem; color: var(--muted); min-height: 2rem; }
#typing { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; font-weight: 700; }

.actions {
  margin-top: 1.2rem;
  display: flex;
  gap: .8rem;
  flex-wrap: wrap;
}

.hero-contact-links {
  margin-top: .85rem;
  display: grid;
  gap: .35rem;
}

.hero-contact-links p {
  display: flex;
  align-items: center;
  gap: .45rem;
  color: var(--muted);
}

.hero-contact-links i {
  color: var(--accent-2);
}

.hero-contact-links a {
  color: var(--text);
  text-decoration: none;
  transition: color .2s ease;
}

.hero-contact-links a:hover {
  color: var(--primary);
}

.btn {
  text-decoration: none;
  border-radius: 10px;
  padding: .72rem 1rem;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-weight: 500;
  transition: .2s ease;
}
.btn.primary { background: var(--gradient); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); transform: translateY(-2px); }
.btn.ghost { color: var(--primary); border-color: var(--primary); }
.btn.ghost:hover { background: color-mix(in oklab, var(--primary) 12%, transparent); }

.socials { display: flex; gap: .8rem; margin-top: .9rem; }
.socials a {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text);
  transition: .2s ease;
}
.socials a:hover { background: var(--gradient); color: #fff; border-color: transparent; }

.hero-image img {
  width: min(390px, 86vw);
  aspect-ratio: 1/1;
  object-fit: cover;
  border-radius: 1.4rem;
  border: 6px solid color-mix(in oklab, var(--accent) 30%, var(--surface));
  box-shadow: var(--shadow);
  margin-inline: auto;
}

/* Reusable cards */
.card-grid {
  margin-top: 1.4rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.card-grid article,
.timeline-item,
.exp-grid article,
.contact-card,
.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  transition: transform .2s ease, box-shadow .2s ease;
}

.card-grid article:hover,
.timeline-item:hover,
.exp-grid article:hover,
.contact-card:hover,
.contact-form:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 28px rgba(37, 99, 235, 0.18);
}

.card-grid article { padding: 1rem; }
.card-grid i { color: var(--accent); font-size: 1.3rem; margin-bottom: .5rem; }

/* Skills */
.skills-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.skill-item span { display: block; margin-bottom: .35rem; font-weight: 500; }
.bar {
  height: 10px;
  border-radius: 99px;
  overflow: hidden;
  background: color-mix(in oklab, var(--muted) 20%, transparent);
}
.bar div {
  height: 100%;
  background: var(--gradient);
}

.timeline, .exp-grid { display: grid; gap: 1rem; }
.timeline-item, .exp-grid article { padding: 1rem; }
.timeline-item span, .exp-grid span { color: var(--accent); font-weight: 600; }
.timeline-item p, .exp-grid p { color: var(--muted); }

/* Contact */
.contact-grid { display: grid; grid-template-columns: .9fr 1.1fr; gap: 1rem; }
.contact-card, .contact-form { padding: 1rem; }
.contact-card i { color: var(--accent-2); margin-right: .35rem; }
.contact-card p { margin-bottom: .7rem; }

.contact-form { display: grid; gap: .8rem; }
.contact-form input,
.contact-form textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .72rem;
  font-family: inherit;
  background: transparent;
  color: var(--text);
}
.contact-form input:focus,
.contact-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in oklab, var(--accent) 20%, transparent); }

footer {
  text-align: center;
  border-top: 1px solid var(--border);
  padding: 1rem;
  color: var(--muted);
}

/* Reveal animation */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: .7s ease;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Scroll-to-top */
#scroll-top {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: var(--gradient);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: .2s ease;
}
#scroll-top.show { opacity: 1; visibility: visible; transform: translateY(0); }

/* Responsive */
@media (max-width: 960px) {
  .hero-grid,
  .contact-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr 1fr; }

  .hero-content {
    text-align: center;
  }

  .actions,
  .socials {
    justify-content: center;
  }

  .hero-contact-links p {
    justify-content: center;
  }
}

@media (max-width: 780px) {
  .menu-btn { display: block; }

  .nav-links {
    position: absolute;
    top: 72px;
    left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: none;
    flex-direction: column;
    padding: .7rem 4%;
  }
  .nav-links.show { display: flex; }

  .skills-grid,
  .card-grid { grid-template-columns: 1fr; }

  .section { padding: 70px 0; }
}

@media (max-width: 480px) {
  .container {
    width: 94%;
  }

  .nav-wrapper {
    min-height: 64px;
  }

  .nav-links {
    top: 64px;
    padding: .65rem 5%;
  }

  .hero h1 {
    font-size: 1.75rem;
  }

  .hero h2 {
    font-size: 1.05rem;
  }

  .btn {
    width: 100%;
    justify-content: center;
  }

  .hero-image img {
    width: min(300px, 92vw);
    border-width: 4px;
  }

  .section {
    padding: 58px 0;
  }

  .contact-form input,
  .contact-form textarea {
    padding: .68rem;
    font-size: .95rem;
  }
}