/* ============================================================
   Agent OS — Premium Animations
   Inspired by Linear, Vercel, and Stripe dashboard aesthetics
   ============================================================ */

/* ── CSS Custom Properties ─────────────────────────────────── */
:root {
  /* Brand gradient palette */
  --ao-accent-start: #6366f1;
  --ao-accent-mid: #8b5cf6;
  --ao-accent-end: #a855f7;
  --ao-surface: #f8f9fc;
  --ao-surface-raised: #ffffff;
  --ao-border: #e2e8f0;
  --ao-border-hover: #cbd5e1;
  --ao-text-primary: #1e293b;
  --ao-text-secondary: #64748b;

  /* Glow colours */
  --ao-glow: rgba(99, 102, 241, 0.15);
  --ao-glow-strong: rgba(139, 92, 246, 0.25);

  /* Timing */
  --ao-ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ao-ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ao-ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);

  /* Durations */
  --ao-dur-fast: 150ms;
  --ao-dur-normal: 250ms;
  --ao-dur-slow: 500ms;
  --ao-dur-slower: 800ms;
}

/* ============================================================
   1 — BACKGROUND ANIMATIONS — Animated Gradient
   ============================================================ */

/* Full-page animated gradient backdrop */
.ao-bg-gradient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    135deg,
    #f8f9fc 0%,
    #eef2ff 25%,
    #faf5ff 50%,
    #f0f9ff 75%,
    #f8f9fc 100%
  );
  background-size: 400% 400%;
  animation: ao-gradient-shift 20s ease infinite;
}

@keyframes ao-gradient-shift {
  0%   { background-position: 0% 50%; }
  25%  { background-position: 100% 0%; }
  50%  { background-position: 100% 100%; }
  75%  { background-position: 0% 100%; }
  100% { background-position: 0% 50%; }
}

/* Subtle aurora wash over the surface */
.ao-bg-aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.ao-bg-aurora::before,
.ao-bg-aurora::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.12;
  animation: ao-aurora-drift 25s ease-in-out infinite alternate;
}

.ao-bg-aurora::before {
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, var(--ao-accent-start), transparent 70%);
  top: -20%;
  left: -10%;
}

.ao-bg-aurora::after {
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, var(--ao-accent-end), transparent 70%);
  bottom: -20%;
  right: -10%;
  animation-delay: -12s;
  animation-direction: alternate-reverse;
}

@keyframes ao-aurora-drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(5vw, 3vh) scale(1.1); }
  100% { transform: translate(-3vw, 5vh) scale(0.95); }
}

/* ============================================================
   2 — CARD ANIMATIONS — Hover lift, glow, scale
   ============================================================ */

.ao-card {
  position: relative;
  background: var(--ao-surface-raised);
  border: 1px solid var(--ao-border);
  border-radius: 12px;
  padding: 24px;
  transition:
    transform var(--ao-dur-normal) var(--ao-ease-spring),
    border-color var(--ao-dur-normal) var(--ao-ease-smooth),
    box-shadow var(--ao-dur-slow) var(--ao-ease-smooth);
  will-change: transform, box-shadow;
}

.ao-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: var(--ao-border-hover);
  box-shadow:
    0 8px 30px rgba(0, 0, 0, 0.3),
    0 0 0 1px var(--ao-border-hover),
    0 0 60px -20px var(--ao-glow);
}

/* Glow-border variant */
.ao-card--glow {
  overflow: hidden;
}

.ao-card--glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(
    135deg,
    var(--ao-accent-start),
    var(--ao-accent-mid),
    var(--ao-accent-end),
    var(--ao-accent-start)
  );
  background-size: 300% 300%;
  z-index: -1;
  opacity: 0;
  transition: opacity var(--ao-dur-slow) var(--ao-ease-smooth);
  animation: ao-border-gradient 4s linear infinite;
}

.ao-card--glow::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: calc(12px - 1px);
  background: var(--ao-surface-raised);
  z-index: -1;
}

.ao-card--glow:hover::before {
  opacity: 1;
}

@keyframes ao-border-gradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Spotlight follow effect (uses CSS anchor or fallback) */
.ao-card--spotlight {
  overflow: hidden;
}

.ao-card--spotlight::before {
  content: '';
  position: absolute;
  top: var(--ao-mouse-y, 50%);
  left: var(--ao-mouse-x, 50%);
  width: 300px;
  height: 300px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--ao-glow) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--ao-dur-slow) var(--ao-ease-smooth);
  pointer-events: none;
  z-index: 0;
}

