/* High-End Professional Theme: Midnight & Electric Indigo */
:root {
  --primary: #6366f1; /* Electric Indigo */
  --secondary: #a855f7; /* Vibrant Purple */
  --background: #020617; /* Deepest Midnight */
  --surface: #0f172a; /* Slate Card */
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --border: rgba(99, 102, 241, 0.15);
  --glass: rgba(15, 23, 42, 0.7);
  --font-sans: 'Inter', sans-serif;
  --font-display: 'Outfit', sans-serif;
  
  --gradient-1: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
  --gradient-glow: radial-gradient(circle at center, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
}

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

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--background);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  letter-spacing: -0.04em;
  font-weight: 900;
}

/* Dynamic Background */
.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -10;
  background-image: 
    radial-gradient(circle at 2px 2px, rgba(99, 102, 241, 0.05) 1px, transparent 0);
  background-size: 40px 40px;
}

.bg-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(150px);
  z-index: -9;
  pointer-events: none;
  opacity: 0.2;
}

.orb-1 { top: -20%; left: -10%; width: 800px; height: 800px; background: var(--primary); animation: pulse 15s infinite alternate; }
.orb-2 { bottom: -20%; right: -10%; width: 700px; height: 700px; background: var(--secondary); animation: pulse 20s infinite alternate-reverse; }

@keyframes pulse {
  from { transform: scale(1); opacity: 0.15; }
  to { transform: scale(1.2); opacity: 0.25; }
}

/* Layout */
.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* Navbar */
nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000; /* Higher z-index */
  padding: 2rem 0;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

nav.scrolled {
  padding: 1.1rem 0;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(30px);
  border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}

.nav-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.75rem;
  font-weight: 900;
  text-decoration: none;
  color: #fff;
  letter-spacing: -0.05em;
}

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

.nav-links {
  display: flex;
  gap: 3rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  transition: all 0.3s ease;
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--gradient-1);
  transition: width 0.3s ease;
}

