/* ==========================================================================
   Platform page · 2 — Why MFIs outgrow their core systems
   "Exhibit": the CEO's two wireframe diagrams, drawn like figures in an
   annual report.
     - hairline boxes with sentence-case labels, no icons
     - straight, right-angled connectors only (no curves)
     - one accent: everything on the usual stack is grey; Finflow is blue
     - breaks drawn as clean gap ticks, not alarm marks
   Each figure's six points sit beneath it as plain lists with hairlines.
   Arrival (once, .is-visible from reveal.js): connectors draw in, boxes
   follow; the usual stack's breaks appear last. Hovering a Finflow module
   lights its spoke (js/platform/why.js).
   Prefixed .wy- and scoped to .why.
   ========================================================================== */

.why {
  --wy-frame:   #FFFFFF;
  --wy-grey:    #9AA3AE;      /* usual-stack strokes */
  --wy-grey-tx: #6B7480;      /* usual-stack labels */
  --wy-note:    #8A939E;
  --wy-break:   #D92D20;      /* discrepancies: red, the one alarm colour here */

  position: relative;
  padding: clamp(72px, 9vw, 120px) var(--page-px);
  background: var(--surface);
  border-top: 1px solid var(--border);
}
:root[data-theme="dark"] .why {
  --wy-frame:   #0B1F42;
  --wy-grey:    #5F6E86;
  --wy-grey-tx: #8392A8;
  --wy-note:    #7586A0;
  --wy-break:   #F97066;
}

.wy-inner { max-width: var(--container); margin: 0 auto; }
.wy-head { display: flex; flex-direction: column; gap: 14px; margin-bottom: clamp(36px, 4.5vw, 56px); }
.wy-title { max-width: 720px; font-size: var(--fs-section-title); font-weight: 600; line-height: 1.12; letter-spacing: -0.03em; text-wrap: balance; }
.wy-sub { max-width: 620px; font-size: var(--fs-section-sub); line-height: 1.6; color: var(--text-secondary); }

