/* winter.css – zimní efekty pro Magickou poštu
   Všechny třídy mají prefix w- a nesahají na žádné stávající styly stránky.
   Smazáním odkazu na tento soubor (a na winter.js) se efekty úplně vypnou. */

/* ---------- padající sníh ---------- */
.w-snow {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: var(--w-z, 50);
}

/* ---------- sníh navršený na prvku ---------- */
.w-cap {
  position: absolute; z-index: 3; pointer-events: none;
  filter: drop-shadow(0 3px 4px rgba(20, 0, 12, .38));
}
.w-cap svg {
  display: block; overflow: visible; transform-origin: 50% var(--w-edge, 10px);
  transition: transform 1.1s cubic-bezier(.2, .8, .2, 1), opacity 1.1s ease;
}
html:not(.w-f-caps) .w-cap { display: none; }
.w-cap.w-bump { animation: w-bump .5s ease; }
@keyframes w-bump {
  0% { transform: translateY(0); }
  30% { transform: translateY(-3px) rotate(-.6deg); }
  65% { transform: translateY(1px) rotate(.4deg); }
  100% { transform: none; }
}

/* ---------- třpyt ---------- */
.w-glint {
  position: absolute; width: 10px; height: 10px; background: #fff; opacity: 0;
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  animation: w-glint 3.2s ease-in-out var(--w-dl, 0s) infinite;
}
html:not(.w-f-glint) .w-glint { display: none; }
@keyframes w-glint {
  0%, 70%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); }
  82% { opacity: 1; transform: scale(1.15) rotate(45deg); }
}

/* ---------- rampouchy ---------- */
.w-ice { position: absolute; left: 0; right: 0; top: calc(100% - 4px); height: 0; z-index: 3; pointer-events: none; }
.w-ice--snowy { top: calc(100% + 28px); }
.w-ice svg {
  position: absolute; left: 0; top: 0; overflow: visible; transform-origin: 50% 0; transform: scaleY(0);
  transition: transform 2.4s cubic-bezier(.3, 1, .4, 1);
  filter: drop-shadow(0 2px 3px rgba(20, 0, 12, .3));
}
html.w-f-ice .w-ice svg { transform: scaleY(1); }
.w-drip {
  position: absolute; width: 5px; height: 7px; border-radius: 50% 50% 55% 55%;
  background: linear-gradient(180deg, #fff, #b9dcf7); opacity: 0;
  animation: w-drip 3.6s cubic-bezier(.5, 0, 1, .6) var(--w-dl, 0s) infinite;
}
html:not(.w-f-ice) .w-drip { display: none; }
@keyframes w-drip {
  0% { opacity: 0; transform: translateY(0) scale(.5); }
  12% { opacity: .95; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(50px) scale(.8); }
}

/* ---------- jinovatka (vlastní vrstva uvnitř prvku, stávající styly se nemění) ---------- */
.w-frost {
  position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
  opacity: 0; transition: opacity .8s ease;
}
html.w-f-frost .w-frost { opacity: 1; }
.w-frost--glass { box-shadow: inset 0 0 14px rgba(215, 238, 255, .38), 0 0 16px rgba(170, 210, 255, .16); }
.w-frost--card {
  box-shadow: inset 0 0 30px rgba(200, 230, 255, .14), 0 0 24px rgba(170, 210, 255, .14);
  background:
    radial-gradient(150px 110px at 0 100%, rgba(225, 242, 255, .2), transparent 72%),
    radial-gradient(170px 120px at 100% 100%, rgba(225, 242, 255, .18), transparent 72%),
    radial-gradient(110px 80px at 100% 0, rgba(225, 242, 255, .14), transparent 70%);
}
.w-frost--card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit;
  background-image: var(--w-noise, none); background-size: 220px 220px; opacity: .45;
  -webkit-mask-image: radial-gradient(110px 80px at 0 100%, #000, transparent 70%), radial-gradient(120px 90px at 100% 100%, #000, transparent 70%), radial-gradient(80px 60px at 100% 0, #000, transparent 68%), radial-gradient(70px 55px at 0 0, #000, transparent 68%);
  mask-image: radial-gradient(110px 80px at 0 100%, #000, transparent 70%), radial-gradient(120px 90px at 100% 100%, #000, transparent 70%), radial-gradient(80px 60px at 100% 0, #000, transparent 68%), radial-gradient(70px 55px at 0 0, #000, transparent 68%);
}

/* ---------- světýlka u horního okraje ---------- */
#w-garland { position: absolute; left: 0; right: 0; top: 0; height: 44px; z-index: var(--w-z, 50); pointer-events: none; }
#w-garland svg { display: block; overflow: visible; }
.w-bulb { animation: w-bulb 2.6s ease-in-out infinite; }
.w-bulb.w-b1 { animation-delay: -.9s; }
.w-bulb.w-b2 { animation-delay: -1.7s; }
@keyframes w-bulb { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
html:not(.w-f-lights) #w-garland { display: none; }

/* ---------- vypnutí všeho najednou (Winter.disable()) ---------- */
html.w-off .w-snow, html.w-off .w-cap, html.w-off .w-ice, html.w-off .w-frost, html.w-off #w-garland { display: none !important; }

/* ---------- lidé, kterým vadí pohyb ---------- */
@media (prefers-reduced-motion: reduce) {
  .w-cap svg, .w-ice svg, .w-frost { transition: none !important; }
  .w-glint, .w-drip, .w-bulb, .w-cap.w-bump { animation: none !important; }
}
