/* ==========================================================================
   Ecosystem board
   --------------------------------------------------------------------------
   Ported from the LBC design system (`ecosystem-v3.css`), renamed to the `eco`
   namespace and rebuilt on the landing's own primitives: .card for the two
   surfaces, .btn for the action, the .icon-box material for the node tiles.
   Replaces the old stack-links spine.

   The product sits in the middle of a board, the add-ons sit on a ring around
   it, and a cable runs from the core to each one. Cable geometry is emitted by
   partials/ecosystem.html.twig, so the board is complete without JS;
   ecosystem.js only adds .is-lit on hover.

   The board is decorative (aria-hidden in the template). The panel on the right
   carries the real links, and below 640px it is the whole section.

   Every accent is var(--primary-color), so a product page rebinding it on its
   .page-* class re-themes the board for free.
   ========================================================================== */

.eco {
  position: relative;
  z-index: 1;
}

.eco-head {
  max-width: 60ch;
}

/* Stretched, not top-aligned: the two cards square off whichever side is
   taller, and each one distributes its own slack. */
.eco__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: var(--gap-sm);
  align-items: stretch;
}

/* ==========================================================================
   Board card
   ========================================================================== */

.eco-map {
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow: hidden;
}

.eco-map__head {
  margin-bottom: 0;
  padding: 24px 24px 0;
}

.eco-map__head h3,
.eco-side__head h3 {
  margin: 0;
  font-family: var(--mono-font);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gray-500);
}

/* Capped and centred: the card takes the width the grid gives it, but the ring
   past ~660px only buys empty middle. */
.eco-board {
  position: relative;
  aspect-ratio: 620 / 440;
  width: 100%;
  max-width: 660px;
  /* auto on every side: centred horizontally, and the card's spare height is
     split above and below it. */
  margin: auto;
}

/* ── Cables ──
   Drawn in a 0-100 square that stretches with the board, so a cable stays
   pinned to its node at any width. */

.eco-wires {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.eco-wire {
  fill: none;
  stroke: rgba(var(--primary-color-rgb), .28);
  stroke-width: 2px;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  transition: stroke .2s ease;
}

.eco-wire.is-lit {
  stroke: rgba(var(--primary-color-rgb), .6);
}

/* The current running along a lit cable. */
/* No drop-shadow here: the wire layer is stretched by preserveAspectRatio="none",
   which would smear a filter. A thicker, fully opaque stroke reads as current
   over the dim cable without it. */
.eco-pulse {
  fill: none;
  stroke: var(--primary-color);
  stroke-width: 3px;
  stroke-linecap: round;
  stroke-dasharray: 22 400;
  vector-effect: non-scaling-stroke;
  opacity: 0;
}

.eco-pulse.is-lit {
  opacity: 1;
  animation: ecoFlow 1.9s linear infinite;
}

@keyframes ecoFlow {
  from { stroke-dashoffset: 422; }
  to   { stroke-dashoffset: 0; }
}

/* ── Core ── */

.eco-core {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: grid;
  justify-items: center;
  gap: 9px;
  width: 150px;
  padding: 16px 12px;
  border-radius: 18px;
  text-align: center;
  /* Neutral face under an accent wash, so the core takes the page's colour
     instead of the design system's indigo. */
  background:
    linear-gradient(180deg, rgba(var(--primary-color-rgb), .18), rgba(var(--primary-color-rgb), .07)),
    linear-gradient(180deg, #242424, #1a1a1a);
  box-shadow:
    inset 0 1px 0 rgba(var(--primary-color-rgb), .3),
    var(--btn-lift),
    0 0 60px -18px rgba(var(--primary-color-rgb), .85);
}

.eco-core__ico {
  display: flex;
  color: var(--primary-color);
}

.eco-core__ico svg {
  width: 26px;
  height: 26px;
}

.eco-core b {
  font-family: var(--title-font);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text-heading);
}

.eco-core__st {
  font-family: var(--mono-font);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--primary-color);
}

/* ── Nodes ── */

/* The node box is the element the ring slot positions, so a cable lands dead
   centre on the tile. The caption hangs off it and never moves that anchor,
   whatever the label wraps to. */
.eco-node {
  position: absolute;
  width: 66px;
  height: 66px;
  transform: translate(-50%, -50%);
  text-decoration: none;
  color: inherit;
}

.eco-node__label {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  justify-items: center;
  gap: 6px;
  width: 132px;
  text-align: center;
}

/* A dense ring needs narrower captions or the outermost slots collide. */
.eco[data-eco-count="5"] .eco-node__label,
.eco[data-eco-count="6"] .eco-node__label,
.eco[data-eco-count="7"] .eco-node__label,
.eco[data-eco-count="8"] .eco-node__label {
  width: 112px;
}

