/* Animated figures for /research/is-rag-still-worth-it. Quiet by the lab guide:
   no boxes or badges, green = the result, red = the baseline or failure, grey for the rest.
   Each plays once when it scrolls into view (assets/js/rag-fig.js). Without JS or with
   reduced motion, the final state is simply drawn. */
.rf { position: relative; }

/* Figure 1: same model, with and without search */
.rf-row { padding: .8rem 0 .9rem; border-top: 1px solid var(--rule); }
.rf-row:last-of-type { border-bottom: 1px solid var(--rule); }
.rf-label { display: block; font-size: .8rem; font-weight: 600; margin-bottom: .35rem; }
.rf-flow { display: flex; align-items: center; flex-wrap: wrap; gap: .2rem .35rem; font-size: .75rem; color: var(--ink-2); }
.rf-w { white-space: nowrap; }
.rf-w.hit { font-weight: 600; color: var(--ink); }
.rf-a { position: relative; display: inline-block; width: 1rem; height: 1px; background: #c4c4c4; }
.rf-a::after { content: ""; position: absolute; right: 0; top: -3px; border: 3.5px solid transparent; border-left: 5px solid #c4c4c4; border-right: 0; }
.rf-a i { position: absolute; top: -2.5px; left: 0; width: 6px; height: 6px; border-radius: 50%; background: var(--good, #5fb883); opacity: 0; }
.rf-row.no .rf-a i { background: var(--bad, #ff3e3e); }
.rf-score { display: grid; grid-template-columns: 1fr 7.5rem; align-items: center; gap: .7rem; margin-top: .55rem; font-size: .75rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rf-track { display: block; height: .5rem; }
.rf-bar { display: block; height: 100%; width: var(--w); border-radius: 0 3px 3px 0; transform-origin: left; }
.rf-bar.bad { background: var(--bad, #ff3e3e); }
.rf-bar.good { background: var(--good, #5fb883); }
.rf-score b { font-weight: 600; color: var(--ink); }

/* Figure 2: your data, and the pile */
.df-rows { list-style: none; margin: 0; padding: 0; }
.df-row { display: grid; grid-template-columns: 10.5rem 1fr 6.2rem; gap: .9rem; padding: .6rem 0; border-top: 1px solid var(--rule); font-size: .75rem; line-height: 1.4; }
.df-yours { font-weight: 600; color: var(--ink); }
.df-yours small, .df-set small { display: block; font-weight: 400; font-size: .75rem; color: var(--muted); }
.df-set b { font-weight: 600; }
.df-n { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.df-pile { border-top: 1px solid var(--ink); padding-top: .8rem; }
.df-total { margin: 0 0 .45rem; font-size: .75rem; color: var(--ink-2); }
.df-total .rf-count { font-family: var(--display, serif); font-size: 1.6rem; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; margin-right: .4rem; }
.df-stack { display: flex; gap: 2px; height: .5rem; }
.df-seg { height: 100%; background: #c4c4c4; transform-origin: left; }
.df-seg:first-child { border-radius: 3px 0 0 3px; }
.df-seg:last-child { border-radius: 0 3px 3px 0; }
.df-labels { display: flex; gap: 2px; margin-top: .35rem; font-size: .7rem; line-height: 1.3; color: var(--muted); }
.df-labels span { min-width: 0; }

/* Figure 3: the layers */
.lf-rows { list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--rule); }
.lf-row { display: grid; grid-template-columns: .6rem 12rem 1fr; gap: .8rem; align-items: baseline; padding: .55rem 0; border-top: 1px solid var(--rule); font-size: .75rem; line-height: 1.4; color: var(--ink-2); }
.lf-dot { width: .55rem; height: .55rem; border-radius: 50%; background: #c4c4c4; align-self: center; }
.lf-dot.good { background: var(--good, #5fb883); }
.lf-dot.bad { background: var(--bad, #ff3e3e); }
.lf-name { font-weight: 600; color: var(--ink); }
.lf-name small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }

/* Animated states */
.rf-js [data-s] { opacity: 0; transform: translateY(5px); transition: opacity .45s ease, transform .45s ease; }
.rf-js [data-s].on { opacity: 1; transform: none; }
.rf-js .rf-row .rf-w { opacity: .25; transition: opacity .35s ease calc(var(--k, 0) * .45s); }
.rf-js .rf-row.on .rf-w { opacity: 1; }
.rf-js .rf-row.on .rf-a i { animation: rf-go .45s linear calc(var(--k, 0) * .45s - .45s) both; }
.rf-js .rf-bar { transform: scaleX(0); }
.rf-js .rf-row.on .rf-bar { transform: none; transition: transform 1s cubic-bezier(.2,.7,.2,1) calc(var(--k, 0) * .45s); }
.rf-js .df-seg[data-s] { opacity: 1; transform: scaleX(0); transition: transform .7s cubic-bezier(.2,.7,.2,1); }
.rf-js .df-seg[data-s].on { transform: none; }
@keyframes rf-go { 0% { left: 0; opacity: 0; } 15% { opacity: 1; } 85% { opacity: 1; } 100% { left: calc(100% - 6px); opacity: 0; } }

@media (max-width: 640px) {
  .df-row { grid-template-columns: 1fr 5.5rem; }
  .df-yours { grid-column: 1 / -1; }
  .lf-row { grid-template-columns: .6rem 1fr; }
  .lf-row > span:last-child { grid-column: 2; }
}
