/* ─── Ecosistema vivo: negocios del Buscador ─── */
.section--ecosistema {
  background:
    radial-gradient(ellipse 90% 70% at 10% -10%, rgba(180, 90, 157, 0.14), transparent 55%),
    radial-gradient(ellipse 70% 60% at 95% 20%, rgba(136, 201, 70, 0.12), transparent 50%),
    linear-gradient(180deg, #f8f7fc 0%, #fff 42%, #f4f2f8 100%);
  overflow: visible;
}

.ecosistema {
  display: flex;
  flex-direction: column;
  gap: clamp(1.25rem, 3vw, 2rem);
}

.ecosistema__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
}

.ecosistema__live {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(29, 29, 58, 0.06);
  border: 1px solid rgba(29, 29, 58, 0.08);
  font-size: clamp(0.78rem, 2vw, 0.88rem);
  font-weight: 700;
  color: #1d1d3a;
  letter-spacing: 0.02em;
}

.ecosistema__live-dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #88c946;
  box-shadow: 0 0 0 0 rgba(136, 201, 70, 0.55);
  animation: ecosistema-pulse 2.2s ease-out infinite;
}

@keyframes ecosistema-pulse {
  0% { box-shadow: 0 0 0 0 rgba(136, 201, 70, 0.5); }
  70% { box-shadow: 0 0 0 10px rgba(136, 201, 70, 0); }
  100% { box-shadow: 0 0 0 0 rgba(136, 201, 70, 0); }
}

.ecosistema__sync {
  margin: 0;
  font-size: clamp(0.75rem, 1.8vw, 0.84rem);
  color: var(--muted);
}

.ecosistema__carousel-wrap {
  position: relative;
  overflow: visible;
}

.ecosistema__viewport {
  width: 100%;
  overflow-x: auto;
  overflow-y: visible;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.35rem 0 0.65rem;
}

.ecosistema__viewport::-webkit-scrollbar {
  display: none;
}

.ecosistema__scroll-hint {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0.35rem;
  z-index: 2;
  width: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.2rem;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    rgba(248, 247, 252, 0) 0%,
    rgba(248, 247, 252, 0.82) 42%,
    #f8f7fc 100%
  );
  opacity: 1;
  transition: opacity 0.28s ease;
}

.ecosistema__scroll-hint--hidden {
  opacity: 0;
}

.ecosistema__scroll-hint-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 999px;
    color: white;
    background: rgb(154 74 134 / 39%);
    box-shadow: 0 4px 14px rgba(154, 74, 134, 0.18);
    animation: ecosistema-scroll-hint-pulse 1.15s ease-in-out infinite;
}

@keyframes ecosistema-scroll-hint-pulse {
  0%,
  100% {
    opacity: 0.4;
    transform: translateX(0);
  }
  50% {
    opacity: 1;
    transform: translateX(5px);
  }
}

.ecosistema__track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(15.5rem, 88vw, 18rem);
  gap: clamp(0.75rem, 2vw, 1rem);
  width: max-content;
  max-width: none;
  padding-inline: 0.2rem;
  align-items: stretch;
}

.eco-card {
  position: relative;
  display: flex;
  flex-direction: column;
  width: clamp(15.5rem, 88vw, 18rem);
  height: 100%;
  padding: 0.35rem 0.1rem;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  scroll-snap-align: start;
  opacity: 0;
  transform: translateY(0.75rem);
  transition:
    opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--eco-i, 0) * 40ms);
}

.eco-card__surface {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  height: calc(clamp(11rem, 50vw, 17rem) + 14rem);
  min-height: calc(clamp(11rem, 50vw, 17rem) + 14rem);
  max-height: calc(clamp(11rem, 50vw, 17rem) + 14rem);
  border-radius: 18px;
  overflow: visible;
  background: transparent;
  border: none;
  box-shadow: none;
  transform: translateY(0) scale(1);
  transform-origin: center center;
  transition:
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.eco-card__surface::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 18px;
  border: 1px solid rgba(29, 29, 58, 0.1);
  box-shadow: 0 4px 14px rgba(29, 29, 58, 0.07);
  pointer-events: none;
  z-index: 0;
  transition: box-shadow 0.32s ease, border-color 0.28s ease;
}

.eco-card:hover .eco-card__surface,
.eco-card:focus-visible .eco-card__surface {
  transform: translateY(-3px) scale(1.012);
}

.eco-card:hover .eco-card__surface::before,
.eco-card:focus-visible .eco-card__surface::before {
  border-color: rgba(154, 74, 134, 0.28);
  box-shadow: 0 8px 18px rgba(29, 29, 58, 0.12);
}

.eco-card__cover {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  height: clamp(11rem, 50vw, 17rem);
  border-radius: 18px 18px 0 0;
  overflow: hidden;
  background:
    linear-gradient(135deg, #1d1d3a 0%, #9a4a86 55%, #88c946 120%);
  background-size: cover;
  background-position: center;
}

.eco-card.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.eco-card.is-leaving {
  opacity: 0;
  transform: translateY(-0.5rem);
  pointer-events: none;
}

.eco-card__cover::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.48) 0%, rgba(8, 8, 20, 0.1) 42%, transparent 100%);
  pointer-events: none;
}

