/* Shared motion language: short, quiet and progressively enhanced. */
:root {
  --motion-ease: cubic-bezier(.22, 1, .36, 1);
  --motion-duration: 480ms;
}

/* Never transform the page wrapper: it contains fixed dialogs and menus. */
.page-content,
.guest-shell,
.public-document-shell {
  animation: none;
}
.page-content > .metric-grid > .metric { animation: none; }

@keyframes premium-page {
  from { opacity: .35; }
  to { opacity: 1; }
}
@keyframes premium-surface {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.tab-panel.active {
  animation: premium-surface 320ms var(--motion-ease);
}
.dropdown-menu:not([hidden]),
.global-search-results:not([hidden]) {
  transform-origin: top right;
  animation: premium-surface 220ms var(--motion-ease);
}
.modal.open .modal-dialog,
dialog[open] {
  animation: premium-surface 320ms var(--motion-ease);
}

.card, .metric, .dashboard-kpi, .payment-document {
  transition: border-color 220ms ease, box-shadow 260ms ease;
}
.button, .icon-button, .nav-link, .dashboard-refresh {
  transition: color 180ms ease, background-color 180ms ease,
    border-color 180ms ease, box-shadow 220ms ease, transform 220ms var(--motion-ease);
}
@media (hover: hover) and (pointer: fine) {
  .card:hover, .metric:hover, .dashboard-kpi:hover, .payment-document:hover {
    border-color: color-mix(in srgb, var(--color-primary) 28%, var(--color-border));
    box-shadow: 0 8px 24px -16px color-mix(in srgb, var(--color-primary) 35%, transparent);
  }
  .button:not(:disabled):not([aria-disabled="true"]):hover,
  .dashboard-refresh:not(:disabled):hover { transform: translateY(-1px); }
}
.button:not(:disabled):active, .icon-button:not(:disabled):active {
  transform: translateY(1px);
}
:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--color-primary-contrast, var(--color-primary));
  outline-offset: 3px;
}

@media (max-width: 760px) {
  :root { --motion-duration: 360ms; }
}
@media (prefers-reduced-motion: reduce) {
  .button, .icon-button, .dashboard-refresh { transform: none !important; }
  *, *::before, *::after {
    animation-delay: 0ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
  }
}
@media print {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .page-content, .guest-shell, .public-document-shell { opacity: 1 !important; transform: none !important; }
}
