/* ==========================================================
   PERFORMANCE OVERRIDES (load this file LAST)
   Mobile scroll-lag fixes. Each block explains what was slow.
   ========================================================== */

/* ----------------------------------------------------------
   FIX 1: `background-attachment: fixed` on <body>
   Phones re-paint the whole background image on every scroll
   tick. Replacement: the same image on a position:fixed layer
   that the GPU composites once and never repaints.
   ---------------------------------------------------------- */
@media (max-width: 900px), (pointer: coarse) {
  body {
    background-image: none !important;
    background-attachment: scroll !important;
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: #FAF5EE url("../assets/images/desktop-bg.webp") center top / cover no-repeat;
    transform: translateZ(0);
  }
}

@media (max-width: 900px) {
  body::before {
    background-image: url("../assets/images/mobile-bg.webp");
  }
}

/* ----------------------------------------------------------
   FIX 2: backdrop-filter (blur) on fixed elements
   Nav bar, music button and venue card sit above the scrolling
   film. Blurring what is behind them forced the GPU to re-blur
   on every frame. Their backgrounds are already ~94% opaque, so
   the look is unchanged.
   ---------------------------------------------------------- */
@media (max-width: 900px), (pointer: coarse) {
  .site-nav,
  .music-button,
  .firework-button,
  .venue-card {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
  }
}

/* ----------------------------------------------------------
   FIX 3: entry gate keeps animating after it is closed
   ---------------------------------------------------------- */
.enter-gate.is-open::before {
  animation: none;
}

/* ----------------------------------------------------------
   FIX 4: smooth, predictable touch scrolling
   ---------------------------------------------------------- */
html {
  -webkit-text-size-adjust: 100%;
}

@media (pointer: coarse) {
  html {
    scroll-behavior: auto; /* native momentum scroll; smooth-scroll fights the scrubbing */
  }
}

/* ----------------------------------------------------------
   FIX 5: respect "reduce motion" for the scroll film overlay
   ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .petals { display: none; }
}
