/* =====================================================================
   myesans.com · Christmas decoration
   Load this file ONLY while the theme is on, and put class "xmas" on <html>.
   Hooks: add data-xmas="…" to existing elements (see README).
   Everything here is decoration: position:absolute, pointer-events:none,
   no layout changes, animations on transform/opacity only.
   For warm-white lights, swap the file names ending in .svg with -warm.svg
   (garland-desktop, garland-mobile, garland-swag, lights).
   ===================================================================== */

:root {
  --xmas-pine: #0F3B2C;
}

@keyframes xmas-snow   { to { transform: translate3d(0, 400px, 0); } }
@keyframes xmas-swing  { 0%, 100% { transform: rotate(-5deg); } 50% { transform: rotate(5deg); } }
@keyframes xmas-glow   { 50% { opacity: .72; } }

/* ---------- 1. Top bar: pine green, light snow, snow drift, string lights ---------- */
.xmas [data-xmas="bar"] {
  position: relative;
  z-index: 40;
  overflow: visible;
  background:
    url(snow-drift-bar.svg) bottom center / 100% 9px no-repeat,
    url(bar-snow.webp) 0 0 / 120px 120px repeat,
    var(--xmas-pine) !important;
}
.xmas [data-xmas="bar"]::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: calc(100% - 3px);
  height: 30px;
  pointer-events: none;
  background: url(lights.svg) 0 0 / 140px 30px repeat-x;
  animation: xmas-glow 2.6s ease-in-out infinite;
}

/* ---------- 2. Santa hat on the logo ---------- */
.xmas [data-xmas="logo"] { position: relative; }
.xmas [data-xmas="logo"]::after {
  content: "";
  position: absolute;
  z-index: 60;
  left: 2px; top: -16px;               /* fine-tune to your logo */
  width: 28px; height: 24px;
  pointer-events: none;
  background: url(santa-hat.svg) center / contain no-repeat;
  transform: rotate(14deg);
}

/* ---------- 3. Hero: falling snow, garland, gifts, snow drift ---------- */
.xmas [data-xmas="hero"] { position: relative; overflow: hidden; }
.xmas [data-xmas="hero"]::before {          /* snow: one GPU layer, moves 400px and loops */
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: -400px;
  height: calc(100% + 400px);
  z-index: 3;
  pointer-events: none;
  background:
    url(snow-near.webp) 0 0 / 400px 400px repeat,
    url(snow-far.webp) 0 0 / 200px 200px repeat;
  animation: xmas-snow 16s linear infinite;
  will-change: transform;
}
.xmas [data-xmas="hero"]::after {           /* static decoration, one element */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    url(garland-desktop.svg) top center / max(100%, 1920px) auto no-repeat,
    url(snow-drift-hero.svg) bottom center / 100% 40px no-repeat,
    url(gifts.svg) left 4% bottom 0 / 300px auto no-repeat;
}

/* ---------- 4. Product cards: snow cap + pine sprig + swinging bauble ---------- */
/* put data-xmas="card" on the IMAGE wrapper of each product card,
   and data-xmas-grid on the grid/carousel that holds the cards */
.xmas [data-xmas="card"] { position: relative; }
.xmas [data-xmas="card"]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  background:
    url(sprig.svg) right -6px top -4px / 60px auto no-repeat,
    url(card-snowcap.svg) top left / 100% 15px no-repeat;
}
.xmas [data-xmas="card"]::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: 12px; right: 26px;
  width: 26px; height: 55px;
  pointer-events: none;
  background: url(bauble-red.svg) top center / contain no-repeat;
  transform-origin: 50% 0;
  animation: xmas-swing 4.2s ease-in-out infinite;
}
.xmas [data-xmas-grid] > :nth-child(4n+2) [data-xmas="card"]::before { background-image: url(bauble-gold.svg);  top: 20px; animation-duration: 4.8s; animation-delay: -1.2s; }
.xmas [data-xmas-grid] > :nth-child(4n+3) [data-xmas="card"]::before { background-image: url(bauble-green.svg); top: 10px; animation-duration: 3.9s; animation-delay: -2.1s; }
.xmas [data-xmas-grid] > :nth-child(4n+4) [data-xmas="card"]::before { background-image: url(bauble-pearl.svg); top: 24px; animation-duration: 4.5s; animation-delay: -0.6s; }

