/* ========================================
   Custom Styles - Portfolio Website
   ======================================== */

/* ---------- BASE RESET & SCROLLBAR ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  overflow-x: hidden;
}

body {
  overflow-x: hidden;
  max-width: 100vw;
}

::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: #0a0a0f;
}

::-webkit-scrollbar-thumb {
  background: #1a1a2e;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #00e5ff33;
}

/* ---------- SELECTION ---------- */
::selection {
  background: #00e5ff22;
  color: #00e5ff;
}

/* ---------- NAVBAR ---------- */
#navbar {
  backdrop-filter: blur(0px);
  background: transparent;
  height: 64px;
}

#navbar.scrolled {
  backdrop-filter: blur(20px);
  background: rgba(10, 10, 15, 0.85);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-link {
  position: relative;
  padding: 0.5rem 0.85rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #94a3b8;
  transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
  color: #00e5ff;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  width: 20px;
  height: 2px;
  background: #00e5ff;
  border-radius: 1px;
  transition: transform 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
  transform: translateX(-50%) scaleX(1);
}

/* ---------- HAMBURGER ANIMATION ---------- */
#hamburgerBtn.active .hamburger-line:nth-child(1) {
  transform: translateY(8.5px) rotate(45deg);
}

#hamburgerBtn.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: translateX(20px);
}

#hamburgerBtn.active .hamburger-line:nth-child(3) {
  transform: translateY(-8.5px) rotate(-45deg);
  width: 1.5rem;
}

/* ---------- MOBILE MENU ---------- */
#mobileMenu {
  height: 100vh;
  height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 80px 20px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  left: 0;
  right: 0;
}

#mobileMenu.open {
  opacity: 1;
  pointer-events: auto;
}

#mobileMenu > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  width: 100%;
  max-width: 100%;
  padding: 0 16px;
}

.mobile-nav-link {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease, color 0.3s ease;
  padding: 12px 0;
  display: block;
  text-align: center;
}

#mobileMenu.open .mobile-nav-link {
  opacity: 1;
  transform: translateY(0);
}

#mobileMenu.open .mobile-nav-link:nth-child(1) { transition-delay: 0.1s; }
#mobileMenu.open .mobile-nav-link:nth-child(2) { transition-delay: 0.15s; }
#mobileMenu.open .mobile-nav-link:nth-child(3) { transition-delay: 0.2s; }
#mobileMenu.open .mobile-nav-link:nth-child(4) { transition-delay: 0.25s; }
#mobileMenu.open .mobile-nav-link:nth-child(5) { transition-delay: 0.3s; }
#mobileMenu.open .mobile-nav-link:nth-child(6) { transition-delay: 0.35s; }

/* ---------- PARTICLE CANVAS ---------- */
#particleCanvas {
  z-index: 0;
}

/* ---------- HERO TYPOGRAPHY ---------- */
.hero-gradient-text {
  background: linear-gradient(135deg, #00e5ff, #00b8d4, #a78bfa);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- CURSOR BLINK ---------- */
.cursor-blink {
  animation: blink 1s step-end infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ---------- SCROLL INDICATOR ---------- */
@keyframes scrollDown {
  0% { transform: translateY(0); opacity: 1; }
  50% { transform: translateY(8px); opacity: 0.5; }
  100% { transform: translateY(0); opacity: 1; }
}

/* ---------- PROJECT CARD GLOW ---------- */
.project-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 1rem;
  padding: 1px;
  background: linear-gradient(135deg, transparent 30%, rgba(0, 229, 255, 0) 50%, transparent 70%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  transition: background 0.5s ease;
  pointer-events: none;
}

.project-card:hover::before {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.3), transparent 50%, rgba(167, 139, 250, 0.3));
}

.project-card {
  position: relative;
}

/* ---------- SKILL BARS ---------- */
.skill-bar {
  width: 0%;
  box-shadow: 0 0 8px currentColor;
}

.skill-bar.animated {
  /* width is set via JS inline style */
}

/* ---------- FILTER BUTTONS ---------- */
.filter-btn {
  background: rgba(255, 255, 255, 0.03);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.filter-btn:hover {
  color: #e2e8f0;
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
}

.filter-btn.active {
  color: #00e5ff;
  border-color: rgba(0, 229, 255, 0.3);
  background: rgba(0, 229, 255, 0.08);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.08);
}

/* ---------- CONTACT FORM FOCUS EFFECTS ---------- */
input:focus,
textarea:focus {
  box-shadow: 0 0 0 1px rgba(0, 229, 255, 0.1);
}

/* ---------- SCROLL TO TOP BUTTON ---------- */
#scrollToTop {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}

#scrollToTop.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

/* ---------- BUTTON RIPPLE EFFECT ---------- */
.btn-ripple {
  position: relative;
  overflow: hidden;
}

.btn-ripple::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 10%, transparent 10.01%);
  background-repeat: no-repeat;
  background-position: 50%;
  transform: scale(10);
  opacity: 0;
  transition: transform 0.5s, opacity 0.8s;
}

