:root {
  /* Color System - steel blue accent */
  --primary-50: #eff6ff;
  --primary-100: #dbeafe;
  --primary-500: #3b82f6;
  --primary-600: #2563eb;
  --primary-700: #1d4ed8;
  --primary-900: #1e3a8a;

  /* Neutrals - slate (navy-tinted) */
  --neutral-50: #f8fafc;
  --neutral-100: #f1f5f9;
  --neutral-200: #e2e8f0;
  --neutral-300: #cbd5e1;
  --neutral-400: #94a3b8;
  --neutral-500: #64748b;
  --neutral-600: #475569;
  --neutral-700: #334155;
  --neutral-800: #1e293b;
  --neutral-900: #0f172a;

  --navy: #1e3a8a;
  --accent-blue: #2563eb;
  /* Reserved for hero / page-header only */
  --gradient: linear-gradient(135deg, var(--navy) 0%, var(--accent-blue) 100%);

  /* Typography */
  --font-sans:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui,
    sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", Consolas, Monaco, monospace;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;

  /* Border Radius */
  --radius-sm: 0.25rem;
  --radius-md: 0.375rem;
  --radius-lg: 0.5rem;
  --radius-xl: 0.75rem;
  --radius-2xl: 1rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md:
    0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg:
    0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl:
    0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

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

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--neutral-700);
  background: var(--neutral-50);
  min-height: 100vh;
  scroll-behavior: smooth;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* Navigation */
nav {
  position: fixed;
  top: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(16px);
  z-index: 1000;
  border-bottom: 1px solid var(--neutral-200);
  transition: all 0.3s ease;
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-600);
  text-decoration: none;
  transition: color 0.3s ease;
}

.logo:hover {
  color: var(--primary-700);
}

.nav-links {
  display: flex;
  gap: var(--space-8);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  color: var(--neutral-600);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  position: relative;
  padding: var(--space-2) var(--space-1);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary-600);
}

.nav-links a:hover::after {
  transform: scaleX(1);
}

.nav-links a::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 2px;
  bottom: -4px;
  left: 0;
  background: var(--primary-600);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

/* Mobile Navigation */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--neutral-600);
  cursor: pointer;
}

@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(16px);
    flex-direction: column;
    padding: var(--space-4) var(--space-6);
    border-top: 1px solid var(--neutral-200);
    gap: var(--space-4);
  }

  .nav-links.active {
    display: flex;
  }
}

/* Hero Section */
.hero {
  background: var(--gradient);
  padding: 8rem 0 6rem;
  text-align: center;
  color: white;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
  opacity: 0.3;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

.profile-image {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid rgba(255, 255, 255, 0.2);
  margin-bottom: var(--space-8);
  box-shadow: var(--shadow-xl);
  transition: transform 0.3s ease;
}

.profile-image:hover {
  transform: scale(1.02);
}

.hero h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  margin-bottom: var(--space-4);
  line-height: 1.1;
}

.hero .subtitle {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  margin-bottom: var(--space-6);
  opacity: 0.95;
  font-weight: 500;
}

.hero .description {
  font-size: 1.125rem;
  line-height: 1.8;
  opacity: 0.9;
  margin-bottom: var(--space-12);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* ===== Hero intro animation ===== */
.profile-wrap {
  position: relative;
  display: inline-block;
  line-height: 0;
}

.matrix-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

.matrix-canvas.fade-out {
  opacity: 0;
  transition: opacity 0.9s ease;
}

/* Terminal prompt + cursor injected by JS */
.tw-prompt {
  font-family: var(--font-mono);
  opacity: 0.7;
  margin-right: 0.5ch;
}

.tw-cursor {
  font-family: var(--font-mono);
  display: inline-block;
  width: 0.6ch;
  margin-left: 1px;
  animation: tw-blink 1s steps(1) infinite;
}

@keyframes tw-blink {
  0%,
  50% {
    opacity: 1;
  }
  50.01%,
  100% {
    opacity: 0;
  }
}

@keyframes heroFadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Intro mode: hide animated bits until JS reveals them (no-flash) */
html.intro .hero .matrix-canvas {
  opacity: 1;
}
html.intro .profile-image {
  opacity: 0;
}
html.intro .hero h1,
html.intro .hero .subtitle,
html.intro .hero .cta-buttons {
  opacity: 0;
}
html.intro .hero .description {
  visibility: hidden;
}

/* JS reveals by adding .intro-show */
html.intro .profile-image {
  transition: opacity 0.9s ease;
}
html.intro .profile-image.intro-show {
  opacity: 1;
}
html.intro .hero h1.intro-show,
html.intro .hero .subtitle.intro-show,
html.intro .hero .cta-buttons.intro-show {
  animation: heroFadeUp 0.6s ease both;
}
html.intro .hero .description.typing,
html.intro .hero .description.typed {
  visibility: visible;
}

@media (prefers-reduced-motion: reduce) {
  html.intro .hero h1,
  html.intro .hero .subtitle,
  html.intro .hero .cta-buttons,
  html.intro .profile-image {
    opacity: 1;
    animation: none;
  }
  html.intro .hero .description {
    visibility: visible;
  }
  html.intro .hero .matrix-canvas {
    display: none;
  }
  .tw-cursor {
    animation: none;
  }
}

.cta-buttons {
  display: flex;
  gap: var(--space-4);
  justify-content: center;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-8);
  text-decoration: none;
  border-radius: var(--radius-xl);
  font-weight: 600;
  font-size: 1rem;
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease,
    color 0.3s ease,
    background 0.3s ease;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  contain: layout style paint;
}

.btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.15),
    transparent
  );
  transition: left 0.4s ease;
  will-change: left;
}

.btn:hover::before {
  left: 100%;
}

.btn-primary {
  background: var(--primary-600);
  color: white;
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  background: var(--primary-700);
  color: white;
}

.btn-secondary {
  background: transparent;
  color: var(--primary-600);
  border: 2px solid var(--primary-600);
}

.btn-secondary:hover {
  background: var(--primary-50);
  transform: translateY(-2px);
}

/* On dark bands (hero, contact) invert buttons for contrast */
.hero .btn-primary,
.contact .btn-primary {
  background: white;
  color: var(--primary-700);
}

.hero .btn-primary:hover,
.contact .btn-primary:hover {
  background: white;
  color: var(--primary-900);
}

.hero .btn-secondary,
.contact .btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
}

.hero .btn-secondary:hover,
.contact .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Sections */
.section {
  padding: var(--space-20) 0;
}

.section:nth-child(even) {
  background: var(--neutral-100);
}

.section-title {
  text-align: center;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  margin-bottom: var(--space-16);
  color: var(--neutral-800);
  position: relative;
}

.section-title::after {
  content: "";
  position: absolute;
  bottom: -var(--space-4);
  left: 50%;
  transform: translateX(-50%);
  width: 60px;
  height: 4px;
  background: var(--primary-600);
  border-radius: var(--radius-sm);
}

/* Skills Grid */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-8);
  margin-top: var(--space-12);
}

.skill-card {
  background: white;
  padding: var(--space-8);
  border-radius: var(--radius-2xl);
  text-align: center;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  border: 1px solid var(--neutral-200);
  position: relative;
  overflow: hidden;
}

.skill-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary-600);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.skill-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.skill-card:hover::before {
  transform: scaleX(1);
}

.skill-icon {
  width: 80px;
  height: 80px;
  background: var(--primary-600);
  border-radius: var(--radius-2xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--space-6);
  font-size: 2rem;
  color: white;
  box-shadow: var(--shadow-lg);
}

.skill-card h3 {
  font-size: 1.5rem;
  margin-bottom: var(--space-4);
  color: var(--neutral-800);
  font-weight: 700;
}

.skill-card p {
  color: var(--neutral-600);
  line-height: 1.7;
}

/* Projects Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--space-8);
  margin-top: var(--space-12);
}

.project-card {
  background: white;
  border-radius: var(--radius-2xl);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: all 0.3s ease;
  border: 1px solid var(--neutral-200);
  position: relative;
}

.project-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.project-image {
  height: 200px;
  background: var(--neutral-800);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 4rem;
  color: white;
  position: relative;
}

.project-image::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0)
  );
}

.project-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.project-content {
  padding: var(--space-8);
}

.project-content h3 {
  font-size: 1.5rem;
  margin-bottom: var(--space-4);
  color: var(--neutral-800);
  font-weight: 700;
}

.project-content p {
  color: var(--neutral-600);
  line-height: 1.7;
  margin-bottom: var(--space-6);
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
}

.tag {
  background: var(--primary-100);
  color: var(--primary-700);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
}

.project-links {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
}

.project-link {
  color: var(--primary-600);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.3s ease;
  position: relative;
}

.project-link:hover {
  color: var(--primary-700);
}

.project-link::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 100%;
  height: 1px;
  background: var(--primary-600);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.project-link:hover::after {
  transform: scaleX(1);
}

/* About Section */
.about-content {
  max-width: 800px;
  margin: 0 auto;
  text-align: center;
}

.about-content p {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--neutral-600);
  margin-bottom: var(--space-8);
}

.interests {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-4);
  margin-top: var(--space-12);
}

.interest-item {
  background: white;
  padding: var(--space-4) var(--space-6);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--neutral-200);
  font-weight: 500;
  color: var(--neutral-700);
  transition: all 0.3s ease;
}

.interest-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: var(--primary-600);
  color: white;
}

/* Contact Section */
.section.contact {
  background: var(--neutral-900);
  color: white;
}

.contact .section-title {
  color: white;
}

.contact .section-title::after {
  background: rgba(255, 255, 255, 0.3);
}

.contact-content {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
}

