/* Motion pass: counters, staggered reveals, chart toggle, desk-panel sequencing,
   flow line, the CI-check demo, copy-button feedback. All CSS transitions and rAF, no library. */

/* ---------- reveal: shorter and lower, per the review ---------- */
.reveal { transform: translateY(10px); transition: opacity .32s ease, transform .32s ease; }
.value-grid .value-card:nth-child(2) { transition-delay: .1s; }
.value-grid .value-card:nth-child(3) { transition-delay: .2s; }
.price-grid .price-card:nth-child(2) { transition-delay: .08s; }
.price-grid .price-card:nth-child(3) { transition-delay: .16s; }
.log-item:nth-child(2) { transition-delay: .08s; }
.log-item:nth-child(3) { transition-delay: .16s; }
.faq-item.reveal:nth-child(2) { transition-delay: .06s; }
.faq-item.reveal:nth-child(3) { transition-delay: .12s; }
.faq-item.reveal:nth-child(4) { transition-delay: .18s; }
.faq-item.reveal:nth-child(5) { transition-delay: .24s; }

/* ---------- N.01: the citation micro-demo ---------- */
.cite { position: relative; display: inline; padding: 0 2px; margin: 0 -2px; white-space: nowrap;
  background-image: linear-gradient(var(--blue-tint), var(--blue-tint)); background-repeat: no-repeat;
  background-size: 0% 100%; background-position: left center; transition: background-size .35s ease .05s;
  border-bottom: 1px dotted var(--blue); }
.cite::after { content: attr(data-src); position: absolute; left: 0; bottom: calc(100% + 6px);
  font-family: var(--mono); font-size: 11px; font-weight: 500; letter-spacing: -0.02em; text-transform: uppercase;
  color: #fff; background: var(--blue); padding: 3px 6px; white-space: nowrap;
  opacity: 0; transform: translateY(4px); transition: opacity .25s ease, transform .25s ease; pointer-events: none; }
.value-card:hover .cite, .value-card:focus-within .cite { background-size: 100% 100%; }
.value-card:hover .cite::after, .value-card:focus-within .cite::after { opacity: 1; transform: none; transition-delay: .3s; }

/* ---------- N.02: counters and the chart toggle ---------- */
.stats .n[data-count] { font-variant-numeric: tabular-nums; }
.chart-cap { flex-wrap: wrap; row-gap: 12px; }
.chart-cap .asof { color: var(--grey-3); margin-left: 8px; }
.chart-toggle { display: inline-flex; border: 1px solid var(--line); margin-left: auto; }
.chart-toggle button { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: -0.04em; text-transform: uppercase;
  color: var(--grey-2); padding: 6px 10px; background: transparent; transition: background .2s ease, color .2s ease; }
.chart-toggle button + button { border-left: 1px solid var(--line); }
.chart-toggle button.is-on { background: var(--ink); color: var(--cream); }
.chart-toggle button:hover:not(.is-on) { color: var(--ink); }
.chart svg rect { transition: y .4s ease, height .4s ease; }
.chart svg .ylab, .chart svg .grid { transition: opacity .3s ease; }
.chart svg .lab3 { transition: opacity .3s ease; }
.chart-key i.k10, .chart-key span.k10 { transition: opacity .3s ease; }
.chart-key.is-share i.k10, .chart-key.is-share .k10t { opacity: 0.25; }

/* ---------- N.03: the desk panel sequences on entry ---------- */
.deskpanel.will-seq .dp-bar, .deskpanel.will-seq .dp-query, .deskpanel.will-seq .dp-chips span,
.deskpanel.will-seq .dp-sum, .deskpanel.will-seq .dp-stats > div, .deskpanel.will-seq .dp-table tbody tr,
.deskpanel.will-seq .dp-foot { opacity: 0; transform: translateY(6px); transition: opacity .35s ease, transform .35s ease; }
.deskpanel.will-seq .dp-table tbody tr { transform: none; }
.deskpanel.is-seq .dp-bar, .deskpanel.is-seq .dp-query, .deskpanel.is-seq .dp-chips span,
.deskpanel.is-seq .dp-sum, .deskpanel.is-seq .dp-stats > div, .deskpanel.is-seq .dp-table tbody tr,
.deskpanel.is-seq .dp-foot { opacity: 1; transform: none; transition-delay: calc(var(--i, 0) * 60ms); }
.deskpanel .dp-stats b { font-variant-numeric: tabular-nums; }
.deskpanel .dp-table tbody tr td:first-child { position: relative; }
.deskpanel .dp-table tbody tr td:first-child::before { content: ""; position: absolute; left: 4px; top: 50%; width: 4px; height: 4px; margin-top: -2px;
  background: var(--blue); opacity: 0; transition: opacity .3s ease; }
.deskpanel.is-seq .dp-table tbody tr td:first-child::before { opacity: 1; transition-delay: calc(var(--i, 0) * 60ms + 120ms); }