.ao-card--spotlight:hover::before {
  opacity: 1;
}

/* ============================================================
   3 — TEXT ANIMATIONS — Typewriter, gradient shimmer
   ============================================================ */

/* Typewriter effect */
.ao-typewriter {
  display: inline-block;
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--ao-text-primary);
  width: 0;
  animation:
    ao-type-expand 2.5s steps(30, end) forwards,
    ao-cursor-blink 0.75s step-end infinite;
}

@keyframes ao-type-expand {
  from { width: 0; }
  to   { width: 100%; }
}

@keyframes ao-cursor-blink {
  0%, 100% { border-color: var(--ao-text-primary); }
  50%      { border-color: transparent; }
}

/* Gradient text shimmer */
.ao-shimmer-text {
  background: linear-gradient(
    110deg,
    var(--ao-text-secondary) 0%,
    var(--ao-text-secondary) 40%,
    var(--ao-text-primary) 50%,
    var(--ao-text-secondary) 60%,
    var(--ao-text-secondary) 100%
  );
  background-size: 250% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: ao-shimmer 3s ease-in-out infinite;
}

@keyframes ao-shimmer {
  0%   { background-position: 150% 0; }
  100% { background-position: -150% 0; }
}

/* Fade-in-up for individual text elements */
.ao-text-reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: ao-fade-in-up var(--ao-dur-slower) var(--ao-ease-out-expo) forwards;
}

.ao-text-reveal:nth-child(1) { animation-delay: 0ms; }
.ao-text-reveal:nth-child(2) { animation-delay: 80ms; }
.ao-text-reveal:nth-child(3) { animation-delay: 160ms; }
.ao-text-reveal:nth-child(4) { animation-delay: 240ms; }
.ao-text-reveal:nth-child(5) { animation-delay: 320ms; }
.ao-text-reveal:nth-child(6) { animation-delay: 400ms; }

/* ============================================================
   4 — BUTTON ANIMATIONS — Pulse glow, ripple
   ============================================================ */

.ao-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 22px;
  font-weight: 500;
  font-size: 14px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  overflow: hidden;
  background: linear-gradient(135deg, var(--ao-accent-start), var(--ao-accent-end));
  color: #fff;
  transition:
    transform var(--ao-dur-fast) var(--ao-ease-spring),
    box-shadow var(--ao-dur-normal) var(--ao-ease-smooth);
  isolation: isolate;
}

.ao-btn:hover {
  transform: translateY(-1px);
  box-shadow:
    0 4px 20px var(--ao-glow),
    0 0 60px -15px var(--ao-glow-strong);
}

.ao-btn:active {
  transform: translateY(0) scale(0.97);
  transition-duration: 80ms;
}

/* Pulse glow (for primary CTA) */
.ao-btn--pulse {
  animation: ao-pulse-glow 2.5s ease-in-out infinite;
}

@keyframes ao-pulse-glow {
  0%, 100% { box-shadow: 0 4px 20px var(--ao-glow); }
  50%      { box-shadow: 0 4px 40px var(--ao-glow-strong), 0 0 80px -20px var(--ao-glow); }
}

/* Ripple on click */
.ao-btn .ao-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  animation: ao-ripple-expand 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes ao-ripple-expand {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Ghost / outline variant */
.ao-btn--ghost {
  background: transparent;
  border: 1px solid var(--ao-border-hover);
  color: var(--ao-text-primary);
}

.ao-btn--ghost:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--ao-accent-start);
  box-shadow: 0 0 30px -10px var(--ao-glow);
}

/* ============================================================
   5 — PAGE TRANSITIONS — Fade-in-slide-up
   ============================================================ */

.ao-page-enter {
  opacity: 0;
  transform: translateY(24px);
  animation: ao-page-in var(--ao-dur-slower) var(--ao-ease-out-expo) forwards;
}

.ao-page-exit {
  animation: ao-page-out var(--ao-dur-normal) var(--ao-ease-smooth) forwards;
}

