/* ===================================================
   Visual Effects Styles
   =================================================== */

/* === Polished Matrix Glitch Text Effect === */
[data-text] {
  position: relative;
  display: inline-block;
  overflow: visible;
}

.glitch-active {
  animation:
    matrix-base-shake 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) infinite,
    matrix-glow-pulse 3s ease-in-out infinite;
  text-shadow:
    0 0 5px rgba(0, 255, 65, 0.5),
    0 0 10px rgba(0, 255, 65, 0.4),
    0 0 20px rgba(0, 255, 65, 0.3),
    0 0 35px rgba(0, 255, 65, 0.2);
  filter: brightness(1.1);
}

.glitch-active::before,
.glitch-active::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
  overflow: hidden;
}

.glitch-active::before {
  color: rgba(0, 255, 65, 0.85);
  z-index: -1;
  text-shadow:
    2px 0 rgba(0, 255, 65, 0.7),
    0 0 8px rgba(0, 255, 65, 0.6),
    0 0 15px rgba(0, 255, 65, 0.4);
  animation: matrix-glitch-top 0.8s cubic-bezier(0.215, 0.610, 0.355, 1.000) infinite;
  clip-path: inset(0 0 50% 0);
  mix-blend-mode: screen;
  will-change: transform, clip-path;
}

.glitch-active::after {
  color: rgba(57, 255, 20, 0.8);
  z-index: -2;
  text-shadow:
    -2px 0 rgba(57, 255, 20, 0.6),
    0 0 10px rgba(57, 255, 20, 0.5),
    0 0 20px rgba(57, 255, 20, 0.3);
  animation: matrix-glitch-bottom 1s cubic-bezier(0.645, 0.045, 0.355, 1.000) infinite;
  clip-path: inset(50% 0 0 0);
  mix-blend-mode: screen;
  opacity: 0.85;
  will-change: transform, clip-path;
}

/* Polished Base Shake - Subtle but precise */
@keyframes matrix-base-shake {
  0%, 100% {
    transform: translate(0, 0) skewX(0deg);
  }
  20% {
    transform: translate(-1px, 0.5px) skewX(-0.5deg);
  }
  40% {
    transform: translate(1px, -0.5px) skewX(0.5deg);
  }
  60% {
    transform: translate(-0.5px, 1px) skewX(-0.3deg);
  }
  80% {
    transform: translate(0.5px, -1px) skewX(0.3deg);
  }
}

/* Polished Top Layer Glitch - Smooth chaos */
@keyframes matrix-glitch-top {
  0%, 100% {
    transform: translate(0, 0);
    clip-path: inset(0 0 50% 0);
  }
  5% {
    transform: translate(3px, 1px);
    clip-path: inset(0 0 48% 0);
  }
  10% {
    transform: translate(-2px, -0.5px);
    clip-path: inset(2% 0 50% 0);
  }
  15% {
    transform: translate(0, 0);
    clip-path: inset(0 0 50% 0);
  }
  20% {
    transform: translate(4px, 0);
    clip-path: inset(1% 0 49% 0);
  }
  25% {
    transform: translate(-3px, 1px);
    clip-path: inset(0 0 51% 0);
  }
  30% {
    transform: translate(0, 0);
    clip-path: inset(0 0 50% 0);
  }
  45% {
    transform: translate(2px, -1px);
    clip-path: inset(0 0 48% 0);
  }
  50% {
    transform: translate(-4px, 0.5px);
    clip-path: inset(1% 0 50% 0);
  }
  55% {
    transform: translate(0, 0);
    clip-path: inset(0 0 50% 0);
  }
  70% {
    transform: translate(3px, 1px);
    clip-path: inset(0 0 49% 0);
  }
  85% {
    transform: translate(-2px, -0.5px);
    clip-path: inset(1% 0 51% 0);
  }
}

