/* ============================================
   Portfolio — Custom Styles
   ============================================ */

/* --- Base --- */
html {
  scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: #0a0a0f;
}
::-webkit-scrollbar-thumb {
  background: #1a1a2e;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #2a2a3e;
}

/* --- Background Noise Texture --- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 128px 128px;
}

/* --- Scroll Animation Classes --- */
.animate-hidden {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

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

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

/* --- Keyframes --- */
@keyframes gradient-shift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -20px) scale(1.05); }
  66% { transform: translate(-20px, 15px) scale(0.95); }
}

@keyframes glow-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.7; }
}

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

@keyframes scroll-hint {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50% { opacity: 0.8; transform: translateY(8px); }
}

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

@keyframes terminalFadeIn {
  to { opacity: 1; transform: translateY(0); }
}

/* --- Background Gradient Blobs --- */
.bg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  animation: gradient-shift 15s ease-in-out infinite;
}

.bg-blob-1 {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.15), transparent 70%);
  top: -10%;
  left: -5%;
}

.bg-blob-2 {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.12), transparent 70%);
  top: 20%;
  right: -10%;
  animation-delay: -5s;
}

.bg-blob-3 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.1), transparent 70%);
  bottom: -5%;
  left: 30%;
  animation-delay: -10s;
}

/* --- Glow Effects --- */
.glow-border {
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.1),
              0 0 20px -5px rgba(139, 92, 246, 0.15);
  transition: box-shadow 0.4s ease;
}

.glow-border:hover {
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.2),
              0 0 30px -5px rgba(139, 92, 246, 0.25);
}

/* --- Gradient Text --- */
.gradient-text {
  background: linear-gradient(135deg, #ffffff 0%, #e2e8f0 50%, #94a3b8 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.gradient-text-accent {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* --- Glass Card (Enhanced) --- */
.glass-card {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.06);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  overflow: hidden;
}

/* Gradient overlay */
.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.04) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

/* Light source simulation */
.glass-card::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.04) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

.glass-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.4),
              inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.glass-card:hover::before,
.glass-card:hover::after {
  opacity: 1;
}

/* --- Button Glow (Enhanced) --- */
.btn-glow {
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.btn-glow::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: inherit;
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s ease;
  filter: blur(12px);
}

.btn-glow:hover {
  transform: scale(1.03);
  box-shadow: 0 0 20px rgba(139, 92, 246, 0.25);
}

.btn-glow:hover::before {
  opacity: 0.6;
}

/* --- Feature List Item --- */
.feature-item {
  position: relative;
  padding-left: 1.5rem;
}

.feature-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #8b5cf6;
  box-shadow: 0 0 8px rgba(139, 92, 246, 0.5);
}

/* --- Hero Canvas --- */
#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.4;
}

/* --- Navbar --- */
#navbar {
  position: relative;
}

#navbar::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(10, 10, 15, 0.7) 0%, transparent 100%);
  z-index: -1;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.nav-scrolled {
  background: rgba(10, 10, 15, 0.85) !important;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  box-shadow: 0 1px 20px rgba(0, 0, 0, 0.3);
}

.nav-scrolled::before {
  opacity: 0 !important;
}

/* Nav link hover glow */
.nav-link {
  position: relative;
  transition: color 0.2s ease, text-shadow 0.2s ease;
}

.nav-link:hover {
  text-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

/* Active section indicator */
.nav-indicator {
  position: absolute;
  bottom: -6px;
  height: 2px;
  background: linear-gradient(90deg, #8b5cf6, #3b82f6);
  border-radius: 1px;
  transition: left 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              width 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  width: 0;
  left: 0;
}

/* --- Section Divider --- */
.section-line {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, #8b5cf6, #3b82f6);
  border-radius: 1px;
}

/* --- Mobile Menu --- */
.mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.mobile-menu.open {
  max-height: 300px;
}

/* --- Tag Pill --- */
.tag-pill {
  font-size: 0.75rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: 0.02em;
}

/* --- Typing Cursor --- */
.typing-cursor {
  animation: blink 0.8s step-end infinite;
  color: #8b5cf6;
  font-weight: 300;
}

/* --- AI Terminal --- */
.ai-terminal {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 30px rgba(139, 92, 246, 0.04),
              inset 0 0 30px rgba(0, 0, 0, 0.15);
}

.ai-terminal .terminal-line {
  opacity: 0;
  transform: translateY(4px);
  animation: terminalFadeIn 0.3s forwards;
}

.terminal-prompt { color: #06b6d4; }
.terminal-output { color: #6b7280; }
.terminal-success { color: #8b5cf6; }
.terminal-cursor {
  display: inline-block;
  width: 6px;
  height: 13px;
  background: #8b5cf6;
  animation: blink 0.8s step-end infinite;
  vertical-align: middle;
  margin-left: 2px;
}

/* --- Micro Interactions --- */
.animated-link {
  background-image: linear-gradient(#8b5cf6, #8b5cf6);
  background-size: 0% 1px;
  background-position: left bottom;
  background-repeat: no-repeat;
  transition: background-size 0.3s ease;
}

.animated-link:hover {
  background-size: 100% 1px;
}
