/* Reduce effects (Settings → Display, static/js/display_prefs.js; base.html sets
   data-effects="reduced" on <html> before this paints), and the same for
   people whose system asks for reduced motion.

   Animations and transitions finish at once rather than being removed, so
   anything that waits for their end (a toast leaving, a drawer closing) still
   hears it, and every element lands on its finished look. Spinners and
   striped "working" bars stop moving but stay on screen, so progress still
   shows; progress bars jump to their new width. Hover shading on table rows
   goes, which saves a repaint per row the pointer crosses on big tables. */

:root[data-effects="reduced"] *,
:root[data-effects="reduced"] *::before,
:root[data-effects="reduced"] *::after {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
}

/* Page-to-page transitions (base.html's @view-transition) cut straight over. */
:root[data-effects="reduced"]::view-transition-group(*),
:root[data-effects="reduced"]::view-transition-old(*),
:root[data-effects="reduced"]::view-transition-new(*) {
    animation: none !important;
}

/* Hover shading on table rows: Bootstrap's .table-hover and the shots' own
   row tints (drawn as a background-image so they sit over a row's colour). */
:root[data-effects="reduced"] .table-hover > tbody > tr:hover > * {
    --bs-table-bg-state: transparent !important;
    --bs-table-color-state: inherit !important;
}

:root[data-effects="reduced"] tr:hover > td,
:root[data-effects="reduced"] tr:hover > th {
    background-image: none !important;
}

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