/* ==========================================================================
   Ecossistema Marlin — independent interactive section.
   ========================================================================== */

.ecosystem {
  --eco-bg: var(--color-petrol-700);
  --eco-bg-deep: var(--color-petrol-800);
  --eco-cyan: var(--color-cyan-400);
  --eco-mint: #42ead5;
  --eco-lime: var(--color-lime);
  --eco-text-soft: var(--color-text-on-dark-soft);
  --eco-wave-h: clamp(52px, 7vw, 96px);

  position: relative;
  z-index: 1;          /* acima da borda da M.IA (ver emenda abaixo) */
  isolation: isolate;
  overflow: hidden;
  margin-top: -2px;    /* sobe 2px sobre a base da M.IA */
  padding: calc(var(--eco-wave-h) + var(--section-space)) 0 var(--section-space);
  color: #fff;
  /* Emenda com a M.IA, sem linha: a seção sobe 2px sobre a base da M.IA e é
     desenhada acima dela; o topo (4px) é só a faixa clara nas cores da onda, e
     as camadas escuras começam logo abaixo, escondidas pela onda. Em telas com
     escala fracionária, a borda da M.IA e as camadas escuras deixavam vazar uma
     linha cinza. */
  background:
    linear-gradient(90deg, var(--color-surface-tint) 68.5%, #b6e7ee) 0 0 / 100% 4px no-repeat,
    radial-gradient(55% 55% at 31% 52%, color-mix(in srgb, var(--color-cyan-400) 10%, transparent), transparent 72%) 0 4px / 100% calc(100% - 4px) no-repeat,
    radial-gradient(35% 45% at 78% 34%, rgba(66, 234, 213, .055), transparent 75%) 0 4px / 100% calc(100% - 4px) no-repeat,
    linear-gradient(145deg, var(--eco-bg), var(--eco-bg-deep)) 0 4px / 100% calc(100% - 4px) no-repeat;
}

.ecosystem-wave {
  position: absolute;
  top: -2px;
  left: 0;
  z-index: -1;
  width: 100%;
  height: calc(var(--eco-wave-h) + 2px);
  fill: var(--color-surface-tint);
}

/* Anel decorativo (canto inferior direito): mesmo círculo de antes — diâmetro
   58% da largura, centro em 83% × (134% da altura − raio) — com o traço de 1 px
   e os dois halos de 80 e 180 px. Antes era um box-shadow cortado em linha
   reta pelo fim da seção, o que marcava a divisão com a Trajetória. Agora é
   um degradê radial na seção inteira, que esmaece nos últimos 160 px. */
.ecosystem::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background: radial-gradient(
    calc(29vw + 180px) calc(29vw + 180px) at 83% calc(134% - 29vw),
    transparent calc(100% - 181px),
    color-mix(in srgb, var(--color-cyan-400) 8%, transparent) calc(100% - 181px) calc(100% - 180px),
    color-mix(in srgb, var(--color-cyan-400) 3.5%, transparent) calc(100% - 180px) calc(100% - 100px),
    color-mix(in srgb, var(--color-cyan-400) 1.5%, transparent) calc(100% - 100px) 100%,
    transparent 100%
  );
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 160px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 160px), transparent);
  pointer-events: none;
}

.ecosystem-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, .75fr);
  gap: 52px;
  align-items: center;
  min-height: 680px;
}

/* Telas largas: o mapa já para em 720 px (max-width), então a sobra vai para a
   coluna do texto e o título cabe em 3 linhas sem diminuir o mapa. */
@media (min-width: 1360px) {
  .ecosystem-inner { grid-template-columns: minmax(0, 1.3fr) minmax(340px, .9fr); }
}

/* ---------- Section copy ---------- */

.ecosystem-copy {
  position: relative;
  z-index: 3;
  padding-right: 18px;
}