.contact-content p {
  font-size: 1.125rem;
  line-height: 1.8;
  opacity: 0.9;
  margin-bottom: var(--space-12);
}

/* Footer */
footer {
  background: var(--neutral-900);
  color: var(--neutral-400);
  text-align: center;
  padding: var(--space-8) 0;
}

footer p {
  font-size: 0.95rem;
}

/* Individual Page Styles */
.page-header {
  background: var(--gradient);
  color: white;
  padding: 8rem 0 4rem;
  text-align: center;
  margin-bottom: var(--space-16);
}

.page-header h1 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 800;
  margin-bottom: var(--space-4);
}

.page-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 var(--space-6);
}

/* Resume Styles */
.resume-section {
  margin-bottom: var(--space-16);
}

.resume-section h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--neutral-800);
  margin-bottom: var(--space-8);
  padding-bottom: var(--space-4);
  border-bottom: 2px solid var(--primary-200);
}

.resume-section h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--neutral-700);
  margin-bottom: var(--space-4);
}

.resume-section h4 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--primary-600);
  margin-bottom: var(--space-2);
}

.resume-section p,
.resume-section li {
  color: var(--neutral-600);
  line-height: 1.7;
  margin-bottom: var(--space-2);
}

.resume-section ul {
  margin-left: var(--space-6);
  margin-bottom: var(--space-6);
}

.contact-info {
  text-align: center;
  margin-bottom: var(--space-12);
}

.contact-info a {
  color: var(--primary-600);
  text-decoration: none;
  margin: 0 var(--space-4);
  font-weight: 500;
}

.contact-info a:hover {
  color: var(--primary-700);
  text-decoration: underline;
}

/* Utility Classes */
.text-center {
  text-align: center;
}
.text-left {
  text-align: left;
}
.text-right {
  text-align: right;
}

.mb-4 {
  margin-bottom: var(--space-4);
}
.mb-8 {
  margin-bottom: var(--space-8);
}
.mb-12 {
  margin-bottom: var(--space-12);
}

.mt-4 {
  margin-top: var(--space-4);
}
.mt-8 {
  margin-top: var(--space-8);
}
.mt-12 {
  margin-top: var(--space-12);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .container {
    padding: 0 var(--space-4);
  }

  .hero {
    padding: 6rem 0 4rem;
  }

  .section {
    padding: var(--space-16) 0;
  }

  .skills-grid,
  .projects-grid {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-6);
  }
}

@media (max-width: 640px) {
  .nav-content {
    padding: var(--space-3) var(--space-4);
  }

  .hero {
    padding: 5rem 0 3rem;
  }

  .section {
    padding: var(--space-12) 0;
  }

  .section-title {
    margin-bottom: var(--space-12);
  }

  .skills-grid,
  .projects-grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .skill-card,
  .project-card {
    margin: 0 var(--space-2);
  }

  .cta-buttons {
    flex-direction: column;
    align-items: center;
  }

  .btn {
    width: 100%;
    max-width: 280px;
    justify-content: center;
  }

  .interests {
    gap: var(--space-2);
  }

  .interest-item {
    padding: var(--space-2) var(--space-4);
    font-size: 0.9rem;
  }
}

/* Image Carousel */
.project-carousel {
  position: relative;
  margin-top: var(--space-6);
  background: var(--neutral-100);
  border-radius: var(--radius-xl);
  overflow: hidden;
  border: 1px solid var(--neutral-200);
}

.carousel-container {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.carousel-track {
  display: flex;
  transition: transform 0.5s ease-in-out;
}

.carousel-slide {
  min-width: 100%;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--neutral-50);
}

.carousel-slide img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: var(--space-4);
}

.carousel-controls {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 var(--space-2);
  pointer-events: none;
}

.carousel-btn {
  pointer-events: all;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid var(--neutral-300);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-md);
  color: var(--neutral-700);
  font-size: 1.2rem;
}

.carousel-btn:hover {
  background: white;
  color: var(--primary-600);
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

.carousel-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  transform: scale(1);
}

.carousel-indicators {
  display: flex;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(10px);
}

.carousel-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--neutral-400);
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  padding: 0;
}

.carousel-indicator.active {
  background: var(--primary-600);
  width: 24px;
  border-radius: var(--radius-sm);
}

.carousel-indicator:hover {
  background: var(--primary-500);
  transform: scale(1.2);
}

/* Animation Classes */
.fade-in {
  opacity: 0;
  transform: translateY(30px);
  transition:
    opacity 0.6s ease,
    transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Legacy classes for existing pages */
.topnav {
  display: none; /* Hide old navigation */
}

.body {
  background: var(--neutral-50);
}

.p-text {
  font-size: 1.125rem;
  line-height: 1.8;
  color: var(--neutral-600);
  margin-bottom: var(--space-6);
}

.a-link {
  color: var(--primary-600);
  text-decoration: none;
  font-weight: 500;
}

.a-link:hover {
  color: var(--primary-700);
  text-decoration: underline;
}
