/* Theme / accent swap: the new palette floods out from the pressed control as a View
   Transitions wipe; without the API every colour consumer gets one beat of transition. */
::view-transition-old(root),
::view-transition-new(root) { mix-blend-mode: normal; }
::view-transition-old(root) { z-index: 0; animation: none; }
/* The UA's default 250ms group animation retimes the pair when the page height changes (a
   scrollbar flipping); only the wipe below drives this transition. */
::view-transition-group(root) { animation: none; }
/* Declarative, not scripted: a transition ends once its pseudo-elements have no animation, so one
   added from ready.then() races the teardown. Origin and radius arrive as custom properties. */
::view-transition-new(root) {
    z-index: 1;
    /* The radius eases IN slightly so the painted AREA (∝ r²) grows evenly — held by browser/tests/ui/motion.test.js;
       the desktop evaluates these control points too (support/dust/ThemeSwapOverlay.hpp swapEase). */
    animation: themeSwapReveal var(--swap-ms, 280ms) cubic-bezier(0.4, 0.25, 0.95, 1) both;
}
/* Sliding pours the new palette out of the control: the genie's silhouette as the mask, its keyframes
   written per swap on a linear clock (motion/surface/themeSwapShape.js). */
html.theme-swap-genie::view-transition-new(root) { animation: themeSwapGenie var(--swap-ms, 560ms) linear both; }
/* Percentages, not px: some engines measure the pseudo-element's box in device pixels. The ragged rings
   have equal vertex counts so they interpolate; the circle is the fallback. */
@keyframes themeSwapReveal {
    from { clip-path: var(--swap-clip-from, circle(0% at var(--swap-x, 50%) var(--swap-y, 50%))); }
    to   { clip-path: var(--swap-clip-to, circle(var(--swap-r, 150%) at var(--swap-x, 50%) var(--swap-y, 50%))); }
}

/* Colour transitions are off while the new state is captured, or the snapshot still wears the old
   colours and the real ones creep in behind the wipe. */
html.theme-instant, html.theme-instant *,
html.theme-instant *::before, html.theme-instant *::after {
    transition: none !important;
}

html.theme-swapping, html.theme-swapping *,
html.theme-swapping *::before, html.theme-swapping *::after {
    transition: background-color 0.45s ease, background-image 0.45s ease, color 0.45s ease,
                border-color 0.45s ease, outline-color 0.45s ease, fill 0.45s ease,
                stroke 0.45s ease, box-shadow 0.45s ease !important;
}

/* A preview's flood drops and re-applies :hover, restarting the row's sweep and ✓ (user report); hold
   both while the menu is marked previewing — the swap classes are gone too soon. */
.accent-dd-menu.dd-preview-hold .accent-dd-opt::after { animation: none !important; }
.accent-dd-menu.dd-preview-hold .accent-dd-opt :is(.ic, .ic *) { animation-name: none !important; }
/* The snapshot covers the page: hold the cursor on :root, in two rules (an engine that drops
   ::view-transition would drop a shared selector list). */
html.dd-preview-cursor { cursor: pointer; }
html.dd-preview-cursor::view-transition { cursor: pointer; }

/* Dust in the wipe's wake: specks in the OLD palette, each delayed to its ignite time on the ring;
   the layer clips itself so an edge mote never mints a scrollbar. */
/* One canvas for the whole wake: a div per grain meant thousands of composited layers. */
.swap-dust {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100011;
    pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
    .swap-dust { display: none; }
}
