:root {
  --bg: #050816;
  --bg-soft: #0f172a;
  --accent: #ec4899;
  --accent-soft: rgba(236, 72, 153, 0.15);
  --text: #e5e7eb;
  --muted: #9ca3af;
  --card: #020617;
  --border: rgba(148, 163, 184, 0.25);
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.9);
  --radius-lg: 18px;
  --radius-pill: 999px;
  --transition-fast: 0.2s ease;
  --transition-med: 0.3s ease;
}

[data-theme="light"] {
  --bg: #f9fafb;
  --bg-soft: #ffffff;
  --accent: #ec4899;
  --accent-soft: rgba(236, 72, 153, 0.12);
  --text: #111827;
  --muted: #6b7280;
  --card: #ffffff;
  --border: rgba(209, 213, 219, 0.9);
  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #1e293b 0, var(--bg) 45%);
  color: var(--text);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scroll Reveal Animations */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1s cubic-bezier(0.22, 1, 0.36, 1), transform 1s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.reveal.active {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

.reveal-item {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.reveal-item.active {
  opacity: 1 !important;
  transform: translateY(0) !important;
}

/* Stagger for grid items */
.services-grid .reveal-item:nth-child(2) {
  transition-delay: 0.1s;
}

.services-grid .reveal-item:nth-child(3) {
  transition-delay: 0.2s;
}

.projects-grid .reveal-item:nth-child(2) {
  transition-delay: 0.15s;
}

.skills-grid .reveal-item:nth-child(n) {
  transition-delay: calc(0.05s * var(--item-index, 0));
}


/* Layout */

.container {
  width: min(1120px, 100% - 3rem);
  margin-inline: auto;
}

.header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: linear-gradient(to bottom,
      rgba(15, 23, 42, 0.9),
      rgba(15, 23, 42, 0.6),
      transparent);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1rem;
}

.logo-link {
  text-decoration: none;
  color: inherit;
  transition: opacity var(--transition-fast);
}

.logo-link:hover {
  opacity: 0.8;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.95rem;
}

.logo span {
  color: var(--accent);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav a {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  position: relative;
  padding-block: 0.15rem;
  transition: color var(--transition-fast);
}

.nav a::after {
  content: "";
  position: absolute;
  inset-inline: 0;
  bottom: -0.2rem;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, #6366f1, var(--accent));
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--transition-fast);
}

.nav a:hover {
  color: #e5e7eb;
}

.nav a:hover::after {
  transform: scaleX(1);
}

.nav-toggle {
  display: none;
  background: transparent;
  border: none;
  padding: 0.2rem;
  flex-direction: column;
  gap: 0.25rem;
  cursor: pointer;
}

.nav-toggle span {
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: var(--text);
}

/* Hero */

.hero {
  padding: 6rem 0 4.5rem;
}

.hero-inner.hero-centered {
  display: flex;
}

.hero-text-centered {
  max-width: 800px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
  opacity: 0;
  animation: fadeInUp 0.8s ease-out forwards;
}

.hero h1 {
  font-size: clamp(2.8rem, 5vw, 3.5rem);
  line-height: 1.05;
  margin-bottom: 0.75rem;
  background: linear-gradient(to right, #e5e7eb, #9ca3af);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  opacity: 0;
  animation: fadeInUp 0.8s ease-out 0.2s forwards;
}

.subtitle {
  color: var(--muted);
  margin-bottom: 1.75rem;
  opacity: 0;
  animation: fadeInUp 0.8s ease-out 0.4s forwards;
}

.subtitle-wide {
  max-width: 40rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  opacity: 0;
  animation: fadeInUp 0.8s ease-out 0.6s forwards;
}

.hero-actions-centered {
  justify-content: flex-start;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 500;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition-med), transform var(--transition-fast),
    box-shadow var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast);
}

.btn.primary {
  background: linear-gradient(135deg, #6366f1, var(--accent));
  box-shadow: 0 16px 40px rgba(79, 70, 229, 0.45);
  color: white;
}

.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 46px rgba(79, 70, 229, 0.6);
}

.btn.ghost {
  background: transparent;
  border-color: rgba(148, 163, 184, 0.4);
  color: var(--text);
}

.btn.ghost:hover {
  border-color: var(--accent);
  background: rgba(15, 23, 42, 0.65);
}

.btn.small {
  padding: 0.6rem 1.3rem;
  font-size: 0.85rem;
}

/* Sections */

.section {
  padding: 4.5rem 0;
}

.section-inner {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.section-header h2 {
  font-size: 1.8rem;
  margin-bottom: 0.75rem;
}

.section-header p {
  margin: 0;
  max-width: 38rem;
  color: var(--muted);
}

.section-header-centered {
  text-align: left;
}

.section-tag {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.78rem;
  color: var(--accent);
  margin-bottom: 0.3rem;
}

/* Skills */

.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.5rem;
}

.skill-card {
  background: radial-gradient(circle at top left, var(--accent-soft), var(--card));
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.25rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.skill-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.9);
  border-color: rgba(236, 72, 153, 0.7);
}

.skill-icon {
  width: 38px;
  height: 38px;
}

.skill-card h3 {
  margin: 0;
  font-size: 1rem;
}

.skill-card p {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

/* Resume & Education cards */

.resume-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.4rem;
}

.resume-item {
  background: radial-gradient(circle at top left, var(--accent-soft), var(--card));
  border-radius: 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  padding: 1.4rem 1.5rem;
}

