/* Animation runtime styles live here so the demo page can stay focused on layout/content.
   The current demo still keeps some matching inline styles inherited from the home copy,
   but new animation-specific work should be added here first. */

.screen-glitch-layer,
.glass-crack-layer,
.falling-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  overflow: hidden;
}

.animation-lab-active {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding-top: 0.2rem;
}

.animation-lab-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.58rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 223, 255, 0.22);
  background: rgba(148, 223, 255, 0.08);
  color: #94dfff;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1;
}

body.balloons-disabled .balloons-layer,
body.balloons-disabled .balloons-dust,
body.balloons-disabled .balloons-toast {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

body.balloons-disabled .brand-balloon-trigger {
  opacity: 0.74;
}

.screen-glitch-layer {
  opacity: 0;
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 7px),
    linear-gradient(90deg, transparent 0 12%, rgba(255, 255, 255, 0.14) 12% 17%, transparent 17% 52%, rgba(255, 211, 56, 0.12) 52% 58%, transparent 58% 100%);
  mix-blend-mode: screen;
  transition: opacity 0.08s linear;
}

body.screen-glitch-active .screen-glitch-layer {
  opacity: 1;
}

body.screen-glitch-active main,
body.screen-glitch-active header {
  transform: translateX(2px);
  filter: saturate(1.14) contrast(1.04);
}

.glass-crack-layer {
  opacity: 0;
  transition: opacity 0.08s linear;
}

.glass-crack-layer::before,
.glass-crack-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  opacity: 0;
}

.glass-crack-layer::before {
  background-image:
    linear-gradient(67deg, transparent 0 46%, rgba(255,255,255,0.82) 46.5%, transparent 47.2%),
    linear-gradient(112deg, transparent 0 49%, rgba(255,255,255,0.72) 49.4%, transparent 50.1%),
    linear-gradient(152deg, transparent 0 48%, rgba(255,255,255,0.55) 48.4%, transparent 49.1%),
    linear-gradient(31deg, transparent 0 49%, rgba(255,255,255,0.42) 49.4%, transparent 50%);
  background-size: 50% 70%, 36% 44%, 38% 52%, 28% 38%;
  background-position: 64% 18%, 58% 26%, 70% 28%, 61% 40%;
}

.glass-crack-layer::after {
  background-image:
    radial-gradient(circle at 63% 22%, rgba(255,255,255,0.42) 0 2px, transparent 3px),
    radial-gradient(circle at 63% 22%, rgba(255,255,255,0.12) 0 24px, transparent 34px);
  mix-blend-mode: screen;
}

body.glass-crack-active .glass-crack-layer,
body.glass-crack-active .glass-crack-layer::before,
body.glass-crack-active .glass-crack-layer::after {
  opacity: 1;
}

.falling-block {
  position: fixed;
  top: -4rem;
  left: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0.7rem;
  background: rgba(10, 10, 10, 0.94);
  color: #f5f5f5;
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.28);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  animation: fallingBlock var(--fall-duration, 1.5s) cubic-bezier(0.2, 0.7, 0.35, 1) forwards;
}

.swap-word {
  display: inline-block;
  transition: color 0.12s ease, transform 0.12s ease, opacity 0.12s ease;
}

.swap-word.is-mutating {
  color: #fff0b3;
  transform: translateY(-0.05em);
}
