/* =========================================================================
   THREE STATEMENT DEMO (#threeStatementDemo).
   See src/components/ThreeStatementDemo.astro for the storyboard.
   Timeline: public/js/three-statement-demo.js toggles `is-*` classes and
   positions `.stmt__cursor` at runtime.

   A single steady scene (no crossfade — same pattern as CapacityChainDemo/
   BudgetMultiplayerDemo): the P&L, balance sheet and cash flow for one
   month, side by side. Same --xxx-* palette (product likeness) as every
   other demo on the site.
   ========================================================================= */

.stmt {
  --stmt-canvas: #FAF9F5;
  --stmt-card: #FFFFFF;
  --stmt-border: #DBDBDE;
  --stmt-line: #EAEAEA;
  --stmt-head: #F6F6F7;
  --stmt-ink: #2B2B2B;
  --stmt-ink2: #777777;
  --stmt-accent: #6A5BC6;
  --stmt-accent-soft: #ECECFF;
}

/* standard product-demo dimensions (width:100% keeps aspect-ratio from
   computing width off the min-height floor in a narrow container). */
.stmt__stage {
  position: relative; overflow: hidden; width: 100%;
  aspect-ratio: 3 / 2; min-height: 380px; max-width: 640px; margin: 0 auto;
  background: var(--stmt-canvas);
  display: flex; flex-direction: column;
  transition: opacity .5s ease;
}
.stmt.is-out .stmt__stage { opacity: 0; }

.stmt__topBar {
  flex: none; font-size: 11px; font-weight: 600; color: var(--stmt-ink);
  padding: 12px 14px 9px; border-bottom: 1px solid var(--stmt-line);
  white-space: nowrap;
}

.stmt__pane { flex: 1; min-height: 0; min-width: 0; padding: 12px 14px; display: flex; flex-direction: column; }

.stmtHead { margin: 0 0 10px; font-size: 12px; font-weight: 600; color: var(--stmt-ink); text-align: center; }

/* ---------- three statement columns, side by side ---------- */
.stmt__grid { display: flex; gap: 8px; flex: 1; min-height: 0; }
.stmtCol {
  flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px;
  background: var(--stmt-card); border: 1px solid var(--stmt-border); border-radius: 8px;
  padding: 8px 8px 10px;
}
.stmtCol__title {
  margin: 0 0 4px; font-size: 9.5px; font-weight: 700; color: var(--stmt-ink);
  text-transform: uppercase; letter-spacing: .03em;
  border-bottom: 1px solid var(--stmt-line); padding-bottom: 5px;
}
.stmtRow {
  display: flex; align-items: baseline; justify-content: space-between; gap: 4px;
  padding: 2.5px 3px; border-radius: 4px;
  transition: background .3s ease, outline-color .3s ease;
}
.stmtRow__label { font-size: 8.5px; color: var(--stmt-ink2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stmtRow__val { font-size: 9px; font-weight: 500; color: var(--stmt-ink); font-variant-numeric: tabular-nums; flex: none; }
.stmtRow--total { margin-top: 2px; padding-top: 4px; border-top: 1px solid var(--stmt-line); }
.stmtRow--total .stmtRow__label, .stmtRow--total .stmtRow__val { font-weight: 700; color: var(--stmt-ink); }

/* the Net Income figure, highlighted in each of its three places. */
.stmtRow.is-lit {
  background: var(--stmt-accent-soft);
  outline: 1.5px solid var(--stmt-accent); outline-offset: -1.5px;
}
.stmtRow.is-lit .stmtRow__label, .stmtRow.is-lit .stmtRow__val { color: var(--stmt-accent); }

/* ---------- cursor — positioned at runtime (JS sets left/top in px via
   getBoundingClientRect against .stmt__stage). ---------- */
.stmt__cursor {
  position: absolute; opacity: 0; pointer-events: none; z-index: 9;
  transition: left .6s cubic-bezier(.5, .05, .3, 1), top .6s cubic-bezier(.5, .05, .3, 1), opacity .3s ease;
}
.stmt.is-cursor-visible .stmt__cursor { opacity: 1; }

/* ---------- responsive — three columns get tight below ~420px; drop to
   a single stacked column instead of squeezing text unreadably. ---------- */
@media (max-width: 420px) {
  .stmt__stage { aspect-ratio: auto; min-height: 560px; }
  .stmt__grid { flex-direction: column; }
}
