/* ════════════════════════════════════════════════════════════════════
   MOONDOG · Anonymised product animations (fake data only).
   GSAP/ScrollTrigger adds the `.play` class when a widget scrolls into view;
   CSS does the drawing. Everything degrades to its final state without JS
   and under prefers-reduced-motion.
   ════════════════════════════════════════════════════════════════════ */

/* ── Shared frame ── */
.anim { background: var(--bg2); border: 1px solid var(--border); border-radius: var(--r-xl); box-shadow: var(--shadow-soft); overflow: hidden; }
.anim-chrome { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--border-soft); background: var(--bg1); }
.anim-dots { display: inline-flex; gap: 6px; }
.anim-dots i { width: 9px; height: 9px; border-radius: 999px; background: var(--bg4); }
.anim-cap { font-size: 11px; color: var(--text-muted); letter-spacing: .04em; }
.anim-legend { display: flex; flex-wrap: wrap; gap: 14px 18px; padding: 14px 22px 20px; border-top: 1px solid var(--border-soft); }
.anim-legend span { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-muted); }
.lk { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Asset-class colours (derived from product status palette) */
.seg-eq,  .lk-eq   { background: var(--blue); }
.seg-fi,  .lk-fi   { background: var(--green); }
.seg-alt, .lk-alt  { background: var(--purple); }
.seg-re,  .lk-re   { background: var(--amber); }
.seg-cash,.lk-cash { background: var(--text-dim); }

/* Count-up numbers should not jiggle width */
[data-countup] { font-variant-numeric: tabular-nums; }

/* ── Scenario engine ── */
.scn-list { padding: 20px 22px; display: flex; flex-direction: column; gap: 18px; }
.scn-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; }
.scn-name { font-family: var(--serif); font-size: 17px; }
.scn-ret { font-size: 15px; }
.scn-blue .scn-ret { color: var(--blue); }
.scn-gold .scn-ret { color: var(--accent); }
.scn-amber .scn-ret { color: var(--amber); }
.scn-bar { display: flex; height: 16px; border-radius: 999px; overflow: hidden; background: var(--bg3); }
.scn-bar .seg { width: 0; transition: width .9s var(--ease-out); }
.scn-metrics { display: flex; gap: 18px; margin-top: 8px; font-size: 11.5px; color: var(--text-muted); }
.scn-metrics b { color: var(--text-soft); }

/* segments draw in when played, staggered */
.anim.play .seg { width: var(--w); }
.scn-bar .seg:nth-child(2) { transition-delay: .06s; }
.scn-bar .seg:nth-child(3) { transition-delay: .12s; }
.scn-bar .seg:nth-child(4) { transition-delay: .18s; }
.scn-bar .seg:nth-child(5) { transition-delay: .24s; }

/* ── Compass concierge ── */
.cmp-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 0; }
.cmp-main { padding: 22px; border-right: 1px solid var(--border-soft); }
.cmp-eyebrow { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .12em; }
.cmp-q { font-family: var(--serif); font-size: clamp(18px, 2.4vw, 22px); line-height: 1.3; margin: 12px 0 18px; }
.cmp-caret { display: inline-block; width: 2px; height: 1em; background: var(--accent); margin-left: 2px; vertical-align: -2px; }
.anim.play .cmp-caret { animation: cmp-blink 1s steps(1) infinite; }
@keyframes cmp-blink { 50% { opacity: 0; } }
.cmp-opts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.cmp-opt { font-size: 12.5px; padding: 7px 13px; border: 1px solid var(--border); border-radius: 999px; color: var(--text-soft); }
.cmp-opt-on { border-color: var(--accent); color: var(--accent); background: var(--accent-bg); }
.cmp-range { position: relative; height: 6px; background: var(--bg3); border-radius: 999px; }
.cmp-range-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--accent); border-radius: 999px; transition: width 1s var(--ease-out) .2s; }
.anim.play .cmp-range-fill { width: 42%; }
.cmp-range-knob { position: absolute; top: 50%; left: 0; width: 14px; height: 14px; border-radius: 999px; background: var(--accent); border: 2px solid var(--bg2); transform: translate(-50%, -50%); transition: left 1s var(--ease-out) .2s; }
.anim.play .cmp-range-knob { left: 42%; }
.cmp-side { padding: 22px; display: flex; flex-direction: column; gap: 12px; background: var(--bg1); }
.cmp-insight { background: var(--bg2); border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--r-md); padding: 12px 14px; font-size: 13px; opacity: 0; transform: translateY(8px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); }
.cmp-insight p { margin: 6px 0 0; color: var(--text-soft); line-height: 1.5; }
.cmp-insight-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .12em; }
.cmp-insight-2 { border-left-color: var(--green); }
.cmp-saved { color: var(--green); font-size: 12px; }
.anim.play .cmp-insight { opacity: 1; transform: none; }
.anim.play .cmp-insight-2 { transition-delay: .35s; }
.anim.play .cmp-insight { transition-delay: .15s; }