/* Polished Bottom Layer Glitch - Offset timing */
@keyframes matrix-glitch-bottom {
  0%, 100% {
    transform: translate(0, 0);
    clip-path: inset(50% 0 0 0);
  }
  8% {
    transform: translate(-3px, -1px);
    clip-path: inset(51% 0 0 0);
  }
  16% {
    transform: translate(2px, 0.5px);
    clip-path: inset(49% 0 1% 0);
  }
  24% {
    transform: translate(0, 0);
    clip-path: inset(50% 0 0 0);
  }
  32% {
    transform: translate(-4px, 1px);
    clip-path: inset(52% 0 0 0);
  }
  40% {
    transform: translate(3px, -0.5px);
    clip-path: inset(48% 0 0 0);
  }
  48% {
    transform: translate(0, 0);
    clip-path: inset(50% 0 0 0);
  }
  56% {
    transform: translate(2px, 1px);
    clip-path: inset(49% 0 1% 0);
  }
  64% {
    transform: translate(-3px, 0);
    clip-path: inset(51% 0 0 0);
  }
  72% {
    transform: translate(0, 0);
    clip-path: inset(50% 0 0 0);
  }
  88% {
    transform: translate(4px, -1px);
    clip-path: inset(48% 0 0 0);
  }
}

/* Polished Glow Pulse - Smooth breathing effect */
@keyframes matrix-glow-pulse {
  0%, 100% {
    text-shadow:
      0 0 5px rgba(0, 255, 65, 0.5),
      0 0 10px rgba(0, 255, 65, 0.4),
      0 0 20px rgba(0, 255, 65, 0.3),
      0 0 35px rgba(0, 255, 65, 0.2);
    filter: brightness(1.1);
  }
  50% {
    text-shadow:
      0 0 10px rgba(0, 255, 65, 0.8),
      0 0 20px rgba(0, 255, 65, 0.6),
      0 0 30px rgba(0, 255, 65, 0.4),
      0 0 50px rgba(0, 255, 65, 0.3),
      0 0 70px rgba(0, 255, 65, 0.15);
    filter: brightness(1.2);
  }
}

/* === Skill List Items === */
.skill-list li {
  position: relative;
  padding: 8px 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(34, 163, 159, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

.skill-list li::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(34, 163, 159, 0.3), transparent);
  transition: left 0.5s ease;
}

.skill-list li:hover {
  transform: translateX(5px) scale(1.02);
  border-color: rgba(34, 163, 159, 0.6);
  background: rgba(34, 163, 159, 0.1);
  box-shadow: 0 0 20px rgba(34, 163, 159, 0.3), inset 0 0 20px rgba(34, 163, 159, 0.1);
}

.skill-list li:hover::before {
  left: 100%;
}

.skill-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-weight: 600;
  color: #434242;
}

.skill-percent {
  font-size: 0.85em;
  color: #22A39F;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(34, 163, 159, 0.5);
  animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
  0%, 100% {
    text-shadow: 0 0 10px rgba(34, 163, 159, 0.5);
  }
  50% {
    text-shadow: 0 0 20px rgba(34, 163, 159, 0.8), 0 0 30px rgba(34, 163, 159, 0.4);
  }
}

/* === Enhanced Skill Bars === */
.skill-bar {
  position: relative;
  height: 8px;
  background: rgba(34, 163, 159, 0.08);
  border-radius: 999px;
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.1);
}

.skill-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  width: 0%;
  background: linear-gradient(90deg, #1c8784 0%, #22A39F 50%, #22d3ee 100%);
  border-radius: inherit;
  transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
  box-shadow: 0 0 10px rgba(34, 163, 159, 0.6), 0 0 20px rgba(34, 163, 159, 0.3);
}

.skill-list li.skill-loaded .skill-bar::before {
  width: var(--fill, 0%);
}

.skill-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.3) 50%,
    transparent 100%
  );
  border-radius: inherit;
  pointer-events: none;
  transition: none;
}

.skill-list li.skill-loaded .skill-bar::after {
  animation: shimmer-sweep 3s ease-in-out infinite;
}

@keyframes shimmer-sweep {
  0% {
    left: -100%;
  }
  50% {
    left: 100%;
  }
  100% {
    left: 100%;
  }
}