@keyframes ao-page-in {
  from {
    opacity: 0;
    transform: translateY(24px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes ao-page-out {
  from {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
  to {
    opacity: 0;
    transform: translateY(-12px);
    filter: blur(4px);
  }
}

/* Staggered children entrance */
.ao-stagger > * {
  opacity: 0;
  transform: translateY(20px);
  animation: ao-fade-in-up var(--ao-dur-slow) var(--ao-ease-out-expo) forwards;
}

.ao-stagger > *:nth-child(1)  { animation-delay: 0ms; }
.ao-stagger > *:nth-child(2)  { animation-delay: 50ms; }
.ao-stagger > *:nth-child(3)  { animation-delay: 100ms; }
.ao-stagger > *:nth-child(4)  { animation-delay: 150ms; }
.ao-stagger > *:nth-child(5)  { animation-delay: 200ms; }
.ao-stagger > *:nth-child(6)  { animation-delay: 250ms; }
.ao-stagger > *:nth-child(7)  { animation-delay: 300ms; }
.ao-stagger > *:nth-child(8)  { animation-delay: 350ms; }
.ao-stagger > *:nth-child(9)  { animation-delay: 400ms; }
.ao-stagger > *:nth-child(10) { animation-delay: 450ms; }

/* Shared keyframe */
@keyframes ao-fade-in-up {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ============================================================
   6 — LOADING ANIMATIONS — Skeleton, spinner, progress bar
   ============================================================ */

/* Skeleton shimmer placeholder */
.ao-skeleton {
  position: relative;
  overflow: hidden;
  background: var(--ao-surface-raised);
  border-radius: 8px;
}

.ao-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.04) 40%,
    rgba(255, 255, 255, 0.08) 50%,
    rgba(255, 255, 255, 0.04) 60%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: ao-skeleton-shimmer 1.8s ease-in-out infinite;
}

@keyframes ao-skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Spinner */
.ao-spinner {
  width: 24px;
  height: 24px;
  border: 2.5px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--ao-accent-start);
  border-radius: 50%;
  animation: ao-spin 0.7s linear infinite;
}

.ao-spinner--sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
}

.ao-spinner--lg {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

@keyframes ao-spin {
  to { transform: rotate(360deg); }
}

/* Orbital spinner (premium look) */
.ao-spinner--orbital {
  position: relative;
  width: 32px;
  height: 32px;
}

.ao-spinner--orbital::before,
.ao-spinner--orbital::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}

.ao-spinner--orbital::before {
  border-top-color: var(--ao-accent-start);
  animation: ao-spin 1s linear infinite;
}

.ao-spinner--orbital::after {
  inset: 4px;
  border-right-color: var(--ao-accent-end);
  animation: ao-spin 1.5s linear infinite reverse;
}

/* Progress bar */
.ao-progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}

.ao-progress__bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--ao-accent-start), var(--ao-accent-end));
  transition: width var(--ao-dur-slow) var(--ao-ease-out-expo);
}

/* Indeterminate progress */
.ao-progress--indeterminate .ao-progress__bar {
  width: 40% !important;
  animation: ao-progress-slide 1.5s ease-in-out infinite;
}

@keyframes ao-progress-slide {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(350%); }
}

/* Dots loader */
.ao-dots {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.ao-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ao-accent-start);
  animation: ao-dot-bounce 1.2s ease-in-out infinite;
}

.ao-dots span:nth-child(2) { animation-delay: 0.15s; }
.ao-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes ao-dot-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-8px); opacity: 1; }
}

/* ============================================================
   7 — PARTICLE EFFECT — Floating dots/stars (CSS only)
   ============================================================ */

.ao-particles {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: -1;
}

.ao-particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: ao-particle-float linear infinite;
}