.eco-node__box {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 18px;
  color: var(--gray-400);
  background: linear-gradient(180deg, #2c2c2c, #212121);
  box-shadow: var(--btn-bevel), var(--btn-lift);
  transition: background .2s ease, box-shadow .2s ease, color .2s ease, transform .2s ease;
}

.eco-node__box svg {
  width: 24px;
  height: 24px;
}

.eco-node__t {
  font-family: var(--title-font);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -.01em;
  color: var(--text-muted);
  transition: color .2s ease;
}

.eco-node__st {
  font-family: var(--mono-font);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gray-600);
  transition: color .2s ease;
}

.eco-node.is-lit .eco-node__box {
  transform: translateY(-2px);
  color: var(--text-heading);
  background: linear-gradient(180deg, #353535, #282828);
  box-shadow:
    inset 0 1px 0 rgba(var(--primary-color-rgb), .28),
    var(--btn-lift-hi),
    0 0 26px -8px rgba(var(--primary-color-rgb), .9);
}

.eco-node.is-lit .eco-node__t { color: var(--text-heading); }
.eco-node.is-lit .eco-node__st { color: var(--primary-color); }

.eco-hint {
  margin: 0;
  padding: 18px 24px 22px;
  text-align: center;
  font-family: var(--mono-font);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gray-600);
}

/* ==========================================================================
   Panel — the real links
   ========================================================================== */

.eco-side {
  display: flex;
  flex-direction: column;
  padding: 0;
}

.eco-side__head {
  margin-bottom: 0;
  padding: 24px 24px 0;
}

.eco-list {
  flex: 1;
  padding: 8px 24px 4px;
}

.eco-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 0;
  text-decoration: none;
  color: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}

.eco-row:first-child {
  box-shadow: none;
}

.eco-row__dot {
  flex: none;
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--gray-600);
  transition: background .2s ease, box-shadow .2s ease;
}

.eco-row__b {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.eco-row__t {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--title-font);
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-body);
  transition: color .2s ease;
}

.eco-row__badge {
  padding: 2px 7px;
  border-radius: 9999px;
  font-family: var(--mono-font);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--primary-color);
  background: rgba(var(--primary-color-rgb), .12);
}

.eco-row__d {
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--text-muted);
}

.eco-row__arrow {
  flex: none;
  display: flex;
  margin-top: 2px;
  color: var(--gray-600);
  transition: transform .2s ease, color .2s ease;
}

.eco-row.is-lit .eco-row__dot {
  background: var(--primary-color);
  box-shadow: 0 0 6px rgba(var(--primary-color-rgb), .9);
}

.eco-row.is-lit .eco-row__t { color: var(--text-heading); }

.eco-row.is-lit .eco-row__arrow {
  color: var(--primary-color);
  transform: translateX(4px);
}

.eco-side__foot {
  align-items: center;
  gap: var(--gap-sm);
  margin-top: 0;
  padding: 16px 24px 18px;
  line-height: 1.55;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  background: rgba(255, 255, 255, .015);
}

.eco-side__foot .btn {
  flex: none;
}

/* ==========================================================================
   Responsive
   --------------------------------------------------------------------------
   The board is the picture and the panel is the content, so on the way down
   the board goes first. A crowded ring (6+ nodes) gives up sooner.
   ========================================================================== */

@media (max-width: 960px) {
  .eco__grid { grid-template-columns: minmax(0, 1fr); }
  .eco-board { aspect-ratio: 560 / 460; }
}

@media (max-width: 860px) {
  .eco[data-eco-count="6"] .eco-map,
  .eco[data-eco-count="7"] .eco-map,
  .eco[data-eco-count="8"] .eco-map { display: none; }
}

@media (max-width: 700px) {
  .eco-board { aspect-ratio: 400 / 470; }
  .eco-node { width: 54px; height: 54px; }
  .eco-node__label { width: 108px; }
  .eco-node__box { border-radius: 15px; }
  .eco-node__box svg { width: 21px; height: 21px; }
  .eco-node__t { font-size: 12.5px; }
  .eco-core { width: 124px; padding: 13px 10px; }
}

@media (max-width: 640px) {
  .eco-map { display: none; }

  .eco-map__head,
  .eco-side__head { padding: 20px 18px 0; }

  .eco-list { padding: 8px 18px 4px; }
  .eco-side__foot { padding: 16px 18px 18px; }
}

@media (max-width: 420px) {
  .eco-side__foot { flex-wrap: wrap; }
  .eco-side__foot .btn { margin-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .eco-pulse.is-lit {
    animation: none;
    opacity: .5;
    stroke-dasharray: none;
  }

  .eco-node__box,
  .eco-row__arrow { transition: none; }

  .eco-node.is-lit .eco-node__box { transform: none; }
  .eco-row.is-lit .eco-row__arrow { transform: none; }
}