/* === Staggered Animation on Scroll === */
.skill-list li {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.skill-list li.scroll-animated {
  opacity: 1;
  transform: translateX(0);
  animation: skill-fade-in 0.6s ease-out forwards;
}

/* Keep the individual delays for staggered effect */
.skill-list li:nth-child(1) { transition-delay: 0.05s; }
.skill-list li:nth-child(2) { transition-delay: 0.1s; }
.skill-list li:nth-child(3) { transition-delay: 0.15s; }
.skill-list li:nth-child(4) { transition-delay: 0.2s; }
.skill-list li:nth-child(5) { transition-delay: 0.25s; }
.skill-list li:nth-child(6) { transition-delay: 0.3s; }
.skill-list li:nth-child(7) { transition-delay: 0.35s; }
.skill-list li:nth-child(8) { transition-delay: 0.4s; }
.skill-list li:nth-child(9) { transition-delay: 0.45s; }
.skill-list li:nth-child(10) { transition-delay: 0.5s; }
.skill-list li:nth-child(11) { transition-delay: 0.55s; }
.skill-list li:nth-child(12) { transition-delay: 0.6s; }
.skill-list li:nth-child(13) { transition-delay: 0.65s; }
.skill-list li:nth-child(14) { transition-delay: 0.7s; }

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

@keyframes skill-fade-out {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(50px) scale(0.8);
  }
}

/* === Rainbow Pulse (God Mode) === */
@keyframes rainbow-pulse {
  0% {
    border-color: #ff0000;
    box-shadow: 0 0 20px #ff0000, inset 0 0 20px rgba(255, 0, 0, 0.3);
  }
  16% {
    border-color: #ff9900;
    box-shadow: 0 0 20px #ff9900, inset 0 0 20px rgba(255, 153, 0, 0.3);
  }
  32% {
    border-color: #ffff00;
    box-shadow: 0 0 20px #ffff00, inset 0 0 20px rgba(255, 255, 0, 0.3);
  }
  48% {
    border-color: #00ff00;
    box-shadow: 0 0 20px #00ff00, inset 0 0 20px rgba(0, 255, 0, 0.3);
  }
  64% {
    border-color: #00ffff;
    box-shadow: 0 0 20px #00ffff, inset 0 0 20px rgba(0, 255, 255, 0.3);
  }
  80% {
    border-color: #0000ff;
    box-shadow: 0 0 20px #0000ff, inset 0 0 20px rgba(0, 0, 255, 0.3);
  }
  100% {
    border-color: #ff00ff;
    box-shadow: 0 0 20px #ff00ff, inset 0 0 20px rgba(255, 0, 255, 0.3);
  }
}

/* === Clickable Cursor === */
.skill-list li {
  cursor: pointer;
  user-select: none;
}

.skill-list li:active {
  transform: scale(0.98);
}

/* === Disable clicks during celebration === */
.skill-list li[data-celebrating="true"] {
  pointer-events: none;
  cursor: default;
}

/* === Prestige Stars === */
.prestige-stars {
  display: inline-block;
  margin-left: 8px;
  font-size: 0.9em;
  color: #FFD700;
  text-shadow:
    0 0 5px rgba(255, 215, 0, 0.8),
    0 0 10px rgba(255, 215, 0, 0.6),
    0 0 15px rgba(255, 215, 0, 0.4);
  animation: prestige-glow 2s ease-in-out infinite;
  letter-spacing: 2px;
}

@keyframes prestige-glow {
  0%, 100% {
    text-shadow:
      0 0 5px rgba(255, 215, 0, 0.8),
      0 0 10px rgba(255, 215, 0, 0.6),
      0 0 15px rgba(255, 215, 0, 0.4);
  }
  50% {
    text-shadow:
      0 0 10px rgba(255, 215, 0, 1),
      0 0 20px rgba(255, 215, 0, 0.8),
      0 0 30px rgba(255, 215, 0, 0.6);
  }
}

@keyframes prestige-pop {
  0% {
    transform: scale(0.5) rotate(-180deg);
    opacity: 0;
  }
  50% {
    transform: scale(1.3) rotate(10deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

/* === Max Prestige Effect === */
.skill-list li[data-prestige="5"] {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.15), rgba(255, 165, 0, 0.1));
  border-color: rgba(255, 215, 0, 0.6);
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.4), inset 0 0 30px rgba(255, 215, 0, 0.1);
}