/* ── Questionnaire hub ── */
.qst-progress { height: 3px; background: var(--bg3); }
.qst-progress-fill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-dark), var(--accent)); transition: width 1.1s var(--ease-out); }
.anim.play .qst-progress-fill { width: var(--w); }
.qst-meta { padding: 12px 22px 4px; font-size: 11.5px; color: var(--text-muted); }
.qst-rows { list-style: none; margin: 0; padding: 6px 22px 22px; display: flex; flex-direction: column; gap: 4px; }
.qst-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; font-size: 13.5px; color: var(--text-soft); border-bottom: 1px solid var(--border-soft); }
.qst-dot { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 999px; border: 1px solid var(--border-strong); display: inline-flex; align-items: center; justify-content: center; font-size: 11px; color: transparent; }
.qst-row[data-done] .qst-dot { background: var(--green-bg2); border-color: var(--green); color: var(--green); }
.qst-active { color: var(--text); }
.qst-dot-now { border-color: var(--accent); position: relative; }
.anim.play .qst-dot-now::after { content: ""; position: absolute; inset: 4px; border-radius: 999px; background: var(--accent); animation: qst-pulse 1.4s var(--ease) infinite; }
@keyframes qst-pulse { 0%,100% { opacity: .4; } 50% { opacity: 1; } }

/* ── Allocation breakdown ── */
.alloc-bar { display: flex; height: 22px; margin: 22px 22px 0; border-radius: 999px; overflow: hidden; background: var(--bg3); }
.alloc-bar .seg { width: 0; transition: width .9s var(--ease-out); }
.alloc-bar .seg:nth-child(2) { transition-delay: .07s; }
.alloc-bar .seg:nth-child(3) { transition-delay: .14s; }
.alloc-bar .seg:nth-child(4) { transition-delay: .21s; }
.alloc-bar .seg:nth-child(5) { transition-delay: .28s; }
.alloc-table { width: calc(100% - 44px); margin: 16px 22px 0; border-collapse: collapse; font-size: 13px; }
.alloc-table td { padding: 8px 0; border-bottom: 1px solid var(--border-soft); color: var(--text-soft); }
.alloc-table td:first-child { display: flex; align-items: center; gap: 8px; }
.alloc-pct { text-align: right; color: var(--text); }
.alloc-flag { margin: 14px 22px 22px; font-size: 12px; color: var(--green); }

/* ── Family alignment board ── */
.aln-question { padding: 20px 22px 0; font-family: var(--serif); font-size: 17px; }
.aln-track { position: relative; height: 10px; margin: 28px 30px 8px; background: var(--bg3); border-radius: 999px; }
.aln-band { position: absolute; top: 0; bottom: 0; left: 40%; width: 22%; background: var(--accent-bg3); border-radius: 999px; opacity: 0; transition: opacity .6s var(--ease-out) .5s; }
.anim.play .aln-band { opacity: 1; }
.aln-median { position: absolute; top: -4px; bottom: -4px; left: 49%; width: 2px; background: var(--text-soft); }
.aln-dot { position: absolute; top: 50%; left: var(--start, 50%); width: 22px; height: 22px; border-radius: 999px; background: var(--accent); color: var(--on-accent); border: 2px solid var(--bg2); transform: translate(-50%, -50%); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; transition: left 1.1s var(--ease); }
.aln-dot { --start: 50%; }
.anim.play .aln-dot { left: var(--x); }
.aln-scale { display: flex; justify-content: space-between; padding: 0 30px; font-size: 10.5px; color: var(--text-muted); }
.aln-tally { display: flex; gap: 8px; padding: 16px 22px 22px; }
.aln-chip { font-size: 12px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-soft); }
.aln-chip-on { border-color: var(--green); color: var(--green); background: var(--green-bg); }

