/* ============================================
   MARKETS SECTION — MORPHING BLOB CARDS
   ============================================

   COLOR MAP:
   ─────────────────────────────────────────
   Background:           #FFFFFF
   Forex Blob:           #00AAE4 → #0066CC → #38BDF8
   Crypto Blob:          #F7931A → #FFD700 → #FF8C00
   Stocks Blob:          #627EEA → #8B5CF6 → #A78BFA
   Indices Blob:         #14F195 → #9945FF → #00FFA3
   Metals Blob:          #F3BA2F → #F0B90B → #FCD34D
   Energy Blob:          #EF4444 → #F97316 → #FCA5A5
   Text Primary:         #0D0D0D
   Text Secondary:       #5F6B7A
   Heading Gradient:     #0D56A9 → #B89857
   Label Gradient:       #00AAE4 → #627EEA
   Glass BG:             rgba(0,0,0,0.85)
   Glass Border:         rgba(255,255,255,0.2)
   ─────────────────────────────────────────
*/

/* ── Section Container ── */
.markets {
  padding: 120px 8%;
  background: #FFFFFF;
  position: relative;
  overflow: hidden;
}

/* ── Background Ambient Glow ── */
.markets-bg-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background:
    radial-gradient(ellipse at 10% 40%, rgba(0, 170, 228, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 90% 30%, rgba(247, 147, 26, 0.05) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(20, 241, 149, 0.04) 0%, transparent 50%),
    radial-gradient(ellipse at 75% 65%, rgba(98, 126, 234, 0.03) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  animation: marketsAmbientPulse 8s ease-in-out infinite;
}

@keyframes marketsAmbientPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.05); }
}

/* ── Title Block ── */
.markets-title {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 70px;
  position: relative;
  z-index: 2;
}

.markets-label {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 3px;
  text-transform: uppercase;
  background: linear-gradient(135deg, #00AAE4, #627EEA);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.markets-label-line {
  display: block;
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, #627EEA, transparent);
}

.markets-title h2 {
  font-family: 'Poppins', sans-serif;
  font-size: 48px;
  font-weight: 800;
  line-height: 1.2;
  margin: 24px 0;
  letter-spacing: -1.5px;
  background: linear-gradient(135deg, #0D56A9, #B89857);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.markets-title p {
  font-size: 16px;
  color: #5F6B7A;
  line-height: 1.8;
}

/* ── Scroll Reveal — Title ── */
.markets-title .markets-label,
.markets-title h2,
.markets-title p {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.7s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.7s cubic-bezier(0.4, 0, 0.2, 1);
}

.markets-title.visible .markets-label {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0s;
}

.markets-title.visible h2 {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.15s;
}

.markets-title.visible p {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.3s;
}

/* ── Grid ── */
.markets-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 28px;
  position: relative;
  z-index: 2;
}

/* ============================================
   MORPH MARKET CARD — BASE
   ============================================ */
.morph-market-card {
  position: relative;
  aspect-ratio: 4 / 5;
  cursor: pointer;
  z-index: 1;
  opacity: 0;
  transform: translateY(40px) scale(0.9);
  transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* .morph-market-card:hover {
  z-index: 10;
} */

.morph-market-card.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── Morph Blob Base ── */
.morph-market-card .morph-blob {
  position: absolute;
  inset: 0;
  transition: all 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  will-change: border-radius, transform;
}

.morph-market-card:hover .morph-blob {
  border-radius: 50% !important;
  animation-play-state: paused !important;
  transform: scale(1.08);
}

/* ── Card Mouse-Follow Glow ── */
.morph-market-card .card-glow {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: transparent;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
  z-index: 1;
}

/* .morph-market-card:hover .card-glow {
  opacity: 1;
} */

/* ── Content Overlay ── */
.morph-market-card .morph-content {
  position: relative;
  z-index: 2;
  padding: 24px 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
}

.market-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55),
              box-shadow 0.5s ease;
}

