/* scenes/carnival.css -- js/motion/scenes/carnival.js (lowered lamps + breeze, awning billow,
 * twinkling bulbs, stall pop-up + valance flutter, tap to celebrate: confetti). Ported from
 * sanjana-sayyam carnival.css.
 *
 * Every node styled here is created by the JS at runtime. Armed (hidden-before-entrance)
 * states are scoped under html.motion and released by .cv-go (added in the same task the
 * fill:"backwards" entrances start, so nothing flashes). Reduced motion / no JS: none of
 * the armed rules apply and the slide is the exact PSD frame (+ a still pill). Coordinates
 * are design px (1 px = var(--u)). Only transform / opacity animate; particles are small. */

html.motion [data-scene="carnival"]:not(.cv-go) .ly:is([data-layer="lamp-2"], [data-layer="lamp-3"]) {
  transform: translateY(-105%);
}
html.motion [data-scene="carnival"]:not(.cv-go) .ly:is([data-layer="lamp-1"], [data-layer="lamp-4"],
  [data-layer="bulbs"], [data-layer="awning"], [data-layer="stall-left"], [data-layer="stall-right"],
  [data-layer="picnic-table"], [data-layer="hedge"]) {
  opacity: 0;
}
html.motion [data-scene="carnival"]:not(.cv-go) .ly:is([data-layer="lawn-left"], [data-layer="lawn-right"]) {
  transform: translateY(calc(14 * var(--u)));
}

/* a warm glow over each baked Edison bulb (inside the bulbs wrapper) */
.cv-glow {
  position: absolute;
  width: calc(78 * var(--u));
  height: calc(78 * var(--u));
  margin: calc(-39 * var(--u)) 0 0 calc(-39 * var(--u));
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle closest-side,
    rgba(255, 250, 228, 0.95) 0%, rgba(255, 228, 160, 0.75) 22%,
    rgba(255, 200, 110, 0.32) 52%, rgba(255, 196, 100, 0) 100%);
  animation: cv-twinkle var(--d, 3s) ease-in-out var(--dl, 0s) infinite;
}
@keyframes cv-twinkle {
  0%, 100% { opacity: 0.15; }
  45% { opacity: var(--pk, 0.9); }
  65% { opacity: calc(var(--pk, 0.9) * 0.6); }
}

/* the stall's front valance: a clip-path copy of the stall sprite, resting exactly on it */
.cv-valance { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* particle overlay: right after lamp-1 (z 19), below every text block (z 20+) */
.cv-fx { position: absolute; inset: 0; pointer-events: none; }
.cv-fx > div { position: absolute; pointer-events: none; user-select: none; }

.cv-conf { border-radius: 1.5px; opacity: 0; box-shadow: 0 0 0 0.5px rgba(150, 120, 70, 0.25); }
.cv-conf--dot { border-radius: 50%; }
.cv-conf--ribbon { border-radius: 3px; }

/* "Tap to celebrate": a real button in the paper band under the venue, above the stalls */
.cv-cta {
  position: absolute;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 30px;
  margin: 0;
  padding: 0.38em 1.05em 0.38em 0.75em;
  border: 1px solid rgba(150, 70, 80, 0.5);
  border-radius: 999px;
  background: rgba(255, 251, 244, 0.9);
  color: #a2394a;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
  font-size: clamp(12px, calc(36 * var(--u)), 16px);
  letter-spacing: 0.04em;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 16px rgba(110, 60, 50, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transform: translate(-50%, -50%);
}
/* motion: hidden until 2.4 s after the entrance, gone after the first burst */
html.motion .cv-cta {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, calc(-50% + 6px));
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0.6s;
}
html.motion .cv-cta.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, -50%);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 0s;
}
.cv-cta::before { content: ""; position: absolute; inset: -8px -4px; }   /* >= 44 px tap target */
.cv-cta:focus-visible { outline: 2px solid #a2394a; outline-offset: 3px; }
/* three little confetti dots that keep popping */
.cv-cta__pop { position: relative; flex: none; width: 1.2em; height: 1.2em; }
.cv-cta__pop > i {
  position: absolute;
  width: 0.36em;
  height: 0.36em;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  margin: -0.18em 0 0 -0.18em;
}
.cv-cta__pop > i:nth-child(1) { background: #d97f95; margin: -0.42em 0 0 -0.4em; }
.cv-cta__pop > i:nth-child(2) { background: #6f9a78; margin: -0.3em 0 0 0.1em; }
.cv-cta__pop > i:nth-child(3) { background: #d4ae5f; margin: 0.1em 0 0 -0.15em; }
html.motion .cv-cta__pop > i { margin: -0.18em 0 0 -0.18em; }
.cv-cta.is-visible .cv-cta__pop > i { animation: cv-pop 2.2s cubic-bezier(0.2, 0.8, 0.3, 1) 0.6s infinite; }
.cv-cta.is-visible .cv-cta__pop > i:nth-child(1) { --dx: -0.42em; --dy: -0.4em; }
.cv-cta.is-visible .cv-cta__pop > i:nth-child(2) { --dx: 0.45em; --dy: -0.3em; animation-delay: 0.68s; }
.cv-cta.is-visible .cv-cta__pop > i:nth-child(3) { --dx: 0.05em; --dy: 0.45em; animation-delay: 0.76s; }
.cv-away .cv-cta__pop > i,
.cv-away .cv-glow { animation-play-state: paused; }
@keyframes cv-pop {
  0% { transform: none; opacity: 1; }
  30% { transform: translate(var(--dx), var(--dy)) scale(0.9); opacity: 1; }
  55%, 100% { transform: translate(calc(var(--dx) * 1.2), calc(var(--dy) * 1.2 + 0.2em)) scale(0.6); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .cv-glow { display: none; }
  .cv-cta__pop > i { animation: none !important; }
}
