/* ============================================================
   SANTA OLIVER — Magic layer
   Twinkling stars · string lights · snow · sparkles · ornaments
   · aurora · moon · flying Santa · treeline · candy-cane rules
   ============================================================ */

/* ---------- twinkling starfield ---------- */
.starfield { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.starfield .star {
  position: absolute; width: 2px; height: 2px; border-radius: 50%;
  background: #fff; opacity: 0;
  animation: twinkle var(--dur, 3s) ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: .15; transform: scale(.7); }
  50%      { opacity: 1;   transform: scale(1.25); }
}

/* ---------- snow canvas wrapper ---------- */
.snow-canvas {
  position: absolute; inset: 0; z-index: 5; pointer-events: none;
  width: 100%; height: 100%; display: block;
}

/* ---------- string lights garland ---------- */
.lights {
  position: relative; height: 46px; margin: 0; pointer-events: none;
}
.lights .row {
  position: absolute; inset: 0;
  display: flex; justify-content: space-evenly; align-items: flex-start;
  padding: 0 4%;
}
.bulb {
  position: relative; width: 11px; height: 15px;
  border-radius: 50% 50% 56% 56%;
  margin-top: var(--drop, 8px);
  background: currentColor;
  box-shadow: 0 0 12px 3px currentColor, inset 1px -1px 2px rgba(255,255,255,0.5);
  animation: bulbglow 2.6s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.bulb::after {
  content: ''; position: absolute; top: -7px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 8px; background: #1a2620;
  border-radius: 1.5px 1.5px 0 0;
}
@keyframes bulbglow {
  0%, 100% {
    filter: brightness(.7);
    box-shadow: 0 0 7px 1px currentColor, inset 1px -1px 2px rgba(255,255,255,0.4);
  }
  50% {
    filter: brightness(1.25);
    box-shadow: 0 0 16px 5px currentColor, inset 1px -1px 2px rgba(255,255,255,0.6);
  }
}

/* ---------- sparkles ---------- */
.sparkle {
  position: absolute;
  width: var(--s, 16px); height: var(--s, 16px);
  pointer-events: none; opacity: 0;
  animation: sparkle 4s ease-in-out infinite;
  animation-delay: var(--d, 0s);
}
.sparkle::before, .sparkle::after {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(closest-side, var(--gold-glow), transparent 70%);
}
.sparkle::before {
  clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%);
}
.sparkle::after {
  clip-path: polygon(50% 0, 58% 42%, 100% 50%, 58% 58%, 50% 100%, 42% 58%, 0 50%, 42% 42%);
  transform: rotate(45deg) scale(.6);
}
@keyframes sparkle {
  0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); }
  45%, 55% { opacity: 1; transform: scale(1) rotate(20deg); }
}

/* ---------- hanging ornaments ---------- */
.ornaments {
  position: absolute; top: 0; left: 0; right: 0;
  height: 0; z-index: 4; pointer-events: none;
}
.ornament {
  position: absolute; top: 0;
  transform-origin: top center;
  animation: swing 5s ease-in-out infinite;
}
.ornament .thread {
  display: block; width: 1px; height: var(--len, 60px); margin: 0 auto;
  background: linear-gradient(var(--gold), transparent);
}
.ornament .ball {
  display: block; width: var(--bs, 30px); height: var(--bs, 30px);
  border-radius: 50%; margin: 0 auto; position: relative;
  box-shadow:
    inset -4px -5px 9px rgba(0,0,0,0.35),
    inset 3px 3px 6px rgba(255,255,255,0.45),
    0 6px 14px -6px rgba(0,0,0,0.5);
}
.ornament .ball::before {
  content: ''; position: absolute; top: -5px; left: 50%; transform: translateX(-50%);
  width: 7px; height: 7px; border-radius: 2px;
  background: var(--gold); box-shadow: 0 0 4px var(--gold);
}
.ornament .ball::after {
  content: ''; position: absolute; top: 18%; left: 24%;
  width: 26%; height: 20%; border-radius: 50%;
  background: rgba(255,255,255,0.5); filter: blur(1px);
}
@keyframes swing {
  0%, 100% { transform: rotate(-3.5deg); }
  50%      { transform: rotate(3.5deg); }
}

/* ---------- gentle float ---------- */
.float { animation: floaty 7s ease-in-out infinite; }
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}

/* ---------- aurora / magic glow ---------- */
.aurora {
  position: absolute; inset: -10% -5%;
  pointer-events: none; filter: blur(60px); opacity: .55;
  background:
    radial-gradient(40% 50% at 30% 35%, rgba(47,138,87,0.5), transparent 60%),
    radial-gradient(36% 46% at 72% 30%, rgba(204,43,43,0.42), transparent 60%),
    radial-gradient(40% 40% at 52% 60%, rgba(200,162,74,0.35), transparent 60%);
  animation: auroradrift 16s ease-in-out infinite;
}
@keyframes auroradrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(2%, -3%) scale(1.06); }
}

