/* Slide 09 (partner ecosystem) visual reconstruction. AutoCert is the central hub; the three partner groups connect
   to it with neutral, directionless lines. The simplified service flow sits apart from the partner diagram.
   Entrance motion runs while #ecosystem.ecosystem-run is present (set by ecosystem-visual.js). */

/* Section: one column; the old two-column and absolute map rules do not apply to this structure. */
#ecosystem.ecosystem-section {
  display: block;
}

#ecosystem > .section-kicker {
  position: absolute;
  left: 5vw;
  top: 110px;
}

#ecosystem .pe-head h2 {
  max-width: 1100px;
}

#ecosystem .pe-intro {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

/* Diagram */
#ecosystem .pe-diagram {
  position: relative;
  margin-top: 26px;
}

#ecosystem .pe-groups {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  padding: 0;
  list-style: none;
}

#ecosystem .pe-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 0 22px 0 0;
}

#ecosystem .pe-group + .pe-group {
  padding-left: 22px;
  border-left: 1px solid rgba(142, 219, 200, 0.12);
}

#ecosystem .pe-icon {
  width: 26px;
  height: 26px;
  margin-bottom: 6px;
  color: var(--mint);
}

#ecosystem .pe-num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--mint);
}

#ecosystem .pe-group h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.2;
}

#ecosystem .pe-part {
  margin: 4px 0 0;
  color: #b9cdd2;
  font-size: 12.5px;
  line-height: 1.45;
}

#ecosystem .pe-role {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

/* Desktop links: one neutral tree from each group down to the hub. No arrowheads. */
#ecosystem .pe-links {
  display: block;
  width: 100%;
  height: 56px;
  margin-top: 12px;
  overflow: visible;
}

#ecosystem .pe-link {
  fill: none;
  stroke: rgba(98, 215, 211, 0.55);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

#ecosystem .pe-hub {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 340px;
  margin: 0 auto;
  padding: 18px 20px 16px;
  border: 1px solid rgba(142, 219, 200, 0.45);
  background: rgba(8, 28, 32, 0.6);
  text-align: center;
}

#ecosystem .pe-hub-icon {
  width: 28px;
  height: 28px;
  color: var(--mint);
}

#ecosystem .pe-hub h3 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

#ecosystem .pe-hub p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

/* Simplified service flow: its own line, clearly not the order of the partner groups. */
#ecosystem .pe-flow {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 24px;
  padding-top: 14px;
  border-top: 1px solid rgba(142, 219, 200, 0.14);
}

#ecosystem .pe-flow-label {
  color: var(--mint);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
}

#ecosystem .pe-flow p {
  margin: 0;
  color: #c7d8dc;
  font-size: 13px;
  line-height: 1.5;
}

#ecosystem .pe-foot {
  margin-top: 18px;
}

#ecosystem .pe-principle {
  margin: 0;
  color: #e5f0ec;
  font-size: 14px;
  line-height: 1.5;
}

#ecosystem .pe-fineprint {
  margin: 8px 0 0;
  color: #8ea5b0;
  font-size: 11px;
  line-height: 1.5;
}

/* Entrance motion (gated by ecosystem-run). */
@keyframes pe-title-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pe-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pe-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pe-hub-in {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

#ecosystem.ecosystem-run .pe-head h2 {
  animation: pe-title-in 0.6s cubic-bezier(0.22, 0.8, 0.26, 1) both;
}

#ecosystem.ecosystem-run .pe-intro {
  animation: pe-fade 0.5s ease-out 0.3s both;
}

#ecosystem.ecosystem-run .pe-group {
  animation: pe-rise 0.45s ease-out both;
}
#ecosystem.ecosystem-run .pe-group:nth-child(1) { animation-delay: 0.45s; }
#ecosystem.ecosystem-run .pe-group:nth-child(2) { animation-delay: 0.57s; }
#ecosystem.ecosystem-run .pe-group:nth-child(3) { animation-delay: 0.69s; }

/* The links fade in as one piece (a simple fade is the agreed fallback for the line drawing). */
#ecosystem.ecosystem-run .pe-link {
  animation: pe-fade 0.6s ease-out 0.9s both;
}

#ecosystem.ecosystem-run .pe-hub {
  animation: pe-hub-in 0.45s ease-out 1.1s both;
}

#ecosystem.ecosystem-run .pe-flow {
  animation: pe-fade 0.5s ease-out 1.45s both;
}

#ecosystem.ecosystem-run .pe-foot {
  animation: pe-fade 0.5s ease-out 1.7s both;
}

/* Desktop composition: groups in a row, links, hub centred under them. */
@media (min-width: 801px) {
  #ecosystem .pe-diagram {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  #ecosystem .pe-hub { margin-top: 0; }
}

/* Phones: hub first, then the three groups as a vertical list, then the flow and the principle. */
@media (max-width: 800px) {
  #ecosystem.ecosystem-section {
    min-height: 0;
    padding-top: 118px;
    padding-bottom: 96px;
  }

  #ecosystem .pe-intro { margin-top: 10px; font-size: 13px; line-height: 1.5; }

  #ecosystem .pe-diagram {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 16px;
  }

  #ecosystem .pe-hub {
    order: 1;
    width: 100%;
    margin: 0;
    padding: 14px 16px 12px;
    gap: 4px;
  }
  #ecosystem .pe-hub-icon { width: 24px; height: 24px; }
  #ecosystem .pe-hub h3 { font-size: 16px; }
  #ecosystem .pe-hub p { font-size: 11px; }

  #ecosystem .pe-links { display: none; }

  #ecosystem .pe-groups {
    order: 2;
    grid-template-columns: 1fr;
    margin-top: 10px;
  }

  #ecosystem .pe-group {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr);
    column-gap: 12px;
    row-gap: 3px;
    align-items: start;
    padding: 12px 0 12px 14px;
    border-left: 1px solid rgba(98, 215, 211, 0.4);
  }
  #ecosystem .pe-group + .pe-group { padding-left: 14px; border-left: 1px solid rgba(98, 215, 211, 0.4); }
  #ecosystem .pe-icon { grid-column: 1; grid-row: 1 / span 4; width: 22px; height: 22px; margin: 2px 0 0; }
  #ecosystem .pe-num { grid-column: 2; grid-row: 1; font-size: 9px; }
  #ecosystem .pe-group h3 { grid-column: 2; grid-row: 2; font-size: 15px; }
  #ecosystem .pe-part { grid-column: 2; grid-row: 3; margin: 0; font-size: 11.5px; }
  #ecosystem .pe-role { grid-column: 2; grid-row: 4; margin: 0; font-size: 12px; }

  #ecosystem .pe-flow { order: 3; margin-top: 16px; }
  #ecosystem .pe-flow p { font-size: 12px; }
  #ecosystem .pe-foot { order: 4; margin-top: 14px; }
  #ecosystem .pe-principle { font-size: 13px; }
  #ecosystem .pe-fineprint { font-size: 10.5px; }
}

@media (prefers-reduced-motion: reduce) {
  #ecosystem.ecosystem-run,
  #ecosystem.ecosystem-run * {
    animation: none !important;
  }
}
