/* ============================================================
   30 — Unified platform / modular solutions   (.plat)
   Story + vertical tab rail on the left, pixel-locked mock
   stage on the right.
   ============================================================ */

.plat {
  background: var(--surface);
  /* one shared chrome recipe — every mock uses it, so the four read as one product */
  --plat-chrome: var(--sh-md);
  --plat-pad: var(--s-5);
}

.plat__inner {
  display: grid;
  gap: var(--s-10);
}

@media (min-width: 900px) {
  .plat__inner {
    grid-template-columns: 44fr 56fr;
    gap: var(--s-11);
    align-items: start;
  }
}

/* ---------------- left column: the story ---------------- */

.plat__copy { max-width: 46ch; }

.plat__eyebrow { margin-bottom: var(--s-4); }

.plat__title { margin-bottom: var(--s-5); }

.plat__lead { color: var(--text-body); }

.plat__cta,
.plat__tab-link {
  min-height: var(--s-9);
  color: var(--c-brand-press);
}
/* --c-brand only clears 4.5:1 on pure white — the cta sits on white, but
   the in-row link sits on the active row's --c-brand-tint, so it darkens
   to navy on hover instead */
.plat__cta:hover { color: var(--c-brand); }
.plat__tab-link:hover { color: var(--c-navy); }

.plat__cta { margin-top: var(--s-5); font-size: var(--fs-body); }

/* ---------------- the rail ---------------- */

/* the 2px rail and the tint fill start on the copy's left text edge */
.plat__rail {
  display: grid;
  margin-top: var(--s-7);
}

.plat__tab {
  position: relative;
  z-index: var(--z-base);
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--s-4);
  align-items: center;
  width: 100%;
  min-height: var(--s-9);
  padding: var(--plat-pad);
  text-align: start;
  border-radius: var(--r-md);
  color: var(--text-strong);
  cursor: pointer;
  transition: background var(--t-base) var(--ease-out);
}

/* inactive rows must still telegraph clickability */
.plat__tab:hover:not(.is-active) { background: var(--surface-alt); }

/* hairline separator between inactive rows */
.plat__tab + .plat__tab::before {
  content: "";
  position: absolute;
  inset-inline: var(--plat-pad);
  top: 0;
  height: 1px;
  background: var(--c-hairline);
  transition: opacity var(--t-base) var(--ease-out);
}

/* 2px brand rail on the inline-start edge, grows from the centre */
.plat__tab::after {
  content: "";
  position: absolute;
  inset-block: var(--s-2);
  inset-inline-start: 0;
  width: 2px;
  border-radius: var(--r-pill);
  background: var(--c-brand);
  transform: scaleY(0);
  opacity: 0;
  transition: transform var(--t-slow) var(--ease-expo),
              opacity var(--t-fast) var(--ease-out);
}

.plat__tab.is-active { background: var(--c-brand-tint); }
.plat__tab.is-active::after { transform: scaleY(1); opacity: 1; }
.plat__tab.is-active::before,
.plat__tab.is-active + .plat__tab::before { opacity: 0; }

.plat__ico {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  place-items: center;
  color: var(--text-body);
  transition: color var(--t-base) var(--ease-out),
              transform var(--t-slow) var(--ease-expo);
}

.plat__tab-title {
  grid-column: 2;
  grid-row: 1;
  font-size: var(--fs-h4);
  font-weight: var(--fw-semi);
  line-height: var(--lh-snug);
  letter-spacing: var(--tracking-snug);
  color: var(--text-body);
  transition: color var(--t-base) var(--ease-out);
}

.plat__tab:hover .plat__tab-title { color: var(--text-strong); }
.plat__tab:hover .plat__ico { color: var(--text-strong); }

.plat__tab.is-active .plat__tab-title { color: var(--text-strong); font-weight: var(--fw-bold); }
.plat__tab.is-active .plat__ico { color: var(--c-brand-press); transform: translateX(2px); }

/* ---------------- expanding description ---------------- */

.plat__reveal {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--t-slow) var(--ease-expo);
}