.skill-list li[data-prestige="5"] .skill-title {
  color: #FFD700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

/* ===================================================
   Experience Section Enhancements
   =================================================== */

/* === Experience Cards === */
#experiences .experience {
  position: relative;
  padding: 20px;
  margin-bottom: 30px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  border-left: 4px solid #22A39F;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}

#experiences .experience::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(34, 163, 159, 0.1), transparent);
  transition: left 0.6s ease;
}

#experiences .experience:hover {
  transform: translateX(10px);
  background: rgba(34, 163, 159, 0.05);
  border-left-width: 6px;
  box-shadow: -5px 0 20px rgba(34, 163, 159, 0.2), 0 5px 20px rgba(0, 0, 0, 0.1);
}

#experiences .experience:hover::before {
  left: 100%;
}

/* === Timeline Connector === */
#experiences .experience::after {
  content: '';
  position: absolute;
  left: -10px;
  top: 30px;
  width: 16px;
  height: 16px;
  background: #22A39F;
  border-radius: 50%;
  box-shadow: 0 0 0 4px #F3EFE0, 0 0 15px rgba(34, 163, 159, 0.6);
  transition: all 0.3s ease;
}

#experiences .experience:hover::after {
  transform: scale(1.3);
  box-shadow: 0 0 0 4px #F3EFE0, 0 0 25px rgba(34, 163, 159, 0.8), 0 0 40px rgba(34, 163, 159, 0.4);
}

/* === Company Name Animation === */
#experiences .experience h4 {
  position: relative;
  display: inline-block;
  color: #22A39F;
  font-weight: 700;
  margin-bottom: 5px;
  transition: all 0.3s ease;
}

#experiences .experience:hover h4 {
  color: #1c8784;
  text-shadow: 0 0 10px rgba(34, 163, 159, 0.5);
}

/* === Period Badge === */
#experiences .experience-period {
  display: inline-block;
  background: linear-gradient(135deg, rgba(34, 163, 159, 0.2), rgba(34, 163, 159, 0.1));
  color: #22A39F;
  padding: 4px 12px;
  border-radius: 15px;
  font-size: 0.85em;
  font-weight: 600;
  margin: 4px 0;
  border: 1px solid rgba(34, 163, 159, 0.3);
  transition: all 0.3s ease;
}

#experiences .experience:hover .experience-period {
  background: linear-gradient(135deg, rgba(34, 163, 159, 0.3), rgba(34, 163, 159, 0.15));
  border-color: rgba(34, 163, 159, 0.6);
  box-shadow: 0 0 10px rgba(34, 163, 159, 0.3);
}

/* === Role Title === */
#experiences .experience strong {
  color: #434242;
  font-size: 1.05em;
  transition: color 0.3s ease;
}

#experiences .experience:hover strong {
  color: #22A39F;
}

/* === Icons Glow === */
#experiences .experience-details i {
  color: #22A39F;
  transition: all 0.3s ease;
}

#experiences .experience:hover .experience-details i {
  text-shadow: 0 0 8px rgba(34, 163, 159, 0.8);
  transform: scale(1.2);
}

/* === Section Headers === */
#experiences h3 {
  position: relative;
  display: inline-block;
  padding-bottom: 10px;
  margin-bottom: 20px;
}

#experiences h3::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 60px;
  height: 3px;
  background: linear-gradient(90deg, #22A39F, transparent);
  animation: header-glow 2s ease-in-out infinite;
}

@keyframes header-glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(34, 163, 159, 0.5);
  }
  50% {
    box-shadow: 0 0 15px rgba(34, 163, 159, 0.8), 0 0 25px rgba(34, 163, 159, 0.4);
  }
}

/* === Staggered Fade-in on Scroll === */
#experiences .experience {
  opacity: 0;
  transform: translateX(-30px);
  animation: experience-fade-in 0.8s ease-out forwards;
}

