/* Small motions for direct actions; background windows show their settled state. */
:root {
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --spring: cubic-bezier(0.34, 1.4, 0.64, 1);
  --t-press: 80ms;
  --t-exit: 120ms;
}

.m-btn, .tabs button, .link {
  transition-property: background-color, border-color, color, transform, opacity;
  transition-duration: var(--quick);
  transition-timing-function: var(--ease);
}
.m-btn:active:not(:disabled) { transform: scale(.975); transition-duration: var(--t-press); }
.m-btn:disabled { opacity: .6; }

.overlay:not(.settled) { animation: fade-in 160ms var(--ease) both; }
.overlay:not(.settled) .sheet { animation: sheet-in 220ms var(--ease) both; }
.overlay.leaving { animation: fade-out var(--t-exit) var(--ease-in) both; pointer-events: none; }
.overlay.leaving .sheet { animation: sheet-out var(--t-exit) var(--ease-in) both; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes sheet-in { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes sheet-out { to { opacity: 0; transform: translateY(8px) scale(.99); } }

.sheet-body:not(.settled) > * { animation: rise 200ms var(--ease) both; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.toast { animation: toast-in 220ms var(--spring) both; }
.toast.leaving { animation: toast-out 160ms var(--ease-in) both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }

.motion-paused *, .motion-paused *::before, .motion-paused *::after {
  animation: none !important;
  transition: none !important;
}

/* ---- Metro, alive (Maro, 2026-11-12: "cool as fuck animations like Tasks"). Nothing here changes a layout, a size
   or a colour at rest: only how things arrive, react and breathe. Off under reduce-motion and .motion-paused. ---- */

/* Views, AIs and session tabs arrive instead of snapping in. */
.view-enter { animation: view-in 260ms var(--ease) both; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } }

/* New chat rows: replies rise, Maro's own message slides in from his side, tools and thoughts fade up. */
.msgs > .row-enter { animation: row-in 280ms var(--spring) both; }
.msgs > .msg.user.row-enter { animation-name: row-in-right; }
.msgs > .tool.row-enter, .msgs > .think.row-enter { animation: row-in 220ms var(--ease) both; }
@keyframes row-in { from { opacity: 0; transform: translateY(10px) scale(.99); } }
@keyframes row-in-right { from { opacity: 0; transform: translateX(18px); } }

/* The rail: a working AI breathes, one that just finished flashes once, rows lift under the pointer. */
.agent { transition: background-color var(--quick) var(--ease), transform 160ms var(--ease), box-shadow 200ms var(--ease); }
.rail-agent-row:hover .agent { transform: translateX(2px); }
.agent[data-status="working"]::after, .agent[data-status="starting"]::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 2px 0 0 color-mix(in srgb, var(--accent) 80%, transparent);
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe { 0%, 100% { opacity: .35; } 50% { opacity: 1; } }
.agent.just-done { animation: done-flash 1.3s var(--ease) both; }
@keyframes done-flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--teal) 0%, transparent); } 18% { box-shadow: 0 0 0 2px color-mix(in srgb, var(--teal) 70%, transparent), 0 0 18px color-mix(in srgb, var(--teal) 35%, transparent); } 100% { box-shadow: 0 0 0 0 transparent; } }

/* Status: the pill pulses while working; badges pop when they change. */
.status-pill.s-working { animation: pill-pulse 1.8s ease-in-out infinite; }
@keyframes pill-pulse { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 0%, transparent); } 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); } }

/* Session tabs and the + button. */
.session-tab { animation: tab-in 240ms var(--spring) both; }
@keyframes tab-in { from { opacity: 0; transform: translateY(-6px) scale(.97); } }

/* Plan: a task that just got done pops its check. */
.rp-task.just-done .rp-task-check { animation: check-pop 420ms var(--spring) both; }
.rp-task.just-done .rp-task-title { animation: fade-in 420ms var(--ease) both; }
@keyframes check-pop { 0% { transform: scale(.4) rotate(-20deg); } 60% { transform: scale(1.25); } 100% { transform: none; } }

/* Usage bars fill in on the Usage page (the side panel redraws every minute, so it stays still). */
.view-enter .usage-meter > i { transform-origin: left; animation: bar-in 600ms var(--ease) both; }
@keyframes bar-in { from { transform: scaleX(0); } }

/* Buttons and rows react under the pointer (no size change at rest). */
.m-btn:hover:not(:disabled) { transform: translateY(-1px); }
.m-btn.primary:hover:not(:disabled) { box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 28%, transparent); }
.rp-usage-row, .team-account, .model-list-opt { transition: background-color var(--quick) var(--ease), transform 140ms var(--ease); }
.rp-usage-row:hover, .team-account:hover:not(:disabled) { transform: translateX(2px); }

/* The composer glows a little while it has focus. */
.composer { transition: border-color 160ms var(--ease), box-shadow 220ms var(--ease); }
.composer:focus-within { box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 45%, transparent), 0 8px 26px color-mix(in srgb, var(--accent) 12%, transparent); }

/* The send button pops when there is something to send. */
.sendbtn:not(.stopping) svg { transition: transform 180ms var(--spring); }
.sendbtn:hover:not(.stopping) svg { transform: translateX(2px); }

/* The live status line's star steps through Claude Code's frames in place (no rotation) and shimmers. */
.statusline .spark::before { content: "✻"; display: inline-block; animation: spark-frames 1.2s steps(1, end) infinite, spark-shimmer 2s ease-in-out infinite; }
@keyframes spark-frames { 0% { content: "·"; } 14% { content: "✢"; } 28% { content: "✳"; } 42% { content: "✶"; } 57% { content: "✻"; } 71% { content: "✽"; } 85% { content: "✻"; } }
@keyframes spark-shimmer { 0%, 100% { color: var(--accent); } 50% { color: color-mix(in srgb, var(--accent) 45%, #fff); } }
@media (prefers-reduced-motion: reduce) { .statusline .spark::before { animation: none; content: "✻"; } }

/* The terminal's newest output fades in line by line. */
.term-ln.partial { animation: fade-in 140ms var(--ease) both; }
.term-block { animation: row-in 240ms var(--ease) both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
}
