/* Motion layer — keyframes + utility classes.
   All animations honor prefers-reduced-motion. */

@keyframes yg-fade-up {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

@keyframes yg-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes yg-slide-in-right {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: none; }
}

@keyframes yg-slide-in-left {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: none; }
}

@keyframes yg-pop {
  0%   { transform: scale(0.96); opacity: 0; }
  70%  { transform: scale(1.02); opacity: 1; }
  100% { transform: scale(1); }
}

@keyframes yg-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 151, 47, 0.32); }
  50%      { box-shadow: 0 0 0 10px rgba(255, 151, 47, 0); }
}

@keyframes yg-glow-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 151, 47, 0.0); }
  50%      { box-shadow: 0 0 28px 2px rgba(255, 151, 47, 0.25); }
}

@keyframes yg-shimmer {
  0%   { background-position: -400% 0; }
  100% { background-position: 400% 0; }
}

@keyframes yg-spin {
  to { transform: rotate(360deg); }
}

@keyframes yg-marquee-x {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@keyframes yg-count-up {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* Reveal on scroll — initial state, JS adds .is-revealed */
.yg-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition:
    opacity 540ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 540ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}

.yg-reveal.is-revealed {
  opacity: 1;
  transform: none;
}

.yg-reveal[data-delay="1"] { transition-delay: 80ms; }
.yg-reveal[data-delay="2"] { transition-delay: 160ms; }
.yg-reveal[data-delay="3"] { transition-delay: 240ms; }
.yg-reveal[data-delay="4"] { transition-delay: 320ms; }

/* M3 state layer — hover uses tonal overlay instead of transform. */
.yg-lift {
  position: relative;
  transition:
    background var(--transition-fast),
    box-shadow var(--transition-fast);
}

.yg-lift:hover,
.yg-lift:focus-visible {
  background: color-mix(in oklch, var(--md-sys-color-primary) 8%, var(--md-sys-color-surface-container-low));
  box-shadow: var(--md-sys-elevation-level-1);
  outline: none;
}

/* Glow on hover — CTAs, accent surfaces */
.yg-glow {
  transition: box-shadow var(--transition-medium, 240ms ease);
}

.yg-glow:hover,
.yg-glow:focus-visible {
  box-shadow:
    0 0 0 1px rgba(255, 151, 47, 0.28),
    0 18px 42px rgba(255, 151, 47, 0.18);
}

/* Pulsing badge — live transcode, recording, processing */
.yg-pulse-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 0 currentColor;
  animation: yg-pulse 1.8s ease-out infinite;
}

/* Shimmer — skeleton loaders */
.yg-shimmer {
  background:
    linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.04) 0%,
      rgba(255, 255, 255, 0.12) 50%,
      rgba(255, 255, 255, 0.04) 100%
    );
  background-size: 400% 100%;
  animation: yg-shimmer 1.4s linear infinite;
}

/* Count-up micro-animation for metrics */
.yg-count-up {
  display: inline-block;
  animation: yg-count-up 480ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Spinner */
.yg-spin {
  animation: yg-spin 900ms linear infinite;
}

/* Scale-in for dialogs, popovers */
.yg-pop-in {
  animation: yg-pop 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.yg-fade-in {
  animation: yg-fade-in 240ms ease both;
}

.yg-fade-up {
  animation: yg-fade-up 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.yg-slide-in-right {
  animation: yg-slide-in-right 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.yg-slide-in-left {
  animation: yg-slide-in-left 320ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Parallax target — JS translates on scroll via data-yg-parallax */
.yg-parallax {
  will-change: transform;
  transition: transform 80ms linear;
}

/* Magnetic CTA — JS tracks pointer */
.yg-magnetic {
  transition: transform 160ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

/* Drag-over highlight (upload) */
.yg-dropzone-glow {
  position: relative;
  overflow: hidden;
}

.yg-dropzone-glow.is-drag-over {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 4px var(--focus);
  animation: yg-glow-pulse 1.6s ease-in-out infinite;
}

/* Live progress pill */
.yg-progress-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.8rem;
  min-height: 2rem;
  border: 1px solid rgba(255, 151, 47, 0.28);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.yg-progress-pill__track {
  position: relative;
  width: 4rem;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.yg-progress-pill__fill {
  position: absolute;
  inset: 0;
  width: var(--yg-progress, 0%);
  background: linear-gradient(90deg, var(--accent), var(--accent-strong));
  border-radius: inherit;
  transition: width 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

.yg-progress-pill--indeterminate .yg-progress-pill__fill {
  width: 32%;
  animation: yg-progress-sweep 1.6s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes yg-progress-sweep {
  0%   { transform: translateX(-120%); }
  100% { transform: translateX(360%); }
}

/* Marquee track */
.yg-marquee {
  overflow: hidden;
  mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}

.yg-marquee__track {
  display: inline-flex;
  gap: 1rem;
  white-space: nowrap;
  animation: yg-marquee-x 28s linear infinite;
}

.yg-marquee:hover .yg-marquee__track {
  animation-play-state: paused;
}

/* Skeleton */
.yg-skeleton {
  display: block;
  border-radius: var(--radius-sm, 14px);
  background: rgba(255, 255, 255, 0.06);
  min-height: 1rem;
  overflow: hidden;
  position: relative;
}

.yg-skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.08) 50%,
    transparent 100%
  );
  transform: translateX(-100%);
  animation: yg-shimmer-sweep 1.4s linear infinite;
}

@keyframes yg-shimmer-sweep {
  100% { transform: translateX(100%); }
}

/* Focus ring — consistent across all interactive elements using .yg-focus */
.yg-focus:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px var(--focus);
  border-color: var(--accent);
}

/* Respect accessibility preference */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .yg-reveal {
    opacity: 1;
    transform: none;
  }

  .yg-marquee__track {
    animation: none;
  }
}
