/* Vitrine "Eclipse" do Hero (partials/hero-ecosystem.php + js/hero-eclipse.js).
   Os apps orbitam o nucleo; o item escolhido voa pro centro e abre num card,
   com uma coroa na cor dele e o diagrama recuando atras (o eclipse).
   Sem JS (.is-live ausente), os cards aparecem em lista simples.
   Movimento so por transform/opacity: nada de layout por quadro. */

.eco-eclipse {
  --cx: 50%;
  --cy: 42%;
  --r: 120px;
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  font-size: clamp(12px, 0.9vw, 14px);
  color: var(--text-primary);
}
.eco-eclipse .sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.eco-eclipse-core, .eco-eclipse-hint, .eco-eclipse-orbit { display: none; }

/* ---- Sem JS: lista simples dos cards ---- */
.eco-eclipse:not(.is-live) .eco-eclipse-cards {
  display: grid;
  gap: 12px;
  padding: 0 20px 18px;
  pointer-events: auto;
}

/* ---- Card (compartilhado) ---- */
.eco-eclipse-card {
  --c: #4b79d8;
  box-sizing: border-box;
  padding: 14px 15px 13px;
  border: 1px solid color-mix(in srgb, var(--c) 42%, var(--color-border, rgba(127,127,127,.3)));
  border-radius: 18px;
  background: var(--color-bg, #0b0b0c);
  box-shadow: 0 22px 50px -18px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.02) inset;
  text-align: left;
}
.eco-eclipse-card-kicker {
  margin: 0 0 9px;
  color: var(--c);
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.eco-eclipse-card-media {
  display: block;
  width: 100%;
  height: auto;
  margin-bottom: 11px;
  border-radius: 10px;
  border: 1px solid var(--color-border, rgba(127,127,127,.3));
}
.eco-eclipse-card-head { display: flex; align-items: center; gap: 11px; }
.eco-eclipse-card-head > img { width: 52px; height: 52px; border-radius: 12px; flex: none; }
.eco-eclipse-card-plats { display: flex; gap: 6px; flex: none; }
.eco-eclipse-card-plats > span {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 11px;
  border: 1px solid var(--color-border, rgba(127,127,127,.3));
}
.eco-eclipse-card-plats svg { width: 22px; height: 22px; }
.eco-eclipse-card-title { margin: 0; font-size: 1.22em; font-weight: 700; line-height: 1.15; }
.eco-eclipse-card-title span { display: block; margin-top: 3px; font-size: 0.7em; font-weight: 500; color: var(--text-muted); }
/* Card de grupo (varios apps do mesmo tipo): uma linha por app */
.eco-eclipse-card-apps { margin: 0; padding: 0; list-style: none; }
.eco-eclipse-card-apps li {
  display: grid;
  grid-template-columns: 44px 1fr;
  column-gap: 11px;
  align-items: center;
  padding: 10px 0;
}
.eco-eclipse-card-apps li + li { border-top: 1px solid var(--color-border, rgba(127,127,127,.25)); }
.eco-eclipse-card-apps li:first-child { padding-top: 2px; }
.eco-eclipse-card-apps li:last-child { padding-bottom: 0; }
.eco-eclipse-card-apps img { grid-row: span 2; width: 44px; height: 44px; border-radius: 11px; align-self: start; }
.eco-eclipse-card-apps .eco-eclipse-card-title { font-size: 1.05em; }
.eco-eclipse-card-apps .eco-eclipse-card-title span { display: inline; margin: 0 0 0 4px; }
.eco-eclipse-card-apps .eco-eclipse-card-links { margin-top: 7px; gap: 5px; flex-wrap: nowrap; }
.eco-eclipse-card-apps .eco-eclipse-card-links a { padding: 4px 9px; font-size: .78em; white-space: nowrap; }
.eco-eclipse.is-live .eco-eclipse-card.is-group { width: calc(var(--card-w, 300px) + 28px); }

/* Dois produtos de TV no mesmo card, sem inventar captura do APPRADIO.PRO. */
.eco-eclipse-tv-extra { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--color-border, rgba(127,127,127,.3)); }
.eco-eclipse-tv-extra .eco-eclipse-card-title { font-size: 1.05em; }
.eco-eclipse-tv-extra .eco-eclipse-card-links { margin-top: 9px; gap: 5px; }
.eco-eclipse-tv-extra .eco-eclipse-card-links a { padding: 5px 9px; font-size: .78em; }
.eco-eclipse-tv-note { margin: 8px 0 0; font-size: .74em; line-height: 1.35; color: var(--text-muted); }
/* Exemplo de app no carro ou skill; pendentes nao recebem link de loja do carro. */
.eco-eclipse-card-examples { margin-top: 12px; border-top: 1px solid var(--color-border, rgba(127,127,127,.3)); }
.eco-eclipse-card-examples .eco-eclipse-card-title { font-size: 1em; }
.eco-eclipse-status { display: block; width: max-content; max-width: 100%; margin-top: 5px; padding: 3px 7px; border-radius: 5px; color: #d6a856; background: rgba(214,168,86,.12); font-size: .7em; font-weight: 600; line-height: 1.2; }
.eco-eclipse-more { display: inline-flex; align-items: center; gap: 7px; margin-top: 15px; padding: 7px 11px; border: 1px solid color-mix(in srgb, var(--c) 48%, transparent); border-radius: 999px; background: color-mix(in srgb, var(--c) 12%, transparent); color: var(--text-primary); font-size: .86em; font-weight: 700; text-decoration: none; pointer-events: auto; transition: background-color .2s ease; }
.eco-eclipse-more:hover { background: color-mix(in srgb, var(--c) 25%, transparent); }
.eco-eclipse-more:focus-visible { outline: 2px solid var(--c); outline-offset: 3px; }
.eco-eclipse-card-links { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0 0; }
.eco-eclipse-card-links a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  color: var(--text-primary);
  font-size: 0.86em;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .2s ease, border-color .2s ease;
}
.eco-eclipse-card-links a::after { content: "\2197"; font-size: .9em; opacity: .7; }
.eco-eclipse-card-links a:hover { background: color-mix(in srgb, var(--c) 26%, transparent); border-color: var(--c); }
.eco-eclipse-card-links a:focus-visible { outline: 2px solid var(--c); outline-offset: 2px; }