.nav-links a:hover { color: #fff; }
.nav-links a:hover::after, .nav-links a.active::after { width: 100%; }
.nav-links a.active { color: var(--primary); }

/* Sections */
section {
  padding: 160px 0 80px; /* Increased top padding for navbar clearance */
  min-height: 100vh;
  display: flex;
  align-items: center;
}

.page-content {
  width: 100%;
}

/* Typography Extensions */
.text-premium {
  background: linear-gradient(to bottom, #fff 40%, #cbd5e1 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.text-accent-gradient {
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Components */
.glass-slab {
  background: var(--glass);
  backdrop-filter: blur(25px);
  border: 1px solid var(--border);
  border-radius: 2.5rem;
  padding: 3.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.glass-slab:hover {
  border-color: rgba(99, 102, 241, 0.5);
  transform: translateY(-8px);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 3rem;
  background: var(--gradient-1);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  border-radius: 100px;
  transition: all 0.3s ease;
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 40px rgba(99, 102, 241, 0.6);
}

.btn-premium {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.5rem;
  height: 3.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: #fff;
  transition: all 0.3s ease;
}

.btn-premium:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-5px) rotate(5deg);
}

.btn-project {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-project:hover {
  background: var(--primary);
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 10px 20px rgba(99, 102, 241, 0.2);
}

/* Hero Section */
.hero-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 4rem;
  align-items: center;
  width: 100%;
}

.hero-text h1 {
  font-size: clamp(3rem, 8vw, 6.5rem); /* Reduced slightly */
  line-height: 0.85;
  margin-bottom: 2.5rem;
}

.text-accent-gradient {
  background: var(--gradient-1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-text p {
  font-size: 1.35rem;
  color: var(--text-muted);
  max-width: 550px;
  margin-bottom: 3.5rem;
}

.profile-frame {
  position: relative;
  width: 100%;
  max-width: 500px; /* Constrain size */
  justify-self: center;
  aspect-ratio: 4/5;
  border-radius: 4rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 0 50px rgba(99, 102, 241, 0.1);
}

.profile-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: contrast(1.1) brightness(0.9);
  transition: all 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-frame:hover img {
  transform: scale(1.05);
  filter: contrast(1) brightness(1);
}

/* Grid Cards */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 2.5rem;
}

@media (max-width: 768px) {
  .grid-cards {
    grid-template-columns: 1fr;
  }
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.project-img {
  aspect-ratio: 16/10;
  background: var(--surface);
  border-radius: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  overflow: hidden;
}

/* Footer */
footer {
  padding: 6rem 0;
  border-top: 1px solid var(--border);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-weight: 500;
}

/* Scroll Reveal Animations */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: all 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: opacity, transform;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

.reveal-left {
  opacity: 0;
  transform: translateX(-40px);
  transition: all 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reveal-left.active {
  opacity: 1;
  transform: translateX(0);
}

.reveal-right {
  opacity: 0;
  transform: translateX(40px);
  transition: all 1.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reveal-right.active {
  opacity: 1;
  transform: translateX(0);
}

/* Staggered entry for grid items */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(30px);
  transition: all 1s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reveal-stagger.active > * {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger.active > *:nth-child(1) { transition-delay: 0.1s; }
.reveal-stagger.active > *:nth-child(2) { transition-delay: 0.2s; }
.reveal-stagger.active > *:nth-child(3) { transition-delay: 0.3s; }
.reveal-stagger.active > *:nth-child(4) { transition-delay: 0.4s; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--background); }
::-webkit-scrollbar-thumb { 
  background: var(--surface); 
  border-radius: 10px; 
  border: 2px solid var(--background);
}
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

.md-hidden { display: none; }

/* Mobile Controls */
.mobile-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0.5rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: all 0.3s ease;
}

.mobile-toggle:hover, .mobile-toggle:active {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
}

/* Mobile Responsive Adjustments */
@media (max-width: 1024px) {
  .md-hidden { display: flex !important; }
  .hero-grid { grid-template-columns: 1fr; text-align: center; gap: 2.5rem; }
  .hero-text p { margin: 0 auto 2.5rem; }
  
  .nav-links { 
    display: none; 
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(25px);
    flex-direction: column;
    padding: 2.5rem 1.5rem;
    gap: 1.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8);
    z-index: 999;
  }

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

  .hero-text h1 { font-size: clamp(2.8rem, 8vw, 4.5rem) !important; }
  .profile-frame { max-width: 380px; margin: 0 auto; border-radius: 2.5rem; }
}

@media (max-width: 768px) {
  .container {
    padding: 0 1.25rem;
  }

  section {
    padding: 120px 0 60px;
    min-height: auto;
  }

  .grid-cards {
    grid-template-columns: 1fr !important;
    gap: 2.5rem !important;
  }

  .project-card {
    min-width: 0;
    width: 100%;
  }

  .project-img {
    border-radius: 1.75rem;
  }

  .glass-slab {
    padding: 2rem 1.5rem;
    border-radius: 1.75rem;
  }

  footer {
    padding: 3rem 0;
  }

  .footer-content {
    flex-direction: column;
    gap: 1.5rem;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 1rem;
  }

  .hero-text h1 {
    font-size: clamp(2.2rem, 9vw, 3.2rem) !important;
    line-height: 1.15 !important;
  }

  .btn-primary {
    width: 100%;
    justify-content: center;
    padding: 1rem 1.5rem;
  }

  .btn-project {
    width: 100%;
    justify-content: center;
  }

  .project-card h3 {
    font-size: 1.4rem !important;
  }
}

/* Interactive Particle Canvas Background */
#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: -8;
  pointer-events: none;
  background: transparent;
}

/* Page PPT-like Transitions */
main.container {
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1), 
              opacity 0.45s cubic-bezier(0.25, 1, 0.5, 1), 
              filter 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform, opacity, filter;
}

.page-exit {
  transform: translateX(-80px);
  opacity: 0;
  filter: blur(8px);
}

.page-enter {
  transform: translateX(80px);
  opacity: 0;
  filter: blur(8px);
}
