/* Motion and the finishing states (docs/CONSOLE-REDESIGN.md §3.6; owner, 15 Nov 2026: "make it look professional made
   with attention to detail"). The tokens are in tokens.css: --dur-1 (120 ms: hover, press), --dur-2 (180 ms: menus,
   popovers, tooltips, a scrim), --dur-3 (260 ms: sheets, panels, ⌘K, the sidebar opening); --ease-out entering,
   --ease-in leaving, --ease-emph for the larger surfaces. Only opacity and transform move here (the sidebar's and the
   rail's widths, which already animated, stay theirs). Reduced motion — the member's or the system's — turns every
   duration in this file off (tokens.css), so things simply appear. Flat: no new boxes, borders or shadows beyond the
   elevation tokens. Loaded after every other stylesheet but safety.css. */

/* ---------- the keyframes: things enter; leaving is left to the element going (most are removed at once) ---------- */
@keyframes cp-fade-in { from { opacity: 0; } }
@keyframes cp-pop-in { from { opacity: 0; transform: translateY(var(--pop-dy, -4px)) scale(.98); } }
@keyframes cp-rise-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes cp-sheet-up { from { transform: translateY(100%); } }
@keyframes cp-from-right { from { opacity: 0; transform: translateX(24px); } }
@keyframes cp-toast-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes cp-ask-in { from { opacity: 0; transform: translateX(-50%) translateY(-8px) scale(.985); } }
@keyframes cp-spin { to { transform: rotate(360deg); } }
@keyframes cp-shimmer { 50% { opacity: .45; } }

/* ---------- scrims fade; what they cover rises or pops from its anchor's side ---------- */
.ask-scrim, .cz-scrim, .fc-scrim, .vw-dlg-back, .scrim { animation: cp-fade-in var(--dur-2) var(--ease-out); }
/* menus and popovers: from their anchor (the Create menu opens beside the sidebar, ⋯ and presence below the header's right) */
.cz-menu { transform-origin: top left; animation: cp-pop-in var(--dur-2) var(--ease-out); }
.hd-menu, .pr-list { transform-origin: top right; animation: cp-pop-in var(--dur-2) var(--ease-out); }
.tc-picker { --pop-dy: 4px; transform-origin: bottom left; animation: cp-pop-in var(--dur-2) var(--ease-out); }
.cz-msheet .cz-menu { animation: cp-sheet-up var(--dur-3) var(--ease-emph); }
/* the larger surfaces: ⌘K, the Create panel, a glimpse, a sheet beside a pane, a dialog */
.ask.open .ask-sheet { animation: cp-ask-in var(--dur-3) var(--ease-emph); }
.cz-panel, .modal, .palette { transform-origin: top center; animation: cp-pop-in var(--dur-3) var(--ease-emph); }
.fc-glimpse.card { transform-origin: left center; animation: cp-pop-in var(--dur-2) var(--ease-out); --pop-dy: 0px; }
.fc-glimpse.sheet { animation: cp-sheet-up var(--dur-3) var(--ease-emph); }
.pn-pane.pn-sheet { animation: cp-from-right var(--dur-3) var(--ease-emph); }
@media (max-width: 780px) {
  .ask.open .ask-sheet { animation: cp-rise-in var(--dur-3) var(--ease-emph); }
  .cz.cz-sheet { animation: cp-rise-in var(--dur-3) var(--ease-emph); }
}
/* the presence names (a tooltip): fade in place, a moment after the pointer arrives */
.pr-faces [data-name]::after { transition: opacity var(--dur-2) var(--ease-out) 80ms, visibility 0s linear var(--dur-2); }
.pr-faces [data-name]:hover::after, .pr-faces [data-name]:focus-visible::after { transition: opacity var(--dur-2) var(--ease-out) 80ms, visibility 0s; }
/* toasts: up and in from the corner, stacked with the newest at the bottom (styles.css .toasts) */
.toasts .toast { transform-origin: bottom right; }

/* ---------- tabs: the underline is drawn by ::after so it can slide from the tab you left (motion.js) ---------- */
.pn-tabs a, .pn-tabs button, .cz-tab { position: relative; transition: color var(--dur-1) var(--ease-out); }
.pn-tabs [aria-selected="true"], .cz-tab.on { border-bottom-color: transparent; }
.pn-tabs [aria-selected="true"]::after, .cz-tab.on::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px; background: var(--canopy);
  transform-origin: left center; pointer-events: none; }
.cz-tab.on::after { left: 10px; right: 10px; background: var(--accent); }
.pn-tabs a:hover, .pn-tabs button:hover { color: var(--text-2); }
.pn-tabs [aria-selected="true"]:hover { color: var(--text); }

