/* ═══════════════════════════════════════════════
   HERO ECOSISTEMA — Anigami
   Widget custom Elementor: anigami_ecosystem
   ═══════════════════════════════════════════════ */

/* ── Contenidor hero ── */
.anigami-ecosystem {
  position: relative;
  width: 100%;
  height: 97dvh;
  overflow: hidden;
  background: var(--color-dark);
}

/* ── Imatge de fons (apareix quan eco-active) ── */
.anigami-ecosystem .bg-image {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-color: var(--color-dark);
  opacity: 0;
  transition: opacity 1.5s ease;
}
.anigami-ecosystem .bg-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.anigami-ecosystem.eco-active .bg-image { opacity: 1; }

/* ── Gradients de fusió amb la pàgina ── */
.anigami-ecosystem .gradient-top {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 140px;
  z-index: 2;
  background: linear-gradient(to bottom, var(--color-dark) 0%, var(--color-dark) 20%, transparent 100%);
  pointer-events: none;
}
.anigami-ecosystem .gradient-bottom {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 220px;
  z-index: 2;
  background: linear-gradient(to top, var(--color-dark) 0%, var(--color-dark) 25%, transparent 100%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.5s ease;
}
.anigami-ecosystem.eco-active  .gradient-bottom { opacity: 1; }
.anigami-ecosystem.eco-closing .gradient-bottom { opacity: 0; transition: opacity 1s ease; }

/* ── Canvas de nodes ── */
.anigami-ecosystem canvas#nodeCanvas {
  position: absolute !important;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.anigami-ecosystem.eco-active  canvas#nodeCanvas { opacity: 1; z-index: 5; }
.anigami-ecosystem.eco-closing canvas#nodeCanvas { opacity: 0; transition: opacity 1s ease; }

/* ── Logo central ── */
@keyframes heartbeat {
  0%, 100% { transform: translate(-50%, -50%) scale(1);    }
  15%       { transform: translate(-50%, -50%) scale(1.08); }
  30%       { transform: translate(-50%, -50%) scale(1);    }
  45%       { transform: translate(-50%, -50%) scale(1.05); }
  60%       { transform: translate(-50%, -50%) scale(1);    }
}
@keyframes heartbeatSmall {
  0%, 100% { transform: translate(-50%, -50%) scale(0.6);    }
  15%       { transform: translate(-50%, -50%) scale(0.648); }
  30%       { transform: translate(-50%, -50%) scale(0.6);   }
  45%       { transform: translate(-50%, -50%) scale(0.63);  }
  60%       { transform: translate(-50%, -50%) scale(0.6);   }
}
@keyframes shrinkThenBeat {
  0%   { transform: translate(-50%, -50%) scale(1);   }
  100% { transform: translate(-50%, -50%) scale(0.6); }
}
@keyframes growBack {
  0%   { transform: translate(-50%, -50%) scale(0.6); }
  100% { transform: translate(-50%, -50%) scale(1);   }
}

.anigami-ecosystem .center-logo {
  position: absolute;
  z-index: 40;
  left: 50%; top: 50%;
  width: 150px; height: 150px;
  object-fit: contain;
  filter: drop-shadow(0 0 30px var(--color-accent-glow));
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  cursor: pointer;
  animation: heartbeat 1.8s ease-in-out infinite;
  transition: none;
}
.anigami-ecosystem.eco-active .center-logo {
  cursor: pointer;
  animation:
    shrinkThenBeat 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards,
    heartbeatSmall 2.4s ease-in-out 1.4s infinite;
}
.anigami-ecosystem.eco-closing .center-logo {
  cursor: pointer;
  animation: growBack 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ── Anells pulsants (splash) ── */
@keyframes ringPulse {
  0%   { transform: translate(-50%, -50%) scale(0.8); opacity: 0.6; }
  100% { transform: translate(-50%, -50%) scale(1.8); opacity: 0;   }
}
.anigami-ecosystem .logo-ring {
  position: absolute;
  z-index: 39;
  left: 50%; top: 50%;
  width: 190px; height: 190px;
  border-radius: 50%;
  border: 1.5px solid rgba(232, 120, 48, 0.2);
  transform: translate(-50%, -50%);
  animation: ringPulse 2.4s ease-out infinite;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
.anigami-ecosystem .logo-ring.ring2 { animation-delay: 1.2s; }
.anigami-ecosystem.eco-active  .logo-ring { opacity: 0; transition: opacity 1s ease; }
.anigami-ecosystem.eco-closing .logo-ring { opacity: 1; transition: opacity 1s ease 0.5s; }

/* ── Splash overlay ── */
@keyframes blink {
  0%, 100% { opacity: 0.3; }
  50%       { opacity: 0.8; }
}
.anigami-ecosystem #eco-splash {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: var(--color-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 1.2s;
}
.anigami-ecosystem #eco-splash.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.anigami-ecosystem .splash-text {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, 130px);
  font-size: 11px;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  animation: blink 2s ease-in-out infinite;
  white-space: nowrap;
  pointer-events: none;
}

/* ── Hint scroll (splash) ── */
@keyframes bounceArrow {
  0%, 100% { transform: rotate(45deg) translate(0, 0);       opacity: 0.5; }
  50%       { transform: rotate(45deg) translate(4px, 4px); opacity: 1;   }
}
.anigami-ecosystem .splash-scroll-hint {
  position: absolute;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  text-align: center;
  pointer-events: auto;
  text-decoration: none;
  cursor: pointer;
}
.anigami-ecosystem .splash-scroll-hint span {
  display: block;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255, 240, 225, 0.65);
  margin-bottom: 8px;
}
.anigami-ecosystem .splash-scroll-hint .arrow,
.anigami-ecosystem .scroll-hint .arrow {
  display: block;
  margin: 0 auto;
  width: 20px; height: 20px;
  border-right: 2px solid var(--color-accent);
  border-bottom: 2px solid var(--color-accent);
  transform: rotate(45deg);
  animation: bounceArrow 1.8s ease-in-out infinite;
}

