/*
 * smooth page changes: saving / adding / deleting reloads the page, but it shouldn't look like the
 * site restarted.
 * - Chrome, Edge, Brave: old and new page cross-fade, sidebar stays put
 * - other browsers: new page fades in instead of flashing white
 */
@view-transition { navigation: auto; }

::view-transition-group(root) { animation-duration: .16s; }
::view-transition-old(root),
::view-transition-new(root)   { animation-duration: .16s; animation-timing-function: ease-out; }

/* the sidebar is the same on every page, so it gets its own layer and doesn't fade */
.sidebar { view-transition-name: dt-sidebar; }
::view-transition-group(dt-sidebar) { animation-duration: 0s; }
::view-transition-old(dt-sidebar)   { display: none; }
::view-transition-new(dt-sidebar)   { animation: none; }

@supports not (view-transition-name: none) {
    @keyframes dtSoftIn { from { opacity: .0; } to { opacity: 1; } }
    body { animation: dtSoftIn .18s ease-out; }
}

@media (prefers-reduced-motion: reduce) {
    ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
    body { animation: none !important; }
}

/*
 * loading spinner (use everywhere)
 * .dt-spinner - big ring for modals / overlays
 * .dt-spin - small ring inside buttons / status text, takes the text color
 * .dt-overlay - full-screen dim layer with a centered .dt-spinner and message
 */
@keyframes dtSpin { to { transform: rotate(360deg); } }
.dt-spinner { display: inline-block; box-sizing: border-box; width: 50px; height: 50px; border: 4px solid #D4D4D4; border-top-color: #C57C4D; border-radius: 50%; animation: dtSpin .8s linear infinite; }
.dt-spin { display: inline-block; box-sizing: border-box; width: 1em; height: 1em; margin-right: .5em; vertical-align: -.15em; border: .14em solid rgba(0, 0, 0, .35); border-top-color: currentColor; border-radius: 50%; animation: dtSpin .8s linear infinite; }
.dt-spin:last-child { margin-right: 0; }
.dt-overlay { display: none; position: fixed; inset: 0; z-index: 9999; flex-direction: column; align-items: center; justify-content: center; gap: 15px; background: rgba(0, 0, 0, .65); color: #FFFFFF; font-weight: 600; text-align: center; }
.dt-overlay.show { display: flex; }
.dt-overlay .dt-spinner { border-color: rgba(255, 255, 255, .3); border-top-color: #C57C4D; }
.dt-overlay h5, .dt-overlay div { margin: 0; }
@media (prefers-reduced-motion: reduce) { .dt-spinner, .dt-spin { animation-duration: 2s; } }
