/* ===== CSS Variables & Theme ===== */
:root {
  --bg: #faf9f6;
  --surface: #ffffff;
  --text: #1e1e1e;
  --text-muted: #5a5a5a;
  --border: #e0dbcf;
  --accent: #6c5ce7;
  --accent-hover: #5a4bd1;
  --shadow: 0 4px 20px rgba(0,0,0,0.05);
  --font-main: 'Inter', sans-serif;
  --font-mono: 'Space Mono', monospace;
  --transition: 0.3s ease;
  --particle-color: rgba(108, 92, 231, 0.15);
  --glow-color: rgba(108, 92, 231, 0.08);
}

[data-theme="dark"] {
  --bg: #121212;
  --surface: #1e1e1e;
  --text: #f0f0f0;
  --text-muted: #b0b0b0;
  --border: #2e2e2e;
  --shadow: 0 4px 20px rgba(0,0,0,0.3);
  --particle-color: rgba(108, 92, 231, 0.25);
  --glow-color: rgba(108, 92, 231, 0.12);
}

/* ===== Animated Background ===== */
.animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

/* Floating orbs */
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.6;
  animation: float 20s ease-in-out infinite;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--glow-color);
  top: -100px;
  right: -100px;
  animation-delay: 0s;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: var(--glow-color);
  bottom: -50px;
  left: -50px;
  animation-delay: -7s;
  animation-duration: 25s;
}

.orb-3 {
  width: 200px;
  height: 200px;
  background: var(--glow-color);
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -14s;
  animation-duration: 18s;
}

@keyframes float {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  25% {
    transform: translate(30px, -30px) scale(1.05);
  }
  50% {
    transform: translate(-20px, 20px) scale(0.95);
  }
  75% {
    transform: translate(20px, 10px) scale(1.02);
  }
}

/* Floating particles */
.particles {
  position: absolute;
  width: 100%;
  height: 100%;
}

.particle {
  position: absolute;
  width: 6px;
  height: 6px;
  background: var(--particle-color);
  border-radius: 50%;
  animation: rise 15s ease-in infinite;
}

.particle:nth-child(1) { left: 10%; animation-delay: 0s; animation-duration: 12s; }
.particle:nth-child(2) { left: 20%; animation-delay: -2s; animation-duration: 14s; }
.particle:nth-child(3) { left: 30%; animation-delay: -4s; animation-duration: 11s; }
.particle:nth-child(4) { left: 40%; animation-delay: -6s; animation-duration: 16s; }
.particle:nth-child(5) { left: 50%; animation-delay: -8s; animation-duration: 13s; }
.particle:nth-child(6) { left: 60%; animation-delay: -10s; animation-duration: 15s; }
.particle:nth-child(7) { left: 70%; animation-delay: -12s; animation-duration: 12s; }
.particle:nth-child(8) { left: 80%; animation-delay: -14s; animation-duration: 17s; }
.particle:nth-child(9) { left: 90%; animation-delay: -16s; animation-duration: 14s; }
.particle:nth-child(10) { left: 15%; animation-delay: -1s; animation-duration: 13s; }
.particle:nth-child(11) { left: 35%; animation-delay: -3s; animation-duration: 15s; }
.particle:nth-child(12) { left: 55%; animation-delay: -5s; animation-duration: 11s; }
.particle:nth-child(13) { left: 75%; animation-delay: -7s; animation-duration: 16s; }
.particle:nth-child(14) { left: 95%; animation-delay: -9s; animation-duration: 12s; }
.particle:nth-child(15) { left: 5%; animation-delay: -11s; animation-duration: 14s; }

@keyframes rise {
  0% {
    bottom: -10px;
    opacity: 0;
    transform: translateX(0) scale(0.5);
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    bottom: 100%;
    opacity: 0;
    transform: translateX(30px) scale(1.2);
  }
}

/* Subtle grid pattern */
.grid-pattern {
  position: absolute;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(var(--particle-color) 1px, transparent 1px),
    linear-gradient(90deg, var(--particle-color) 1px, transparent 1px);
  background-size: 50px 50px;
  opacity: 0.3;
  animation: gridPulse 8s ease-in-out infinite;
}

@keyframes gridPulse {
  0%, 100% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.4;
  }
}

/* Mouse trail glow - positioned via JS */
.cursor-glow {
  position: fixed;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--glow-color) 0%, transparent 70%);
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -50%);
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.cursor-glow.active {
  opacity: 1;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
  overflow-x: hidden;          /* prevent horizontal scroll on tiny screens */
}

