/* Holiday look, painted in watercolor: soft pinks and reds, sage and forest
   green, a little gold, drawn from the Pinterest board. Loaded by the pages that
   carry the sale bar when "winter" is active in data/products.json
   (scripts/build-shop.js). Pictures live in /images/winter/ (SVG with a
   watercolor filter). Nothing here moves except a light snowfall on the home
   hero, which stands still for visitors who ask for reduced motion. */

/* ---- light snowfall over the home hero (loops without a jump: every layer
   moves exactly one tile height per cycle) ---- */
.home-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: url("/images/winter/snow-a.svg"), url("/images/winter/snow-b.svg"), url("/images/winter/snow-c.svg");
  background-repeat: repeat, repeat, repeat;
  background-size: 300px 380px, 210px 270px, 370px 450px;
  background-position: 0 0, 90px 0, 40px 0;
  animation: winter-snow 18s linear infinite;
}

@keyframes winter-snow {
  from {
    background-position: 0 0, 90px 0, 40px 0;
  }
  to {
    background-position: 0 380px, 90px 270px, 40px 450px;
  }
}

/* ---- the shop page: snowflakes drifting down behind everything ---- */
body.shop--catalog::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: url("/images/winter/snowl-a.svg"), url("/images/winter/snowl-b.svg"), url("/images/winter/snowl-c.svg");
  background-repeat: repeat, repeat, repeat;
  background-size: 300px 380px, 210px 270px, 370px 450px;
  background-position: 0 0, 90px 0, 40px 0;
  animation: winter-snow 22s linear infinite;
}

/* ---- little painted stickers stuck on the corner of each product picture ---- */
.shop-card__media::after {
  content: "";
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 3;
  width: clamp(78px, 31%, 124px);
  aspect-ratio: 1;
  background: var(--sticker, url("/images/winter/sticker-bow.svg")) no-repeat center / contain;
  transform: rotate(var(--sticker-rot, 8deg));
  pointer-events: none;
}

.shop-card:nth-child(8n+1) { --sticker: url("/images/winter/sticker-bow.svg"); --sticker-rot: 8deg; }
.shop-card:nth-child(8n+2) { --sticker: url("/images/winter/sticker-orn-stripe.svg"); --sticker-rot: -9deg; }
.shop-card:nth-child(8n+3) { --sticker: url("/images/winter/sticker-holly.svg"); --sticker-rot: 7deg; }
.shop-card:nth-child(8n+4) { --sticker: url("/images/winter/sticker-star.svg"); --sticker-rot: -6deg; }
.shop-card:nth-child(8n+5) { --sticker: url("/images/winter/sticker-wreath.svg"); --sticker-rot: 10deg; }
.shop-card:nth-child(8n+6) { --sticker: url("/images/winter/sticker-orn-harl.svg"); --sticker-rot: -8deg; }
.shop-card:nth-child(8n+7) { --sticker: url("/images/winter/sticker-tree.svg"); --sticker-rot: 6deg; }
.shop-card:nth-child(8n+8) { --sticker: url("/images/winter/sticker-sprig.svg"); --sticker-rot: -10deg; }

.shop-gallery__main {
  position: relative;
}

.shop-gallery__main::after {
  content: "";
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 3;
  width: clamp(78px, 18%, 120px);
  aspect-ratio: 1;
  background: url("/images/winter/sticker-holly.svg") no-repeat center / contain;
  transform: rotate(8deg);
  pointer-events: none;
}

@media (max-width: 560px) {
  .shop-card__media::after {
    width: 62px;
  }
}

/* ---- footer: a painted pine garland with bows ---- */
.shop-footer {
  position: relative;
  padding-top: 4.2rem;
}

.shop-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 62px;
  background: url("/images/winter/sprig.svg") repeat-x left top / auto 62px;
  pointer-events: none;
}

/* ---- the photos, hung on a watercolor tree ---- */
.home-tree {
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--gutter);
  background: #fff3f6;
  overflow: hidden;
}

.home-tree__card {
  position: relative;
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(2.2rem, 5vw, 3.2rem) clamp(0.75rem, 4vw, 3rem) clamp(2.5rem, 5vw, 3.5rem);
  border-radius: 28px;
  background: #fde7ee url("/images/winter/stripes.svg") 0 0 / 540px 400px repeat;
  text-align: center;
  box-shadow: 0 10px 30px rgba(207, 74, 69, 0.12);
}

.home-tree__head {
  position: relative;
  z-index: 2;
  max-width: 36rem;
  margin: 0 auto;
  padding: 1rem 1.25rem 0.9rem;
  border-radius: 18px;
  background: rgba(255, 251, 247, 0.93);
}

.home-tree__script {
  margin: 0;
  font-family: "Chillink", cursive;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.35;
  color: #cf4a45;
}

.home-tree__head h2 {
  margin: 0.2rem 0 0.4rem;
  line-height: 1.3;
}

