/* ---------- Mocks that play ---------------------------------------------
   Add-on to approach-mocks.css, driven by assets/js/ax-play.js. A mock is
   static markup; on a page that loads the script it runs once when it comes
   into view, the way the tool it shows would: the agent's steps arrive in
   order, the stale file is struck line by line, the decision is stamped.

   The window frame and its bar never move, and every beat keeps its place
   in the layout, so nothing shifts while it runs. The script adds
   .ax-anim (armed: beats wait), .ax-run (playing) and .ax-done (finished);
   each beat carries its start time in --d. Without the script, with
   reduced motion, or in print, the mock is the static one. */

.ax-anim .ax-beat { opacity: 0; }

.ax-run .ax-beat {
    animation: ax-in 460ms cubic-bezier(0.16, 1, 0.3, 1) var(--d, 0ms) both;
}
@keyframes ax-in {
    from { opacity: 0; transform: translateY(7px); }
    to { opacity: 1; transform: none; }
}

/* the prompt is sent: it rises out of the composer's side of the window */
.ax-run .ax-me.ax-beat { animation-name: ax-send; animation-duration: 520ms; }
@keyframes ax-send {
    from { opacity: 0; transform: translateY(14px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

/* agent steps come in from the left, like a log line being written */
.ax-run .ax-step.ax-beat { animation-name: ax-log; }
@keyframes ax-log {
    from { opacity: 0; transform: translateX(-6px); }
    to { opacity: 1; transform: none; }
}

/* a verdict lands a moment after its row: the mark is the last thing in */
.ax-anim .ax-list li.ax-beat::before { opacity: 0; }
.ax-run .ax-list li.ax-beat::before {
    animation: ax-mark 380ms cubic-bezier(0.16, 1, 0.3, 1) calc(var(--d, 0ms) + 140ms) both;
}
@keyframes ax-mark {
    from { opacity: 0; transform: scale(0.4); }
    to { opacity: 1; transform: none; }
}

/* the one row that is the human's call: it arrives last and settles */
.ax-run .ax-list li.you.ax-beat {
    animation-name: ax-call;
    animation-duration: 640ms;
}
@keyframes ax-call {
    from { opacity: 0; transform: translateY(10px); clip-path: inset(0 0 100% 0 round 6px); }
    to { opacity: 1; transform: none; clip-path: inset(0 0 0 0 round 6px); }
}

/* a file or a tool call is written top to bottom */
.ax-run .ax-code.ax-beat {
    animation-name: ax-write;
    animation-duration: 700ms;
}
@keyframes ax-write {
    from { opacity: 0; clip-path: inset(0 0 100% 0); }
    30% { opacity: 1; }
    to { opacity: 1; clip-path: inset(0 0 0 0); }
}

/* a stale statement reads as current until the strike is drawn through it */
.ax-anim .ax-code .stale.ax-beat {
    opacity: 1;
    color: var(--ax-ink);
    text-decoration: none;
    background: linear-gradient(var(--ax-no), var(--ax-no)) no-repeat 0 54% / 0% 1px;
}
.ax-run .ax-code .stale.ax-beat {
    animation: ax-strike 420ms cubic-bezier(0.65, 0, 0.35, 1) var(--d, 0ms) both;
}
@keyframes ax-strike {
    from { background-size: 0% 1px; color: var(--ax-ink); }
    to { background-size: 100% 1px; color: var(--ax-dim); }
}
.ax-run .ax-code .flag.ax-beat { animation-name: ax-flag; }
@keyframes ax-flag {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}

/* the meter counts up to its reading */
.ax-anim .ax-meter .fill { clip-path: inset(0 100% 0 0 round 99px); }
.ax-run .ax-meter .fill {
    animation: ax-fill 900ms cubic-bezier(0.16, 1, 0.3, 1) calc(var(--d, 0ms) + 200ms) both;
}
@keyframes ax-fill {
    from { clip-path: inset(0 100% 0 0 round 99px); }
    to { clip-path: inset(0 0 0 0 round 99px); }
}

/* the decision is stamped once both options have been read */
.ax-run .ax-pill.on.ax-beat { animation-name: ax-stamp; animation-duration: 420ms; }
@keyframes ax-stamp {
    from { opacity: 0; transform: scale(1.35); }
    to { opacity: 1; transform: none; }
}

/* the column that makes the second table a different contract fills in */
.ax-anim .ax-shell i.hl.ax-beat { opacity: 1; clip-path: inset(-2px 100% -2px -2px); }
.ax-run .ax-shell i.hl.ax-beat {
    animation: ax-col 420ms cubic-bezier(0.16, 1, 0.3, 1) var(--d, 0ms) both;
}
@keyframes ax-col {
    from { clip-path: inset(-2px 100% -2px -2px); }
    to { clip-path: inset(-2px -2px -2px -2px); }
}

/* board: the dashed lines run toward the question mark, it appears, and the
   editor goes on being typed in regardless */
.ax-anim .bd-ld.ax-beat { opacity: 0; }
.ax-run .bd-ld.ax-beat {
    animation: ax-dash 1300ms cubic-bezier(0.16, 1, 0.3, 1) var(--d, 0ms) both;
}
@keyframes ax-dash {
    from { opacity: 0; stroke-dashoffset: 90; }
    25% { opacity: 1; }
    to { opacity: 1; stroke-dashoffset: 0; }
}
.ax-anim .bd-bad.ax-beat,
.ax-anim .bd-Nw.ax-beat { transform-box: fill-box; transform-origin: center; }
.ax-run .bd-bad.ax-beat,
.ax-run .bd-Nw.ax-beat { animation-name: ax-pop; animation-duration: 520ms; }
@keyframes ax-pop {
    from { opacity: 0; transform: scale(0.3); }
    to { opacity: 1; transform: none; }
}
.ax-anim .bd-edl.ax-beat { opacity: 1; clip-path: inset(0 100% 0 0); }
.ax-run .bd-edl.ax-beat {
    animation: ax-type 380ms cubic-bezier(0.33, 1, 0.68, 1) var(--d, 0ms) both;
}
@keyframes ax-type {
    from { clip-path: inset(0 100% 0 0); }
    to { clip-path: inset(0 0 0 0); }
}

/* replay: quiet, at the end of the caption, once the mock has run */
.ax-replay {
    float: right;
    display: grid; place-items: center;
    width: 24px; height: 24px; margin: -4px 0 0 10px; padding: 0;
    border: 1px solid color-mix(in srgb, var(--frgd) 30%, transparent);
    border-radius: 50%;
    background: transparent; color: var(--frgd);
    cursor: pointer;
    opacity: 0; visibility: hidden;
    transition: opacity 240ms ease, visibility 0s linear 240ms, background-color 150ms ease, border-color 150ms ease;
}
.ax-done .ax-replay { opacity: 0.7; visibility: visible; transition-delay: 0s; }
.ax-replay:hover, .ax-replay:focus-visible { opacity: 1; background: var(--action); border-color: var(--frgd); }
.ax-replay:focus-visible { outline: 2px solid var(--frgd); outline-offset: 2px; }
.ax-replay svg { width: 13px; height: 13px; fill: currentColor; }
.ax-replay:active svg { transform: rotate(-40deg); }

@media (prefers-reduced-motion: reduce), print {
    .ax-anim .ax-beat,
    .ax-anim .ax-list li.ax-beat::before {
        opacity: 1 !important; transform: none !important; clip-path: none !important; animation: none !important;
    }
    .ax-anim .ax-meter .fill { clip-path: none !important; animation: none !important; }
    .ax-anim .ax-code .stale.ax-beat {
        color: var(--ax-dim) !important; background: none !important;
        text-decoration: line-through !important; text-decoration-color: var(--ax-no) !important;
    }
    .ax-replay { display: none; }
}