/* ---- MAIN CONTAINER (the fix) ---- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* ---- Navbar (unchanged visually, just kept) ---- */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
  transition: background var(--transition);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
}

.logo {
  text-decoration: none;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
}

.logo .mono {
  font-family: var(--font-mono);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.8rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  transition: color var(--transition);
}

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

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition);
}

.theme-toggle:hover {
  background: var(--border);
}

/* ---- Hero (home page) ---- */
.hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  padding: 4rem 0;
  gap: 2rem;
}

.hero-content {
  flex: 1 1 500px;
}

.badge {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--accent);
  background: rgba(108, 92, 231, 0.1);
  padding: 0.3rem 0.8rem;
  border-radius: 20px;
}

.hero-content h1 {
  font-size: 3rem;
  line-height: 1.2;
  margin: 1rem 0;
  font-weight: 700;
}

.hero-content h1 span {
  color: var(--accent);
}

.hero-content p {
  color: var(--text-muted);
  font-size: 1.1rem;
  max-width: 450px;
  margin-bottom: 2rem;
}

.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn-primary, .btn-outline {
  display: inline-block;
  padding: 0.75rem 1.8rem;
  border-radius: 30px;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

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

.btn-outline {
  border: 2px solid var(--accent);
  color: var(--accent);
}

.btn-outline:hover {
  background: var(--accent);
  color: #fff;
}

.hero-stats {
  display: flex;
  gap: 2rem;
}

.stat {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ---- Services Preview ---- */
.services-preview {
  padding: 3rem 0;
}

.services-preview h2,
.skills-section h2 {
  font-size: 2rem;
  margin-bottom: 2rem;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
}

.service-card {
  background: var(--surface);
  padding: 2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform var(--transition);
}

.service-card:hover {
  transform: translateY(-5px);
}

.service-icon {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.service-card h3 {
  margin-bottom: 0.5rem;
}

/* ---- Page Header (used on about, resume, etc) ---- */
.page-header {
  text-align: center;
  padding: 3rem 0 2rem;
}

.page-header h1 {
  font-size: 2.5rem;
}

.page-header p {
  color: var(--text-muted);
  max-width: 600px;
  margin: 0.5rem auto 0;
}

.section-divider {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 2rem 0;
}

/* ---- Skills ---- */
.grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 2rem;
}

.skill-item {
  margin-bottom: 1.5rem;
}

.skill-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.skill-name {
  font-weight: 600;
}

.skill-percent {
  color: var(--accent);
  font-weight: 600;
}

.skill-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.skill-progress {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  width: 0%;
  transition: width 1s ease;
}

.skill-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.tag {
  background: var(--border);
  color: var(--text-muted);
  padding: 0.2rem 0.8rem;
  border-radius: 20px;
  font-size: 0.85rem;
  transition: background var(--transition);
}

.tag:hover {
  background: var(--accent);
  color: #fff;
}

/* ---- Timeline (resume) ---- */
.timeline {
  max-width: 700px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.timeline-title {
  font-size: 1.5rem;
  margin: 2rem 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.timeline-item {
  display: flex;
  gap: 1.5rem;
  margin-bottom: 2rem;
  position: relative;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
  position: relative;
}

.timeline-dot::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 14px;
  bottom: -2rem;
  width: 2px;
  background: var(--border);
  transform: translateX(-50%);
}

.timeline-item:last-child .timeline-dot::before {
  display: none;
}

.timeline-content {
  background: var(--surface);
  padding: 1.2rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  flex: 1;
}

.timeline-date {
  font-size: 0.85rem;
  color: var(--accent);
  font-family: var(--font-mono);
}

.timeline-content h3 {
  margin: 0.3rem 0;
}

.timeline-content h4 {
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ---- Portfolio grid ---- */
.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.7rem;
  margin: 2rem 0;
}

.filter-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 0.5rem 1.2rem;
  border-radius: 25px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-main);
  color: var(--text-muted);
}

.filter-btn.active,
.filter-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  padding: 0 0 3rem;
}

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  transition: transform var(--transition), box-shadow var(--transition);
}

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

.project-card h3 {
  margin-bottom: 0.3rem;
}

.project-category {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: rgba(108, 92, 231, 0.1);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  margin-bottom: 0.5rem;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.8rem;
}