#experiences .experience:nth-child(1) { animation-delay: 0.1s; }
#experiences .experience:nth-child(2) { animation-delay: 0.15s; }
#experiences .experience:nth-child(3) { animation-delay: 0.2s; }
#experiences .experience:nth-child(4) { animation-delay: 0.25s; }
#experiences .experience:nth-child(5) { animation-delay: 0.3s; }
#experiences .experience:nth-child(6) { animation-delay: 0.35s; }
#experiences .experience:nth-child(7) { animation-delay: 0.4s; }
#experiences .experience:nth-child(8) { animation-delay: 0.45s; }
#experiences .experience:nth-child(9) { animation-delay: 0.5s; }
#experiences .experience:nth-child(10) { animation-delay: 0.55s; }

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

/* === Link Hover Effects === */
#experiences .experience-details a {
  color: #22A39F;
  text-decoration: none;
  position: relative;
  transition: all 0.3s ease;
}

#experiences .experience-details a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: #22A39F;
  transition: width 0.3s ease;
}

#experiences .experience-details a:hover::after {
  width: 100%;
}

#experiences .experience-details a:hover {
  color: #1c8784;
  text-shadow: 0 0 10px rgba(34, 163, 159, 0.5);
}

/* === Floating Animation === */
.float {
  animation: float 6s ease-in-out infinite;
}

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

/* === Pulse Glow === */
.pulse-glow {
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 20px rgba(34, 163, 159, 0.5);
  }
  50% {
    box-shadow: 0 0 40px rgba(34, 163, 159, 0.8);
  }
}

/* === Scroll Reveal Animation === */
.scroll-reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-reveal.revealed {
  opacity: 1;
  transform: translateY(0);
}

/* === Neon Text === */
.neon-text {
  color: #22A39F;
  text-shadow:
    0 0 5px #22A39F,
    0 0 10px #22A39F,
    0 0 20px #22A39F,
    0 0 40px #22A39F;
  animation: neon-flicker 3s ease-in-out infinite;
}

@keyframes neon-flicker {
  0%, 19%, 21%, 23%, 25%, 54%, 56%, 100% {
    text-shadow:
      0 0 5px #22A39F,
      0 0 10px #22A39F,
      0 0 20px #22A39F,
      0 0 40px #22A39F;
  }
  20%, 24%, 55% {
    text-shadow: none;
  }
}

/* === Card Hover Effects === */
.card-hover-lift {
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-hover-lift:hover {
  transform: translateY(-10px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

/* === Gradient Border === */
.gradient-border {
  position: relative;
  background: linear-gradient(45deg, #22d3ee, #3b82f6, #a855f7, #22d3ee);
  background-size: 300% 300%;
  animation: gradient-shift 6s ease infinite;
  padding: 2px;
  border-radius: 12px;
}

.gradient-border > * {
  background: #fff;
  border-radius: 10px;
}

@keyframes gradient-shift {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* === Loading Spinner === */
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(34, 163, 159, 0.3);
  border-radius: 50%;
  border-top-color: #22A39F;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Tilt Effect on Hover === */
.tilt-hover {
  transition: transform 0.3s ease;
}

.tilt-hover:hover {
  transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}

/* === Typewriter Cursor === */
.typewriter-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background-color: currentColor;
  margin-left: 2px;
  animation: blink 1s step-end infinite;
}

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

/* === Skill Highlight Effect === */
.skill-list li.skill-highlighted {
  animation: skill-highlight-pulse 0.5s ease-in-out 4 !important;
  border-color: #22A39F !important;
  background: rgba(34, 163, 159, 0.2) !important;
  box-shadow: 0 0 30px rgba(34, 163, 159, 0.8), inset 0 0 30px rgba(34, 163, 159, 0.2) !important;
  transform: scale(1.05) !important;
  opacity: 1 !important;
}

@keyframes skill-highlight-pulse {
  0%, 100% {
    box-shadow: 0 0 20px rgba(34, 163, 159, 0.6), inset 0 0 20px rgba(34, 163, 159, 0.15);
    transform: scale(1.05);
  }
  50% {
    box-shadow: 0 0 40px rgba(34, 163, 159, 1), inset 0 0 40px rgba(34, 163, 159, 0.3);
    transform: scale(1.08);
  }
}

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