/* Motion: calm but alive (D-103), the same everywhere. Pages glide in when shown (a fade and a small rise),
   side columns slide in, menus grow from where they were opened, colours change softly, cards brighten
   when pointed at and buttons give a little when pressed. Nothing cascades, bounces or loops (Orbis's
   breathing is its own). The times are the one scale in tokens.css, and
   with reduced motion whatever moves only fades, over 150 ms. */
@keyframes wl-fade { from { opacity: 0; } }
@keyframes wl-in { from { opacity: 0; transform: translateY(4px); } }
@keyframes wl-pop { from { opacity: 0; transform: scale(.96); } }
@keyframes wl-toast { from { opacity: 0; transform: translate(-50%, 6px); } }
@keyframes wl-out { to { opacity: 0; transform: translateY(4px); } }
@keyframes wl-rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes wl-slide { from { opacity: 0; transform: translateX(-10px); } }
@keyframes wl-mark { from { opacity: 0; transform: scaleY(.3); } }

/* Pages: a tab's page fades in each time it is shown; the Projects page, a new grid or a
   Settings section fades in when chosen (motion.js marks it .wl-enter for a moment). */
body.wb-shell :is(.workspace-leaf-content, .wl-page),
body.wb-shell .wb-projects-overview,
body.wb-shell .wp-project-grid.wl-enter,
body.wb-shell .vertical-tab-content-container.wl-enter > .vertical-tab-content { animation: wl-fade var(--wl-short) var(--wl-ease-out); }
/* In our own window a page's content glides in with the page's fade; a map only fades, so it never seems to shift.
   A side column's content slides in as the column opens or changes (a side panel's time), and the rail's marker
   grows into its place. */
body.wb-shell .wl-page:not([data-type="canvas"]) > .wl-page-content { animation: wl-rise var(--wl-short) var(--wl-ease-out); }
body.wb-shell .wl-page-column:not(.is-folded) > * { animation: wl-slide var(--wl-long) var(--wl-ease-out); }
body.wb-shell .wl-rail-button.is-active::before { animation: wl-mark var(--wl-short) var(--wl-ease-out); }

/* Menus, suggestions, dialogs and toasts. A menu opens from where it was asked for. */
body.wb-shell .menu, body.wb-shell .suggestion-container { animation: wl-pop var(--wl-short) var(--wl-ease-out); transform-origin: var(--wl-menu-origin, top left); }
body.wb-shell .modal-container .modal-bg, body.wb-shell .wb-modal-backdrop { animation: wl-fade var(--wl-short) var(--wl-ease-out); }
body.wb-shell .modal-container :is(.modal, .prompt), body.wb-shell .wb-modal, body.wb-shell .notice { animation: wl-in var(--wl-short) var(--wl-ease-out); }
body.wb-shell .wb-toast { animation: wl-toast var(--wl-short) var(--wl-ease-out); }

/* Soft state changes: rows, icons, tabs, fields and cards. A focus ring is never animated. */
body.wb-shell :is(.tree-item-self, .nav-file-title, .nav-folder-title, .clickable-icon, .vertical-tab-nav-item, .side-dock-ribbon-action, .workspace-tab-header-inner-title, .workspace-tab-header-inner-icon, .wp-nav-link, .wp-genre, .wh-type-head, .wh-type-file, .wh-file-row, .wh-map-tile) {
  transition: background-color var(--wl-quick) var(--wl-ease), color var(--wl-quick) var(--wl-ease), border-color var(--wl-quick) var(--wl-ease);
}
body.wb-shell :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, select) {
  transition: border-color var(--wl-short) var(--wl-ease), background-color var(--wl-short) var(--wl-ease);
}
body.wb-shell :is(button.wt-entry-card, .wt-type-card, .wh-type-card, .wp-card, .wp-kind, .wh-tile, .wl-sys-row, .wl-sys-card) {
  transition: border-color var(--wl-short) var(--wl-ease), background-color var(--wl-short) var(--wl-ease), box-shadow var(--wl-short) var(--wl-ease), transform var(--wl-short) var(--wl-ease-out), filter var(--wl-short) var(--wl-ease);
}
/* Pointed at, a card brightens a little and its picture drifts closer, slowly. */
@media (hover: hover) {
  body.wb-shell :is(.wp-card, .wh-tile, .wl-sys-card):hover { filter: brightness(1.06); }
  body.wb-shell :is(.wp-card, .wh-tile) :is(img, .wl-emblem-art) { transition: transform var(--wl-scene) var(--wl-ease-out); }
  body.wb-shell :is(.wp-card, .wh-tile):hover :is(img, .wl-emblem-art) { transform: scale(1.035); }
}
/* Pressed, a button gives a little. */
body.wb-shell :is(.wl-sys-button, .wh-button, .wh-hero-button, .wl-page-text-action, .wp-hero-actions button, .wp-create-actions button, .wp-bar-actions button) {
  transition: background-color var(--wl-quick) var(--wl-ease), border-color var(--wl-quick) var(--wl-ease), color var(--wl-quick) var(--wl-ease), transform var(--wl-quick) var(--wl-ease-out);
}
body.wb-shell :is(.wl-sys-button, .wh-button, .wh-hero-button, .wl-page-text-action, .wp-hero-actions button, .wp-create-actions button, .wp-bar-actions button):not(:disabled):active { transform: scale(.97); }

/* Reduced motion: everything takes 150 ms and loops stop. What moved only fades (each file keeps fade-only
   versions of its own keyframes), and in the game nothing slides or changes size: it is at once in its new place. */
@media (prefers-reduced-motion: reduce) {
  @keyframes wl-in { from { opacity: 0; } }
  @keyframes wl-pop { from { opacity: 0; } }
  @keyframes wl-toast { from { opacity: 0; } }
  @keyframes wl-out { to { opacity: 0; } }
  @keyframes wl-rise { from { opacity: 0; } }
  @keyframes wl-slide { from { opacity: 0; } }
  @keyframes wl-mark { from { opacity: 0; } }
  body.wb-shell :is(.wp-card, .wh-tile):hover :is(img, .wl-emblem-art) { transform: none; }
  body.wb-shell :is(.wl-sys-button, .wh-button, .wh-hero-button, .wl-page-text-action, .wp-hero-actions button, .wp-create-actions button, .wp-bar-actions button):active { transform: none; }
  body.wb-shell *, body.wb-shell *::before, body.wb-shell *::after {
    scroll-behavior: auto !important; animation-duration: 150ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important;
    transition-duration: 150ms !important; transition-delay: 0s !important;
  }
  body.wb-shell :is(.wb-game, .wl-sync, .wl-narrator-picker, .wl-paint-picker, .wl-thought),
  body.wb-shell :is(.wb-game, .wl-sync, .wl-narrator-picker, .wl-paint-picker) *,
  body.wb-shell :is(.wb-game, .wl-sync) *::before, body.wb-shell :is(.wb-game, .wl-sync) *::after,
  body.wb-shell :is(button.wt-entry-card, .wt-type-card, .wh-type-card, .wp-card, .wp-kind) {
    transition-property: opacity, color, background-color, border-color, box-shadow, text-decoration-color !important;
  }
}
