/* ==========================================================================
   Platform page · 3 — Core banking and lending
   A coverage chart, drawn like section 2's exhibits (hairlines, one blue,
   sentence-case labels):
                  Products  Applications  Underwriting  Approval  Disb.  Coll.
       Web app    ██████████████████████████████████████████████████
       Field app            ██████████████████████████   ┄┄┄   ███████████████
                  └──────────────────── One system ────────────────────┘
   One grid. Each stage is a column spanning every row (its rule and its
   hover band); the bars sit on top, placed by --a / --b, and their dots
   (flex: 1 each) line up with the stage columns they cover.
   On phones the same grid turns: stages become rows, the bars run down
   two narrow columns on the right, using the same --a / --b.
   States (js/platform/core.js): .cv-band glides to the hot stage; a stage
   .is-hot colours its name; its dots .is-hot grow; a lane .is-hot lights.
   Prefixed .cr- / .cv- and scoped to .core.
   ========================================================================== */

.core {
  --cv-frame: #FFFFFF;
  --cv-row:   52px;
  --cv-foot:  44px;
  --cv-web:   var(--accent);
  --cv-field: color-mix(in srgb, var(--accent) 50%, var(--cv-frame));

  position: relative;
  padding: clamp(72px, 9vw, 120px) var(--page-px);
  background: var(--surface-raised);
  border-top: 1px solid var(--border);
}
:root[data-theme="dark"] .core { --cv-frame: #0B1F42; }

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

/* ─── Frame and grid ──────────────────────────────────────────────────── */
.cv-frame {
  margin: 0;
  padding: clamp(20px, 2.8vw, 36px) clamp(16px, 2.6vw, 32px) clamp(16px, 2.2vw, 28px);
  background: var(--cv-frame);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.cv-chart {
  position: relative;
  display: grid;
  grid-template-columns: 124px repeat(6, minmax(0, 1fr));
  grid-template-rows: auto var(--cv-row) var(--cv-row) var(--cv-foot);
}
.cv-stages { display: contents; }

/* a stage: its column, its rule, its copy at the top */
.cv-stage {
  grid-column: var(--s);
  grid-row: 1 / 4;
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 2px clamp(10px, 1.2vw, 16px) calc(var(--cv-row) * 2 + 22px);
  border-left: 1px solid var(--border);
  cursor: default;
}
.cv-stage:last-child { border-right: 1px solid var(--border); }
.cv-name {
  font-family: var(--font-display);
  font-size: clamp(14px, 1.25vw, 16px);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  hyphens: auto;
  transition: color 0.2s ease;
}
.cv-text { font-size: clamp(12.5px, 1.1vw, 13.5px); line-height: 1.5; color: var(--text-secondary); }
.cv-stage.is-hot .cv-name { color: var(--accent-text); }

/* the highlight band behind the hot stage (positioned by JS) */
.cv-band {
  position: absolute;
  left: 0; top: 0;
  z-index: 0;
  width: var(--w, 0px);
  height: var(--h, 0px);
  background: var(--accent-soft);
  border-top: 2px solid var(--accent);
  opacity: 0;
  transform: translate(var(--x, 0px), var(--y, 0px));
  transition: transform 0.35s var(--ease-out), width 0.35s var(--ease-out), height 0.35s var(--ease-out), opacity 0.25s ease;
  pointer-events: none;
}
.cv-band.is-on { opacity: 1; }

/* lane labels, left column */
.cv-lane {
  grid-column: 1;
  align-self: center;
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}
.cv-lane i { font-size: 17px; }
.cv-lane--web   { grid-row: 2; }
.cv-lane--field { grid-row: 3; }
.cv-lane--web i   { color: var(--cv-web); }
.cv-lane--field i { color: var(--cv-field); }
.cv-lane.is-hot { color: var(--accent-text); }

/* dashed tracks: where a lane isn't used, the gap reads as a gap */
.cv-track { grid-column: 2 / -1; position: relative; z-index: 1; }
.cv-track::before {
  content: '';
  position: absolute;
  left: 0; right: 0; top: 50%;
  border-top: 1px dashed var(--border-strong);
}
.cv-track--web   { grid-row: 2; }
.cv-track--field { grid-row: 3; }

/* the bars */
.cv-bar {
  grid-column: var(--a) / var(--b);
  position: relative;
  z-index: 2;
  display: flex;
  pointer-events: none;
}
.cv-bar--web   { grid-row: 2; --cv-c: var(--cv-web); }
.cv-bar--field { grid-row: 3; --cv-c: var(--cv-field); }
.cv-bar::before {
  content: '';
  position: absolute;
  left: 8px; right: 8px;
  top: 50%;
  height: 24px;
  margin-top: -12px;
  background: var(--cv-c);
  border-radius: 5px;
  transform-origin: left center;
}
.cv-bar i { position: relative; flex: 1; display: grid; place-items: center; }
.cv-bar i::before {
  content: '';
  width: 6px; height: 6px;
  background: #FFFFFF;
  border-radius: 50%;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.cv-bar i.is-hot::before { transform: scale(1.7); }

/* "One system": a bracket under all six */
.cv-foot {
  grid-column: 2 / -1;
  grid-row: 4;
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
}
.cv-foot::before {
  content: '';
  position: absolute;
  left: 8px; right: 8px;
  top: 50%; height: 8px;
  margin-top: -8px;
  border: 1px solid var(--border-strong);
  border-top: 0;
}
.cv-foot em {
  position: relative;
  padding: 0 12px;
  font-style: normal;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--cv-frame);
}

/* ─── Arrival (once, .is-visible from reveal.js) ──────────────────────── */
html.has-js .cv-frame:not(.is-visible) .cv-stage > * { opacity: 0; transform: translateY(6px); }
html.has-js .cv-frame:not(.is-visible) .cv-bar::before { transform: scaleX(0); }
html.has-js .cv-frame:not(.is-visible) .cv-bar i,
html.has-js .cv-frame:not(.is-visible) .cv-lane,
html.has-js .cv-frame:not(.is-visible) .cv-track,
html.has-js .cv-frame:not(.is-visible) .cv-foot { opacity: 0; }

.cv-frame.is-visible .cv-stage > * { transition: opacity 0.45s ease calc(0.15s + var(--s) * 60ms), transform 0.45s var(--ease-out) calc(0.15s + var(--s) * 60ms), color 0.2s ease; }
.cv-frame.is-visible .cv-lane,
.cv-frame.is-visible .cv-track { transition: opacity 0.4s ease 0.2s, color 0.2s ease; }
/* bars draw as the card lands (web first, then the field stretches) */
.cv-frame.is-visible .cv-bar::before { transition: transform 0.8s var(--ease-out) calc(0.25s + (var(--a) - 2) * 90ms); }
.cv-frame.is-visible .cv-bar i { transition: opacity 0.3s ease 1s; }
.cv-frame.is-visible .cv-foot { transition: opacity 0.4s ease 1.05s; }

/* ─── Phones: the chart turns; stages are rows, bars run down ─────────── */
@media (max-width: 860px) {
  .cv-frame { padding: 8px 12px 12px; }
  .cv-chart {
    grid-template-columns: minmax(0, 1fr) 52px 52px;
    grid-template-rows: 56px repeat(6, auto);
  }
  .cv-stage {
    grid-column: 1 / -1;
    grid-row: var(--s);
    padding: 14px 116px 16px 8px;
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .cv-stage:last-child { border-right: 0; }
  .cv-band { border-top: 0; border-left: 2px solid var(--accent); }

  .cv-lane { grid-row: 1; flex-direction: column; gap: 3px; justify-self: center; font-size: 11px; text-align: center; line-height: 1.1; }
  .cv-lane--web   { grid-column: 2; }
  .cv-lane--field { grid-column: 3; }

  .cv-track { grid-row: 2 / -1; }
  .cv-track::before { left: 50%; right: auto; top: 0; bottom: 0; border-top: 0; border-left: 1px dashed var(--border-strong); }
  .cv-track--web   { grid-column: 2; }
  .cv-track--field { grid-column: 3; }

  .cv-bar { grid-row: var(--a) / var(--b); flex-direction: column; }
  .cv-bar--web   { grid-column: 2; }
  .cv-bar--field { grid-column: 3; }
  .cv-bar::before { left: 50%; right: auto; top: 10px; bottom: 10px; width: 22px; height: auto; margin: 0 0 0 -11px; transform-origin: center top; }
  html.has-js .cv-frame:not(.is-visible) .cv-bar::before { transform: scaleY(0); }

  .cv-foot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .cv-band, .cv-name, .cv-bar i::before { transition: none; }
}