/* A tab's words reserve their bold width (motion.js wraps them in .cp-tl): the selected tab turns 600 and nothing after
   it moves. The hidden copy is the same words at 600, no height, never read out. */
.cp-tl { display: inline-grid; }
.cp-tl::after { content: attr(data-label); font-weight: 600; visibility: hidden; height: 0; overflow: hidden; user-select: none; pointer-events: none; }

/* ---------- rows that arrive in a list drawn again (CP.swap, motion.js); rows that leave fold away in script ---------- */
@keyframes cp-arrive { from { opacity: 0; transform: translateY(-4px); } }
.cp-arrive { animation: cp-arrive var(--dur-3) var(--ease-out); }

/* ---------- buttons: hover, press, disabled and busy ---------- */
/* a link drawn as a button reads as one: the button's words, not the link colour (People's Invite was --sky in light) */
a.btn { color: var(--text); text-decoration: none; }
.btn, .hbtn, .iconbtn, .fchip, .cz-mi, .cz-x, .linkbtn, .set-go, .tl-row, .cvl-row, .ask-it {
  transition: background-color var(--dur-1) var(--ease-out), border-color var(--dur-1) var(--ease-out), color var(--dur-1) var(--ease-out),
    box-shadow var(--dur-1) var(--ease-out), opacity var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out); }
.btn:active:not(:disabled):not(.locked):not([aria-busy="true"]), .fchip:active, .hbtn:active, .iconbtn:active { transform: translateY(1px); }
.iconbtn:hover { background: var(--raised); }
.btn:disabled:not([aria-busy="true"]) { opacity: .5; cursor: not-allowed; }
/* A request on its way from the button just pressed (console.js `api` marks it aria-busy): after 150 ms — so a quick
   answer never flickers — the words step back and a small ring turns in their place, in the button's own text colour. */
.btn[aria-busy="true"] { position: relative; cursor: progress; color: transparent !important; transition: color 0s linear 150ms; }
.btn[aria-busy="true"]::after { content: ""; position: absolute; inset: 0; margin: auto; width: 14px; height: 14px; border-radius: 50%; box-sizing: border-box;
  border: 2px solid color-mix(in srgb, var(--text) 25%, transparent); border-top-color: var(--text); display: block;
  animation: cp-fade-in var(--dur-1) var(--ease-out) 150ms backwards, cp-spin .7s linear infinite; }
.btn.primary[aria-busy="true"]::after { border-color: color-mix(in srgb, var(--on-fill) 30%, transparent); border-top-color: var(--on-fill); }
.btn.ok[aria-busy="true"]::after { border-color: color-mix(in srgb, var(--ok) 30%, transparent); border-top-color: var(--ok); }
.btn.bad[aria-busy="true"]::after { border-color: color-mix(in srgb, var(--bad-2) 30%, transparent); border-top-color: var(--bad-2); }

/* ---------- chips: a pressed chip is filled, with a 1 px edge (it was a 2 px dark ring: a thick rounded border) ---------- */
.fchip[aria-pressed="true"] { background: var(--ink-3); border-color: var(--text-2); box-shadow: none; }

/* ---------- checkboxes, radios and switches in the theme's accent ---------- */
input[type="checkbox"], input[type="radio"] { accent-color: var(--canopy-fill); cursor: pointer; }
input[type="checkbox"]:disabled, input[type="radio"]:disabled { cursor: not-allowed; }
label:has(> input[type="checkbox"], > input[type="radio"]) { cursor: pointer; }

/* ---------- loading: skeleton lines instead of a bare "Loading…" (motion.js marks the placeholder .cp-loading) ---------- */
.cp-loading { --sk: color-mix(in srgb, var(--text) 9%, transparent); color: transparent !important; user-select: none; min-height: 50px;
  background-image: linear-gradient(var(--sk) 0 0), linear-gradient(var(--sk) 0 0), linear-gradient(var(--sk) 0 0);
  background-size: min(320px, 70%) 10px, min(480px, 100%) 10px, min(200px, 45%) 10px; background-position: 0 4px, 0 22px, 0 40px;
  background-repeat: no-repeat; background-origin: content-box; animation: cp-shimmer 1.4s ease-in-out infinite; }

/* ---------- numbers line up: counts, money and times ---------- */
.n, .c, .ping, .fc-n, .cvl-n, .when, time, .mono, td.num, .num, .amt, .money { font-variant-numeric: tabular-nums; }

/* ---------- reduced motion: no movement at all (tokens.css already stops every duration; this stops the loops' look) ---------- */
:root[data-motion="reduced"] .cp-loading, :root[data-motion="reduced"] .btn[aria-busy="true"]::after { animation: none; }
@media (prefers-reduced-motion: reduce) { .cp-loading, .btn[aria-busy="true"]::after { animation: none; } }