.btn-ripple:active::after {
  transform: scale(0);
  opacity: 0.3;
  transition: 0s;
}

/* ---------- PROJECT CARD FADE TRANSITIONS ---------- */
.project-card.fade-out {
  opacity: 0;
  transform: scale(0.95);
}

.project-card.fade-in {
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.project-card {
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* ---------- GLOWING ELEMENTS ---------- */
.glow-text {
  text-shadow: 0 0 20px rgba(0, 229, 255, 0.3), 0 0 40px rgba(0, 229, 255, 0.1);
}

.glow-box {
  box-shadow: 0 0 20px rgba(0, 229, 255, 0.1), 0 0 40px rgba(0, 229, 255, 0.05);
}

/* ---------- SECTION DIVIDER ---------- */
.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent);
}

/* ---------- RESPONSIVE TYPOGRAPHY ---------- */
@media (max-width: 640px) {
  html, body {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
  }
  
  * {
    max-width: 100vw;
  }
  
  .max-w-7xl, .max-w-6xl, .max-w-4xl {
    max-width: 100% !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  
  h1 { font-size: 2.5rem !important; }
  h2 { font-size: 1.875rem !important; }
  
  /* Mobile Navbar */
  #navbar {
    height: 64px;
    z-index: 100 !important;
  }
  
  #hamburgerBtn {
    z-index: 110 !important;
  }
  
  #mobileMenu {
    z-index: 100 !important;
  }
  
  #mobileMenu .w-full {
    width: 100% !important;
    max-width: 280px !important;
    text-align: center;
  }
  
  /* Mobile Hero */
  #home {
    padding-top: 80px;
    padding-bottom: 40px;
  }
  
  #home .text-4xl {
    font-size: 2.25rem !important;
  }
  
  #home .text-xl {
    font-size: 1rem !important;
  }
  
  /* Mobile About */
  #about {
    padding: 60px 16px;
  }
  
  #about > .max-w-6xl {
    max-width: 100% !important;
  }
  
  #about .grid {
    gap: 24px !important;
    grid-template-columns: 1fr !important;
  }
  
  #about .w-64 {
    width: 200px !important;
    height: 200px !important;
    margin: 0 auto;
  }
  
  #about .text-2xl {
    font-size: 1.25rem !important;
  }
  
  #about .text-xl {
    font-size: 1rem !important;
  }
  
  #about .text-center {
    text-align: center !important;
  }
  
  /* Mobile Projects */
  #projects {
    padding: 60px 16px;
  }
  
  #projects .grid {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  
  #projects .project-card {
    width: 100% !important;
    max-width: 100% !important;
  }
  
  /* Mobile Skills */
  #skills {
    padding: 60px 16px;
  }
  
  #skills .grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
  
  /* Mobile Contact */
  #contact {
    padding: 60px 16px;
  }
  
  #contact .grid {
    grid-template-columns: 1fr !important;
  }
  
  /* Mobile Footer */
  footer {
    padding: 30px 16px !important;
  }

  footer .flex {
    flex-direction: column !important;
    gap: 20px !important;
  }

  footer .text-center {
    text-align: center !important;
  }

  /* Mobile Footer - Keep social icons in a single line */
  footer .flex.items-center.gap-4 {
    flex-direction: row !important;
    justify-content: center !important;
    width: 100% !important;
  }
}

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

  .skill-bar {
    width: attr(data-width 46%) !important;
  }
};

/* ---------- PRINT STYLES ---------- */
@media print {
  #particleCanvas,
  #navbar,
  #scrollToTop,
  .scroll-indicator {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
  }
}
