/* ==========================================================================
   KOBIL — Homepage: "Your Ecosystem Your Brand"
   Figma: D-Homepage → 6019:111654 (mobile 6203:41926)
   Cards: 6019:111660 / :111661 / :111662

   The three cards are hover-expanding. Figma's default state shows only the
   number, the audience label, the title and the description; the prototype's
   ON_HOVER reaction (SMART_ANIMATE, 0.4s ease-out) reveals a six-item list
   and a closing link that are present in the component but collapsed. That's
   reproduced here with a height/content transition at the same duration and
   easing.

   On touch/mobile, the Figma card is 334×329 and an explicit text-plus-icon
   control expands it downward to the 334×736 open variant.
   ========================================================================== */

.sec-ecosystem {
  background: var(--white);
  padding: var(--w72) 0 var(--w80);
}

.sec-ecosystem__inner {
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--w80);
}

.sec-ecosystem__head {
  max-width: var(--w780);
  margin: 0 auto var(--w56);
  text-align: center;
}

.sec-ecosystem__title {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: var(--w56);
  line-height: 1.2;
  color: var(--navy);
}

.sec-ecosystem__lead {
  margin-top: var(--w12);
  font-family: var(--font-sans);
  font-size: var(--w16);
  font-weight: 400;
  line-height: var(--w23);
  color: var(--navy-70);
}

/* ---- Cards ---- */

.sec-ecosystem__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--w24);
  /* A hovered card grows independently. Stretching the grid items here made
     the two idle cards inherit the active row height as well. */
  align-items: start;
}

.sec-ecosystem__card {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: var(--w292);
  padding: var(--w32);
  border: 1px solid #eff2f8;
  /* Figma: 26px radius, white fill, drop shadow 0 24 60 rgba(69,75,93,.2). */
  border-radius: var(--w26);
  background: var(--white);
  box-shadow: 0 24px 60px rgba(69, 75, 93, 0.2);
  transition: height 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.sec-ecosystem__card:hover,
.sec-ecosystem__card:focus-within,
.sec-ecosystem__card.is-open {
  height: var(--w752);
}

/* The tinted wash across the top of each card — a different accent per
   audience (blue / violet / peach), set per card via --card-accent. */
.sec-ecosystem__card::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  height: var(--w3);
  background: linear-gradient(90deg, #fff 0%, var(--card-line, #5b66ff) 50%, #fff 100%);
  pointer-events: none;
}

.sec-ecosystem__card::after {
  content: "";
  position: absolute;
  z-index: -1;
  top: calc(-1 * var(--w64));
  right: calc(-1 * var(--w62));
  width: var(--w224);
  height: var(--w224);
  border-radius: 50%;
  background: var(--card-glow, rgba(91, 140, 255, 0.22));
  filter: blur(64px);
  opacity: 0.4;
  pointer-events: none;
}

.sec-ecosystem__card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--w16);
}

.sec-ecosystem__card-num {
  font-family: var(--font-mono);
  font-size: var(--w36);
  font-weight: 400;
  line-height: var(--w40);
  letter-spacing: -0.9px;
  color: var(--navy);
}

.sec-ecosystem__card-label {
  font-family: var(--font-sans);
  font-size: var(--w20);
  font-weight: 700;
  line-height: var(--w26);
  color: var(--navy);
}

.sec-ecosystem__card-title {
  margin-top: var(--w31);
  font-family: var(--font-sans);
  font-size: var(--w20);
  font-weight: 600;
  line-height: var(--w26);
  color: var(--navy);
}

.sec-ecosystem__card-text {
  margin-top: var(--w12);
  font-family: var(--font-ui);
  font-size: var(--w14);
  font-weight: 400;
  line-height: 22.75px;
  color: var(--navy-70);
}

/* ---- The part the hover reveals ---- */

.sec-ecosystem__reveal {
  position: absolute;
  top: var(--w290);
  right: var(--w32);
  bottom: var(--w32);
  left: var(--w32);
  visibility: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.22s ease-out 0.08s, transform 0.3s ease-out 0.08s,
    visibility 0s linear 0.4s;
}

.sec-ecosystem__card.is-open .sec-ecosystem__reveal {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.08s, 0.08s, 0s;
}

/* Pointer devices get the prototype's hover reveal; touch devices get the
   "See more" button below instead (Figma 6203:41926 draws one on each mobile
   card, and a hover state is unreachable there). */
@media (hover: hover) {
  .sec-ecosystem__card:hover .sec-ecosystem__reveal,
  .sec-ecosystem__card:focus-within .sec-ecosystem__reveal {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    transition-delay: 0.08s, 0.08s, 0s;
  }
}

.sec-ecosystem__reveal-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sec-ecosystem__list {
  display: flex;
  flex-direction: column;
  margin: 0;
}

.sec-ecosystem__list li {
  display: flex;
  min-height: var(--w54);
  align-items: center;
  gap: var(--w12);
  padding: var(--w11) var(--w15);
  border: 1px solid transparent;
  border-radius: var(--w14);
  font-family: var(--font-ui);
  font-size: var(--w14);
  font-weight: 400;
  line-height: var(--w20);
  color: var(--navy);
}

