/* ============================================================
   Graphico Pro — animation.css (Ultra‑Premium)
   Rich animations for every interaction.
   ============================================================ */

/* --------------------------------------------
   Fade In
   -------------------------------------------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInDown {
  from { opacity: 0; transform: translateY(-16px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(16px); }
  to   { opacity: 1; transform: translateX(0); }
}

.animate-fade-in       { animation: fadeIn 0.3s ease-out both; }
.animate-fade-in-up    { animation: fadeInUp 0.4s cubic-bezier(0.22, 0.68, 0, 1.2) both; }
.animate-fade-in-down  { animation: fadeInDown 0.4s cubic-bezier(0.22, 0.68, 0, 1.2) both; }
.animate-fade-in-left  { animation: fadeInLeft 0.4s cubic-bezier(0.22, 0.68, 0, 1.2) both; }
.animate-fade-in-right { animation: fadeInRight 0.4s cubic-bezier(0.22, 0.68, 0, 1.2) both; }

/* --------------------------------------------
   Slide In (with spring)
   -------------------------------------------- */
@keyframes slideInUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes slideInDown {
  from { transform: translateY(-24px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

@keyframes slideInLeft {
  from { transform: translateX(-24px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(24px); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

.animate-slide-in-up    { animation: slideInUp 0.5s cubic-bezier(0.22, 0.68, 0, 1.2) both; }
.animate-slide-in-down  { animation: slideInDown 0.5s cubic-bezier(0.22, 0.68, 0, 1.2) both; }
.animate-slide-in-left  { animation: slideInLeft 0.5s cubic-bezier(0.22, 0.68, 0, 1.2) both; }
.animate-slide-in-right { animation: slideInRight 0.5s cubic-bezier(0.22, 0.68, 0, 1.2) both; }

/* --------------------------------------------
   Scale (bouncy)
   -------------------------------------------- */
@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

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

.animate-scale-in  { animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both; }
.animate-scale-out { animation: scaleOut 0.2s ease-in both; }

/* --------------------------------------------
   Rotate / Spin
   -------------------------------------------- */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

@keyframes spinPulse {
  0%   { transform: rotate(0deg) scale(1); }
  50%  { transform: rotate(180deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

.animate-spin       { animation: spin 0.8s linear infinite; }
.animate-spin-slow  { animation: spinSlow 3s linear infinite; }
.animate-spin-pulse { animation: spinPulse 1.5s ease-in-out infinite; }

/* --------------------------------------------
   Pulse & Glow
   -------------------------------------------- */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(201, 161, 91, 0.4); }
  50%      { box-shadow: 0 0 0 12px rgba(201, 161, 91, 0); }
}

.animate-pulse      { animation: pulse 2s ease-in-out infinite; }
.animate-pulse-glow { animation: pulseGlow 2s ease-in-out infinite; }

/* --------------------------------------------
   Shimmer / Skeleton Loading
   -------------------------------------------- */
@keyframes shimmer {
  0%   { background-position: -200% center; }
  100% { background-position: 200% center; }
}

.animate-shimmer {
  background: linear-gradient(90deg, #1E2024 0%, #2A2C32 45%, #1E2024 100%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

/* --------------------------------------------
   Bounce In
   -------------------------------------------- */
@keyframes bounceIn {
  0%   { transform: scale(0.3); opacity: 0; }
  50%  { transform: scale(1.08); }
  70%  { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

.animate-bounce-in { animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both; }

/* --------------------------------------------
   Typing Dots (enhanced)
   -------------------------------------------- */
@keyframes typingBounce {
  0%, 80%, 100% { transform: translateY(0); opacity: 0.4; }
  40%           { transform: translateY(-6px); opacity: 1; }
}

.typing-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: typingBounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

/* --------------------------------------------
   Stagger Children (enhanced)
   -------------------------------------------- */
.stagger-children > * {
  opacity: 0;
  animation: fadeInUp 0.5s cubic-bezier(0.22, 0.68, 0, 1.2) forwards;
}

.stagger-children > *:nth-child(1)  { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2)  { animation-delay: 0.10s; }
.stagger-children > *:nth-child(3)  { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4)  { animation-delay: 0.20s; }
.stagger-children > *:nth-child(5)  { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6)  { animation-delay: 0.30s; }
.stagger-children > *:nth-child(7)  { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8)  { animation-delay: 0.40s; }
.stagger-children > *:nth-child(9)  { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.50s; }

/* --------------------------------------------
   Hover Effects (additional)
   -------------------------------------------- */
.hover-lift {
  transition: transform 0.25s cubic-bezier(0.22, 0.68, 0, 1.2), box-shadow 0.25s ease;
}
.hover-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,.4);
}

.hover-glow {
  transition: box-shadow 0.25s ease, border-color 0.25s ease;
}
.hover-glow:hover {
  box-shadow: 0 0 0 4px rgba(201, 161, 91, 0.2);
  border-color: var(--color-brass-dim);
}

.hover-scale {
  transition: transform 0.2s cubic-bezier(0.22, 0.68, 0, 1.2);
}
.hover-scale:hover {
  transform: scale(1.05);
}

/* --------------------------------------------
   New: Ripple (used via JS or :active)
   -------------------------------------------- */
.ripple {
  position: relative;
  overflow: hidden;
}
.ripple::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  width: 100%;
  padding-top: 100%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.4s, opacity 0.4s;
  opacity: 0;
}
.ripple:active::after {
  transform: translate(-50%, -50%) scale(3);
  opacity: 1;
  transition: 0s;
}

/* --------------------------------------------
   New: Gradient Move (for backgrounds)
   -------------------------------------------- */
@keyframes gradientMove {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
.animate-gradient {
  background-size: 200% 200%;
  animation: gradientMove 4s ease infinite;
}

/* --------------------------------------------
   New: Float (gentle hover lift)
   -------------------------------------------- */
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-8px); }
}
.animate-float {
  animation: float 3s ease-in-out infinite;
}

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

/* ============================================================
   God-Tier Motion Layer
   Additive — none of the rules above are modified or removed.
   New keyframes + opt-in utility classes for richer motion.
   ============================================================ */

/* --------------------------------------------
   Elastic / Spring entrances
   -------------------------------------------- */
@keyframes elasticIn {
  0%   { transform: scale(0.4); opacity: 0; }
  60%  { transform: scale(1.12); opacity: 1; }
  80%  { transform: scale(0.94); }
  100% { transform: scale(1); }
}
.animate-elastic-in { animation: elasticIn 0.7s cubic-bezier(.68,-0.55,.27,1.55) both; }

@keyframes popIn {
  0%   { transform: scale(0.6) rotate(-4deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}
.animate-pop-in { animation: popIn 0.45s cubic-bezier(.34,1.56,.64,1) both; }

/* --------------------------------------------
   Reveal on axis (smooth clip-path curtain)
   -------------------------------------------- */
@keyframes revealLeft {
  from { clip-path: inset(0 100% 0 0); }
  to   { clip-path: inset(0 0 0 0); }
}
@keyframes revealRight {
  from { clip-path: inset(0 0 0 100%); }
  to   { clip-path: inset(0 0 0 0); }
}
.animate-reveal-left  { animation: revealLeft 0.6s cubic-bezier(.16,1,.3,1) both; }
.animate-reveal-right { animation: revealRight 0.6s cubic-bezier(.16,1,.3,1) both; }

/* --------------------------------------------
   Aurora gradient sweep (for text or borders)
   -------------------------------------------- */
@keyframes auroraSweep {
  0%   { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}
.animate-aurora {
  background-size: 200% auto;
  animation: auroraSweep 4s linear infinite;
}

/* --------------------------------------------
   Border glow rotate (conic gradient sweep)
   -------------------------------------------- */
@keyframes borderRotate {
  to { --border-angle: 360deg; }
}
@property --border-angle {
  syntax: '<angle>';
  inherits: false;
  initial-value: 0deg;
}
.animate-border-glow {
  position: relative;
}
.animate-border-glow::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--border-angle), var(--color-brass, #5EEAD4), transparent 30%, var(--color-violet, #818CF8), transparent 70%, var(--color-brass, #5EEAD4));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: borderRotate 3s linear infinite;
  pointer-events: none;
}

/* --------------------------------------------
   Magnetic tilt (pairs with JS setting --rx/--ry, degrades gracefully)
   -------------------------------------------- */
.tilt-card {
  transform: perspective(900px) rotateX(var(--ry, 0deg)) rotateY(var(--rx, 0deg));
  transition: transform 0.15s ease-out;
  transform-style: preserve-3d;
}

/* --------------------------------------------
   Attention seekers (opt-in, single-shot)
   -------------------------------------------- */
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(2px); }
  30%, 50%, 70% { transform: translateX(-4px); }
  40%, 60% { transform: translateX(4px); }
}
.animate-shake { animation: shake 0.6s cubic-bezier(.36,.07,.19,.97) both; }

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  14%      { transform: scale(1.12); }
  28%      { transform: scale(1); }
  42%      { transform: scale(1.08); }
  70%      { transform: scale(1); }
}
.animate-heartbeat { animation: heartbeat 1.4s ease-in-out infinite; }

/* --------------------------------------------
   Blur-in (cinematic focus pull)
   -------------------------------------------- */
@keyframes blurIn {
  from { opacity: 0; filter: blur(8px); transform: scale(1.02); }
  to   { opacity: 1; filter: blur(0);   transform: scale(1); }
}
.animate-blur-in { animation: blurIn 0.6s cubic-bezier(.16,1,.3,1) both; }

/* --------------------------------------------
   Marquee (continuous scroll, e.g. ticker rows)
   -------------------------------------------- */
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.animate-marquee {
  display: flex;
  width: max-content;
  animation: marquee 18s linear infinite;
}
.animate-marquee:hover {
  animation-play-state: paused;
}

/* --------------------------------------------
   Confetti-free celebratory pop (pure CSS, single element)
   -------------------------------------------- */
@keyframes celebratePop {
  0%   { transform: scale(0.5); opacity: 0; }
  50%  { transform: scale(1.15); opacity: 1; }
  75%  { transform: scale(0.96); }
  100% { transform: scale(1); }
}
.animate-celebrate { animation: celebratePop 0.5s cubic-bezier(.34,1.56,.64,1) both; }

/* --------------------------------------------
   Stagger, refined — supports up to 16 children
   Extends the existing .stagger-children pattern above
   without altering it (adds coverage for larger lists)
   -------------------------------------------- */
.stagger-children > *:nth-child(11) { animation-delay: 0.55s; }
.stagger-children > *:nth-child(12) { animation-delay: 0.60s; }
.stagger-children > *:nth-child(13) { animation-delay: 0.65s; }
.stagger-children > *:nth-child(14) { animation-delay: 0.70s; }
.stagger-children > *:nth-child(15) { animation-delay: 0.75s; }
.stagger-children > *:nth-child(16) { animation-delay: 0.80s; }

/* --------------------------------------------
   View Transitions API hooks (progressive enhancement)
   Safe no-op in browsers without support.
   -------------------------------------------- */
@supports (view-transition-name: none) {
  ::view-transition-old(root) {
    animation: fadeOutSoft 0.25s ease-out both;
  }
  ::view-transition-new(root) {
    animation: fadeInUp 0.35s cubic-bezier(0.22, 0.68, 0, 1.2) both;
  }
  @keyframes fadeOutSoft {
    to { opacity: 0; }
  }
}

/* --------------------------------------------
   Reduced Motion — extend coverage to new utilities
   (base rule above already zeroes durations globally;
   this just documents/guards the newly added infinite loops)
   -------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .animate-marquee,
  .animate-heartbeat,
  .animate-aurora,
  .animate-border-glow::before {
    animation: none !important;
  }
}


/* ============================================================
   GRAND COOL-TONE MOTION SYSTEM
   ============================================================ */

@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.animate-float { animation: floatY 4.5s ease-in-out infinite; }

@keyframes pulseGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(94, 234, 212, 0.2); }
  50% { box-shadow: 0 0 28px rgba(94, 234, 212, 0.45), 0 0 48px rgba(129, 140, 248, 0.15); }
}
.animate-pulse-glow { animation: pulseGlow 2.8s ease-in-out infinite; }

@keyframes shimmerSweep {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.animate-shimmer {
  background: linear-gradient(
    105deg,
    transparent 30%,
    rgba(94, 234, 212, 0.15) 45%,
    rgba(125, 211, 252, 0.2) 50%,
    rgba(129, 140, 248, 0.15) 55%,
    transparent 70%
  );
  background-size: 200% 100%;
  animation: shimmerSweep 2.4s ease-in-out infinite;
}

@keyframes auroraBreath {
  0%, 100% { opacity: 0.4; filter: hue-rotate(0deg); }
  50% { opacity: 0.75; filter: hue-rotate(25deg); }
}
.animate-aurora-breath { animation: auroraBreath 8s ease-in-out infinite; }

@keyframes riseFade {
  from { opacity: 0; transform: translateY(18px) scale(0.98); filter: blur(4px); }
  to   { opacity: 1; transform: translateY(0) scale(1); filter: blur(0); }
}
.animate-rise { animation: riseFade 0.55s cubic-bezier(0.16, 1, 0.3, 1) both; }

@keyframes slideInLeftSoft {
  from { opacity: 0; transform: translateX(-16px); }
  to   { opacity: 1; transform: translateX(0); }
}
.animate-slide-in-left { animation: slideInLeftSoft 0.4s cubic-bezier(0.16, 1, 0.3, 1) both; }

@keyframes borderOrbit {
  0% { --angle: 0deg; }
  100% { --angle: 360deg; }
}
.animate-border-orbit {
  position: relative;
  isolation: isolate;
}
.animate-border-orbit::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: conic-gradient(from var(--angle, 0deg), #5EEAD4, #7DD3FC, #818CF8, #A78BFA, #5EEAD4);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  animation: borderOrbit 4s linear infinite;
  pointer-events: none;
  z-index: -1;
  opacity: 0.7;
}

@keyframes icebergIn {
  from { opacity: 0; transform: translateY(24px) rotateX(8deg); }
  to   { opacity: 1; transform: translateY(0) rotateX(0); }
}
.animate-iceberg { animation: icebergIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* Panel enter */
.panel-enter {
  animation: riseFade 0.45s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Stagger project cards */
#project-grid .project-card {
  animation: riseFade 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}
#project-grid .project-card:nth-child(1) { animation-delay: 0.05s; }
#project-grid .project-card:nth-child(2) { animation-delay: 0.1s; }
#project-grid .project-card:nth-child(3) { animation-delay: 0.15s; }
#project-grid .project-card:nth-child(4) { animation-delay: 0.2s; }
#project-grid .project-card:nth-child(5) { animation-delay: 0.25s; }
#project-grid .project-card:nth-child(6) { animation-delay: 0.3s; }
#project-grid .project-card:nth-child(7) { animation-delay: 0.35s; }
#project-grid .project-card:nth-child(8) { animation-delay: 0.4s; }

/* Auth brand mark pulse */
#auth-screen .inline-block.h-2\.5,
#auth-screen span.bg-brass {
  animation: pulseGlow 3s ease-in-out infinite;
  border-radius: 9999px;
}

/* Chat message soft entrance */
#chat-history .chat-message,
#chat-history article {
  animation: riseFade 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Header subtle sheen */
#app-header,
header.workspace-header {
  backdrop-filter: blur(12px) saturate(1.15);
  -webkit-backdrop-filter: blur(12px) saturate(1.15);
  border-bottom: 1px solid var(--color-glass-border, rgba(148, 200, 255, 0.12));
}

@media (prefers-reduced-motion: reduce) {
  .animate-float,
  .animate-pulse-glow,
  .animate-shimmer,
  .animate-aurora-breath,
  .animate-border-orbit::before,
  #project-grid .project-card,
  #chat-history .chat-message {
    animation: none !important;
  }
}