.plat__reveal-in {
  overflow: hidden;
  min-height: 0;
  visibility: hidden;
  opacity: 0;
  transition: opacity var(--t-base) var(--ease-out),
              visibility 0s linear var(--t-slow);
}

.plat__tab.is-active .plat__reveal { grid-template-rows: 1fr; }
.plat__tab.is-active .plat__reveal-in {
  visibility: visible;
  opacity: 1;
  transition: opacity var(--t-slow) var(--ease-out) var(--t-fast),
              visibility 0s linear 0s;
}

.plat__desc {
  display: block;
  padding-top: var(--s-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  font-weight: var(--fw-regular);
  color: var(--text-body);
}

/* in-row arrow link — only focusable while the row is expanded, because
   the collapsed .plat__reveal-in is visibility:hidden */
.plat__tab-link { margin-top: var(--s-1); }

@media (max-width: 559px) {
  .plat { --plat-pad: var(--s-4); }
  .plat__tab { column-gap: var(--s-3); }
}

/* ---------------- stage: every panel occupies one cell ----------------
   All four panels share a single grid cell, so the stage is always as
   tall as the tallest mock — switching tabs cannot move a pixel.        */

.plat__stage {
  display: grid;
  min-width: 0;
}

.plat__panel {
  grid-area: 1 / 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s-5);
  border-radius: var(--r-lg);
  transition: opacity var(--t-slow) var(--ease-out),
              transform var(--t-slow) var(--ease-expo),
              visibility 0s linear 0s;
}

/* override the UA `[hidden] { display:none }` so the cell keeps its size */
.plat__panel[hidden] {
  display: flex;
  visibility: hidden;
  opacity: 0;
  transform: translateY(10px) scale(.985);
  pointer-events: none;
  transition: opacity var(--t-base) var(--ease-out),
              transform var(--t-base) var(--ease-out),
              visibility 0s linear var(--t-base);
}

/* ---------------- shared mock chrome ---------------- */

.plat__mock {
  flex: 1;
  align-self: stretch;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: var(--s-6);
  border: 1px solid var(--c-hairline);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--plat-chrome);
}

.plat__mock-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding-bottom: var(--s-4);
  margin-bottom: var(--s-5);
  border-bottom: 1px solid var(--c-hairline-soft);
}

.plat__mock-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--text-body);
}

.plat__mock-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
/* nothing inside a mock may be squeezed by the shared stage height —
   the chart in particular must keep its aspect-ratio-driven height */
.plat__mock-body > * { flex: none; }

.plat__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  height: var(--s-6);
  padding-inline: var(--s-2);
  border-radius: var(--r-sm);
  background: var(--surface-alt);
  color: var(--text-body);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  white-space: nowrap;
}

.plat__dot {
  width: var(--s-2); height: var(--s-2);
  border-radius: var(--r-pill);
  background: var(--c-brand);
}

.plat__mono {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  letter-spacing: var(--tracking-normal);
}

/* ================= 1 — checkout ================= */

.plat__pay-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  margin-bottom: var(--s-5);
}

.plat__pay-caption { font-size: var(--fs-sm); color: var(--text-body); }

.plat__pay-figure {
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-strong);
}

.plat__fields { display: grid; gap: var(--s-4); }
.plat__field { display: grid; gap: var(--s-2); }

.plat__field-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--text-body);
}

.plat__input {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-width: 0;
  height: var(--s-8);
  padding-inline: var(--s-3);
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: 0 0 0 1px var(--c-hairline), var(--sh-xs);
  color: var(--text-strong);
}

.plat__val { font-size: var(--fs-sm); }

.plat__input .plat__mono,
.plat__input .plat__val {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plat__input-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2); }

.plat__brands { display: flex; align-items: center; gap: var(--s-1); flex: none; }

.plat__chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--s-6);
  padding-inline: var(--s-1);
  border-radius: var(--r-xs);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--c-hairline);
  color: var(--text-body);
}

.plat__chip--more {
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  line-height: 1;
}

/* the primary action every checkout resolves to — mock chrome, not a .btn */
.plat__paybtn {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--s-9);
  margin-top: var(--s-5);
  border-radius: var(--r-sm);
  background: var(--c-brand);
  color: var(--c-white);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  letter-spacing: var(--tracking-snug);
  box-shadow: var(--sh-xs);
}