.sec-ecosystem__list-icon {
  display: inline-flex;
  flex: 0 0 var(--w32);
  width: var(--w32);
  height: var(--w32);
  align-items: center;
  justify-content: center;
  border-radius: var(--w10);
  background: #f7f8fd;
}

.sec-ecosystem__list-icon img {
  display: block;
  width: var(--w16);
  height: var(--w16);
}

.sec-ecosystem__card-link {
  display: block;
  width: var(--w221);
  margin: auto auto 0;
  font-family: var(--font-mono);
  font-size: var(--w14);
  font-weight: 500;
  line-height: var(--w20);
  letter-spacing: 2.24px;
  text-align: center;
  text-transform: uppercase;
  color: var(--navy);
}

/* ---- "See more" toggle — Figma 6203:41926, one per mobile card ---- */

.sec-ecosystem__toggle {
  display: none; /* pointer devices reveal on hover instead */
  align-items: center;
  justify-content: center;
  gap: var(--w8);
  padding: 0;
  appearance: none;
  background: transparent;
  border: 0;
  font-family: var(--font-ui);
  font-size: var(--w14);
  font-weight: 600;
  line-height: var(--w18);
  color: var(--navy);
  cursor: pointer;
}

.sec-ecosystem__toggle:focus-visible {
  outline: 0;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

/* Same plus/minus crossfade used by the SuperApp FAQ accordion. */
.sec-ecosystem__toggle-icon {
  position: relative;
  flex: 0 0 var(--w18);
  width: var(--w18);
  height: var(--w18);
}

.sec-ecosystem__toggle-icon img {
  visibility: hidden;
}

.sec-ecosystem__toggle-icon::before,
.sec-ecosystem__toggle-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background-color: currentColor;
  -webkit-mask: url("/assets/ecosystem/icon-toggle-plus.svg") center / contain no-repeat;
  mask: url("/assets/ecosystem/icon-toggle-plus.svg") center / contain no-repeat;
  transition: opacity var(--dur) var(--ease), transform 0.3s var(--ease);
}

.sec-ecosystem__toggle-icon::after {
  opacity: 0;
  clip-path: inset(45% 0);
}

.sec-ecosystem__card.is-open .sec-ecosystem__toggle-icon::before {
  opacity: 0;
  transform: rotate(90deg);
}

.sec-ecosystem__card.is-open .sec-ecosystem__toggle-icon::after {
  opacity: 1;
}

/* The toggle's own label swaps via these two spans, so the button keeps a
   stable accessible name from aria-expanded rather than changing text nodes
   in JS. */
.sec-ecosystem__card.is-open .sec-ecosystem__toggle-more,
.sec-ecosystem__toggle-less {
  display: none;
}

.sec-ecosystem__card.is-open .sec-ecosystem__toggle-less {
  display: inline;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

/* Below the three-up grid, and on any touch device, the cards are shown
   expanded — the mobile frame draws them that way, and there is no hover to
   reveal them with. */
@media (hover: none) {
  .sec-ecosystem__card {
    height: var(--w329);
    padding: var(--w32);
    transition: height 0.4s ease-out, box-shadow 0.4s ease-out;
  }

  .sec-ecosystem__card:hover,
  .sec-ecosystem__card:focus-within {
    height: var(--w329);
  }

  .sec-ecosystem__card.is-open,
  .sec-ecosystem__card.is-open:hover,
  .sec-ecosystem__card.is-open:focus-within {
    height: var(--w736);
  }

  .sec-ecosystem__reveal {
    top: var(--w320);
    right: var(--w32);
    bottom: var(--w30);
    left: var(--w32);
  }

  .sec-ecosystem__reveal-inner {
    height: 100%;
  }

  .sec-ecosystem__toggle {
    position: absolute;
    z-index: 2;
    top: var(--w285);
    left: 50%;
    display: inline-flex;
    transform: translateX(-50%);
    white-space: nowrap;
  }
}

@media (max-width: 768px) {
  .sec-ecosystem__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--m12);
  }

  .sec-ecosystem {
    padding: var(--m48) 0 var(--m52);
  }

  .sec-ecosystem__inner {
    padding: 0 var(--m16);
  }

  .sec-ecosystem__head {
    margin-bottom: var(--m32);
  }

  /* Centred with auto margins, NOT left:50% + translateX(-50%): this node
     carries data-reveal, and the reveal system's `.is-visible` sets
     `transform: none`, which silently cancelled the translate and left the
     grid parked at the viewport's midpoint. */
  .sec-ecosystem__grid {
    width: min(var(--m334), calc(100vw - var(--m32)));
    margin-left: auto;
    margin-right: auto;
  }

  .sec-ecosystem__title {
    font-size: var(--m34);
  }

  .sec-ecosystem__lead {
    font-size: var(--m14);
    line-height: var(--m20);
  }

  .sec-ecosystem__card {
    padding: var(--m32);
  }

  .sec-ecosystem__card-num {
    font-size: var(--m24);
  }

  .sec-ecosystem__card-label {
    font-size: var(--m16);
  }

  .sec-ecosystem__card-title {
    margin-top: var(--m31);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sec-ecosystem__toggle-icon::before,
  .sec-ecosystem__toggle-icon::after {
    transition: none;
  }
}