/* ── Step layout (how-it-works) ── */
.steps { display: flex; flex-direction: column; gap: clamp(40px, 7vw, 80px); margin-top: 8px; }
.step { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(24px, 5vw, 56px); align-items: center; }
.step-rev .step-body { order: 2; }
.step-num { display: inline-block; font-size: 13px; color: var(--accent); border: 1px solid var(--accent-line); border-radius: 999px; padding: 3px 10px; margin-bottom: 14px; }
.step-body h3 { font-size: clamp(20px, 2.6vw, 26px); margin-bottom: 10px; }
.step-body p { font-size: 15px; line-height: 1.65; max-width: 44ch; }
@media (max-width: 820px) {
  .step { grid-template-columns: 1fr; gap: 24px; }
  .step-rev .step-body { order: 0; }
  .cmp-grid { grid-template-columns: 1fr; }
  .cmp-main { border-right: 0; border-bottom: 1px solid var(--border-soft); }
}

/* ── Reduced motion / no-JS: show final state ── */
@media (prefers-reduced-motion: reduce) {
  .anim .seg { width: var(--w) !important; transition: none !important; }
  .anim .qst-progress-fill { width: var(--w) !important; transition: none !important; }
  .anim .cmp-range-fill, .anim .cmp-range-knob { transition: none !important; }
  .anim .cmp-range-fill { width: 42% !important; }
  .anim .cmp-range-knob { left: 42% !important; }
  .anim .cmp-insight { opacity: 1 !important; transform: none !important; }
  .anim .aln-dot { left: var(--x) !important; transition: none !important; }
  .anim .aln-band { opacity: 1 !important; }
}
/* When JS is disabled entirely, .play never gets added; show final state. */
.no-js .anim .seg { width: var(--w); }
.no-js .anim .qst-progress-fill { width: var(--w); }
.no-js .anim .cmp-insight { opacity: 1; transform: none; }
.no-js .anim .aln-dot { left: var(--x); }

/* ── Client-ready output (IPS report preview) ── */
.anim-report { max-width: 560px; margin-inline: auto; }
.report-doc { padding: 20px 22px 22px; }
.report-head { display: flex; align-items: center; gap: 12px; padding-bottom: 14px; border-bottom: 1px solid var(--border-soft); }
.report-mark { font-size: 20px; color: var(--accent); line-height: 1; }
.report-headings { flex: 1; min-width: 0; }
.report-title { font-family: var(--serif); font-size: 17px; color: var(--text); margin: 0; }
.report-sub { font-size: 11px; color: var(--text-muted); margin: 2px 0 0; }
.report-status { font-size: 10.5px; color: var(--green); border: 1px solid var(--border); border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.report-rows { margin: 16px 0 0; display: grid; gap: 10px; }
.report-rows > div { display: flex; justify-content: space-between; gap: 16px; font-size: 12.5px; }
.report-rows dt { color: var(--text-muted); margin: 0; flex: 0 0 auto; }
.report-rows dd { color: var(--text-soft); margin: 0; text-align: right; }
.report-rows dd b { color: var(--text); }
.report-alloc { margin-top: 18px; }
.report-alloc-label { display: block; font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; }
.report-alloc .alloc-bar { margin: 0; height: 16px; }
.report-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border-soft); }
.report-foot .alloc-flag { margin: 0; }
.report-export { font-size: 11px; color: var(--text-muted); letter-spacing: .03em; }
