/* ==========================================================================
   REPORTS: describe a report, watch it build itself (js/reports.js)
   The window is always the app's dark; the words around it follow the theme.
   ========================================================================== */
.rp { position: relative; padding: 12vh 0 14vh; }
.rp-wrap { max-width: calc(84rem + var(--gutter) * 2); }
.rp-head { max-width: 46rem; }
.rp-head .lede { margin-top: 1.25rem; }
.rp-body { display: grid; grid-template-columns: minmax(15rem, 19rem) minmax(0, 1fr); gap: clamp(1.5rem, 3.5vw, 3.5rem); align-items: center; margin-top: clamp(2.5rem, 6vh, 4rem); }

/* the three steps: the one playing is lit, with a bar that fills while it plays */
.rp-steps { display: flex; flex-direction: column; gap: .4rem; counter-reset: rp; }
.rp-steps li { position: relative; padding: 1.1rem 0 1.15rem 2.6rem; border-top: 1px solid var(--hair); color: var(--muted-foreground); transition: color .4s ease; counter-increment: rp; }
.rp-steps li::before { content: "0" counter(rp); position: absolute; left: 0; top: 1.25rem; font: 500 .78rem/1 "JetBrains Mono", ui-monospace, monospace; color: var(--text-ghost); }
.rp-steps b { display: block; font: 600 1.18rem/1.25 var(--font-display); color: var(--muted-foreground); transition: color .4s ease; }
.rp-steps span { display: block; max-height: 0; overflow: hidden; opacity: 0; margin-top: 0; font-size: .95rem; line-height: 1.55; transition: max-height .5s var(--ease), opacity .4s ease, margin .4s ease; }
.rp-steps i { position: absolute; left: 0; right: 0; top: -1px; height: 1px; transform: scaleX(0); transform-origin: left; background: linear-gradient(90deg, #a78bfa, #e879f9); }
.rp-steps li.on b { color: var(--foreground); }
.rp-steps li.on span { max-height: 7rem; opacity: 1; margin-top: .5rem; }
.rp-steps li.on i { animation: rp-step 4s linear forwards; }
@keyframes rp-step { to { transform: scaleX(1); } }

/* ---------- the window ---------- */
.rp-win {
  --ink: #ece9f5; --mute: #9a93b0; --line: rgb(255 255 255 / .07); --tile: rgb(255 255 255 / .035);
  position: relative; overflow: hidden; border-radius: 22px; padding: 18px 20px 16px;
  background: radial-gradient(70% 60% at 80% 0%, rgb(124 58 237 / .2), transparent 70%), radial-gradient(60% 50% at 0% 100%, rgb(20 168 245 / .1), transparent 70%), #0d0a1f;
  border: 1px solid rgb(255 255 255 / .12); box-shadow: 0 60px 140px -30px rgb(76 29 149 / .6), 0 0 0 1px rgb(0 0 0 / .4);
  color: var(--ink); font-family: var(--font-body); color-scheme: dark;
}
.rp-win p { margin: 0; }
.rp-bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0 2px 14px; font-size: .85rem; color: var(--mute); }
.rp-crumb i, .rp-range i { font-style: normal; margin: 0 .45rem; opacity: .6; }
.rp-range { padding: .35rem .7rem; border-radius: 10px; border: 1px solid var(--line); }

.rp-ask { display: flex; align-items: center; gap: .8rem; padding: .85rem .85rem .85rem 1rem; border-radius: 16px; border: 1px solid rgb(167 139 250 / .35); background: rgb(139 92 246 / .08); box-shadow: 0 0 0 4px rgb(139 92 246 / .06); }
.rp-ask svg { width: 20px; height: 20px; flex: none; fill: none; stroke: #c4b5fd; stroke-width: 1.7; stroke-linecap: round; }
.rp-q { flex: 1; min-width: 0; min-height: 1.5em; font: 400 1.05rem/1.45 var(--font-display); color: #f5f3fb; }
.rp-caret { display: inline-block; width: 2px; height: 1.1em; margin-left: 2px; vertical-align: -.2em; background: #c4b5fd; animation: rp-blink 1s steps(2) infinite; }
@keyframes rp-blink { 50% { opacity: 0; } }
.rp-go { flex: none; padding: .55rem 1rem; border-radius: 11px; background: linear-gradient(135deg, #c4b5fd, #f0abfc); color: #1a1030; font-weight: 600; font-size: .88rem; transition: transform .2s ease, filter .2s ease; }
.rp-go.pressed { transform: scale(.94); filter: brightness(1.15); }
.rp-win.built .rp-caret { display: none; }

/* the canvas: parts arrive as placeholders, then fill */
.rp-canvas { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: auto; gap: 12px; margin-top: 14px; min-height: 22rem; align-content: start; }
.rp-part { position: relative; min-width: 0; padding: 14px 16px; border-radius: 14px; background: var(--tile); border: 1px solid var(--line); opacity: 0; transform: translateY(10px) scale(.98); transition: opacity .4s ease, transform .5s var(--ease), border-color .4s ease; }
.rp-part.seen { opacity: 1; transform: none; }
.rp-part.on { border-color: rgb(167 139 250 / .2); }
.rp-t { font-size: .8rem; color: var(--mute); }
.rp-sk { display: grid; gap: 8px; margin-top: 12px; }
.rp-sk i { display: block; height: 10px; border-radius: 6px; background: linear-gradient(90deg, rgb(255 255 255 / .05), rgb(255 255 255 / .12), rgb(255 255 255 / .05)) 0 0 / 200% 100%; animation: rp-shim 1.4s linear infinite; }
.rp-sk i:nth-child(1) { width: 70%; height: 18px; } .rp-sk i:nth-child(3) { width: 45%; }
@keyframes rp-shim { to { background-position: -200% 0; } }
.rp-b { display: none; }
.rp-part.on .rp-sk { display: none; }
.rp-part.on .rp-b { display: block; animation: rp-in .45s var(--ease) both; }
@keyframes rp-in { from { opacity: 0; transform: translateY(6px); } }
.k-line .rp-sk, .k-bars .rp-sk, .k-funnel .rp-sk, .k-table .rp-sk, .k-donut .rp-sk { min-height: 9.5rem; align-content: end; }

/* kpi */
.rp-v { margin-top: 6px !important; font: 600 1.7rem/1.1 var(--font-display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.rp-d { margin-top: 4px !important; font-size: .78rem; color: #fca5a5; }
.rp-d.up { color: #6ee7b7; }
.rp-d small { color: var(--mute); font-size: inherit; }

/* line */
.rp-line { display: block; width: 100%; height: 8.2rem; margin-top: 10px; overflow: visible; }
.rp-line .g { stroke: var(--line); stroke-width: 1; fill: none; vector-effect: non-scaling-stroke; }
.rp-line .prev { fill: none; stroke: rgb(255 255 255 / .28); stroke-width: 1.5; stroke-dasharray: 4 5; vector-effect: non-scaling-stroke; }
.rp-line .now { fill: none; stroke: #a78bfa; stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 1; filter: drop-shadow(0 0 8px rgb(167 139 250 / .6)); }
.rp-line .area { fill: rgb(167 139 250 / .12); opacity: 0; }
.rp-part.on .rp-line .now { animation: rp-draw 1.3s var(--ease) .1s forwards; }
.rp-part.on .rp-line .area { animation: rp-fade .8s ease .9s forwards; }
@keyframes rp-draw { to { stroke-dashoffset: 0; } }
@keyframes rp-fade { to { opacity: 1; } }
.rp-key { display: flex; gap: 1rem; margin-top: 8px !important; font-size: .74rem; color: var(--mute); }
.rp-key span::before { content: ""; display: inline-block; width: 14px; height: 2px; margin-right: 6px; vertical-align: middle; background: #a78bfa; }
.rp-key .k2::before { background: none; border-top: 2px dashed rgb(255 255 255 / .35); height: 0; }
.rp-key .k3::before { background: #14a8f5; }

/* bars and funnel */
.rp-bars { display: grid; gap: 9px; margin-top: 12px; }
.rp-bars p { display: grid; grid-template-columns: 4.6rem minmax(2.5rem, 1fr) 3rem; align-items: center; gap: 8px; font-size: .76rem; color: #cfc9df; }
.rp-bars span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-bars b { height: 10px; border-radius: 5px; background: rgb(255 255 255 / .05); overflow: hidden; }
.rp-bars b i { display: block; height: 100%; width: calc(var(--w) * 100%); border-radius: inherit; background: linear-gradient(90deg, #6b4cf0, #e053b0); transform: scaleX(0); transform-origin: left; }
.rp-bars.fun b { height: 18px; border-radius: 6px; }
.rp-bars.fun b i { background: linear-gradient(90deg, #14a8f5, #6b4cf0); }
.rp-bars em { text-align: right; font-style: normal; font-variant-numeric: tabular-nums; color: var(--ink); }
.rp-part.on .rp-bars b i { animation: rp-grow .9s var(--ease) calc(.15s + var(--i) * .09s) forwards; }
@keyframes rp-grow { to { transform: scaleX(1); } }

/* donut */
.rp-donut { position: relative; width: 7.4rem; margin: 10px auto 0; }
.rp-donut svg { display: block; width: 100%; transform: rotate(-90deg); }
.rp-donut circle { fill: none; stroke-width: 13; }
.rp-donut .t { stroke: #14a8f5; opacity: .75; }
.rp-donut .s1 { stroke: #a78bfa; stroke-dasharray: 0 var(--c); }
.rp-part.on .rp-donut .s1 { animation: rp-arc 1.2s var(--ease) .15s forwards; }
@keyframes rp-arc { to { stroke-dasharray: var(--len) var(--c); } }
.rp-donut p { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font-size: .7rem; color: var(--mute); line-height: 1.2; }
.rp-donut p b { display: block; font: 600 1.3rem/1 var(--font-display); color: var(--ink); }
.k-donut .rp-key { justify-content: center; }

/* table */
.rp-table { margin-top: 8px; }
.rp-table p { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--line); font-size: .8rem; color: #cfc9df; opacity: 0; animation: rp-in .4s ease calc(.1s + var(--i) * .08s) forwards; }
.rp-table p:first-child { border-top: 0; }
.rp-table b { font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* sources, and who is looking */
.rp-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; min-height: 2rem; margin-top: 12px; }
.rp-src { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: .74rem; color: var(--mute); opacity: 0; transition: opacity .5s ease; }
.rp-src span { padding: 4px 9px; border-radius: 8px; background: rgb(255 255 255 / .06); color: #cfc9df; }
.rp-src small { margin-left: 4px; font-size: inherit; }
.rp-win.built .rp-src { opacity: 1; }
.rp-as { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: #fcd34d; }
.rp-av { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; flex: none; font: 600 .62rem/1 var(--font-display); color: #1a1030; }
.rp-av.a1 { background: linear-gradient(140deg, #fcd34d, #f472b6 55%, #8b5cf6); }
.rp-av.a2 { background: linear-gradient(140deg, #7dd3fc, #a78bfa); }

/* the share sheet, and Jordan's view: money parts locked */
.rp-share {
  position: absolute; right: 18px; bottom: 58px; width: min(19rem, 70%); padding: 14px 16px; border-radius: 16px;
  background: rgb(23 19 42 / .94); border: 1px solid rgb(167 139 250 / .35); box-shadow: 0 30px 70px -20px rgb(0 0 0 / .7);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  opacity: 0; transform: translateY(16px) scale(.97); pointer-events: none; transition: opacity .4s ease, transform .5s var(--ease); z-index: 2;
}
.rp-win.shared .rp-share { opacity: 1; transform: none; }
.rp-win.as-jordan .rp-share { opacity: 0; transform: translateY(10px); transition-delay: .2s; }
.rp-share-h { font-size: .9rem; color: var(--mute); margin-bottom: 10px !important; }
.rp-share-h b { color: var(--ink); }
.rp-who { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: .82rem; }
.rp-who > span:nth-child(2) { flex: 1; color: var(--mute); }
.rp-who b { color: var(--ink); margin-right: 6px; }
.rp-who em { font-style: normal; font-size: .76rem; color: #c4b5fd; }
.rp-share-n { margin-top: 8px !important; font-size: .74rem; color: var(--mute); }
.rp-lock {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 1rem; border-radius: inherit; text-align: center;
  font-size: .76rem; color: #fcd34d; background: rgb(13 10 31 / .55); opacity: 0; transition: opacity .5s ease; pointer-events: none;
}
.rp-part[data-money] .rp-b { transition: filter .5s ease; }
.rp-win.as-jordan .rp-part[data-money] .rp-b { filter: blur(9px); }
.rp-win.as-jordan .rp-part[data-money] .rp-lock { opacity: 1; }
.rp-win.as-jordan .rp-part[data-money] { border-color: rgb(252 211 77 / .3); }

/* ---------- smaller windows ---------- */
@media (max-width: 1100px) {
  .rp-body { grid-template-columns: 1fr; }
  .rp-steps { flex-direction: row; gap: 1rem; }
  .rp-steps li { flex: 1; padding-left: 0; padding-top: 2rem; }
  .rp-steps li::before { top: 1rem; }
  .rp-steps li.on span { max-height: 9rem; }
}
@media (max-width: 760px) {
  .rp-steps { gap: .6rem; }
  .rp-steps b { font-size: .95rem; }
  .rp-steps span { display: none; }
  .rp-win { padding: 12px 12px 12px; border-radius: 18px; }
  .rp-range { display: none; }
  .rp-q { font-size: .92rem; min-height: 4.4em; }
  .rp-go { padding: .5rem .75rem; font-size: .8rem; }
  .rp-canvas { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; min-height: 22rem; }
  .rp-part { padding: 11px 12px; }
  .rp-part.k-line, .rp-part.k-bars, .rp-part.k-funnel, .rp-part.k-table, .rp-part.k-donut { grid-column: span 2 !important; }
  .rp-part.k-donut, .rp-part.k-table, .rp-part.k-bars { display: none; }
  .rp-v { font-size: 1.3rem; }
  .rp-src small { display: none; }
  .rp-share { right: 10px; left: 10px; width: auto; bottom: 50px; }
}
