/* =====================================================
   PORTRAIT EFFECTS
   Tejaswi-style morphing blob with glowing borders
   ===================================================== */

/* === Portrait Container === */
.portraitWrap {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* === Main Portrait Image - Morphing Blob Shape === */
.portrait {
  width: 90%;
  height: 90%;
  object-fit: cover;
  object-position: center 20%;
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  border: none;
  box-shadow: 
    0 0 40px rgba(59, 130, 246, 0.4),
    0 0 80px rgba(96, 165, 250, 0.2),
    0 0 120px rgba(147, 197, 253, 0.1);
  animation: morphing 8s ease-in-out infinite;
  position: relative;
  z-index: 2;
}

/* === Primary Morphing Border - Reverse Animation === */
.portraitWrap::before {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  border: 2px solid rgba(96, 165, 250, 0.5);
  animation: morphing 8s ease-in-out infinite reverse;
  z-index: 1;
}

/* === Secondary Morphing Border - Slower === */
.portraitWrap::after {
  content: '';
  position: absolute;
  inset: -28px;
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  border: 1px solid rgba(59, 130, 246, 0.3);
  animation: morphing 12s ease-in-out infinite;
  z-index: 0;
}

/* === The Core Morphing Animation === */
@keyframes morphing {
  0%, 100% {
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  }
  25% {
    border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%;
  }
  50% {
    border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%;
  }
  75% {
    border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%;
  }
}

/* =====================================================
   FLOATING CODE ELEMENTS
   ===================================================== */

.codeFloat {
  position: absolute;
  font-family: 'Courier New', Consolas, monospace;
  color: rgba(96, 165, 250, 0.5);
  font-size: 1.1rem;
  font-weight: 500;
  animation: float 4s ease-in-out infinite;
  pointer-events: none;
  z-index: 3;
  user-select: none;
}

.codeFloat:nth-child(1) {
  left: -25px;
  top: 20%;
  animation-delay: 0s;
}

.codeFloat:nth-child(2) {
  right: -20px;
  top: 45%;
  animation-delay: 0.7s;
}

.codeFloat:nth-child(3) {
  left: 10%;
  top: -20px;
  animation-delay: 1.4s;
}

.codeFloat:nth-child(4) {
  right: 15%;
  bottom: -15px;
  animation-delay: 2.1s;
}

@keyframes float {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
    opacity: 0.4;
  }
  50% {
    transform: translateY(-12px) rotate(5deg);
    opacity: 0.7;
  }
}

/* =====================================================
   AMBIENT GLOW ON CARD
   ===================================================== */

.portraitCard {
  position: relative;
  overflow: visible;
}

.portraitCard::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 70%;
  height: 70%;
  transform: translate(-50%, -50%);
  background: radial-gradient(
    ellipse at center,
    rgba(59, 130, 246, 0.15) 0%,
    rgba(96, 165, 250, 0.08) 40%,
    transparent 70%
  );
  filter: blur(40px);
  z-index: -1;
  animation: ambientPulse 6s ease-in-out infinite;
  pointer-events: none;
}

@keyframes ambientPulse {
  0%, 100% {
    opacity: 0.6;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
  }
}

/* =====================================================
   HOVER ENHANCEMENTS
   ===================================================== */

.portraitWrap:hover .portrait {
  box-shadow: 
    0 0 50px rgba(59, 130, 246, 0.5),
    0 0 100px rgba(96, 165, 250, 0.3),
    0 0 150px rgba(147, 197, 253, 0.15);
  transition: box-shadow 0.3s ease;
}

.portraitWrap:hover::before {
  border-color: rgba(96, 165, 250, 0.8);
  box-shadow: 0 0 25px rgba(96, 165, 250, 0.3);
  transition: all 0.3s ease;
}

.portraitWrap:hover::after {
  border-color: rgba(59, 130, 246, 0.5);
  transition: border-color 0.3s ease;
}

.portraitWrap:hover .codeFloat {
  color: rgba(96, 165, 250, 0.7);
  transition: color 0.3s ease;
}

/* =====================================================
   REDUCED MOTION - Accessibility
   ===================================================== */

@media (prefers-reduced-motion: reduce) {
  .portrait,
  .portraitWrap::before,
  .portraitWrap::after,
  .codeFloat,
  .portraitCard::before {
    animation: none !important;
  }
  
  /* Static organic shape */
  .portrait,
  .portraitWrap::before,
  .portraitWrap::after {
    border-radius: 40% 60% 55% 45% / 45% 40% 60% 55%;
  }
  
  .codeFloat {
    opacity: 0.5;
  }
}

/* =====================================================
   RESPONSIVE ADJUSTMENTS
   ===================================================== */

@media (max-width: 768px) {
  .portraitWrap {
    max-width: 260px;
    height: 260px;
  }
  
  .portraitWrap::before {
    inset: -10px;
  }
  
  .portraitWrap::after {
    inset: -22px;
  }
  
  .codeFloat {
    font-size: 1rem;
  }
}

@media (max-width: 480px) {
  .portraitWrap {
    max-width: 200px;
    height: 200px;
  }
  
  .portrait {
    box-shadow: 
      0 0 30px rgba(59, 130, 246, 0.4),
      0 0 60px rgba(96, 165, 250, 0.2);
  }
  
  .portraitWrap::before {
    inset: -8px;
  }
  
  .portraitWrap::after {
    inset: -18px;
  }
  
  .codeFloat {
    font-size: 0.9rem;
  }
  
  .codeFloat:nth-child(1) {
    left: -15px;
  }
  
  .codeFloat:nth-child(2) {
    right: -12px;
  }
}