/* slack from a stretched stage collects above the divider, so the
   wallet buttons stay welded to the bottom of the card */
.plat__or {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  margin-block: auto var(--s-5);
  padding-top: var(--s-5);
  font-size: var(--fs-xs);
  color: var(--text-body);
}
.plat__or::before, .plat__or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--c-hairline);
}

.plat__wallets {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-3);
}

.plat__wallet {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: var(--s-9);
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semi);
  letter-spacing: var(--tracking-snug);
}

.plat__wallet--apple { background: var(--c-navy-deep); color: var(--c-white); }
.plat__wallet--google {
  background: var(--surface);
  color: var(--text-strong);
  box-shadow: 0 0 0 1px var(--c-hairline), var(--sh-xs);
}

/* ================= 2 — recurring revenue ================= */

.plat__delta {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  height: var(--s-6);
  padding-inline: var(--s-2);
  border-radius: var(--r-sm);
  background: var(--c-brand-tint);
  color: var(--c-brand-press);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  white-space: nowrap;
}

.plat__mrr { display: grid; gap: var(--s-1); margin-bottom: var(--s-5); }

.plat__mrr-figure {
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-strong);
  line-height: var(--lh-tight);
}

.plat__mrr-caption { font-size: var(--fs-xs); color: var(--text-body); }

.plat__chart-wrap {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--s-3);
}

/* labels sit just inside the top and bottom gridlines — dashboard convention */
.plat__yaxis {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-size: var(--fs-xs);
  line-height: 1;
  color: var(--text-body);
  font-variant-numeric: tabular-nums;
}

/* height tracks width at the viewBox's 520:200 ratio, so the drawn slope
   is identical at every width — preserveAspectRatio="none" never distorts */
.plat__chart {
  grid-column: 2;
  grid-row: 1;
  width: 100%;
  height: auto;
  aspect-ratio: 520 / 200;
}
.plat__grid path {
  stroke: var(--c-hairline);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.plat__line {
  fill: none;
  stroke: var(--c-brand);
  stroke-width: 2.25;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.plat__area-a { stop-color: var(--c-brand); stop-opacity: .22; }
.plat__area-b { stop-color: var(--c-brand); stop-opacity: 0; }

.plat__axis {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-top: var(--s-2);
  font-size: var(--fs-xs);
  color: var(--text-body);
}
.plat__axis span { text-align: center; }

.plat__stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-4);
  margin-top: auto;
  padding-top: var(--s-5);
  border-top: 1px solid var(--c-hairline-soft);
}

.plat__stat { display: grid; gap: var(--s-1); }
.plat__stat-n {
  font-size: var(--fs-body);
  font-weight: var(--fw-bold);
  color: var(--text-strong);
  line-height: var(--lh-snug);
}
.plat__stat-l { font-size: var(--fs-xs); color: var(--text-body); }

/* ================= 3 — embedded finance ================= */

.plat__cards {
  position: relative;
  max-width: calc(var(--s-14) * 2 + var(--s-9));
  padding-top: var(--s-9);
}

.plat__vcard {
  border-radius: var(--r-md);
  padding: var(--s-5);
  color: var(--c-white);
}

.plat__vcard--back {
  position: absolute;
  inset-inline: var(--s-6) var(--s-6);
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding-block: var(--s-3) var(--s-9);
  background: var(--c-brand-press);
}

/* solid ink card + a grad-brand accent edge: no text ever sits on the cyan */
.plat__vcard--front {
  position: relative;
  overflow: hidden;
  display: grid;
  gap: var(--s-5);
  aspect-ratio: 1.586;
  align-content: space-between;
  background: var(--c-navy-deep);
  box-shadow: var(--sh-md);
}
.plat__vcard--front::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: var(--s-1);
  background: var(--grad-brand);
}

.plat__vcard-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); }

.plat__vcard-brand {
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.plat__vcard-num { font-size: var(--fs-sm); letter-spacing: var(--tracking-wide); }

.plat__vcard-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  font-size: var(--fs-xs);
  color: var(--text-invert-body);
}
.plat__vcard-foot span:first-child { color: var(--c-white); font-weight: var(--fw-medium); }