.morph-market-card:hover .market-icon-wrap {
  transform: rotate(-8deg) scale(1.15);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.morph-market-card .morph-content h3 {
  font-family: 'Poppins', sans-serif;
  font-size: 17px;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  margin-bottom: 6px;
  transition: transform 0.4s ease;
}

.morph-market-card:hover .morph-content h3 {
  transform: translateY(-2px);
}

.market-sub {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.5px;
  line-height: 1.4;
  transition: color 0.4s ease;
}

.morph-market-card:hover .market-sub {
  color: rgba(255, 255, 255, 0.85);
}

/* ============================================
   6 UNIQUE BLOB ANIMATIONS
   ============================================ */

/* ── 1. Forex (Blue / Cyan) ── */
.blob-forex {
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  background: linear-gradient(135deg, #00AAE4, #0066CC);
  box-shadow: 0 15px 40px rgba(0, 170, 228, 0.25);
  animation: morphForex 7s ease-in-out infinite;
  animation-delay: 0s;
}

.morph-market-card:hover .blob-forex {
  box-shadow: 0 25px 60px rgba(0, 170, 228, 0.45);
}

@keyframes morphForex {
  0%, 100% {
    border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
    background: linear-gradient(135deg, #00AAE4, #0066CC);
  }
  25% {
    border-radius: 58% 42% 75% 25% / 76% 46% 54% 24%;
    background: linear-gradient(135deg, #0066CC, #38BDF8);
  }
  50% {
    border-radius: 50% 50% 33% 67% / 55% 27% 73% 45%;
    background: linear-gradient(135deg, #38BDF8, #00AAE4);
  }
  75% {
    border-radius: 33% 67% 58% 42% / 63% 68% 32% 37%;
    background: linear-gradient(135deg, #00AAE4, #0066CC);
  }
}

/* ── 2. Cryptocurrency (Orange / Gold) ── */
.blob-crypto {
  border-radius: 42% 58% 60% 40% / 55% 45% 55% 45%;
  background: linear-gradient(135deg, #F7931A, #FFD700);
  box-shadow: 0 15px 40px rgba(247, 147, 26, 0.25);
  animation: morphCrypto 8s ease-in-out infinite;
  animation-delay: -2s;
}

.morph-market-card:hover .blob-crypto {
  box-shadow: 0 25px 60px rgba(247, 147, 26, 0.45);
}

@keyframes morphCrypto {
  0%, 100% {
    border-radius: 42% 58% 60% 40% / 55% 45% 55% 45%;
    background: linear-gradient(135deg, #F7931A, #FFD700);
  }
  25% {
    border-radius: 70% 30% 50% 50% / 30% 60% 40% 70%;
    background: linear-gradient(135deg, #FFD700, #FF8C00);
  }
  50% {
    border-radius: 38% 62% 45% 55% / 65% 35% 65% 35%;
    background: linear-gradient(135deg, #FF8C00, #F7931A);
  }
  75% {
    border-radius: 55% 45% 70% 30% / 40% 55% 45% 60%;
    background: linear-gradient(135deg, #F7931A, #FFD700);
  }
}

/* ── 3. Global Stocks (Purple / Blue) ── */
.blob-stocks {
  border-radius: 60% 40% 30% 70% / 50% 60% 40% 50%;
  background: linear-gradient(135deg, #627EEA, #8B5CF6);
  box-shadow: 0 15px 40px rgba(98, 126, 234, 0.25);
  animation: morphStocks 9s ease-in-out infinite;
  animation-delay: -4s;
}

.morph-market-card:hover .blob-stocks {
  box-shadow: 0 25px 60px rgba(98, 126, 234, 0.45);
}

@keyframes morphStocks {
  0%, 100% {
    border-radius: 60% 40% 30% 70% / 50% 60% 40% 50%;
    background: linear-gradient(135deg, #627EEA, #8B5CF6);
  }
  25% {
    border-radius: 35% 65% 55% 45% / 70% 30% 70% 30%;
    background: linear-gradient(135deg, #8B5CF6, #A78BFA);
  }
  50% {
    border-radius: 45% 55% 65% 35% / 35% 65% 35% 65%;
    background: linear-gradient(135deg, #A78BFA, #627EEA);
  }
  75% {
    border-radius: 65% 35% 40% 60% / 55% 45% 55% 45%;
    background: linear-gradient(135deg, #627EEA, #8B5CF6);
  }
}

/* ── 4. Indices (Green / Purple) ── */
.blob-indices {
  border-radius: 25% 75% 65% 35% / 40% 55% 45% 60%;
  background: linear-gradient(135deg, #14F195, #9945FF);
  box-shadow: 0 15px 40px rgba(20, 241, 149, 0.2);
  animation: morphIndices 7.5s ease-in-out infinite;
  animation-delay: -1s;
}

.morph-market-card:hover .blob-indices {
  box-shadow: 0 25px 60px rgba(20, 241, 149, 0.4);
}

@keyframes morphIndices {
  0%, 100% {
    border-radius: 25% 75% 65% 35% / 40% 55% 45% 60%;
    background: linear-gradient(135deg, #14F195, #9945FF);
  }
  25% {
    border-radius: 45% 55% 35% 65% / 60% 40% 60% 40%;
    background: linear-gradient(135deg, #9945FF, #00FFA3);
  }
  50% {
    border-radius: 55% 45% 60% 40% / 35% 65% 35% 65%;
    background: linear-gradient(135deg, #00FFA3, #14F195);
  }
  75% {
    border-radius: 40% 60% 45% 55% / 55% 40% 60% 45%;
    background: linear-gradient(135deg, #14F195, #9945FF);
  }
}

/* ── 5. Metals (Yellow / Gold) ── */
.blob-metals {
  border-radius: 35% 65% 50% 50% / 65% 35% 65% 35%;
  background: linear-gradient(135deg, #F3BA2F, #F0B90B);
  box-shadow: 0 15px 40px rgba(243, 186, 47, 0.25);
  animation: morphMetals 8.5s ease-in-out infinite;
  animation-delay: -3s;
}

.morph-market-card:hover .blob-metals {
  box-shadow: 0 25px 60px rgba(243, 186, 47, 0.45);
}

@keyframes morphMetals {
  0%, 100% {
    border-radius: 35% 65% 50% 50% / 65% 35% 65% 35%;
    background: linear-gradient(135deg, #F3BA2F, #F0B90B);
  }
  25% {
    border-radius: 60% 40% 65% 35% / 40% 60% 40% 60%;
    background: linear-gradient(135deg, #F0B90B, #FCD34D);
  }
  50% {
    border-radius: 45% 55% 35% 65% / 55% 45% 55% 45%;
    background: linear-gradient(135deg, #FCD34D, #F3BA2F);
  }
  75% {
    border-radius: 70% 30% 55% 45% / 30% 70% 30% 70%;
    background: linear-gradient(135deg, #F3BA2F, #F0B90B);
  }
}

/* ── 6. Energy (Red / Orange) ── */
.blob-energy {
  border-radius: 50% 50% 40% 60% / 45% 55% 45% 55%;
  background: linear-gradient(135deg, #EF4444, #F97316);
  box-shadow: 0 15px 40px rgba(239, 68, 68, 0.25);
  animation: morphEnergy 9.5s ease-in-out infinite;
  animation-delay: -5s;
}

.morph-market-card:hover .blob-energy {
  box-shadow: 0 25px 60px rgba(239, 68, 68, 0.45);
}

@keyframes morphEnergy {
  0%, 100% {
    border-radius: 50% 50% 40% 60% / 45% 55% 45% 55%;
    background: linear-gradient(135deg, #EF4444, #F97316);
  }
  25% {
    border-radius: 40% 60% 55% 45% / 65% 35% 55% 45%;
    background: linear-gradient(135deg, #F97316, #FCA5A5);
  }
  50% {
    border-radius: 65% 35% 45% 55% / 40% 60% 40% 60%;
    background: linear-gradient(135deg, #FCA5A5, #EF4444);
  }
  75% {
    border-radius: 35% 65% 60% 40% / 55% 45% 65% 35%;
    background: linear-gradient(135deg, #EF4444, #F97316);
  }
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1100px) {
  .markets-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
  }
}

@media (max-width: 640px) {
  .markets {
    padding: 80px 5%;
  }

  .markets-title {
    margin-bottom: 50px;
  }

  .markets-title h2 {
    font-size: 30px;
    letter-spacing: -0.5px;
  }

  .markets-title p {
    font-size: 14px;
  }

  .markets-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .market-icon-wrap {
    width: 52px;
    height: 52px;
    border-radius: 14px;
  }

  .market-icon-wrap svg {
    width: 26px;
    height: 26px;
  }

  .morph-market-card .morph-content h3 {
    font-size: 14px;
  }

  .market-sub {
    font-size: 9px;
  }
}

@media (max-width: 380px) {
  .markets-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
  }

  .morph-market-card .morph-content {
    padding: 18px 10px;
  }

  .market-icon-wrap {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    margin-bottom: 10px;
  }

  .market-icon-wrap svg {
    width: 22px;
    height: 22px;
  }

  .morph-market-card .morph-content h3 {
    font-size: 13px;
  }
}

/* ============================================
   REDUCED MOTION
   ============================================ */
@media (prefers-reduced-motion: reduce) {
  .markets-bg-glow {
    animation: none !important;
  }

  .morph-market-card .morph-blob {
    animation: none !important;
    border-radius: 24px !important;
  }

  .morph-market-card:hover .morph-blob {
    transform: scale(1.04) !important;
    border-radius: 24px !important;
  }

  .markets-title .markets-label,
  .markets-title h2,
  .markets-title p,
  .morph-market-card {
    opacity: 1 !important;
    transform: none !important;
    transition: color 0.3s ease, background 0.3s ease !important;
  }
}