/* ---- Modo vivo (JS) ---- */
.eco-eclipse.is-live .eco-eclipse-orbit {
  display: block;
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}
.eco-eclipse-item {
  --c: #4b79d8;
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  will-change: transform, opacity;
}
.eco-eclipse-bubble {
  position: absolute;
  left: -30px;
  top: -30px;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--c) 55%, var(--color-border, rgba(127,127,127,.3)));
  border-radius: 50%;
  background: var(--color-bg, #0b0b0c);
  color: var(--c);
  box-shadow: 0 10px 26px -8px rgba(0, 0, 0, 0.45), 0 0 0 5px color-mix(in srgb, var(--c) 10%, transparent);
  cursor: pointer;
  pointer-events: auto;
  transition: box-shadow .3s ease, border-color .3s ease;
}
.eco-eclipse-bubble img { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; }
.eco-eclipse-bubble svg { width: 28px; height: 28px; }
/* TV: dois produtos identificaveis na bolha; screenshot real fica no card. */
.eco-eclipse-product-pair { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.eco-eclipse-bubble .eco-eclipse-product-pair img { width: 30px; height: 30px; border-radius: 9px; object-fit: contain; background: #111; border: 1px solid rgba(255,255,255,.12); }
.eco-eclipse-bubble .eco-eclipse-product-pair img + img { margin-left: -6px; box-shadow: -2px 0 0 #111; }

/* Integracoes do carro: marcas da plataforma em vez de um volante generico. */
.eco-eclipse-platform-pair { display: flex; align-items: center; justify-content: center; gap: 2px; width: 100%; height: 100%; }
.eco-eclipse-platform-pair > span { display: grid; place-items: center; width: 25px; height: 25px; border-radius: 7px; background: rgba(73,185,110,.13); }
.eco-eclipse-platform-pair > span:first-child { color: #3ddc84; }
.eco-eclipse-platform-pair > span:last-child { color: #f5f5f7; }
.eco-eclipse-platform-pair svg { width: 19px; height: 19px; }
/* Grupo: icones empilhados em leque dentro do balao */
.eco-eclipse-stack { position: relative; width: 100%; height: 100%; }
.eco-eclipse-stack img {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 32px;
  height: 32px;
  margin: -16px 0 0 -16px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px var(--color-bg, #0b0b0c);
  transform: translateX(calc((var(--k) - (var(--n) - 1) / 2) * 15px)) rotate(calc((var(--k) - (var(--n) - 1) / 2) * 8deg));
  z-index: calc(3 - var(--k));
}
.eco-eclipse-bubble:hover,
.eco-eclipse-bubble:focus-visible {
  border-color: var(--c);
  box-shadow: 0 10px 26px -8px rgba(0, 0, 0, 0.45), 0 0 0 7px color-mix(in srgb, var(--c) 22%, transparent);
  outline: none;
}
.eco-eclipse-name {
  position: absolute;
  left: 50%;
  top: 36px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.8em;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
  transition: opacity .3s ease;
}
.eco-eclipse-item.is-dim .eco-eclipse-name { opacity: 0; }
.eco-eclipse-item.is-dim .eco-eclipse-bubble { opacity: .45; filter: blur(1.5px) saturate(.6); }
/* Desktop: os baloes que abriram espaco ao lado do card ficam nitidos e com
   nome, pra dar pra trocar de item direto. */
@media (min-width: 768px) {
  .eco-eclipse-item.is-dim .eco-eclipse-name { opacity: .8; }
  .eco-eclipse-item.is-dim .eco-eclipse-bubble { opacity: .8; filter: saturate(.75); }
  .eco-eclipse-item.is-dim .eco-eclipse-bubble:hover { opacity: 1; filter: none; }
}
.eco-eclipse-bubble { transition: box-shadow .3s ease, border-color .3s ease, opacity .35s ease, filter .35s ease; }

/* Coroa do eclipse: anel na cor do item, atras do card */
.eco-eclipse-corona {
  --c: #4b79d8;
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  width: calc(var(--r) * 3.2);
  height: calc(var(--r) * 3.2);
  margin: calc(var(--r) * -1.6) 0 0 calc(var(--r) * -1.6);
  border-radius: 50%;
  background: radial-gradient(circle closest-side, transparent 74%, color-mix(in srgb, var(--c) 38%, transparent) 86%, transparent 100%);
  box-shadow: 0 0 90px 6px color-mix(in srgb, var(--c) 18%, transparent);
  z-index: 0;
  opacity: 0;
  transform: scale(.55) rotate(0deg);
  transition: opacity .45s ease, transform .6s cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}
.eco-eclipse.is-open .eco-eclipse-corona { opacity: 1; transform: scale(1); }

.eco-eclipse.is-live .eco-eclipse-cards {
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  z-index: 6; /* acima dos baloes (z 1/3) */
  width: 0;
  height: 0;
}
.eco-eclipse.is-live .eco-eclipse-card {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--card-w, 300px);
  transform: translate(-50%, -50%) scale(.5);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity .28s ease, transform .5s cubic-bezier(.2, .9, .25, 1.08), visibility 0s linear .5s;
}
.eco-eclipse.is-live .eco-eclipse-card.is-on {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity .3s ease .12s, transform .55s cubic-bezier(.2, .9, .25, 1.08) .08s, visibility 0s;
}

/* O diagrama recua atras do card (so no repouso, enquanto a vitrine esta viva) */
.eco-flow .eco-flow-svg { transition: opacity .5s ease, transform .6s cubic-bezier(.2, .8, .2, 1); }
.eco-flow.is-eclipse .eco-flow-svg { opacity: .22; transform: scale(.94); }

/* Desktop: sem sequencia (reduced motion / sem GSAP) o diagrama inteiro ja
   aparece -- a vitrine nao o encobre. */
@media (min-width: 768px) {
  .eco-flow.is-static .eco-eclipse,
  html:not(.js-eco-ready) .eco-eclipse { display: none; }
  .eco-eclipse.is-live .eco-eclipse-hint {
    display: block;
    position: absolute;
    left: var(--cx);
    top: calc(var(--cy) + var(--r) * 1.95);
    transform: translateX(-50%);
    margin: 0;
    white-space: nowrap;
    font-size: .78em;
    letter-spacing: .04em;
    color: var(--text-muted);
    opacity: .8;
    transition: opacity .3s ease;
  }
  .eco-eclipse.is-open .eco-eclipse-hint { opacity: 0; }
}
.eco-eclipse-hint-touch { display: none; }
@media (hover: none) {
  .eco-eclipse-hint-mouse { display: none; }
  .eco-eclipse-hint-touch { display: inline; }
}

/* Celular: o diagrama ja aparece inteiro; a orbita ganha palco proprio abaixo
   dele, com um V pequeno no centro e holofote automatico. */
@media (max-width: 767px) {
  .hero-eco-stage .eco-flow { flex-direction: column; }
  .eco-eclipse { font-size: 13px; }
  .eco-eclipse:not(.is-live) { position: relative; }
  .eco-eclipse.is-live {
    position: relative;
    inset: auto;
    width: 100%;
    height: 430px;
    margin-top: 4px;
  }
  .eco-eclipse.is-live .eco-eclipse-core {
    display: block;
    position: absolute;
    left: var(--cx);
    top: var(--cy);
    width: 64px;
    height: 64px;
    margin: -32px 0 0 -32px;
    transition: opacity .4s ease, transform .5s cubic-bezier(.2, .8, .2, 1);
  }
  .eco-eclipse.is-open .eco-eclipse-core { opacity: .15; transform: scale(.7); }
  .eco-eclipse.is-live::before {
    content: "";
    position: absolute;
    left: var(--cx);
    top: var(--cy);
    width: calc(var(--r) * 2);
    height: calc(var(--r) * 2);
    margin: calc(var(--r) * -1) 0 0 calc(var(--r) * -1);
    border-radius: 50%;
    border: 1px dashed var(--color-border, rgba(127,127,127,.3));
    opacity: .7;
  }
  .eco-eclipse.is-live .eco-eclipse-hint {
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: 2px;
    margin: 0;
    text-align: center;
    font-size: .82em;
    color: var(--text-muted);
  }
  .eco-flow.is-eclipse .eco-flow-svg { opacity: 1; transform: none; }
  .eco-eclipse.is-live .eco-eclipse-card.is-group { width: var(--card-w, 300px); }
}

@media (prefers-reduced-motion: reduce) {
  .eco-eclipse *, .eco-eclipse::before, .eco-eclipse-corona { transition-duration: .01ms !important; transition-delay: 0s !important; }
}
