/* ================== WINTER THEME ================== */
/* Loaded only when SiteTheme is "winter" (see app/models/site_theme.rb).
   Swaps the colorful mesh background (homepage hero, catalog, product pages, checkout)
   for a wintry sky, and replaces the hero's rotating shapes with falling snow. */

:root {
  --winter-sky: linear-gradient(180deg, #1f3b63 0%, #335d8f 50%, #5f8fc0 100%);
  --gradient-hero-mesh:
    radial-gradient(at 15% 10%, hsla(205, 80%, 72%, 0.55) 0px, transparent 50%),
    radial-gradient(at 85% 30%, hsla(220, 60%, 60%, 0.6) 0px, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(255, 255, 255, 0.25) 0%, transparent 60%),
    var(--winter-sky);
}

/* Homepage hero fades to snowy white at the bottom */
.hero--winter {
  background:
    radial-gradient(ellipse at 50% 110%, rgba(255, 255, 255, 0.55) 0%, transparent 55%),
    radial-gradient(at 15% 10%, hsla(205, 80%, 72%, 1) 0px, transparent 50%),
    radial-gradient(at 85% 20%, hsla(220, 60%, 55%, 1) 0px, transparent 50%),
    linear-gradient(180deg, #1f3b63 0%, #3c6a9e 45%, #8fb8de 80%, #dceaf6 100%);
}

/* Hide the default theme's rotating shapes */
.hero--winter::before,
.hero--winter::after,
.hero--winter .hero-content::before,
.hero--winter .hero-content::after,
.checkout-hero::before,
.checkout-hero::after {
  display: none;
}

.hero--winter .mascot-image {
  border: 6px solid rgba(255, 255, 255, 0.85);
}

.hero--winter h1 {
  text-shadow: 0 2px 12px rgba(15, 35, 70, 0.55);
}

.hero--winter .hero-subtitle {
  color: #ffffff;
  text-shadow: 0 1px 6px rgba(15, 35, 70, 0.6);
}

/* === Falling snow === */
/* Sections that show snow: the flakes sit behind the section's content */
.product-hero,
.catalog-section {
  position: relative;
  overflow: hidden;
}

.product-hero > .content-wrapper,
.catalog-section > .content-wrapper {
  position: relative;
  z-index: 2;
}

/* container-type lets the flakes fall the full height of the section (cqh units),
   so they also reach the bottom of tall pages like the catalog */
.snowfall {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
  container-type: size;
}

.snowflake {
  position: absolute;
  top: -20px;
  left: var(--x);
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
  opacity: var(--opacity);
  animation: snowfall var(--duration) linear var(--delay) infinite;
  will-change: transform;
}

@keyframes snowfall {
  0% {
    transform: translate3d(0, -20px, 0);
  }

  50% {
    transform: translate3d(var(--drift), 52cqh, 0);
  }

  100% {
    transform: translate3d(0, calc(100cqh + 20px), 0);
  }
}

/* Snow on/off: data-snow is set on <html> by the layout script and the snow toggle */
html[data-snow="off"] .snowfall {
  display: none;
}

/* If the script hasn't run, still respect the device's reduced-motion setting */
@media (prefers-reduced-motion: reduce) {
  html:not([data-snow]) .snowfall {
    display: none;
  }
}

/* === Snow toggle button === */
.snow-toggle {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  background: rgba(31, 59, 99, 0.85);
  color: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 35, 70, 0.35);
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.snow-toggle:hover {
  background: rgba(31, 59, 99, 1);
  transform: scale(1.06);
}

.snow-toggle:focus-visible {
  outline: 3px solid var(--lello-yellow);
  outline-offset: 2px;
}

.snow-toggle-icon {
  position: relative;
  font-size: 1.5rem;
  line-height: 1;
}

/* Off state: dim the flake and strike it through */
.snow-toggle[aria-pressed="false"] {
  background: rgba(90, 105, 125, 0.85);
}

.snow-toggle[aria-pressed="false"] .snow-toggle-icon {
  opacity: 0.75;
}

.snow-toggle[aria-pressed="false"] .snow-toggle-icon::after {
  content: "";
  position: absolute;
  top: 50%;
  left: -15%;
  width: 130%;
  height: 2px;
  background: currentColor;
  transform: rotate(-45deg);
}

/* Only show the toggle on pages that have snow */
body:not(:has(.snowfall)) .snow-toggle {
  display: none;
}