/* ── Hint scroll (eco-active) ── */
.anigami-ecosystem .scroll-hint {
  position: absolute;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  text-align: center;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transition: opacity 1s ease 2.2s;
  text-decoration: none;
}
.anigami-ecosystem.eco-active  .scroll-hint { opacity: 1; }
.anigami-ecosystem.eco-closing .scroll-hint { opacity: 0; transition: opacity 0.4s ease; }
.anigami-ecosystem .scroll-hint span {
  display: block;
  font-size: 12px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: rgba(255, 240, 225, 0.65);
  margin-bottom: 8px;
}

/* ── Popup circular de node ── */
.anigami-ecosystem #nodePopup {
  position: fixed;
  z-index: 3000;
  width: 340px; height: 340px;
  border-radius: 50%;
  background: var(--color-dark);
  border: 2.5px solid rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  pointer-events: auto;
  overflow: hidden;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: var(--shadow-popup);
}
.anigami-ecosystem #nodePopup.show {
  opacity: 1;
  transform: scale(1);
}

.anigami-ecosystem .popup-img-area {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 55%;
  overflow: hidden;
}
.anigami-ecosystem .popup-img-area img {
  width: 100%; height: 100%;
  object-fit: cover;
	filter: grayscale();
}
.anigami-ecosystem .popup-img-area .popup-gradient {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 60%;
  background: linear-gradient(to top, var(--color-dark) 0%, transparent 100%);
}

.anigami-ecosystem .popup-content {
  position: relative;
  z-index: 2;
  padding: 0 36px 28px;
  width: 100%;
}
.anigami-ecosystem .popup-title {
  font-size: var(--text-body);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: var(--ls-card);
  color: #ffffff;
  margin-bottom: 8px;
  line-height: 1.3;
}
.anigami-ecosystem .popup-desc {
  font-size: var(--text-body-sm);
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.anigami-ecosystem .popup-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: none;
  border: none;
  color: #ffffff;
  cursor: pointer;
  transition: opacity var(--transition), color var(--transition);
  text-decoration: none;
}
.anigami-ecosystem .popup-link:hover { color: var(--color-accent); }
.anigami-ecosystem .popup-link svg  { width: 26px; height: 26px; }

/* ── Responsive ── */
@media (max-width: 480px) {
  .anigami-ecosystem #nodePopup   { width: 260px; height: 260px; }
  .anigami-ecosystem .popup-content { padding: 0 24px 18px; }
  .anigami-ecosystem .popup-title  { font-size: 11px; }
  .anigami-ecosystem .popup-desc   { font-size: 10px; }
  .anigami-ecosystem .center-logo  { width: 110px !important; height: 110px !important; }
  .anigami-ecosystem .logo-ring    { width: 145px !important; height: 145px !important; }
  .anigami-ecosystem .splash-text  { font-size: 10px; letter-spacing: 3px; }
}