/* 20 particles with varied sizes, positions, and timing */
.ao-particle:nth-child(1)  { left:  5%; width: 2px; height: 2px; animation-duration: 18s; animation-delay: 0s; }
.ao-particle:nth-child(2)  { left: 12%; width: 1px; height: 1px; animation-duration: 22s; animation-delay: -3s; }
.ao-particle:nth-child(3)  { left: 20%; width: 3px; height: 3px; animation-duration: 15s; animation-delay: -7s; opacity: 0.3; }
.ao-particle:nth-child(4)  { left: 28%; width: 2px; height: 2px; animation-duration: 25s; animation-delay: -2s; }
.ao-particle:nth-child(5)  { left: 35%; width: 1px; height: 1px; animation-duration: 20s; animation-delay: -10s; }
.ao-particle:nth-child(6)  { left: 42%; width: 2px; height: 2px; animation-duration: 17s; animation-delay: -5s; opacity: 0.6; }
.ao-particle:nth-child(7)  { left: 50%; width: 3px; height: 3px; animation-duration: 23s; animation-delay: -1s; opacity: 0.25; }
.ao-particle:nth-child(8)  { left: 58%; width: 1px; height: 1px; animation-duration: 19s; animation-delay: -8s; }
.ao-particle:nth-child(9)  { left: 65%; width: 2px; height: 2px; animation-duration: 21s; animation-delay: -4s; }
.ao-particle:nth-child(10) { left: 72%; width: 1px; height: 1px; animation-duration: 16s; animation-delay: -12s; opacity: 0.5; }
.ao-particle:nth-child(11) { left: 78%; width: 3px; height: 3px; animation-duration: 24s; animation-delay: -6s; opacity: 0.2; }
.ao-particle:nth-child(12) { left: 85%; width: 2px; height: 2px; animation-duration: 18s; animation-delay: -9s; }
.ao-particle:nth-child(13) { left: 92%; width: 1px; height: 1px; animation-duration: 20s; animation-delay: -3s; }
.ao-particle:nth-child(14) { left:  8%; width: 2px; height: 2px; animation-duration: 26s; animation-delay: -11s; opacity: 0.4; }
.ao-particle:nth-child(15) { left: 15%; width: 1px; height: 1px; animation-duration: 14s; animation-delay: -2s; }
.ao-particle:nth-child(16) { left: 33%; width: 2px; height: 2px; animation-duration: 22s; animation-delay: -7s; opacity: 0.35; }
.ao-particle:nth-child(17) { left: 48%; width: 3px; height: 3px; animation-duration: 19s; animation-delay: -4s; opacity: 0.2; }
.ao-particle:nth-child(18) { left: 62%; width: 1px; height: 1px; animation-duration: 25s; animation-delay: -1s; }
.ao-particle:nth-child(19) { left: 76%; width: 2px; height: 2px; animation-duration: 17s; animation-delay: -8s; opacity: 0.45; }
.ao-particle:nth-child(20) { left: 90%; width: 1px; height: 1px; animation-duration: 21s; animation-delay: -5s; }

@keyframes ao-particle-float {
  0% {
    transform: translateY(100vh) scale(0);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: translateY(-10vh) scale(1);
    opacity: 0;
  }
}

/* Star-twinkle variant */
.ao-particles--stars .ao-particle {
  background: rgba(255, 255, 255, 0.8);
  animation-name: ao-star-twinkle;
}

@keyframes ao-star-twinkle {
  0%, 100% { opacity: 0.1; transform: scale(0.5); }
  50%      { opacity: 0.8; transform: scale(1.2); }
}

/* ============================================================
   8 — HOVER EFFECTS — Color transitions, underline
   ============================================================ */

/* Smooth colour shift on hover */
.ao-hover-color {
  transition: color var(--ao-dur-normal) var(--ao-ease-smooth);
}

.ao-hover-color:hover {
  color: var(--ao-accent-start);
}

/* Animated underline (slides in from left) */
.ao-underline {
  position: relative;
  text-decoration: none;
  color: var(--ao-text-primary);
}

.ao-underline::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: linear-gradient(90deg, var(--ao-accent-start), var(--ao-accent-end));
  transition: width var(--ao-dur-normal) var(--ao-ease-out-expo);
  border-radius: 999px;
}

.ao-underline:hover::after {
  width: 100%;
}

/* Centre-expand underline */
.ao-underline--center::after {
  left: 50%;
  transform: translateX(-50%);
}

.ao-underline--center:hover::after {
  width: 100%;
}

/* Glow underline */
.ao-underline--glow::after {
  height: 2px;
  box-shadow: 0 0 8px var(--ao-glow);
}

/* Icon lift on hover */
.ao-icon-lift {
  display: inline-flex;
  transition:
    transform var(--ao-dur-normal) var(--ao-ease-spring),
    color var(--ao-dur-normal) var(--ao-ease-smooth);
}

.ao-icon-lift:hover {
  transform: translateY(-2px);
  color: var(--ao-accent-start);
}

/* Image zoom on hover */
.ao-img-zoom {
  overflow: hidden;
  border-radius: 8px;
}

.ao-img-zoom img {
  transition: transform var(--ao-dur-slow) var(--ao-ease-smooth);
}

.ao-img-zoom:hover img {
  transform: scale(1.05);
}

/* ============================================================
   9 — SCROLL ANIMATIONS — Fade in on viewport entry (CSS only)
   Uses animation-timeline: view() for native CSS scroll-driven
   animations. Falls back gracefully in unsupported browsers.
   ============================================================ */

.ao-scroll-reveal {
  animation: ao-fade-in-up linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 40%;
}

.ao-scroll-reveal-left {
  animation: ao-slide-in-left linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 35%;
}

