/* =========================================================================
   CAPACITY PLAN DEMO (#capacityPlanDemo) — the /sales-capacity-planning
   hero. See src/components/CapacityPlanDemo.astro for the storyboard.
   Timeline: public/js/capacity-plan-demo.js toggles `is-*` classes and
   positions `.cpd__cursor` at runtime.

   A single steady scene (no crossfade — same pattern as CapacityChainDemo
   and BudgetMultiplayerDemo): the segment-level plan never leaves view,
   because the point is watching one edit travel across the row. Same
   --xxx-* palette (product likeness) as every other demo on the site.
   ========================================================================= */

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

/* standard product-demo dimensions (matches every other demo's stage —
   width:100% keeps aspect-ratio from computing width off the min-height
   floor in a narrow container, the bug this pattern has hit before). */
.cpd__stage {
  position: relative; overflow: hidden; width: 100%;
  aspect-ratio: 3 / 2; min-height: 380px; max-width: 640px; margin: 0 auto;
  background: var(--cpd-canvas);
  display: flex; flex-direction: column;
  transition: opacity .5s ease;
}
.cpd.is-out .cpd__stage { opacity: 0; }

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

.cpd__pane {
  flex: 1; min-height: 0; min-width: 0; padding: 12px 14px;
  display: flex; flex-direction: column; justify-content: center;
}

/* ---------- panel header ---------- */
.cpdHead { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.cpdHead__title2 { font-size: 12px; font-weight: 600; color: var(--cpd-ink); }
.cpdHead__sub { font-size: 9.5px; color: var(--cpd-ink2); }

/* ---------- card grid — same card-style table as every other demo.
   Every row's last cell carries .cpdCell--last rather than relying on an
   nth-child rule, so the narrow-width column drop below can't leave a
   stray vertical rule behind. ---------- */
.cpdGrid {
  display: grid; grid-template-columns: 1fr 64px 42px 42px 66px;
  background: var(--cpd-card); border: 1px solid var(--cpd-border); border-radius: 8px;
  overflow: hidden; max-width: 100%;
}
.cpdCell {
  display: flex; align-items: center; justify-content: flex-end;
  padding: 6px 8px; font-size: 9.5px; color: var(--cpd-ink2);
  border-bottom: 1px solid var(--cpd-line); border-right: 1px solid var(--cpd-line);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: background .3s ease, outline-color .3s ease;
}
.cpdCell--last { border-right: none; }
.cpdCell--head { background: var(--cpd-head); font-weight: 500; border-bottom: 1px solid var(--cpd-border); }
.cpdCell--label { justify-content: flex-start; font-weight: 600; color: var(--cpd-ink); }
.cpdCell--val { font-variant-numeric: tabular-nums; position: relative; }
.cpdCell--total { font-weight: 700; color: var(--cpd-ink); border-top: 1px solid var(--cpd-border); border-bottom: none; }

/* the cell being typed into, and the cells recalculating behind it —
   same "being edited" / "just changed" language as the other demos. */
.cpdCell.is-editing {
  outline: 1.5px solid var(--cpd-accent); outline-offset: -1.5px;
  background: var(--cpd-accent-soft); color: var(--cpd-ink);
  animation: cpdCellPulse .8s ease-out;
}
@keyframes cpdCellPulse {
  0% { box-shadow: 0 0 0 0 rgba(106, 91, 198, .45); }
  70% { box-shadow: 0 0 0 8px rgba(106, 91, 198, 0); }
  100% { box-shadow: 0 0 0 0 rgba(106, 91, 198, 0); }
}
.cpdCell.is-flash {
  outline: 1.5px solid var(--cpd-accent); outline-offset: -1.5px;
  background: var(--cpd-accent-soft); color: var(--cpd-ink);
}

/* ---------- reconciliation footer — the single number the chain
   resolves into. ---------- */
.cpdRecon {
  display: flex; align-items: center; flex-wrap: wrap; gap: 4px 7px;
  margin-top: 10px; padding: 8px 10px;
  background: var(--cpd-card); border: 1px solid var(--cpd-border); border-radius: 8px;
  transition: background .3s ease, border-color .3s ease;
}
.cpd.is-recon-flash .cpdRecon { background: var(--cpd-green-soft); border-color: #BEE3CB; }
.cpdRecon__label { font-size: 9px; color: var(--cpd-ink2); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.cpdRecon__val { font-size: 11px; font-weight: 700; color: var(--cpd-ink); font-variant-numeric: tabular-nums; }
.cpdRecon__vs { font-size: 9px; color: var(--cpd-ink2); }
.cpdRecon__pill {
  margin-left: auto; flex: none;
  font-size: 8.5px; font-weight: 700; color: var(--cpd-green);
  background: var(--cpd-green-soft); border: 1px solid #BEE3CB; border-radius: 999px;
  padding: 3px 8px;
}

/* ---------- cursor — positioned at runtime (JS sets left/top in px via
   getBoundingClientRect against .cpd__stage). ---------- */
.cpd__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;
}
.cpd.is-cursor-visible .cpd__cursor { opacity: 1; }

/* ---------- responsive — below the width where five columns get cramped,
   drop the two intermediate count columns and keep the ends of the chain
   (target → cost) plus the totals. ---------- */
@media (max-width: 460px) {
  .cpdGrid { grid-template-columns: 1fr 66px 68px; }
  .cpdCell--hires { display: none; }
  .cpdRecon__vs, .cpdRecon__label { font-size: 8.5px; }
}