.plat__balance {
  margin-top: auto;
  padding-top: var(--s-6);
  display: grid;
  gap: var(--s-3);
}

.plat__balance-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  padding-top: var(--s-3);
  border-top: 1px solid var(--c-hairline-soft);
}
.plat__balance-row:first-child { padding-top: 0; border-top: 0; }

.plat__balance-l { font-size: var(--fs-sm); color: var(--text-body); }
.plat__balance-v {
  font-size: var(--fs-h4);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-snug);
  color: var(--text-strong);
}
.plat__balance-p { font-size: var(--fs-xs); font-weight: var(--fw-semi); color: var(--c-brand-press); }
.plat__balance-s { font-size: var(--fs-xs); font-weight: var(--fw-medium); color: var(--text-body); }

/* ================= 4 — risk ================= */

/* the one payment this card is scoring */
.plat__subject {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--s-4);
  min-width: 0;
  padding-bottom: var(--s-5);
}
.plat__subject-id {
  color: var(--text-body);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.plat__subject-v {
  flex: none;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
  color: var(--text-strong);
}

.plat__gauge {
  position: relative;
  width: 100%;
  max-width: calc(var(--s-13) * 2);
  margin-inline: auto;
  margin-bottom: var(--s-6);
}

.plat__gauge-svg { width: 100%; height: auto; }
.plat__gauge-track {
  fill: none;
  stroke: var(--c-hairline-soft);
  stroke-width: 8;
  stroke-linecap: round;
}
/* semicircle r=82 → π·82 = 257.6; offset 234 leaves 23.6 plus two 4-unit
   round caps = 31.6 of 257.6 ≈ the 12/100 the readout states */
.plat__gauge-fill {
  fill: none;
  stroke: var(--c-brand);
  stroke-width: 8;
  stroke-linecap: round;
}

.plat__gauge-read {
  position: absolute;
  inset-inline: 0;
  bottom: 0;
  display: grid;
  gap: var(--s-1);
  justify-items: center;
}
.plat__gauge-n {
  font-size: var(--fs-h3);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  color: var(--text-strong);
  line-height: 1;
}
.plat__gauge-l { font-size: var(--fs-xs); color: var(--text-body); }

.plat__rules { margin-top: auto; display: grid; }

.plat__rule {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-3);
  min-width: 0;
  padding-block: var(--s-3);
  border-top: 1px solid var(--c-hairline-soft);
}

.plat__rule-code {
  color: var(--text-body);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plat__verdict {
  display: inline-flex;
  align-items: center;
  gap: var(--s-1);
  flex: none;
  height: var(--s-6);
  padding-inline: var(--s-2);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semi);
}
.plat__verdict--pass { background: color-mix(in srgb, var(--c-lime) 34%, var(--surface)); color: var(--c-navy); }
.plat__verdict--off  { background: var(--surface-alt); color: var(--text-body); }
.plat__verdict--3ds  { background: var(--c-brand-tint); color: var(--c-brand-press); }

/* ---------------- narrow ---------------- */

@media (max-width: 559px) {
  .plat__mock { padding: var(--s-5); }
  .plat__pay-figure, .plat__mrr-figure, .plat__gauge-n { font-size: var(--fs-h4); }
  .plat__vcard--back { inset-inline: var(--s-5) var(--s-5); }
  .plat__wallet { font-size: var(--fs-xs); }
  /* three narrow cells still fit — a 2×2 would orphan the third stat */
  .plat__stats { gap: var(--s-3); }
  .plat__subject { flex-direction: column; align-items: start; gap: var(--s-1); }
}

@media (prefers-reduced-motion: reduce) {
  .plat__ico, .plat__tab::after,
  .plat__panel, .plat__panel[hidden] { transform: none; }
  /* base.css zeroes durations but not delays — zero ours too */
  .plat__reveal-in, .plat__tab.is-active .plat__reveal-in,
  .plat__panel, .plat__panel[hidden] { transition-delay: 0s; }
}
