/* Patient motion: navigation is native; no delayed links or recording actions. */
@view-transition { navigation: auto; }
:root {
  --patient-enter-x: 22px;
  --patient-exit-x: -12px;
  --patient-motion-ease: cubic-bezier(.22, 1, .36, 1);
}
html[data-route-direction="back"] { --patient-enter-x: -18px; --patient-exit-x: 14px; }
html[data-route-direction="same"] { --patient-enter-x: 0px; --patient-exit-x: 0px; }
::view-transition-group(root) { animation-duration: 240ms; animation-timing-function: var(--patient-motion-ease); }
::view-transition-old(root) { animation: patient-route-out 180ms var(--patient-motion-ease) both; }
::view-transition-new(root) { animation: patient-route-in 240ms var(--patient-motion-ease) both; }
::view-transition { pointer-events: none; }
.patient-motion-scrim { position: fixed; inset: 0; z-index: 999; pointer-events: none; }
@keyframes patient-route-out {
  to { opacity: 0; transform: translateX(var(--patient-exit-x)); }
}
@keyframes patient-route-in {
  from { opacity: 0; transform: translateX(var(--patient-enter-x)); }
  to { opacity: 1; transform: translateX(0); }
}
/* display and overlay retain the closing frame while native close/focus is immediate. */
html body[data-patient-theme] dialog {
  --sheet-offset: 24px;
  opacity: 0;
  transform: translateY(var(--sheet-offset)) scale(.985);
  transform-origin: center bottom;
  transition: opacity 160ms var(--patient-motion-ease),
    transform 180ms var(--patient-motion-ease),
    display 180ms allow-discrete, overlay 180ms allow-discrete;
}
html body[data-patient-theme] dialog[open] {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition-duration: 220ms, 240ms, 240ms, 240ms;
}
html body[data-patient-theme] dialog:not([open]) { pointer-events: none; }
html body[data-patient-theme] dialog::backdrop {
  background-color: rgb(41 56 69 / 0);
  transition: background-color 180ms ease, display 180ms allow-discrete, overlay 180ms allow-discrete;
}
html body[data-patient-theme] dialog[open]::backdrop { background-color: rgb(41 56 69 / .38); }
@starting-style {
  html body[data-patient-theme] dialog[open] { opacity: 0; transform: translateY(var(--sheet-offset)) scale(.985); }
  html body[data-patient-theme] dialog[open]::backdrop { background-color: rgb(41 56 69 / 0); }
}
html body[data-patient-theme] .acct::details-content {
  content-visibility: hidden;
  transition: content-visibility 180ms allow-discrete;
}
html body[data-patient-theme] .acct[open]::details-content { content-visibility: visible; }
html body[data-patient-theme] .acct > .acct-menu {
  opacity: 0; transform: translateY(-6px) scale(.98); transform-origin: top right;
  transition: opacity 150ms var(--patient-motion-ease), transform 180ms var(--patient-motion-ease);
}
html body[data-patient-theme] .acct[open] > .acct-menu { opacity: 1; transform: none; }
@starting-style {
  html body[data-patient-theme] .acct[open] > .acct-menu { opacity: 0; transform: translateY(-6px) scale(.98); }
}
@media (min-width: 768px) {
  html body[data-patient-theme] dialog { --sheet-offset: 10px; transform-origin: center; }
}
/* Keyboard and reduced-motion preferences retain immediate navigation and focus. */
html[data-ui-input="keyboard"] body[data-patient-theme] dialog,
html[data-ui-input="keyboard"] body[data-patient-theme] dialog::backdrop,
html[data-ui-input="keyboard"] body[data-patient-theme] .acct::details-content,
html[data-ui-input="keyboard"] body[data-patient-theme] .acct > .acct-menu,
html[data-motion-reduced="true"] body[data-patient-theme] dialog,
html[data-motion-reduced="true"] body[data-patient-theme] dialog::backdrop,
html[data-motion-reduced="true"] body[data-patient-theme] .acct::details-content,
html[data-motion-reduced="true"] body[data-patient-theme] .acct > .acct-menu { transition: none; }
html[data-motion-reduced="true"]::view-transition-old(root),
html[data-motion-reduced="true"]::view-transition-new(root) { animation: none; }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(root), ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
  html body[data-patient-theme] dialog, html body[data-patient-theme] dialog::backdrop,
  html body[data-patient-theme] .acct::details-content, html body[data-patient-theme] .acct > .acct-menu { transition: none !important; }
}
