/* Christmas theme. Styles the decorations added by public/js/christmas.js.
   Only loaded when website effects are on in /admin/effects. */

.xm-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Below the navbar (1000) and modals (2000), above everything else on the page. */
.xm-snowfall {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 900;
  pointer-events: none;
}

.xm-anchor { position: relative; }

/* A panel opened up so its snow can sit above its top edge. min-width keeps the
   grid and flex sizing that overflow:hidden was quietly providing. */
.xm-unclipped { overflow: visible !important; min-width: 0; }

.xm-snow, .xm-lights {
  position: absolute;
  max-width: none;
  pointer-events: none;
}

.xm-snow {
  z-index: 6;
  overflow: visible;
  /* The shadow is what separates white snow from a cream page behind it. */
  filter: drop-shadow(0 1px 2px rgba(35, 50, 70, 0.42));
}

.xm-lights { top: 0; left: 0; z-index: 5; overflow: visible; }
.xm-wire { stroke: #1c3a2a; stroke-width: 1.4; }

.xm-bulb { animation: xm-twinkle 2.4s ease-in-out infinite; }
.xm-paused .xm-bulb { animation-play-state: paused; }
.xm-twinkle-1 { animation-duration: 3.1s; animation-delay: -0.8s; }
.xm-twinkle-2 { animation-duration: 2s;   animation-delay: -1.5s; }
.xm-twinkle-3 { animation-duration: 3.7s; animation-delay: -2.3s; }

@keyframes xm-twinkle {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  .xm-bulb { animation: none; }
}

@media print {
  .xm-snowfall, .xm-snow, .xm-lights, .xm-snowman, .xm-scene, .xm-garland, .xm-holly, .xm-admin-lights, .xm-fireplace { display: none !important; }
  h1, .find-title, .touch-title { filter: none !important; }
}

/* Clears the bulbs hanging over the top of an event tile's text. */
.event-tile-body { padding-top: 2.1rem; }

/* Date and special badges stay readable on top of the snow's lip. */
.event-tile-date, .drink-card .drink-special-tag, .pastry-special-tag { z-index: 7; }

/* Stands at the bottom of a section. christmas.js sets its side and size, and
   leaves it out when it would cover something. */
.xm-snowman {
  position: absolute; bottom: 0;
  z-index: 1;
  max-width: none;
  pointer-events: none;
}
.xm-snowman-right { transform: scaleX(-1); }

/* Find us and Get in touch */
.xm-scene { display: block; width: 100%; height: auto; pointer-events: none; }
.xm-scene-find { max-width: 400px; margin-top: auto; }
.xm-scene-touch { max-width: 360px; margin-top: 0.5rem; }

.xm-garland {
  position: absolute; top: 0; left: 0;
  z-index: 2;
  max-width: none;
  pointer-events: none;
}

.xm-holly {
  position: absolute; top: -18px; right: -18px;
  z-index: 7;
  width: 64px; height: 56px;
  pointer-events: none;
}

/* Admin panel: room for the string of lights below the header, and for a snowman
   at the bottom of the page. */
.xm-admin-lights { position: relative; flex-shrink: 0; height: 36px; }
.admin-main { padding-bottom: 8.5rem; }

/* Fireplace on its own row under the hanging review cards, centred across the
   whole reviews wall. */
.xm-fireplace {
  display: block;
  grid-column: 1 / -1;
  justify-self: center;
  width: 100%; max-width: 520px;
  aspect-ratio: 540 / 400;
  margin-top: 0.5rem;
  pointer-events: none;
}

.xm-flame {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: xm-flicker 0.9s ease-in-out infinite alternate;
}
.xm-flame-b { animation-duration: 0.7s; animation-delay: -0.3s; }
.xm-flame-c { animation-duration: 1.15s; animation-delay: -0.6s; }
.xm-fire-glow { animation: xm-glow 1.6s ease-in-out infinite alternate; }
.xm-ember { animation: xm-ember 2.2s ease-out infinite; }
.xm-paused .xm-flame, .xm-paused .xm-fire-glow, .xm-paused .xm-ember { animation-play-state: paused; }

@keyframes xm-flicker {
  0%   { transform: scale(1, 1) skewX(0deg); }
  50%  { transform: scale(0.96, 1.06) skewX(-2deg); }
  100% { transform: scale(1.03, 0.95) skewX(2deg); }
}
@keyframes xm-glow {
  from { opacity: 0.7; }
  to   { opacity: 1; }
}
@keyframes xm-ember {
  0%   { transform: translateY(40px); opacity: 0; }
  30%  { opacity: 1; }
  100% { transform: translateY(-50px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .xm-flame, .xm-fire-glow { animation: none; }
  .xm-ember { display: none; }
}