.tech-badge {
  display: inline-block;
  background: var(--border);
  color: var(--text-muted);
  padding: 0.15rem 0.6rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 500;
  transition: background var(--transition), color var(--transition);
}

.tech-badge:hover {
  background: var(--accent);
  color: #fff;
}

.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 1rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--accent);
  border: 1px solid var(--accent);
  transition: all var(--transition);
}

.project-link:hover {
  background: var(--accent);
  color: #fff;
}

.project-link i {
  font-size: 0.75rem;
}

.project-card.featured {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}

/* ------------------------------
   ✨ Project image gallery
   ------------------------------ */
.project-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  overflow: hidden;
}

/* Single image takes full width */
.project-images:has(img:only-child) {
  grid-template-columns: 1fr;
}

.project-images img {
  width: 100%;
  height: 140px;
  border-radius: 8px;
  object-fit: cover;
  object-position: center top;
  border: 1px solid var(--border);
  background: var(--bg);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
  cursor: pointer;
}

.project-images img:hover {
  transform: scale(1.03);
  box-shadow: 0 4px 16px rgba(108, 92, 231, 0.2);
  z-index: 1;
  position: relative;
}

/* Lightbox effect on click - handled by adding class via JS if desired */
.project-images img.expanded {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90vw;
  max-height: 90vh;
  height: auto;
  width: auto;
  z-index: 10000;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
}

/* Overlay for lightbox */
.lightbox-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.8);
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.lightbox-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ---- Contact page ---- */
.contact-grid {
  display: flex;
  justify-content: center;
  padding-bottom: 3rem;
}

.contact-info-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2rem;
  max-width: 500px;
  width: 100%;
  box-shadow: var(--shadow);
  text-align: center;
}

.contact-links a {
  display: block;
  margin-bottom: 1rem;
  color: var(--text);
  text-decoration: none;
  transition: color var(--transition);
}

.contact-links a i {
  margin-right: 0.5rem;
  color: var(--accent);
}

.contact-links a:hover {
  color: var(--accent);
}

/* ---- Footer ---- */
footer {
  text-align: center;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.9rem;
  max-width: 1100px;       /* align with main content */
  margin: 0 auto;
}

/* =========================================
   RESPONSIVE – TABLETS & SMALL DESKTOPS
   ========================================= */
@media (max-width: 768px) {
  .nav-container {
    padding: 0.8rem 1.2rem;
  }

  .menu-toggle {
    display: block;
  }

  .nav-links {
    position: fixed;
    top: 65px;
    left: 0;
    right: 0;
    background: var(--surface);
    flex-direction: column;
    padding: 2rem;
    gap: 1.5rem;
    display: none;
    border-bottom: 1px solid var(--border);
    z-index: 999;
  }

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

  .hero {
    flex-direction: column;
    padding: 2.5rem 0;
  }

  .hero-content h1 {
    font-size: 2.2rem;
  }

  .hero-stats {
    width: 100%;
    justify-content: space-around;
  }

  .services-grid,
  .grid-2col {
    grid-template-columns: 1fr;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .timeline-item {
    flex-direction: column;
    gap: 0.5rem;
  }

  .timeline-dot {
    display: none;          /* hide dot on small screens for cleaner look */
  }

  .timeline-content {
    width: 100%;
  }

  .contact-grid {
    padding: 0 1rem;
  }

  main {
    padding: 0 1rem;
    border-left: none;      /* no side borders on mobile */
    border-right: none;
  }

/* Adjust image grid on tablets */
  .project-images {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.5rem;
  }
  
  .project-images img {
    height: 120px;
  }
}

/* =========================================
   RESPONSIVE – MOBILE PHONES (extra)
   ========================================= */
@media (max-width: 480px) {
  .hero-content h1 {
    font-size: 1.8rem;
  }

  .hero-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .hero-stats {
    gap: 1rem;
  }

  .stat-number {
    font-size: 1.7rem;
  }

  .page-header h1 {
    font-size: 2rem;
  }

  .timeline-content {
    padding: 1rem;
  }

  .filter-buttons {
    gap: 0.4rem;
  }

  .filter-btn {
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
  }

/* Smaller images on mobile */
  .project-images {
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
  }
  
  .project-images img {
    height: 100px;
  }
  
  .project-images:has(img:only-child) {
    grid-template-columns: 1fr;
  }
  
  .project-images:has(img:only-child) img {
    height: 160px;
  }
}