/* ---------- N.04: the flow line through the cards ---------- */
.how-grid { position: relative; }
.how-flow { position: absolute; left: 0; right: 0; top: 197px; height: 1px; pointer-events: none; overflow: visible; }
.how-flow svg { position: absolute; left: 0; top: -12px; width: 100%; height: 24px; overflow: visible; }
.how-flow .base { stroke: var(--line); stroke-width: 1; }
.how-flow .draw { stroke: var(--blue); stroke-width: 2; transition: stroke-dashoffset .45s ease; }
.how-flow .node { fill: var(--cream); stroke: var(--grey-3); stroke-width: 1; transition: fill .3s ease, stroke .3s ease; }
.how-flow .node.is-on { fill: var(--blue); stroke: var(--blue); }
@media (max-width: 1080px) { .how-flow { display: none; } }

/* ---------- N.05: copy button feedback ---------- */
.code .bar button { transition: transform .12s ease, color .2s ease, background .2s ease; }
.code .bar button:active { transform: scale(0.94); }
.code .bar button.is-done { color: var(--blue); }
.code pre .code-cursor { display: inline-block; width: 7px; height: 14px; vertical-align: -2px; background: var(--blue); margin-left: 2px; animation: blink 1s steps(1) infinite; }

/* ---------- N.07: the CI-check demo ---------- */
.ci-demo { margin-top: 48px; border: 1px solid var(--line-dark); display: grid; grid-template-columns: 5fr 7fr; }
.ci-demo > div { min-width: 0; }
.ci-copy { padding: 32px; border-right: 1px solid var(--line-dark); display: flex; flex-direction: column; gap: 16px; }
.ci-copy .kicker { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: -0.04em; text-transform: uppercase; color: var(--on-dark-3); }
.ci-copy .h4 { color: var(--on-dark); }
.ci-copy .body { max-width: 380px; }
.ci-switch { display: inline-grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line-dark); margin-top: 8px; align-self: flex-start; }
.ci-switch button { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: -0.04em; text-transform: uppercase; color: var(--on-dark-3);
  padding: 10px 14px; background: transparent; text-align: left; transition: background .2s ease, color .2s ease; }
.ci-switch button + button { border-left: 1px solid var(--line-dark); }
.ci-switch button.is-on { background: var(--cream); color: var(--ink); }
.ci-switch button:hover:not(.is-on) { color: var(--on-dark); }
.ci-term { background: var(--ink-2); font-family: var(--mono); font-size: 13px; letter-spacing: -0.03em; color: var(--on-dark-2); display: flex; flex-direction: column; min-height: 320px; }
.ci-term .bar { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line-dark); font-size: 12px; font-weight: 500; text-transform: uppercase; letter-spacing: -0.04em; color: var(--on-dark-3); }
.ci-term .bar i { display: inline-grid; place-items: center; width: 16px; height: 16px; background: var(--blue); color: #fff; font-style: normal; margin-right: 8px; }
.ci-term .lines { padding: 16px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.ci-line { display: flex; gap: 12px; align-items: baseline; opacity: 0; transform: translateY(4px); transition: opacity .3s ease, transform .3s ease; white-space: pre-wrap; word-break: break-word; }
.ci-line.is-on { opacity: 1; transform: none; }
.ci-line .p { color: var(--on-dark-3); flex: none; width: 28px; }
.ci-line .k { color: #7C9CCB; }
.ci-line .s { color: var(--on-dark); }
.ci-line .m { color: #E0A15B; }
.ci-line .ok { color: #5BB98B; }
.ci-line .no { color: #E06B5B; }
.ci-line .run { display: inline-block; width: 1.6em; overflow: hidden; vertical-align: bottom; white-space: nowrap; }
.ci-line .run::after { content: "..."; display: block; width: 0; overflow: hidden; white-space: nowrap; animation: cidots 1.2s steps(4, end) infinite; }
@keyframes cidots { from { width: 0; } to { width: 1.6em; } }
.ci-verdict { margin-top: auto; border-top: 1px solid var(--line-dark); padding: 14px; display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--on-dark);
  opacity: 0; transition: opacity .3s ease, background .3s ease; min-height: 52px; }
.ci-verdict.is-on { opacity: 1; }
.ci-verdict .mark { width: 22px; height: 22px; display: grid; place-items: center; flex: none; color: #fff; }
.ci-verdict.is-fail .mark { background: #C7402C; }
.ci-verdict.is-pass .mark { background: #2E8B57; }
.ci-verdict .mark svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 2; fill: none; }
.ci-verdict.is-fail { background: rgba(199, 64, 44, 0.12); }
.ci-verdict.is-pass { background: rgba(46, 139, 87, 0.12); }
.ci-verdict b { font-weight: 500; }
.ci-verdict small { color: var(--on-dark-3); font-family: var(--mono); font-size: 11px; margin-left: auto; white-space: nowrap; }
@media (max-width: 1080px) {
  .ci-demo { grid-template-columns: 1fr; }
  .ci-copy { border-right: 0; border-bottom: 1px solid var(--line-dark); }
}
@media (max-width: 720px) {
  .ci-copy { padding: 24px; }
  .ci-switch { grid-template-columns: 1fr; }
  .ci-switch button + button { border-left: 0; border-top: 1px solid var(--line-dark); }
  .ci-term { font-size: 12px; min-height: 0; }
  .ci-verdict small { display: none; }
  .chart-toggle { margin-left: 0; }
  .dp-foot { flex-wrap: wrap; gap: 4px 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal, .ci-line, .ci-verdict, .deskpanel.will-seq * { transition: none !important; }
  .chart svg rect { transition: none; }
  .how-flow .draw { transition: none; }
}