/* ---------- moon / warm glow disc ---------- */
.moon {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle at 38% 36%, #fff8e6, #f2dca0 55%, rgba(242,220,160,0) 72%);
}
.moon-disc {
  position: absolute; border-radius: 50%;
  background: radial-gradient(circle at 40% 34%, #fffaf0 0%, #f6e8bd 48%, #ecd596 78%, #dcc079 100%);
  box-shadow:
    0 0 50px 14px rgba(242,220,160,0.45),
    0 0 120px 40px rgba(242,220,160,0.22),
    inset -18px -14px 44px rgba(150,120,60,0.28);
}
.moon-disc::before, .moon-disc::after {
  content: ''; position: absolute; border-radius: 50%;
  background: rgba(180,150,90,0.18);
  box-shadow: inset 2px 2px 4px rgba(120,95,45,0.25);
}
.moon-disc::before { width: 18%; height: 18%; top: 26%; left: 30%; }
.moon-disc::after  { width: 11%; height: 11%; top: 54%; left: 58%; }

/* ---------- snowbank (bottom of hero) ---------- */
.snowbank {
  position: absolute; left: 0; right: 0; bottom: -1px;
  z-index: 8; pointer-events: none; line-height: 0;
}
.snowbank svg { width: 100%; height: auto; display: block; }

/* ---------- candy-cane rule ---------- */
.candy-rule {
  height: 6px; border-radius: 999px;
  background-size: 18px 18px;
  background-image: repeating-linear-gradient(45deg, var(--red) 0 9px, #fff 9px 18px);
}

/* ---------- pine treeline ---------- */
.treeline {
  position: absolute; left: 0; right: 0;
  bottom: 34px; height: 0; z-index: 7;
  pointer-events: none;
}
.tree {
  position: absolute; bottom: 0;
  background: linear-gradient(160deg, #1c4a30, #0c2a1b);
  clip-path: polygon(50% 0, 64% 30%, 56% 30%, 72% 60%, 62% 60%, 84% 100%, 16% 100%, 38% 60%, 28% 60%, 44% 30%, 36% 30%);
  filter: drop-shadow(0 -1px 0 rgba(255,255,255,0.18));
}
.tree.snowy { background: linear-gradient(160deg, #245a3b, #123320); }

/* ---------- flying Santa + reindeer ---------- */
.flyer {
  position: absolute; z-index: 6; width: 210px;
  pointer-events: none; will-change: transform;
  animation: fly var(--fly, 26s) linear infinite;
  animation-delay: var(--flyd, 0s);
}
.flyer .bob { animation: bob 3.4s ease-in-out infinite; transform-origin: center; }
.flyer svg {
  width: 100%; height: auto; display: block; overflow: visible;
  filter:
    drop-shadow(0 0 7px rgba(242,220,160,0.55))
    drop-shadow(0 3px 5px rgba(0,0,0,0.35));
}
.flyer .dust {
  position: absolute; top: 38%; left: -42px;
  width: 84px; height: 11px; border-radius: 999px;
  background: radial-gradient(closest-side, rgba(242,220,160,0.85), transparent 75%);
  filter: blur(3px); opacity: .8;
  animation: dustpulse 1.6s ease-in-out infinite;
}
@keyframes fly {
  0%   { transform: translateX(-26vw) translateY(8px); }
  100% { transform: translateX(128vw) translateY(-34px); }
}
@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2.5deg); }
  50%      { transform: translateY(-13px) rotate(1.5deg); }
}
@keyframes dustpulse {
  0%, 100% { opacity: .4; }
  50%      { opacity: .85; }
}

/* arc that sails up and across the moon then off */
.flyer--moon {
  position: absolute; top: 0; left: 0; z-index: 6;
  width: 230px; pointer-events: none; will-change: transform;
  animation: flyMoon var(--fly, 22s) ease-in-out infinite;
  animation-delay: var(--flyd, 0s);
}
@keyframes flyMoon {
  0%   { transform: translate(-28vw, 46vh) scale(0.7); opacity: 0; }
  8%   { opacity: 1; }
  46%  { transform: translate(40vw, 20vh) scale(0.92); }
  70%  { transform: translate(72vw, 8vh) scale(1.06); }
  88%  { transform: translate(92vw, 4vh) scale(1.12); opacity: 1; }
  100% { transform: translate(120vw, 1vh) scale(1.16); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .star, .bulb, .sparkle, .ornament, .float, .aurora,
  .flyer, .flyer .bob, .flyer--moon { animation: none !important; }
  .star { opacity: .6; }
  .sparkle { opacity: .8; }
  .flyer { opacity: .9; }
  .flyer--moon { opacity: 1; transform: translate(70vw, 8vh) scale(1.05); }
  .snow-canvas { display: none; }
}