.home-tree__lead {
  margin: 0;
  color: var(--muted);
}

.tree {
  position: relative;
  width: min(100%, 920px);
  aspect-ratio: 100 / 128;
  margin: 3.4rem auto 0;
  background: url("/images/winter/tree.svg") no-repeat center / 100% 100%;
}

.tree__star {
  position: absolute;
  left: 50%;
  top: -5.5%;
  width: 9%;
  aspect-ratio: 1;
  transform: translateX(-50%);
  background: url("/images/winter/star.svg") no-repeat center / contain;
}

/* Watercolor bows on the sides of the tree. */
.tree__bow {
  position: absolute;
  z-index: 3;
  width: 13%;
  aspect-ratio: 200 / 165;
  transform: translate(-50%, -50%) rotate(var(--r, 0deg));
  background: url("/images/winter/bow.svg") no-repeat center / contain;
  pointer-events: none;
}

/* Painted ornaments hanging in the card's corners on wide screens. */
.tree__hang {
  position: absolute;
  top: 0;
  z-index: 1;
  width: 92px;
  aspect-ratio: 120 / 206;
  background: no-repeat top center / contain;
  pointer-events: none;
}

.tree__hang--stripe { left: 3%; background-image: url("/images/winter/orn-stripe.svg"); }
.tree__hang--harl { left: 12%; width: 78px; background-image: url("/images/winter/orn-harl.svg"); }
.tree__hang--dots { right: 12%; width: 78px; background-image: url("/images/winter/orn-dots.svg"); }
.tree__hang--squig { right: 3%; background-image: url("/images/winter/orn-stripe.svg"); transform: scaleX(-1); }

@media (max-width: 900px) {
  .tree__hang {
    display: none;
  }
}

.tree__row {
  position: absolute;
  left: 0;
  right: 0;
  top: var(--y);
  display: flex;
  justify-content: center;
  gap: 1.6%;
  margin: 0;
  padding: 0;
  list-style: none;
  transform: translateY(-50%);
}

.orn {
  flex: 0 0 16%;
  transform: rotate(var(--tilt));
}

.orn__btn {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
}

/* Hung from a thin ribbon tied in a small bow. */
.orn__bow {
  position: absolute;
  left: 50%;
  top: -14%;
  z-index: 2;
  width: 40%;
  aspect-ratio: 200 / 165;
  transform: translateX(-50%);
  background: url("/images/winter/bow.svg") no-repeat center / contain;
}

.orn__frame {
  display: block;
  padding: 4.5% 4.5% 14%;
  border-radius: 2px;
  background: #fffdf9;
  box-shadow: 0 3px 8px rgba(40, 30, 25, 0.35), 0 0 0 1px rgba(40, 30, 25, 0.06);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.orn__frame img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  object-position: 50% 30%;
  background: var(--light-orange);
}

.orn__btn:hover .orn__frame {
  transform: scale(1.1);
  box-shadow: 0 8px 18px rgba(40, 30, 25, 0.4);
}

.orn__btn:focus-visible {
  outline: 3px solid #cf4a45;
  outline-offset: 4px;
}

.home-tree__all {
  position: relative;
  z-index: 2;
  margin: 2.2rem auto 0;
}

/* ---- photo viewer: open one, then swipe, scroll or use the arrows ---- */
.tree-lightbox {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: #fff;
}

.tree-lightbox::backdrop {
  background: rgba(36, 24, 28, 0.88);
}

.tree-lightbox__track {
  display: flex;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.tree-lightbox__track::-webkit-scrollbar {
  display: none;
}

.tree-lightbox__slide {
  flex: 0 0 100%;
  display: grid;
  place-items: center;
  padding: 3.6rem 4.2rem 4rem;
  box-sizing: border-box;
  scroll-snap-align: center;
  scroll-snap-stop: always;
}

.tree-lightbox__slide img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  padding: 10px 10px 30px;
  background: #fffdf9;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

.tree-lightbox__close,
.tree-lightbox__nav {
  position: absolute;
  z-index: 3;
  display: grid;
  place-items: center;
  width: 2.8rem;
  height: 2.8rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 253, 249, 0.95);
  color: #2b1d22;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.tree-lightbox__close {
  top: 0.9rem;
  right: 0.9rem;
}

.tree-lightbox__nav {
  top: 50%;
  transform: translateY(-50%);
}

.tree-lightbox__nav--prev { left: 0.9rem; }
.tree-lightbox__nav--next { right: 0.9rem; }

.tree-lightbox__nav:disabled {
  opacity: 0.3;
  cursor: default;
}

.tree-lightbox__count {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1rem;
  z-index: 3;
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
}

@media (max-width: 640px) {
  .tree {
    margin-top: 2.6rem;
  }
  .tree-lightbox__slide {
    padding: 3.4rem 0.6rem 3.6rem;
  }
  .tree-lightbox__nav {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-hero::before,
  body.shop--catalog::before {
    animation: none;
  }
}
