/* =================================
   Custom Styles for Portfolio
   ================================= */

/* Body Background Pattern */
body {
  background-color: #020617;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 30px 30px;
}

/* Project image wrapper: keep consistent 16:9 framing across cards */
.project-media {
  aspect-ratio: 16 / 9;
}

/* Scroll Spy Nav Highlight */
.nav-link {
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 2px;
  background: #60a5fa;
  opacity: 0;
  transform: scaleX(0.65);
  transform-origin: center;
  transition: opacity 220ms ease, transform 220ms ease;
}

.nav-link.is-active {
  color: #60a5fa;
}

.nav-link.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

/* Hero Network (Agentic Theme) */
.hero-network {
  pointer-events: none;
  opacity: 0.9;
  filter: drop-shadow(0 0 22px rgba(96, 165, 250, 0.12));
  animation: hero-float 12s ease-in-out infinite;
}

.hero-network__edges path {
  fill: none;
  stroke: rgba(96, 165, 250, 0.22);
  stroke-width: 2;
  stroke-dasharray: 10 14;
  animation: hero-dash var(--dur, 16s) linear infinite;
}

.hero-network__nodes circle {
  fill: rgba(15, 23, 42, 1);
  stroke: rgba(96, 165, 250, 0.45);
  stroke-width: 2;
  animation: hero-pulse var(--pulse, 2.8s) ease-in-out infinite;
}

@keyframes hero-dash {
  0% { stroke-dashoffset: 0; }
  100% { stroke-dashoffset: -240; }
}

@keyframes hero-pulse {
  0%, 100% { opacity: 0.9; transform: scale(1); }
  50% { opacity: 0.55; transform: scale(1.08); }
}

@keyframes hero-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

/* Fade-in Animation */
.fade-in-up {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}

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

/* Back to Top Button */
#back-to-top {
  transition: opacity 0.3s, transform 0.3s;
}

#back-to-top.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
}

/* Image Loading Effect */
.project-img,
.profile-img-main {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

.project-img.loaded,
.profile-img-main.loaded {
  opacity: 1;
}

/* Project Filter Active State */
.filter-btn {
  position: relative;
  overflow: hidden;
}

.project-tag-chip {
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  will-change: transform, opacity;
}

.project-tag-chip.chip-animate {
  animation: chip-in 520ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--chip-delay, 0ms);
}

@keyframes chip-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.filter-btn.active {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.filter-btn:hover::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(59, 130, 246, 0.1);
  z-index: -1;
}

/* Smooth Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}

::-webkit-scrollbar-track {
  background: #020617;
}

::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: #475569;
}

/* Mobile Improvements */
@media (max-width: 640px) {
  .hero h1 {
    font-size: 2rem;
    line-height: 1.2;
  }
  
  .hero .text-xl {
    font-size: 1.1rem;
  }
  
  .hero p {
    font-size: 0.95rem;
  }
  
  /* Adjust padding for mobile */
  section {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Tablet Improvements */
@media (min-width: 641px) and (max-width: 1024px) {
  .hero h1 {
    font-size: 3rem;
  }
  
  .hero .text-xl {
    font-size: 1.5rem;
  }
}

/* Animation for Skills Cards */
.skill-card {
  transition: all 0.3s ease;
}

.skill-card:hover {
  transform: translateY(-2px);
}

/* Project Card Hover Effect */
.project-card {
  transition: all 0.3s ease;
}

.project-card:hover {
  box-shadow: 0 20px 40px rgba(59, 130, 246, 0.15);
}

/* Timeline Dots Animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.timeline-dot {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Loading State for Images */
.loading-skeleton {
  background: linear-gradient(
    90deg,
    #1e293b 0%,
    #334155 50%,
    #1e293b 100%
  );
  background-size: 200% 100%;
  animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* Focus Styles for Accessibility */
a:focus,
button:focus {
  outline: 2px solid #60a5fa;
  outline-offset: 2px;
}

/* Selection Color */
::selection {
  background-color: #3b82f6;
  color: white;
}

::-moz-selection {
  background-color: #3b82f6;
  color: white;
}

/* Print Styles */
@media print {
  body {
    background: white;
    color: black;
  }
  
  header,
  footer,
  #back-to-top,
  .filter-btn {
    display: none;
  }
  
  a {
    text-decoration: underline;
  }
}

/* Reduced Motion for Accessibility */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .hero-network {
    animation: none !important;
  }

  .hero-network__edges path,
  .hero-network__nodes circle {
    animation: none !important;
  }

  .project-tag-chip {
    opacity: 1;
    transform: none;
    animation: none !important;
  }
}

/* Dark Mode Enhancements (if implementing light mode later) */
@media (prefers-color-scheme: light) {
  /* Add light mode styles here if needed */
}

/* Custom Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Utility Classes */
.animate-fade-in-up {
  animation: fadeInUp 0.6s ease-out;
}

.animate-slide-in-right {
  animation: slideInRight 0.6s ease-out;
}

.animate-slide-in-left {
  animation: slideInLeft 0.6s ease-out;
}

/* Gradient Text Effect */
.gradient-text {
  background: linear-gradient(135deg, #60a5fa 0%, #3b82f6 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Glass Morphism Effect (if needed) */
.glass {
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Glow Effect */
.glow {
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

.glow:hover {
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.7);
}