.ecosystem-badge {
  display: inline-flex;
  align-items: center;
  height: 36px;
  padding: 0 20px;
  border-radius: var(--radius-sm);
  background: linear-gradient(110deg, #74df89, var(--eco-lime));
  box-shadow: 0 8px 24px rgba(109, 225, 121, .17);
  color: #113d40;
  font-family: var(--font-ui);
  font-size: var(--section-badge-size);
  font-weight: 800;
  letter-spacing: .055em;
}

.ecosystem-title {
  margin: var(--space-4) 0 0;
  font-family: var(--font-display);
  font-size: var(--section-title-size);
  font-weight: 800;
  line-height: var(--section-title-leading);
  letter-spacing: -.015em;
  text-wrap: balance;
}

.ecosystem-text {
  max-width: 430px;
  margin: var(--space-5) 0 0;
  color: var(--eco-text-soft);
  font-family: var(--font-display);
  font-size: var(--section-text-size);
  line-height: var(--section-text-leading);
}

.ecosystem-hint {
  display: grid;
  gap: 5px;
  margin: var(--space-5) 0 0;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.45;
}

.ecosystem-hint-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: color-mix(in srgb, var(--color-surface-tint) 94%, transparent);
  font-weight: 600;
}

.ecosystem-hint-title svg {
  flex: none;
  width: 17px;
  height: 17px;
  stroke: var(--eco-cyan);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--color-cyan-400) 42%, transparent));
}

.ecosystem-hint-text {
  padding-left: 25px;
  color: color-mix(in srgb, var(--color-text-on-dark-soft) 68%, transparent);
}

/* ---------- Interactive detail card ---------- */

.ecosystem-detail {
  position: relative;
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  min-height: 148px;
  margin-top: 26px;
  padding: 22px 24px;
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(255, 255, 255, .97), color-mix(in srgb, var(--color-surface-tint) 94%, transparent));
  box-shadow: 0 22px 48px rgba(0, 20, 28, .27), 0 0 30px color-mix(in srgb, var(--color-cyan-400) 9%, transparent);
  color: var(--color-petrol-800);
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity .24s ease, transform .24s ease, visibility .24s;
}

.ecosystem-detail::before {
  content: "";
  position: absolute;
  left: -15px;
  top: 48px;
  width: 29px;
  height: 29px;
  border-left: 1px solid rgba(255, 255, 255, .82);
  border-bottom: 1px solid rgba(255, 255, 255, .82);
  background: var(--color-surface-alt);
  transform: rotate(45deg);
}

.ecosystem-detail.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.ecosystem-detail-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  border-radius: var(--radius-md);
  background: linear-gradient(145deg, var(--color-petrol-500), var(--color-petrol-700));
  box-shadow: 0 12px 24px color-mix(in srgb, var(--color-petrol-700) 22%, transparent), inset 0 0 0 1px rgba(79, 233, 229, .32);
  color: var(--eco-cyan);
}

.ecosystem-detail-icon svg {
  width: 52px;
  height: 52px;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ecosystem-detail-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  line-height: 1.18;
}

.ecosystem-detail-rule {
  display: block;
  width: 54px;
  height: 3px;
  margin-top: 10px;
  border-radius: var(--radius-xs);
  background: linear-gradient(90deg, var(--eco-cyan), var(--eco-lime));
}

.ecosystem-detail-text {
  margin: 10px 0 0;
  color: #37505a;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
}

/* ---------- Ecosystem map ---------- */

.ecosystem-visual {
  position: relative;
  min-width: 0;
}

.ecosystem-map {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  aspect-ratio: 680 / 600;
}

.ecosystem-map::before {
  content: "";
  position: absolute;
  inset: 17% 11%;
  border-radius: 50%;
  background: radial-gradient(ellipse, color-mix(in srgb, var(--color-cyan-400) 11%, transparent), rgba(20, 151, 172, .025) 52%, transparent 73%);
  filter: blur(18px);
  pointer-events: none;
}

