/* Motion for the dashboard and the public pages (2026-11-15). Pure CSS, so it starts with the very first paint (no flash)
   and also plays for lists and panels that htmx swaps in. Only transform, opacity and stroke-dasharray move: nothing shifts
   the layout and old phones keep 60 fps. "backwards" holds the start state during the delay and lets go afterwards, so hover
   effects and the final layout are untouched. Everything is off when the device asks for reduced motion.
   motion.js only rolls the numbers. */
:root { --m-ease: cubic-bezier(0.22, 1, 0.36, 1); --m-draw: cubic-bezier(0.16, 1, 0.3, 1); }

@keyframes m-in { from { opacity: 0; transform: translateY(14px); } }
@keyframes m-row { from { opacity: 0; transform: translateY(10px); } }
@keyframes m-bar-x { from { transform: scaleX(0); } }
@keyframes m-bar-y { from { transform: scaleY(0); } }
@keyframes m-ring { from { stroke-dasharray: 0 100; } }

/* position in its group (1st = 0, ... 15th = 14) */
:where(.op-tiles, .cm-tiles, .rp-hero, .rp-funnel, .bg-grid, .bd-kpis, .np-tiles, .op-side, .rp-grid, .cl, .op-rows, tbody, .hist, .al-list,
       .mm-grid, .vol-tasks, .faq, .rp-bars, .bd-bars, .bd-months, .cs-grid, .ct-grid, .site-grid, .works-grid, .upd-list, .cards, .notice-list) > :nth-child(2) { --m-i: 1; }
:where(.op-tiles, .cm-tiles, .rp-hero, .rp-funnel, .bg-grid, .bd-kpis, .np-tiles, .op-side, .rp-grid, .cl, .op-rows, tbody, .hist, .al-list,
       .mm-grid, .vol-tasks, .faq, .rp-bars, .bd-bars, .bd-months, .cs-grid, .ct-grid, .site-grid, .works-grid, .upd-list, .cards, .notice-list) > :nth-child(3) { --m-i: 2; }
:where(.op-tiles, .cm-tiles, .rp-hero, .rp-funnel, .bg-grid, .bd-kpis, .np-tiles, .op-side, .rp-grid, .cl, .op-rows, tbody, .hist, .al-list,
       .mm-grid, .vol-tasks, .faq, .rp-bars, .bd-bars, .bd-months, .cs-grid, .ct-grid, .site-grid, .works-grid, .upd-list, .cards, .notice-list) > :nth-child(4) { --m-i: 3; }
:where(.op-tiles, .cm-tiles, .rp-hero, .rp-funnel, .bg-grid, .bd-kpis, .np-tiles, .op-side, .rp-grid, .cl, .op-rows, tbody, .hist, .al-list,
       .mm-grid, .vol-tasks, .faq, .rp-bars, .bd-bars, .bd-months, .cs-grid, .ct-grid, .site-grid, .works-grid, .upd-list, .cards, .notice-list) > :nth-child(5) { --m-i: 4; }
:where(.op-tiles, .cm-tiles, .rp-hero, .rp-funnel, .bg-grid, .bd-kpis, .np-tiles, .op-side, .rp-grid, .cl, .op-rows, tbody, .hist, .al-list,
       .mm-grid, .vol-tasks, .faq, .rp-bars, .bd-bars, .bd-months, .cs-grid, .ct-grid, .site-grid, .works-grid, .upd-list, .cards, .notice-list) > :nth-child(6) { --m-i: 5; }
:where(.op-tiles, .cm-tiles, .rp-hero, .rp-funnel, .bg-grid, .bd-kpis, .np-tiles, .op-side, .rp-grid, .cl, .op-rows, tbody, .hist, .al-list,
       .mm-grid, .vol-tasks, .faq, .rp-bars, .bd-bars, .bd-months, .cs-grid, .ct-grid, .site-grid, .works-grid, .upd-list, .cards, .notice-list) > :nth-child(7) { --m-i: 6; }
:where(.op-tiles, .cm-tiles, .rp-hero, .rp-funnel, .bg-grid, .bd-kpis, .np-tiles, .op-side, .rp-grid, .cl, .op-rows, tbody, .hist, .al-list,
       .mm-grid, .vol-tasks, .faq, .rp-bars, .bd-bars, .bd-months, .cs-grid, .ct-grid, .site-grid, .works-grid, .upd-list, .cards, .notice-list) > :nth-child(8) { --m-i: 7; }
:where(.op-tiles, .cm-tiles, .rp-hero, .rp-funnel, .bg-grid, .bd-kpis, .np-tiles, .op-side, .rp-grid, .cl, .op-rows, tbody, .hist, .al-list,
       .mm-grid, .vol-tasks, .faq, .rp-bars, .bd-bars, .bd-months, .cs-grid, .ct-grid, .site-grid, .works-grid, .upd-list, .cards, .notice-list) > :nth-child(9) { --m-i: 8; }