/* ---------- 5. "Shop by category" tiles: snow cap + pair of baubles ---------- */
.xmas [data-xmas="tile"] { position: relative; }
.xmas [data-xmas="tile"]::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: url(card-snowcap.svg) top left / 100% 17px no-repeat;
}
.xmas [data-xmas="tile"]::before {
  content: "";
  position: absolute;
  z-index: 2;
  top: 0; right: 28px;
  width: 60px; height: 100px;
  pointer-events: none;
  background: url(baubles-pair-red.svg) top center / contain no-repeat;
  transform-origin: 50% 0;
  animation: xmas-swing 4.6s ease-in-out infinite;
}
.xmas [data-xmas-grid] > :nth-child(even) [data-xmas="tile"]::before,
.xmas [data-xmas-grid] > [data-xmas="tile"]:nth-child(even)::before { background-image: url(baubles-pair-green.svg); animation-delay: -1.8s; }

/* ---------- 6. Section titles: holly ---------- */
.xmas [data-xmas="title"]::after,
.xmas [data-xmas="title-center"]::after,
.xmas [data-xmas="title-center"]::before {
  content: "";
  display: inline-block;
  width: 44px; height: 29px;
  margin-left: 10px;
  vertical-align: middle;
  background: url(holly.svg) center / contain no-repeat;
}
.xmas [data-xmas="title-center"]::before { margin: 0 10px 0 0; transform: scaleX(-1); }

/* ---------- 7. Offer banner (e.g. Get 6 Pay 5): garland strip + snow cap ---------- */
.xmas [data-xmas="banner"] { position: relative; overflow: visible; }
.xmas [data-xmas="banner"]::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: -16px;
  height: 56px;
  z-index: 3;
  pointer-events: none;
  background: url(garland-swag.svg) center top / 320px 56px repeat-x;
}
.xmas [data-xmas="banner"]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  border-radius: inherit;
  background: url(banner-snowcap.svg) top left / 100% 24px no-repeat;
}

/* ---------- 8. Product page main image: garland strip + baubles ---------- */
.xmas [data-xmas="media"] { position: relative; }
.xmas [data-xmas="media"]::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: -12px;
  height: 56px;
  z-index: 3;
  pointer-events: none;
  background: url(garland-swag.svg) center top / 292px 56px repeat-x;
}
.xmas [data-xmas="media"]::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 30px; right: 14%;
  width: 72px; height: 120px;
  pointer-events: none;
  background: url(baubles-pair-red.svg) top center / contain no-repeat;
  transform-origin: 50% 0;
  animation: xmas-swing 4.6s ease-in-out infinite;
}

/* ---------- Mobile: lighter ---------- */
@media (max-width: 767px) {
  .xmas [data-xmas="bar"]::after { animation: none; }
  .xmas [data-xmas="hero"]::before {
    background: url(snow-far.webp) 0 0 / 200px 200px repeat;
    animation-duration: 20s;
  }
  .xmas [data-xmas="hero"]::after {
    background:
      url(garland-mobile.svg) top center / 100% auto no-repeat,
      url(snow-drift-hero.svg) bottom center / 100% 26px no-repeat;
  }
  .xmas [data-xmas="card"]::after {
    background:
      url(sprig.svg) right -4px top -3px / 46px auto no-repeat,
      url(card-snowcap.svg) top left / 100% 11px no-repeat;
  }
  .xmas [data-xmas="card"]::before { width: 20px; height: 42px; top: 9px; right: 20px; }
  .xmas [data-xmas="tile"]::before { width: 44px; height: 74px; right: 16px; }
  .xmas [data-xmas="media"]::after { width: 56px; height: 94px; }
}

/* ---------- Motion off: reduced-motion users, save-data, hero off screen ---------- */
@media (prefers-reduced-motion: reduce) {
  .xmas [data-xmas]::before,
  .xmas [data-xmas]::after { animation: none !important; }
}
.xmas.xmas-static [data-xmas]::before,
.xmas.xmas-static [data-xmas]::after { animation: none !important; }
.xmas [data-xmas="hero"].xmas-paused::before { animation-play-state: paused; }

/* Admin toggles. Warm is the store default; multicolour is the file set above. */
html.xmas.xmas-warm [data-xmas="bar"]::after {
  background-image: url(lights-warm.svg);
}
html.xmas.xmas-warm [data-xmas="hero"]::after {
  background-image:
    url(garland-desktop-warm.svg),
    url(snow-drift-hero.svg),
    url(gifts.svg);
}
html.xmas.xmas-warm [data-xmas="banner"]::before,
html.xmas.xmas-warm [data-xmas="media"]::before {
  background-image: url(garland-swag-warm.svg);
}
@media (max-width: 767px) {
  html.xmas.xmas-warm [data-xmas="hero"]::after {
    background-image:
      url(garland-mobile-warm.svg),
      url(snow-drift-hero.svg);
  }
}
html.xmas.xmas-nohat [data-xmas="logo"]::after { content: none; }
