.ambient-scene {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  contain: paint;
  pointer-events: none;
}

.menu-page { position: relative; z-index: 1; }

.warm-glow {
  position: absolute;
  top: -75px;
  left: calc(50% - 290px);
  width: 580px;
  height: 430px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(245, 202, 54, .14), rgba(250, 233, 180, .06) 45%, transparent 72%);
  animation: glow-drift 24s ease-in-out infinite alternate;
}

.header-mist {
  position: absolute;
  top: -12px;
  left: 50%;
  width: min(100vw, 460px);
  height: 360px;
  overflow: visible;
  transform: translateX(-50%);
}

.mist-wisp {
  transform-box: fill-box;
  transform-origin: center;
  opacity: .65;
  animation: mist-rise 14s linear infinite;
}

.mist-wisp-one { animation-delay: -3s; }
.mist-wisp-two { animation-duration: 17s; animation-delay: -10s; }
.mist-wisp-three { animation-duration: 15s; animation-delay: -6s; }

.floating-bean {
  position: absolute;
  width: 22px;
  height: 31px;
  overflow: visible;
  fill: #9b8060;
  opacity: .23;
  animation: bean-float var(--duration, 21s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

.floating-bean path {
  fill: none;
  stroke: #fffaf1;
  stroke-width: 2.4;
  stroke-linecap: round;
}

.bean-one { top: 13%; left: max(5px, calc(50% - 420px)); --tilt: -30deg; --delay: -4s; }
.bean-two { top: 38%; right: max(5px, calc(50% - 435px)); --tilt: 24deg; --duration: 24s; --delay: -10s; }
.bean-three { top: 70%; left: max(5px, calc(50% - 448px)); --tilt: 12deg; --duration: 23s; --delay: -16s; }
.bean-four { top: 85%; right: max(5px, calc(50% - 415px)); --tilt: -42deg; --duration: 26s; --delay: -8s; }
.bean-five { top: 51%; left: max(5px, calc(50% - 500px)); --tilt: 42deg; --duration: 27s; --delay: -20s; }
.bean-six { top: 17%; right: max(5px, calc(50% - 505px)); --tilt: -12deg; --duration: 22s; --delay: -15s; }

.cookie-button {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: clamp(44px, 9vw, 54px);
  height: clamp(48px, 10vw, 60px);
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.cookie-button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  background: #fdf3ce;
}

.cookie-button .cookie-doodle { transition: transform 180ms ease-out; }
.cookie-button.is-popping .cookie-doodle { animation: cookie-pop 650ms ease-out; }

.cookie-crumb {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 4px;
  height: 5px;
  border-radius: 1px;
  background: var(--yellow);
  opacity: 0;
  pointer-events: none;
}

.cookie-crumb:nth-of-type(2n) { background: #705031; width: 3px; height: 4px; }
.cookie-button.is-popping .cookie-crumb { animation: crumb-scatter 750ms ease-out both; }

@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  .title-scene h1 {
    background: linear-gradient(105deg, var(--ink) 0%, var(--ink) 42%, #9c7418 49%, #b58a25 51%, var(--ink) 58%, var(--ink) 100%);
    background-size: 300% 100%;
    background-position: 100% 0;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: title-sheen 12s ease-in-out infinite;
    animation-delay: -6.8s;
  }
}

@keyframes glow-drift {
  from { transform: translate(-24px, -12px) scale(.96); }
  to { transform: translate(30px, 18px) scale(1.07); }
}

@keyframes mist-rise {
  0% { opacity: 0; transform: translate(9px, 55px) scale(.94) rotate(-3deg); }
  22% { opacity: .85; }
  72% { opacity: .65; }
  100% { opacity: 0; transform: translate(-16px, -70px) scale(1.1) rotate(4deg); }
}

@keyframes bean-float {
  0%, 100% { transform: translate(0, 0) rotate(var(--tilt)); }
  50% { transform: translate(4px, -18px) rotate(calc(var(--tilt) + 18deg)); }
}

@keyframes title-sheen {
  0%, 60% { background-position: 100% 0; }
  85%, 100% { background-position: 0% 0; }
}

@keyframes cookie-pop {
  0%, 100% { transform: translateY(0) rotate(0) scale(1); }
  30% { transform: translateY(-8px) rotate(-10deg) scale(1.08); }
  62% { transform: translateY(1px) rotate(6deg) scale(.97); }
}

@keyframes crumb-scatter {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.35); }
  18% { opacity: .95; }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) rotate(var(--spin)) scale(.65); }
}

@media (hover: hover) and (pointer: fine) {
  .cookie-button:hover .cookie-doodle { transform: scale(1.07); }
}

@media (max-width: 600px) {
  .floating-bean { width: 12px; height: 17px; opacity: .22; }
  .bean-five, .bean-six { display: none; }
  .warm-glow { top: -85px; left: calc(50% - 220px); width: 440px; height: 400px; }
}

@media (prefers-reduced-motion: reduce) {
  .warm-glow, .mist-wisp, .floating-bean, .title-scene h1,
  .cookie-button.is-popping .cookie-doodle, .cookie-button.is-popping .cookie-crumb {
    animation: none;
  }
  .mist-wisp { opacity: .45; }
  .cookie-button .cookie-doodle { transition: none; }
  .cookie-button.is-popping { background: #fdf3ce; }
  .title-scene h1 { color: var(--ink); background: none; }
}

@media print {
  .ambient-scene, .cookie-crumb { display: none; }
  .title-scene h1 { color: var(--ink); background: none; animation: none; }
  .cookie-button .cookie-doodle { animation: none; }
}
