/* ================= POP-OUT ANIMATIONS =================
   Entrance: the dim backdrop fades up (with a touch of blur) while the dialog rises out of slight depth —
   up from 24px low and 5% small, with a soft overshoot-free spring. Exit: the dialog sinks back a little and the
   backdrop fades, a bit quicker than the entrance. Overlays are wrapped by popouts.js so the exit can play. */
@keyframes kmBackdropIn{ from{ opacity:0; backdrop-filter:blur(0); -webkit-backdrop-filter:blur(0); } to{ opacity:1; backdrop-filter:blur(2px); -webkit-backdrop-filter:blur(2px); } }
@keyframes kmBackdropOut{ from{ opacity:1; backdrop-filter:blur(2px); -webkit-backdrop-filter:blur(2px); } to{ opacity:0; backdrop-filter:blur(0); -webkit-backdrop-filter:blur(0); } }
@keyframes kmDialogIn{
  0%{ opacity:0; transform:translateY(26px) scale(.945); }
  60%{ opacity:1; }
  100%{ opacity:1; transform:none; }
}
@keyframes kmDialogOut{ from{ opacity:1; transform:none; } to{ opacity:0; transform:translateY(14px) scale(.965); } }

.overlay:not([hidden]){
  backdrop-filter:blur(2px); -webkit-backdrop-filter:blur(2px);
  animation:kmBackdropIn .3s ease both;
}
.overlay:not([hidden]) > *{ animation:kmDialogIn .46s cubic-bezier(.16,1,.3,1) both; }
.overlay.is-leaving{ pointer-events:none; animation:kmBackdropOut .24s ease forwards; }
.overlay.is-leaving > *{ animation:kmDialogOut .24s cubic-bezier(.4,0,1,1) forwards; }

/* Settings panel (theme.js): grows out of the gear, shrinks back into it. */
@keyframes kmPanelIn{ from{ opacity:0; transform:translateY(10px) scale(.92); } to{ opacity:1; transform:none; } }
@keyframes kmPanelOut{ from{ opacity:1; transform:none; } to{ opacity:0; transform:translateY(8px) scale(.94); } }
.km-settings{ transform-origin:100% 100%; animation:kmPanelIn .26s cubic-bezier(.16,1,.3,1) both; }
.km-settings.is-leaving{ pointer-events:none; animation:kmPanelOut .16s ease-in forwards; }

@media (prefers-reduced-motion:reduce){
  .overlay:not([hidden]), .overlay:not([hidden]) > *, .overlay.is-leaving, .overlay.is-leaving > *, .km-settings, .km-settings.is-leaving{ animation:none; }
}