/* ─── Two figures ─────────────────────────────────────────────────────── */
.wy-figs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 48px);
}
.wy-fig { margin: 0; min-width: 0; }
.wy-frame {
  padding: clamp(16px, 2.6vw, 32px);
  background: var(--wy-frame);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.wy-fig-svg { display: block; width: 100%; height: auto; overflow: visible; }

/* boxes */
.wy-n rect { fill: var(--wy-frame); stroke-width: 1; vector-effect: non-scaling-stroke; }
.wy-n text {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  text-anchor: middle;
}
.wy-fig--old .wy-n rect { stroke: var(--wy-grey); }
.wy-fig--old .wy-n text { fill: var(--wy-grey-tx); }
.wy-n--new rect { stroke: var(--accent); transition: fill 0.2s ease, stroke-width 0.2s ease; }
.wy-n--new text { fill: var(--text-primary); }
.wy-n--new.is-lit rect { fill: var(--accent-soft); stroke-width: 1.6; }

.wy-hub rect { fill: var(--blue-600); }
.wy-hub text {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  text-anchor: middle;
  fill: #ffffff;
}

/* connectors: straight runs, square corners */
.wy-links path,
.wy-spokes path {
  fill: none;
  stroke-width: 1;
  stroke-linejoin: miter;
  stroke-linecap: butt;
}
.wy-links path { stroke: var(--wy-grey); }
.wy-links path.is-dash { stroke-dasharray: 4 4; }
.wy-spokes path { stroke: var(--accent); transition: stroke-width 0.2s ease; }
.wy-spokes path.is-lit { stroke-width: 2; }

/* breaks: a clean gap with two ticks, in red — where data doesn't get through */
.wy-breaks rect { fill: var(--wy-frame); }
.wy-breaks path { stroke: var(--wy-break); stroke-width: 1.6; vector-effect: non-scaling-stroke; }

/* notes on the links */
.wy-notes text {
  font-family: var(--font-body);
  font-size: 11.5px;
  text-anchor: middle;
  fill: var(--wy-note);
  font-style: italic;
}
.wy-notes--ok text { fill: var(--accent-text); }

/* packets: square, engineered; grey ones stall and die, blue ones flow */
.wy-pkt--bad { fill: var(--wy-grey-tx); }
.wy-pkt--ok  { fill: var(--accent); }
.wy-pkts { transition: opacity 0.5s ease 1.2s; }
html.has-js .wy-fig:not(.is-visible) .wy-pkts { opacity: 0; transition: none; }
/* Finflow block breathes softly as the packets arrive */
.wy-hub-pulse {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  transform-box: fill-box;
  transform-origin: center;
  animation: wy-pulse 1.8s ease-out infinite;
}
@keyframes wy-pulse {
  0%   { opacity: 0.55; transform: scale(1); }
  100% { opacity: 0;    transform: scale(1.18, 1.45); }
}

/* ─── Captions and the six points ─────────────────────────────────────── */
.wy-cap { padding-top: clamp(20px, 2.2vw, 28px); }
.wy-cap-title {
  margin-bottom: 12px;
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.wy-fig--old .wy-cap-title { color: var(--text-muted); }
.wy-fig--new .wy-cap-title { color: var(--accent-text); }
.wy-list { display: flex; flex-wrap: wrap; gap: 8px; }
.wy-list li {
  padding: 6px 12px;
  font-size: 13.5px;
  line-height: 1.3;
  border-radius: 999px;
}
.wy-fig--old .wy-list li { color: var(--wy-grey-tx); background: color-mix(in srgb, var(--wy-grey) 12%, transparent); border: 1px solid color-mix(in srgb, var(--wy-grey) 35%, transparent); }
.wy-fig--new .wy-list li { color: var(--accent-text); background: var(--accent-soft); border: 1px solid var(--accent-line); font-weight: 500; }

/* ─── Arrival (once) ──────────────────────────────────────────────────── */
.wy-links path:not(.is-dash), .wy-spokes path { stroke-dasharray: 1; }
html.has-js .wy-fig:not(.is-visible) .wy-links path:not(.is-dash),
html.has-js .wy-fig:not(.is-visible) .wy-spokes path { stroke-dashoffset: 1; }
html.has-js .wy-fig:not(.is-visible) .wy-links path.is-dash,
html.has-js .wy-fig:not(.is-visible) .wy-n,
html.has-js .wy-fig:not(.is-visible) .wy-hub,
html.has-js .wy-fig:not(.is-visible) .wy-breaks,
html.has-js .wy-fig:not(.is-visible) .wy-notes,
html.has-js .wy-fig:not(.is-visible) .wy-list li { opacity: 0; }

.wy-fig.is-visible .wy-links path,
.wy-fig.is-visible .wy-spokes path { transition: stroke-dashoffset 0.7s var(--ease-out) calc(0.2s + var(--d, 0s)), opacity 0.5s ease calc(0.2s + var(--d, 0s)), stroke-width 0.2s ease; }
.wy-fig.is-visible .wy-n          { transition: opacity 0.4s ease calc(0.35s + var(--d, 0s)); }
.wy-fig.is-visible .wy-hub        { transition: opacity 0.4s ease 0.15s; }
.wy-fig.is-visible .wy-notes      { transition: opacity 0.4s ease 0.9s; }
.wy-fig.is-visible .wy-breaks     { transition: opacity 0.3s ease 1.1s; }
.wy-fig.is-visible .wy-list li    { transition: opacity 0.4s ease calc(0.6s + var(--i) * 60ms); }

/* ─── Responsive ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .wy-pkts, .wy-hub-pulse { display: none; }
}

@media (max-width: 860px) {
  .wy-figs { grid-template-columns: minmax(0, 1fr); row-gap: 44px; }
}
/* phones: the figure scales down, so its text scales up to stay ≥10px */
@media (max-width: 520px) {
  .wy-frame { padding: 12px 8px; }
  .wy-n text { font-size: 14.5px; }
  .wy-hub text { font-size: 16px; }
  .wy-notes text { font-size: 13px; }
}
