:root {
  --mx-motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mx-motion-fast: 180ms;
  --mx-motion-normal: 360ms;
}

@keyframes mx-fade-down {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes mx-rise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes mx-pop {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes mx-dialog-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.965);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes mx-backdrop-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes mx-menu-in {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

body {
  overflow-x: hidden;
}

.topbar {
  animation: mx-fade-down 520ms var(--mx-motion-ease) 60ms backwards;
}

.logo-container {
  animation: mx-rise 650ms var(--mx-motion-ease) 100ms backwards;
}

.search-bar {
  animation: mx-rise 650ms var(--mx-motion-ease) 190ms backwards;
}

.shortcuts-shell {
  animation: mx-rise 650ms var(--mx-motion-ease) 280ms backwards;
}

.radar-wrapper {
  animation: mx-rise 680ms var(--mx-motion-ease) 360ms backwards;
}

.weather-timebar {
  animation: mx-rise 680ms var(--mx-motion-ease) 420ms backwards;
}

.weather-container:nth-child(1) {
  animation: mx-rise 620ms var(--mx-motion-ease) 490ms backwards;
}

.weather-container:nth-child(2) {
  animation: mx-rise 620ms var(--mx-motion-ease) 560ms backwards;
}

.countdown-card:nth-child(1) {
  animation: mx-rise 620ms var(--mx-motion-ease) 620ms backwards;
}

.countdown-card:nth-child(2) {
  animation: mx-rise 620ms var(--mx-motion-ease) 690ms backwards;
}

.shortcut {
  animation: mx-pop 420ms var(--mx-motion-ease) backwards;
}

.shortcut:nth-child(1) { animation-delay: 20ms; }
.shortcut:nth-child(2) { animation-delay: 55ms; }
.shortcut:nth-child(3) { animation-delay: 90ms; }
.shortcut:nth-child(4) { animation-delay: 125ms; }
.shortcut:nth-child(5) { animation-delay: 160ms; }
.shortcut:nth-child(6) { animation-delay: 195ms; }
.shortcut:nth-child(7) { animation-delay: 230ms; }
.shortcut:nth-child(8) { animation-delay: 265ms; }
.shortcut:nth-child(9) { animation-delay: 300ms; }
.shortcut:nth-child(n + 10) { animation-delay: 335ms; }

.topbar a,
.topbar button,
.shortcut,
.shortcut img,
.weather-timebar,
.weather-container,
.weather-icon,
.countdown-card,
.app-item,
.note-card,
.shortcut-list__item,
.countdown-manager-item {
  transition-duration: var(--mx-motion-normal);
  transition-timing-function: var(--mx-motion-ease);
}

.topbar > a:hover,
.topbar > button:hover,
.topbar .apps-btn:hover,
.topbar .manage-shortcuts-btn:hover,
.topbar .notes-open-button:hover {
  transform: translateY(-2px);
}

.topbar a:active,
.topbar button:active,
.search-icon:active,
.notes-primary-button:active,
.notes-secondary-button:active,
.primary-button:active,
.secondary-button:active {
  transform: scale(0.96);
}

.search-bar:hover,
.search-bar:focus-within {
  transform: translateY(-4px) scale(1.008);
}

.search-action img:hover {
  transform: translateY(-2px) scale(1.08);
}

.shortcuts-row a:hover {
  transform: translateY(-7px) scale(1.035);
}

.shortcuts-row a:hover img {
  transform: translateY(-2px) scale(1.12) rotate(-2deg);
}

.weather-timebar,
.countdown-card {
  transition-property: transform, box-shadow, border-color, background-color;
}

.weather-timebar:hover,
.countdown-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
}

.weather-container:hover {
  transform: translateY(-5px) scale(1.015);
}

.weather-container:hover .weather-icon {
  transform: translateY(-4px) scale(1.06);
}

.note-card:hover,
.shortcut-list__item:hover,
.countdown-manager-item:hover {
  transform: translateY(-2px);
}

.apps-menu {
  transform-origin: top right;
  animation: mx-menu-in 260ms var(--mx-motion-ease) backwards;
}

.notes-manager__backdrop,
.notes-password-dialog__backdrop,
.shortcut-manager__backdrop,
.token-dialog__backdrop {
  animation: mx-backdrop-in 220ms ease-out backwards;
}

.notes-manager__panel,
.notes-password-dialog__panel,
.shortcut-manager__panel,
.token-dialog__panel {
  animation: mx-dialog-in 380ms var(--mx-motion-ease) backwards;
}

.note-card,
.shortcut-list__item,
.countdown-manager-item {
  animation: mx-rise 340ms var(--mx-motion-ease) backwards;
}

@media (hover: none) {
  .topbar > a:hover,
  .topbar > button:hover,
  .topbar .apps-btn:hover,
  .topbar .manage-shortcuts-btn:hover,
  .topbar .notes-open-button:hover,
  .search-bar:hover,
  .shortcuts-row a:hover,
  .weather-timebar:hover,
  .weather-container:hover,
  .countdown-card:hover,
  .note-card:hover,
  .shortcut-list__item:hover,
  .countdown-manager-item:hover {
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Keep managers light; homepage motion remains enabled. */
.notes-manager__backdrop,
.shortcut-manager__backdrop,
.token-dialog__backdrop,
.notes-manager__panel,
.shortcut-manager__panel,
.token-dialog__panel,
.notes-manager.is-entering .notes-manager__header,
.notes-manager.is-entering .notes-form,
.notes-manager.is-entering .notes-library,
.note-card,
.shortcut-list__item,
.countdown-manager-item {
  animation: none;
}

.note-card:hover,
.shortcut-list__item:hover,
.countdown-manager-item:hover {
  transform: none;
}

@keyframes mx-password-open {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.notes-password-dialog:not([hidden]) .notes-password-dialog__panel {
  animation: mx-password-open 160ms ease-out both;
}

.notes-password-dialog.is-shaking .notes-password-dialog__panel,
.notes-password-dialog.is-success .notes-password-dialog__icon {
  animation: none;
}