.ao-scroll-reveal-right {
  animation: ao-slide-in-right linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 35%;
}

.ao-scroll-reveal-scale {
  animation: ao-scale-in linear both;
  animation-timeline: view();
  animation-range: entry 0% entry 40%;
}

@keyframes ao-slide-in-left {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes ao-slide-in-right {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

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

/* Parallax-style fade for hero sections */
.ao-scroll-parallax {
  animation: ao-parallax linear both;
  animation-timeline: scroll();
  animation-range: 0% 50%;
}

@keyframes ao-parallax {
  from { transform: translateY(60px); opacity: 0.3; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ============================================================
   10 — MODAL ANIMATIONS — Backdrop blur, scale-in, slide-down
   ============================================================ */

/* Backdrop */
.ao-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  animation: ao-backdrop-in var(--ao-dur-normal) var(--ao-ease-smooth) forwards;
}

@keyframes ao-backdrop-in {
  from { opacity: 0; backdrop-filter: blur(0px); }
  to   { opacity: 1; backdrop-filter: blur(8px); }
}

.ao-modal-backdrop--exiting {
  animation: ao-backdrop-out var(--ao-dur-normal) var(--ao-ease-smooth) forwards;
}

@keyframes ao-backdrop-out {
  from { opacity: 1; backdrop-filter: blur(8px); }
  to   { opacity: 0; backdrop-filter: blur(0px); }
}

/* Modal panel — scale-in from center */
.ao-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  z-index: 1001;
  background: var(--ao-surface-raised);
  border: 1px solid var(--ao-border);
  border-radius: 16px;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  opacity: 0;
  animation: ao-modal-scale-in var(--ao-dur-slow) var(--ao-ease-spring) forwards;
}

@keyframes ao-modal-scale-in {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.92) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) translateY(0);
  }
}

.ao-modal--exiting {
  animation: ao-modal-scale-out var(--ao-dur-normal) var(--ao-ease-smooth) forwards;
}

@keyframes ao-modal-scale-out {
  from {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1) translateY(0);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.95) translateY(10px);
  }
}

/* Slide-down variant */
.ao-modal--slide-down {
  top: 0;
  left: 50%;
  transform: translate(-50%, 0) translateY(-100%);
  border-radius: 0 0 16px 16px;
  animation: ao-modal-slide-down var(--ao-dur-slow) var(--ao-ease-spring) forwards;
}

@keyframes ao-modal-slide-down {
  from { transform: translate(-50%, 0) translateY(-100%); opacity: 0; }
  to   { transform: translate(-50%, 0) translateY(0);    opacity: 1; }
}

.ao-modal--slide-down.ao-modal--exiting {
  animation: ao-modal-slide-up var(--ao-dur-normal) var(--ao-ease-smooth) forwards;
}

@keyframes ao-modal-slide-up {
  from { transform: translate(-50%, 0) translateY(0);    opacity: 1; }
  to   { transform: translate(-50%, 0) translateY(-100%); opacity: 0; }
}

/* ============================================================
   BONUS — UTILITY / SHARED ANIMATIONS
   ============================================================ */

/* Breathing glow (used for status indicators) */
.ao-breathe {
  animation: ao-breathe 3s ease-in-out infinite;
}

@keyframes ao-breathe {
  0%, 100% { box-shadow: 0 0 0 0 var(--ao-glow); }
  50%      { box-shadow: 0 0 20px 4px var(--ao-glow); }
}

/* Gentle float (for decorative elements) */
.ao-float {
  animation: ao-float 6s ease-in-out infinite;
}

@keyframes ao-float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}

/* Notification slide-in from top-right */
.ao-toast {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 2000;
  animation: ao-toast-in var(--ao-dur-slow) var(--ao-ease-spring) forwards;
}

@keyframes ao-toast-in {
  from {
    opacity: 0;
    transform: translateX(40px) translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0) translateY(0);
  }
}

.ao-toast--exiting {
  animation: ao-toast-out var(--ao-dur-normal) var(--ao-ease-smooth) forwards;
}

@keyframes ao-toast-out {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(40px); }
}

/* Magnetic hover (JS sets --ao-mx / --ao-my custom properties) */
.ao-magnetic {
  transition: transform var(--ao-dur-fast) var(--ao-ease-smooth);
  transform: translate(var(--ao-mx, 0px), var(--ao-my, 0px));
}

/* Number count-up placeholder styling */
.ao-counter {
  display: inline-block;
  font-variant-numeric: tabular-nums;
}

/* Reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