.ecosystem-connections {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ecosystem-connections .ecosystem-orbit-glow {
  fill: none;
  stroke: color-mix(in srgb, var(--color-cyan-400) 18%, transparent);
  stroke-width: 12;
  filter: url("#ecosystem-line-glow");
}

.ecosystem-connections .ecosystem-orbit {
  fill: none;
  stroke: url("#ecosystem-ring-gradient");
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 360 72 190 56;
  filter: url("#ecosystem-line-glow");
}

.ecosystem-connections line {
  stroke: rgba(60, 229, 228, .68);
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  filter: url("#ecosystem-line-glow");
  transition: stroke .24s ease, stroke-width .24s ease, opacity .24s ease;
}

.ecosystem-connections line.is-active {
  stroke: var(--eco-lime);
  stroke-width: 5;
}

.ecosystem-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34%;
  aspect-ratio: 1.7;
  border: 3px solid #67ede1;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, var(--color-petrol-500), var(--color-petrol-800) 72%);
  box-shadow:
    0 18px 0 -5px color-mix(in srgb, var(--color-petrol-950) 52%, transparent),
    0 0 20px color-mix(in srgb, var(--color-cyan-400) 58%, transparent),
    inset 0 0 26px color-mix(in srgb, var(--color-cyan-400) 13%, transparent);
  transform: translate(-50%, -50%);
}

.ecosystem-hub::after {
  content: "";
  position: absolute;
  inset: -9px;
  border: 1px solid color-mix(in srgb, var(--color-lime) 42%, transparent);
  border-radius: inherit;
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--color-lime) 35%, transparent));
}

.ecosystem-hub-logo {
  position: relative;
  z-index: 1;
  width: 76%;
  height: auto;
}

.ecosystem-modules {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ecosystem-module {
  position: absolute;
  z-index: 3;
  width: 23%;
  height: 20%;
  transform: translate(-50%, -50%);
}

.ecosystem-module--strategy { left: 34%; top: 17%; }
.ecosystem-module--experience { left: 68%; top: 17%; }
.ecosystem-module--software { left: 86%; top: 50%; }
.ecosystem-module--cloud { left: 68%; top: 82%; }
.ecosystem-module--marketing { left: 32%; top: 82%; }
.ecosystem-module--evolution { left: 14%; top: 50%; }

.ecosystem-module button {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  cursor: pointer;
}

.ecosystem-module-label {
  position: absolute;
  left: 50%;
  bottom: calc(100% - 26px);
  width: 148px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.18;
  text-align: center;
  text-shadow: 0 2px 8px rgba(0, 20, 28, .8);
  transform: translateX(-50%);
}

.ecosystem-module-pointer {
  position: absolute;
  left: 50%;
  top: 25px;
  z-index: 2;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 9px solid var(--eco-lime);
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--color-lime) 65%, transparent));
  transform: translateX(-50%);
}

.ecosystem-module-disc {
  position: absolute;
  left: 50%;
  bottom: 0;
  display: grid;
  place-items: center;
  width: 78%;
  height: 68%;
  border: 2px solid var(--eco-cyan);
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 36%, #0d5c69, var(--color-petrol-800) 72%);
  box-shadow:
    0 13px 0 -4px color-mix(in srgb, var(--color-petrol-950) 58%, transparent),
    0 0 15px color-mix(in srgb, var(--color-cyan-400) 70%, transparent),
    inset 0 0 18px color-mix(in srgb, var(--color-cyan-400) 14%, transparent);
  transform: translateX(-50%);
  transition: border-color .22s ease, box-shadow .22s ease, transform .22s ease;
}

.ecosystem-module-disc::after {
  content: "";
  position: absolute;
  inset: -7px;
  border: 1px solid color-mix(in srgb, var(--color-lime) 70%, transparent);
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
}

.ecosystem-module.is-discovery-cue .ecosystem-module-disc::after {
  animation: ecosystem-discovery-cue 1.8s ease-out 1;
}

@keyframes ecosystem-discovery-cue {
  0% {
    opacity: 0;
    transform: scale(.96);
  }
  38% {
    opacity: .68;
    box-shadow: 0 0 18px color-mix(in srgb, var(--color-cyan-400) 42%, transparent), 0 0 28px color-mix(in srgb, var(--color-lime) 16%, transparent);
  }
  100% {
    opacity: 0;
    transform: scale(1.12);
  }
}

.ecosystem-module-icon {
  display: grid;
  place-items: center;
  width: 58%;
  height: 72%;
  color: var(--eco-cyan);
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--color-cyan-400) 50%, transparent));
  transition: color .22s ease, filter .22s ease;
}