.eco-card__tag {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 2;
    padding: 0.7rem 0.9rem;
    background: rgba(0, 0, 0, 0.58);
    font-size: clamp(0.78rem, 1.8vw, 0.9rem);
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: none;
    color: #e4bd29;
    line-height: 1.3;
}

.eco-card__body {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.85rem 0.9rem 0.95rem;
  padding-top: 2.15rem;
  flex: 1;
  min-height: 14rem;
  overflow: visible;
  background: #fff;
  border-radius: 0 0 18px 18px;
}

.eco-card__logo {
  position: absolute;
  top: -1.75rem;
  left: 0.9rem;
  z-index: 5;
  width: 3.35rem;
  height: 3.35rem;
  border-radius: 14px;
  object-fit: cover;
  border: 3px solid #fff;
  box-shadow: 0 8px 20px rgba(29, 29, 58, 0.18);
  background: #fff;
}

.eco-card__logo--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 900;
  color: #9a4a86;
  background: linear-gradient(145deg, #fff, #f3edf2);
}

.eco-card__name {
  margin: 0;
  font-size: clamp(0.9rem, 2.2vw, 0.98rem);
  line-height: 1.25;
  font-weight: 900;
  color: #1d1d3a;
  flex-shrink: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.eco-card__address {
  margin: 0;
  font-size: clamp(0.72rem, 1.85vw, 0.8rem);
  line-height: 1.4;
  color: var(--muted);
  text-transform: none;
  flex-shrink: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.eco-card__description {
  margin: 0;
  font-size: clamp(0.72rem, 1.85vw, 0.8rem);
  line-height: 1.45;
  color: #4a4a62;
  flex: 1;
  min-height: 0;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  overflow-wrap: anywhere;
}

.eco-card__cta {
  margin-top: auto;
  flex-shrink: 0;
  font-size: 0.76rem;
  font-weight: 800;
  color: #9a4a86;
  letter-spacing: 0.02em;
}

.eco-card:hover .eco-card__cta {
  color: #1d1d3a;
}

.ecosistema__state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  min-height: 12rem;
  padding: 2rem 1rem;
  border-radius: 20px;
  border: 1px dashed rgba(29, 29, 58, 0.16);
  background: rgba(255, 255, 255, 0.55);
  text-align: center;
}

.ecosistema__state[hidden] {
  display: none !important;
}

.ecosistema__state p {
  margin: 0;
  max-width: 28rem;
  color: var(--muted);
  font-size: clamp(0.88rem, 2.2vw, 0.96rem);
}

.ecosistema__skeleton {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(15.5rem, 88vw, 18rem);
  gap: clamp(0.75rem, 2vw, 1rem);
  width: max-content;
}

.ecosistema__skeleton-card {
  height: calc(clamp(11rem, 50vw, 17rem) + 14rem);
  border-radius: 18px;
  background: linear-gradient(110deg, #ece9f2 8%, #f7f5fb 18%, #ece9f2 33%);
  background-size: 200% 100%;
  animation: ecosistema-shimmer 1.35s linear infinite;
}

@keyframes ecosistema-shimmer {
  to { background-position-x: -200%; }
}

.ecosistema__actions {
  display: flex;
  justify-content: center;
  margin-top: 0.25rem;
}

@media (min-width: 768px) {
  .ecosistema__track {
    grid-auto-columns: 18rem;
  }

  .eco-card {
    width: 18rem;
  }

  .eco-card__cover {
    height: 17rem;
  }

  .eco-card__surface {
    height: 31rem;
    min-height: 31rem;
    max-height: 31rem;
  }
}

@media (min-width: 1100px) {
  .ecosistema__track {
    grid-auto-columns: 18rem;
  }

  .eco-card {
    width: 18rem;
  }
}

@media (max-width: 600px) {
  .ecosistema__track {
    padding-inline: 0.1rem;
    grid-auto-columns: min(88vw, 16.5rem);
  }

  .eco-card {
    width: min(88vw, 16.5rem);
  }

  .eco-card__body {
    padding-top: 2rem;
    min-height: 13rem;
  }
}

@media (max-width: 380px) {
  .ecosistema__track {
    grid-auto-columns: min(92vw, 15.5rem);
  }

  .eco-card {
    width: min(92vw, 15.5rem);
  }

  .eco-card__cover {
    height: clamp(9.5rem, 44vw, 12rem);
  }

  .eco-card__surface {
    height: auto;
    min-height: calc(clamp(9.5rem, 44vw, 12rem) + 13rem);
    max-height: none;
  }
}

@media (min-width: 768px) and (max-width: 1099px) {
  .ecosistema__track {
    grid-auto-columns: 17rem;
  }

  .eco-card {
    width: 17rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .eco-card,
  .eco-card.is-visible,
  .eco-card.is-leaving,
  .eco-card__surface,
  .eco-card:hover .eco-card__surface,
  .ecosistema__live-dot,
  .ecosistema__scroll-hint-icon,
  .ecosistema__skeleton-card {
    animation: none !important;
    transition: none !important;
    opacity: 1;
    transform: none;
  }
}