.resume-meta {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.6rem;
}

.resume-role {
  font-weight: 600;
  font-size: 0.98rem;
}

.resume-org {
  font-size: 0.9rem;
  color: var(--muted);
}

.resume-date {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.resume-item ul {
  margin: 0.2rem 0 0;
  padding-left: 1.1rem;
  font-size: 0.88rem;
  color: var(--muted);
}

.resume-item ul li+li {
  margin-top: 0.2rem;
}

/* Projects */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2rem;
}

.project-card {
  position: relative;
  background: radial-gradient(circle at top, var(--accent-soft), var(--card));
  border-radius: 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  overflow: hidden;
  padding: 0;
  /* Remove padding to let image bleed to edges if desired, or keep it for a container look */
}

.project-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
  background: var(--bg-soft);
  display: flex;
  align-items: center;
  justify-content: center;
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform var(--transition-med);
}

.project-card:hover .project-image img {
  transform: scale(1.05);
}

/* Add back padding for text content */
.project-card>*:not(.project-image) {
  padding-inline: 1.7rem;
}

.project-card>.project-links {
  padding-bottom: 1.6rem;
}

.project-tag {
  align-self: flex-start;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  padding: 0.25rem 0.9rem;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.5);
  color: var(--muted);
}

.project-card h3 {
  margin: 0;
  font-size: 1.15rem;
}

.project-card p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.project-features {
  margin: 0;
  padding-left: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.project-features li+li {
  margin-top: 0.15rem;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 0.6rem;
}

/* Services */
.services-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.5rem;
}

.service-card {
  background: radial-gradient(circle at top left, var(--accent-soft), var(--card));
  border-radius: var(--radius-lg);
  padding: 2rem 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 1rem;
  transition: transform var(--transition-fast),
    box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.service-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 45px rgba(15, 23, 42, 0.9);
  border-color: rgba(236, 72, 153, 0.7);
}

.service-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.service-card h3 {
  margin: 0;
  font-size: 1.25rem;
}

.service-card p {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.6;
}

#contact.section {
  padding-bottom: 2.5rem;
}

/* Contact */

.contact-inner {
  gap: 1.5rem;
}

.contact-grid {
  display: flex;
  justify-content: center;
}

.contact-card {
  max-width: 650px;
  width: 100%;
  background: radial-gradient(circle at top left, var(--accent-soft), var(--card));
  border-radius: 20px;
  padding: 1.5rem;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

.contact-card p {
  margin-top: 0;
  margin-bottom: 1.1rem;
  color: var(--muted);
}

/* Contact form */

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.form-field {
  flex: 1 1 180px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-field label {
  font-size: 0.85rem;
  color: var(--muted);
}

.form-field input,
.form-field textarea {
  border-radius: 0.75rem;
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.85);
  color: var(--text);
  padding: 0.6rem 0.8rem;
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease,
    background 0.2s ease;
}

[data-theme="light"] .form-field input,
[data-theme="light"] .form-field textarea {
  background: #f9fafb;
}

.form-field input:focus,
.form-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(236, 72, 153, 0.4);
}

.contact-direct {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.contact-email {
  display: inline-flex;
  align-items: center;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.5);
  font-size: 0.9rem;
  text-decoration: none;
  transition: background var(--transition-fast), transform var(--transition-fast),
    box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.contact-email:hover {
  background: linear-gradient(135deg, #6366f1, var(--accent));
  border-color: transparent;
  box-shadow: 0 14px 35px rgba(79, 70, 229, 0.55);
  transform: translateY(-1px);
}

/* Social Sidebar */
.social-sidebar {
  position: absolute;
  right: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  z-index: 10;
}

.social-sidebar a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: all var(--transition-fast);
  backdrop-filter: blur(8px);
}

.social-sidebar a:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateX(-5px);
  background: var(--bg-soft);
  box-shadow: 0 10px 20px rgba(236, 72, 153, 0.2);
}

.social-sidebar .line {
  width: 1px;
  height: 60px;
  background: var(--border);
}

@media (max-width: 1024px) {
  .social-sidebar {
    display: none;
  }
}

/* Footer + theme toggle */

.footer {
  padding: 1.5rem 0 2rem;
  border-top: 1px solid rgba(15, 23, 42, 0.9);
  margin-top: 1rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(148, 163, 184, 0.6);
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background var(--transition-fast), transform var(--transition-fast),
    border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.theme-toggle:hover {
  background: rgba(15, 23, 42, 1);
  border-color: var(--accent);
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.85);
  transform: translateY(-1px);
}

.theme-toggle .sun {
  filter: drop-shadow(0 0 6px rgba(251, 191, 36, 0.7));
}

.theme-toggle .moon {
  opacity: 0.7;
}

/* Responsive */

@media (max-width: 900px) {
  .skills-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .projects-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 720px) {
  .header-inner {
    padding-block: 0.75rem;
  }

  .nav {
    position: absolute;
    inset-inline: 0;
    top: 100%;
    padding: 0.75rem 1.5rem 1.4rem;
    background: rgba(15, 23, 42, 0.96);
    flex-direction: column;
    gap: 0.7rem;
    transform: translateY(-20px);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-med), transform var(--transition-med);
  }

  .nav.open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .nav-toggle {
    display: flex;
  }

  .hero {
    padding-top: 5rem;
  }
}