:where(.cl, .op-rows, tbody, .hist, .al-list, .rp-bars, .bd-bars, .bd-months, .works-grid, .site-grid, .upd-list, .vol-tasks, .cards, .notice-list) > :nth-child(10) { --m-i: 9; }
:where(.cl, .op-rows, tbody, .hist, .al-list, .rp-bars, .bd-bars, .bd-months, .works-grid, .site-grid, .upd-list, .vol-tasks, .cards, .notice-list) > :nth-child(11) { --m-i: 10; }
:where(.cl, .op-rows, tbody, .hist, .al-list, .rp-bars, .bd-bars, .bd-months, .works-grid, .site-grid, .upd-list, .vol-tasks, .cards, .notice-list) > :nth-child(12) { --m-i: 11; }
:where(.cl, .op-rows, tbody, .hist, .al-list, .rp-bars, .bd-bars, .bd-months, .works-grid, .site-grid, .upd-list, .vol-tasks, .cards, .notice-list) > :nth-child(13) { --m-i: 12; }
:where(.cl, .op-rows, tbody, .hist, .al-list, .rp-bars, .bd-bars, .bd-months, .works-grid, .site-grid, .upd-list, .vol-tasks, .cards, .notice-list) > :nth-child(14) { --m-i: 13; }
:where(.cl, .op-rows, tbody, .hist, .al-list, .rp-bars, .bd-bars, .bd-months, .works-grid, .site-grid, .upd-list, .vol-tasks, .cards, .notice-list) > :nth-child(n+15) { --m-i: 14; }

/* 1. Cascade: number tiles (50 ms apart), then cards (from 150 ms), then rows (from 250 ms, 35 ms apart, first 15 only). */
:where(.dbody, .pub-main) :where(.op-tiles, .cm-tiles, .rp-hero, .rp-funnel, .bg-grid, .bd-kpis, .np-tiles) > * {
  animation: m-in 450ms var(--m-ease) backwards; animation-delay: calc(var(--m-i, 0) * 50ms); }
:where(.dbody, .pub-main) > :where(.card, section.card, .op-grid, .rp-grid, .cs) ,
:where(.dbody, .pub-main) :where(.op-side, .rp-grid, .cs-grid, .ct-grid, .site-grid, .works-grid, .cards) > * {
  animation: m-in 450ms var(--m-ease) backwards; animation-delay: calc(150ms + var(--m-i, 0) * 40ms); }
:where(.dbody, .pub-main) :where(.cl, .op-rows, .dtable tbody, .hist, .al-list, .mm-grid, .vol-tasks, .faq, .upd-list, .notice-list) > :nth-child(-n+15) {
  animation: m-row 380ms var(--m-ease) backwards; animation-delay: calc(250ms + var(--m-i, 0) * 35ms); }

/* 3. Charts draw themselves: bars grow from their start edge (60 ms apart), the ring sweeps clockwise. */
:where(.dbody, .pub-main) :where(.mbar i, .rp-stack i, .setup-bar i, .bd-hbar i, .rp-age i) {
  transform-origin: left center; animation: m-bar-x 700ms var(--m-draw) backwards; animation-delay: 300ms; }
:where(.dbody, .pub-main) :where(tr:nth-child(2) .mbar i, tr:nth-child(2) .rp-stack i) { animation-delay: 360ms; }
:where(.dbody, .pub-main) :where(tr:nth-child(3) .mbar i, tr:nth-child(3) .rp-stack i) { animation-delay: 420ms; }
:where(.dbody, .pub-main) :where(tr:nth-child(4) .mbar i, tr:nth-child(4) .rp-stack i) { animation-delay: 480ms; }
:where(.dbody, .pub-main) :where(tr:nth-child(n+5) .mbar i, tr:nth-child(n+5) .rp-stack i) { animation-delay: 540ms; }
:where(.dbody, .pub-main) :where(.rp-bar-pair i, .bd-bars > span, .bd-months span) {
  transform-origin: center bottom; animation: m-bar-y 700ms var(--m-draw) backwards; animation-delay: calc(300ms + var(--m-i, 0) * 30ms); }
:where(.dbody, .pub-main) :where(.rp-bars > *, .bd-months > *) :where(i, span) { animation-delay: calc(300ms + var(--m-i, 0) * 40ms); }
:where(.dbody, .pub-main) .bd-ring circle[stroke-dasharray] { animation: m-ring 800ms var(--m-draw) backwards; animation-delay: 250ms; }

/* 2. Numbers keep one width while they roll (motion.js). */
.op-tile b, .cm-tiles b, .rp-funnel b, .rp-badge b, .bd-kpi b, .bg-grid span, [data-count], .dtable td.num, .cv-n, .count, .tab-cnt {
  font-variant-numeric: tabular-nums; }

/* 5. The active menu item and tab glide to their new place between pages (Chrome / Edge / Brave; others just load). */
@view-transition { navigation: auto; }
.is-dash .side a.on:not(.side-me) { view-transition-name: m-nav-on; }
.is-dash .subtabs a.on { view-transition-name: m-tab-on; }
.pub-nav a[aria-current=page] { view-transition-name: m-pub-on; }
::view-transition-group(m-nav-on), ::view-transition-group(m-tab-on), ::view-transition-group(m-pub-on) { animation-duration: 320ms; animation-timing-function: var(--m-ease); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; }

/* 6. Touch: buttons answer the press; cards that are links lift a little under a mouse; rows ease their hover colour. */
.btn, .qa-btn, .op-tile, .cm-tiles > a, .ct-card { transition: transform 160ms var(--m-ease), box-shadow 200ms var(--m-ease), background-color 160ms ease, border-color 160ms ease; }
.btn:active:not(:disabled), .qa-btn:active:not(:disabled) { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) {
  .op-tile:hover, .cm-tiles > a:hover, a.card:hover, .ct-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.08); }
}
.dtable tbody tr, .cl-item, .op-row { transition: background-color 160ms ease, border-color 160ms ease; }

/* Less motion asked for: nothing moves, nothing waits. Printing: everything at rest. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  @view-transition { navigation: none; }
  .btn:active, .qa-btn:active, .op-tile:hover, .cm-tiles > a:hover, a.card:hover, .ct-card:hover { transform: none !important; }
}
@media print { *, *::before, *::after { animation: none !important; } }