.ecosystem-module-icon svg {
  width: 100%;
  height: 100%;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ecosystem-module button:hover .ecosystem-module-disc,
.ecosystem-module button:focus-visible .ecosystem-module-disc,
.ecosystem-module.is-active .ecosystem-module-disc {
  border-color: var(--eco-lime);
  box-shadow:
    0 13px 0 -4px color-mix(in srgb, var(--color-petrol-950) 58%, transparent),
    0 0 22px color-mix(in srgb, var(--color-cyan-400) 74%, transparent),
    0 0 34px color-mix(in srgb, var(--color-lime) 20%, transparent),
    inset 0 0 20px color-mix(in srgb, var(--color-lime) 12%, transparent);
  transform: translateX(-50%) translateY(-3px);
}

.ecosystem-module button:hover .ecosystem-module-icon,
.ecosystem-module button:focus-visible .ecosystem-module-icon,
.ecosystem-module.is-active .ecosystem-module-icon {
  color: var(--eco-lime);
  filter: drop-shadow(0 0 8px color-mix(in srgb, var(--color-lime) 70%, transparent));
}

.ecosystem-module button:focus-visible {
  outline: 2px solid var(--eco-lime);
  outline-offset: 4px;
  border-radius: var(--radius-lg);
}

/* ---------- Stable copy block (two-column layout) ----------
   The copy column is vertically centred in the grid. The detail card used to
   be part of its height, so a longer description re-centred the column and
   moved the badge, title and hint. The column now reserves exactly the space
   the card took in its resting state (gap + min-height), and the card is laid
   out from the top of that space: it can grow downwards freely without
   pushing the block above it. */

@media (min-width: 961px) {
  .ecosystem-copy {
    --eco-detail-gap: 26px;
    --eco-detail-min: 148px;
    padding-bottom: calc(var(--eco-detail-gap) + var(--eco-detail-min));
  }

  .ecosystem-detail {
    position: absolute;
    top: calc(100% - var(--eco-detail-min));
    left: 0;
    right: 18px;
    min-height: var(--eco-detail-min);
    margin-top: 0;
  }
}

/* ---------- Responsive ---------- */

@media (max-width: 1120px) {
  .ecosystem-inner {
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
    gap: 28px;
  }

  .ecosystem-module-label { width: 128px; font-size: 12px; }
}

@media (max-width: 960px) {
  .ecosystem-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 46px;
    min-height: 0;
  }

  .ecosystem-copy {
    order: -1;
    max-width: 620px;
    padding-right: 0;
  }

  .ecosystem-text { max-width: 560px; }
  .ecosystem-detail { max-width: 560px; }
  .ecosystem-map { max-width: 680px; }
}

@media (max-width: 600px) {
  .ecosystem-inner { gap: 38px; }
  .ecosystem-badge { height: 36px; padding: 0 16px; }
  .ecosystem-text { margin-top: var(--space-4); }
  .ecosystem-hint { font-size: 12px; }

  .ecosystem-detail {
    grid-template-columns: 56px minmax(0, 1fr);
    gap: 14px;
    min-height: 132px;
    padding: 18px;
  }

  .ecosystem-detail::before { display: none; }
  .ecosystem-detail-icon { width: 56px; height: 56px; }
  .ecosystem-detail-icon svg { width: 40px; height: 40px; }
  .ecosystem-detail-title { font-size: 16px; }
  .ecosystem-detail-text { font-size: 12.5px; }

  .ecosystem-map {
    width: calc(100% + 20px);
    margin-left: -10px;
  }

  .ecosystem-module { width: 27%; height: 21%; }
  .ecosystem-module--software { left: 84%; }
  .ecosystem-module--evolution { left: 16%; }
  .ecosystem-module-label {
    bottom: calc(100% - 20px);
    width: 98px;
    font-size: 12px;
    line-height: 1.15;
  }
  .ecosystem-module-pointer { top: 18px; border-left-width: 4px; border-right-width: 4px; border-top-width: 7px; }
  .ecosystem-hub { width: 35%; }
}

@media (prefers-reduced-motion: reduce) {
  .ecosystem-detail,
  .ecosystem-connections line,
  .ecosystem-module-disc,
  .ecosystem-module-icon {
    transition: none;
  }

  .ecosystem-module.is-discovery-cue .ecosystem-module-disc::after {
    animation: none;
  }
}
