/*
 * Christmas Offers page template (template-page-christmas-offers.php).
 *
 * Enqueued only by that template, after the theme's style.css. Everything is
 * scoped to the template's body class and to .xmas-scene, the wrapper around
 * the page banner, intro and dynamic blocks. The header (#masthead) and footer
 * (#mastfoot) are deliberately untouched.
 *
 * Stacking inside .xmas-scene (an isolated stacking context):
 *   0  section backgrounds (banner photo, green grid background)
 *   1  .xmas-snowfall      falling decorations (pointer-events: none)
 *   2  page content containers (always above the decorations)
 */

body.page-template-template-page-christmas-offers .xmas-scene {
  --xmas-red: #a3202a;
  --xmas-gold: #ceb12e;            /* Talbot Block brand gold (header/footer bar) */
  --xmas-cream: #f6f5ec;           /* card colour from the original Christmas template */

  /* Height of the fixed header, mirroring #pushwrapper's margin-top in src/scss/base/_base.scss */
  --xmas-header-h: 213px;

  position: relative;
  z-index: 0;
  isolation: isolate;
}

@media (max-width: 1299px) {
  body.page-template-template-page-christmas-offers .xmas-scene { --xmas-header-h: 199px; }
}

@media (max-width: 991px) {
  body.page-template-template-page-christmas-offers .xmas-scene { --xmas-header-h: 125px; }
}


/* ---------------------------------------------------------------------------
 * Falling decorations layer
 * ------------------------------------------------------------------------- */

/* Covers the whole scene. clip-path clips the fixed stage below to the scene,
   so decorations never paint over the footer. */
.xmas-scene .xmas-snowfall {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 1;
  pointer-events: none;
  clip-path: inset(0);
}

/* A viewport-sized window directly below the fixed header. Being fixed, the
   decorations keep falling through whatever part of the scene is on screen
   while the user scrolls. */
.xmas-scene .xmas-snowfall__stage {
  position: fixed;
  top: var(--xmas-header-h);
  right: 0;
  left: 0;
  height: calc(100vh - var(--xmas-header-h));
  height: calc(100dvh - var(--xmas-header-h));
  overflow: hidden;
  pointer-events: none;
}

.xmas-scene .xmas-deco {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  height: auto;
  max-width: none;
  /* Parked above the stage until the first keyframe applies. */
  transform: translate3d(0, -200px, 0);
  will-change: transform;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .3));
}

/* Static arrangement used when the visitor prefers reduced motion. */
.xmas-scene .xmas-deco--static {
  will-change: auto;
}

/* Page content sits above the decorations. Every theme .container is already
   position: relative, so only the stacking order changes. */
.xmas-scene .container {
  z-index: 2;
}


/* ---------------------------------------------------------------------------
 * Page banner
 * ------------------------------------------------------------------------- */

/* Restrained festive flourish under the existing heading: gold rules either
   side of a small star. */
.xmas-scene .page-banner-wide .content-container h1::after {
  content: "";
  display: block;
  width: 180px;
  height: 14px;
  margin: 16px auto 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 14'%3E%3Cpolygon points='7,0 8.6,5 14,5 9.7,8.1 11.3,13.3 7,10.1 2.7,13.3 4.3,8.1 0,5 5.4,5' fill='%23e2c14f'/%3E%3C/svg%3E") center / 14px 14px no-repeat,
    linear-gradient(to right, transparent, var(--xmas-gold) 30%, var(--xmas-gold) 42%, transparent 42%, transparent 58%, var(--xmas-gold) 58%, var(--xmas-gold) 70%, transparent) center / 100% 2px no-repeat;
}

@media (max-width: 479px) {
  .xmas-scene .page-banner-wide .content-container h1::after {
    width: 140px;
  }
}


/* ---------------------------------------------------------------------------
 * Product grid (dynamic block "Grid 3", .db-cleangrid-wide)
 * ------------------------------------------------------------------------- */

/* Deep green over the original Christmas pattern (still faintly visible), so
   the red, gold and white decorations read clearly behind the cards. */
body.page-template-template-page-christmas-offers .xmas-scene .db-cleangrid-wide {
  background:
    linear-gradient(180deg, rgba(11, 52, 35, .9) 0%, rgba(20, 81, 58, .88) 50%, rgba(11, 52, 35, .92) 100%),
    url("../images/backgrounds/christmas-bg-pattern-2.jpg") center top / 640px repeat;
  /* Gold edge under the banner; inset shadow so the layout height is unchanged. */
  box-shadow: inset 0 4px 0 var(--xmas-gold);
}

/* Cards keep the original Christmas template's cream background and rounded
   corners; a soft shadow and a fine gold ring (box-shadow, so the card's
   layout is unchanged) lift them off the animated scene. */
body.page-template-template-page-christmas-offers .xmas-scene .db-cleangrid-wide ul li .item-container {
  background-color: var(--xmas-cream);
  border-radius: 8px;
  box-shadow: 0 0 0 1px rgba(206, 177, 46, .6), 0 10px 28px rgba(0, 0, 0, .35);
}

/* Prices in festive red. */
body.page-template-template-page-christmas-offers .xmas-scene .db-cleangrid-wide ul li .item-container .item-detail strong {
  color: var(--xmas-red);
}

/* Optional grid heading (cleangrid_list_header) is white on the green background. */
body.page-template-template-page-christmas-offers .xmas-scene .db-cleangrid-wide .container h2 {
  color: #fff;
}


/* ---------------------------------------------------------------------------
 * Reduced motion: christmas.js renders a few static decorations instead of
 * the animation; this guarantees nothing moves even if it did not.
 * ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  .xmas-scene .xmas-deco {
    animation: none !important;
    transition: none !important;
  }
}
