/*
 * Snø i julesesongen (show_snow() i date_helper, datoene i CustomConfig). Bare CSS:
 * et snølag med istapper langs toppmenyen, og snø som daler over siden.
 * Snøen som daler tar aldri imot trykk og forsvinner for den som har slått av animasjoner.
 */

/* snø langs toppmenyen: et snølag på den oransje streken, og istapper som henger under den */
.snow-top .navbar::after,
.snow-top .navbar::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
  z-index: 1;
}
.snow-top .navbar::after {
  bottom: 0;
  height: 12px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='10' viewBox='0 0 120 10' preserveAspectRatio='none'%3E%3Cpath d='M0 10 L0 5.5 Q6.0 0.5 12.0 1.7 Q18.0 0.5 24.0 6.2 Q30.0 3.2 36.0 4.4 Q42.0 3.2 48.0 5.6 Q54.0 2.3 60.0 3.5 Q66.0 2.3 72.0 5.9 Q78.0 0.8 84.0 2.0 Q90.0 0.8 96.0 4.7 Q102.0 3.5 108.0 5.4 Q114.0 4.2 120.0 5.5 L120 10 Z' fill='%23dfe8f0'/%3E%3Cpath d='M0 10 L0 5.5 Q6.0 0.5 12.0 1.7 Q18.0 0.5 24.0 6.2 Q30.0 3.2 36.0 4.4 Q42.0 3.2 48.0 5.6 Q54.0 2.3 60.0 3.5 Q66.0 2.3 72.0 5.9 Q78.0 0.8 84.0 2.0 Q90.0 0.8 96.0 4.7 Q102.0 3.5 108.0 5.4 Q114.0 4.2 120.0 5.5 L120 10 Z' transform='translate%280 -1%29' fill='%23ffffff'/%3E%3C/svg%3E") repeat-x 0 0 / 120px 10px,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='170' height='9' viewBox='0 0 170 9' preserveAspectRatio='none'%3E%3Cpath d='M0 9 L0 5.0 Q7.1 -0.1 14.2 1.1 Q21.2 -0.1 28.3 4.1 Q35.4 2.9 42.5 4.6 Q49.6 3.4 56.7 5.8 Q63.7 0.8 70.8 2.0 Q77.9 0.8 85.0 5.4 Q92.1 2.5 99.2 3.7 Q106.2 2.5 113.3 5.3 Q120.4 1.3 127.5 2.5 Q134.6 1.3 141.7 5.2 Q148.7 3.1 155.8 4.3 Q162.9 3.1 170.0 5.0 L170 9 Z' fill='%23dfe8f0'/%3E%3Cpath d='M0 9 L0 5.0 Q7.1 -0.1 14.2 1.1 Q21.2 -0.1 28.3 4.1 Q35.4 2.9 42.5 4.6 Q49.6 3.4 56.7 5.8 Q63.7 0.8 70.8 2.0 Q77.9 0.8 85.0 5.4 Q92.1 2.5 99.2 3.7 Q106.2 2.5 113.3 5.3 Q120.4 1.3 127.5 2.5 Q134.6 1.3 141.7 5.2 Q148.7 3.1 155.8 4.3 Q162.9 3.1 170.0 5.0 L170 9 Z' transform='translate%280 -1%29' fill='%23ffffff'/%3E%3C/svg%3E") repeat-x 37px 1px / 170px 9px;
  background-size: 120px 12px, 170px 10px;
}
.snow-top .navbar::before {
  top: calc(100% + 2px);
  height: 10px;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='97' height='10' viewBox='0 0 97 10'%3E%3Cpath d='M0 0 H97 V1.5 L95.2 6.3 L93.0 1.5 L87.6 1.6 L84.6 1.7 L80.6 1.9 L77.8 7.7 L74.3 1.5 L70.7 2.2 L65.6 2.0 L62.3 2.0 L60.5 8.8 L58.1 1.5 L53.2 2.2 L47.4 1.8 L44.6 9.2 L41.2 1.5 L38.3 5.2 L34.7 1.5 L30.8 1.8 L28.3 7.0 L25.3 1.5 L23.3 7.4 L20.8 1.5 L15.4 2.0 L8.7 2.3 L6.1 8.8 L3.0 1.5 L0 1.5 Z' fill='%23dfe8f0'/%3E%3Cpath d='M0 0 H97 V1.5 L95.2 6.3 L93.0 1.5 L87.6 1.6 L84.6 1.7 L80.6 1.9 L77.8 7.7 L74.3 1.5 L70.7 2.2 L65.6 2.0 L62.3 2.0 L60.5 8.8 L58.1 1.5 L53.2 2.2 L47.4 1.8 L44.6 9.2 L41.2 1.5 L38.3 5.2 L34.7 1.5 L30.8 1.8 L28.3 7.0 L25.3 1.5 L23.3 7.4 L20.8 1.5 L15.4 2.0 L8.7 2.3 L6.1 8.8 L3.0 1.5 L0 1.5 Z' transform='translate%28-.6 -.6%29' fill='%23ffffff' opacity='.9'/%3E%3C/svg%3E") repeat-x 0 0 / 97px 10px,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='143' height='10' viewBox='0 0 143 10'%3E%3Cpath d='M0 0 H143 V1.5 L139.1 1.6 L136.5 5.7 L133.3 1.5 L130.1 7.7 L126.3 1.5 L124.1 7.0 L121.4 1.5 L117.7 1.6 L115.9 5.8 L113.7 1.5 L109.1 1.8 L107.5 9.5 L105.6 1.5 L102.4 1.8 L99.9 8.0 L96.8 1.5 L91.8 2.2 L89.4 4.8 L86.4 1.5 L83.4 5.5 L79.7 1.5 L72.9 2.1 L69.9 6.3 L66.3 1.5 L63.4 8.3 L59.8 1.5 L56.4 2.1 L49.6 1.9 L47.9 7.1 L45.9 1.5 L43.6 9.0 L40.8 1.5 L35.8 1.7 L34.0 6.2 L31.8 1.5 L30.0 6.4 L27.7 1.5 L21.4 1.6 L19.3 7.8 L16.8 1.5 L13.7 8.3 L9.9 1.5 L8.0 8.3 L5.7 1.5 L3.8 6.7 L1.4 1.5 L0 1.5 Z' fill='%23dfe8f0'/%3E%3Cpath d='M0 0 H143 V1.5 L139.1 1.6 L136.5 5.7 L133.3 1.5 L130.1 7.7 L126.3 1.5 L124.1 7.0 L121.4 1.5 L117.7 1.6 L115.9 5.8 L113.7 1.5 L109.1 1.8 L107.5 9.5 L105.6 1.5 L102.4 1.8 L99.9 8.0 L96.8 1.5 L91.8 2.2 L89.4 4.8 L86.4 1.5 L83.4 5.5 L79.7 1.5 L72.9 2.1 L69.9 6.3 L66.3 1.5 L63.4 8.3 L59.8 1.5 L56.4 2.1 L49.6 1.9 L47.9 7.1 L45.9 1.5 L43.6 9.0 L40.8 1.5 L35.8 1.7 L34.0 6.2 L31.8 1.5 L30.0 6.4 L27.7 1.5 L21.4 1.6 L19.3 7.8 L16.8 1.5 L13.7 8.3 L9.9 1.5 L8.0 8.3 L5.7 1.5 L3.8 6.7 L1.4 1.5 L0 1.5 Z' transform='translate%28-.6 -.6%29' fill='%23ffffff' opacity='.9'/%3E%3C/svg%3E") repeat-x 41px 0 / 143px 10px;
}

/* snø som daler: tre lag, de nærmeste er størst og faller fortest. Flakene i hvert lag er et SVG-bilde som
   gjentas. Med radial-gradient-flak tegnet Firefox om lagene i hver ramme og klarte rundt 6 bilder i sekundet
   (Chrome merket ingenting); med ferdige bilder går det jevnt */
.snowfall {
  position: fixed;
  inset: 0;
  z-index: 1020;
  overflow: hidden;
  pointer-events: none;
}
.snowfall i {
  position: absolute;
  left: -20px;
  right: -20px;
  will-change: translate, transform;
}
.snowfall i:nth-child(1) {
  top: -400px;
  height: calc(100% + 400px);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Ccircle cx='221.2' cy='279.6' r='2.7' fill='%23fff' fill-opacity='0.9'/%3E%3Ccircle cx='19.2' cy='112' r='2.7' fill='%23fff' fill-opacity='0.9'/%3E%3Ccircle cx='3.6' cy='158.8' r='3' fill='%23fff' fill-opacity='0.9'/%3E%3Ccircle cx='102' cy='366.8' r='2.6' fill='%23fff' fill-opacity='0.9'/%3E%3Ccircle cx='288' cy='48' r='2.8' fill='%23fff' fill-opacity='0.9'/%3E%3Ccircle cx='343.2' cy='106' r='2.1' fill='%23fff' fill-opacity='0.9'/%3E%3Ccircle cx='249.6' cy='220' r='2.6' fill='%23fff' fill-opacity='0.9'/%3E%3C/svg%3E") 0 0 / 400px 400px;
  animation: snow-fall-near 11s linear infinite, snow-sway 5s ease-in-out infinite alternate;
}
.snowfall i:nth-child(2) {
  top: -300px;
  height: calc(100% + 300px);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Ccircle cx='114.3' cy='175.5' r='2.2' fill='%23fff' fill-opacity='0.75'/%3E%3Ccircle cx='100.5' cy='286.8' r='2.2' fill='%23fff' fill-opacity='0.75'/%3E%3Ccircle cx='62.4' cy='80.7' r='2.3' fill='%23fff' fill-opacity='0.75'/%3E%3Ccircle cx='43.5' cy='190.5' r='2.1' fill='%23fff' fill-opacity='0.75'/%3E%3Ccircle cx='178.2' cy='218.7' r='2.2' fill='%23fff' fill-opacity='0.75'/%3E%3Ccircle cx='130.8' cy='150.3' r='2' fill='%23fff' fill-opacity='0.75'/%3E%3C/svg%3E") 0 0 / 300px 300px;
  animation: snow-fall-mid 14s linear infinite, snow-sway 7s ease-in-out -2s infinite alternate;
  opacity: .8;
}
.snowfall i:nth-child(3) {
  top: -250px;
  height: calc(100% + 250px);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Ccircle cx='190' cy='203.2' r='1.5' fill='%23fff' fill-opacity='0.6'/%3E%3Ccircle cx='82.8' cy='155.5' r='1.4' fill='%23fff' fill-opacity='0.6'/%3E%3Ccircle cx='157.5' cy='113.8' r='1.7' fill='%23fff' fill-opacity='0.6'/%3E%3Ccircle cx='86' cy='114.2' r='1.6' fill='%23fff' fill-opacity='0.6'/%3E%3Ccircle cx='246.8' cy='245.8' r='1.5' fill='%23fff' fill-opacity='0.6'/%3E%3Ccircle cx='228.5' cy='80' r='1.2' fill='%23fff' fill-opacity='0.6'/%3E%3C/svg%3E") 0 0 / 250px 250px;
  animation: snow-fall-far 20s linear infinite, snow-sway 9s ease-in-out -4s infinite alternate;
  opacity: .6;
}
@keyframes snow-fall-near { to { translate: 0 400px; } }
@keyframes snow-fall-mid { to { translate: 0 300px; } }
@keyframes snow-fall-far { to { translate: 0 250px; } }
@keyframes snow-sway {
  from { transform: translateX(-14px); }
  to { transform: translateX(14px); }
}

/* i lys modus forsvinner hvit snø mot de lyse kortene, så flakene får en svak kant. Kanten er tegnet inn i
   bildene: filter: drop-shadow på lagene gjorde Firefox treg (se kommentaren over .snowfall) */
html.design-light .snowfall i:nth-child(1) { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Ccircle cx='221.2' cy='279.6' r='2.7' fill='%23fff' fill-opacity='0.9' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='19.2' cy='112' r='2.7' fill='%23fff' fill-opacity='0.9' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='3.6' cy='158.8' r='3' fill='%23fff' fill-opacity='0.9' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='102' cy='366.8' r='2.6' fill='%23fff' fill-opacity='0.9' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='288' cy='48' r='2.8' fill='%23fff' fill-opacity='0.9' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='343.2' cy='106' r='2.1' fill='%23fff' fill-opacity='0.9' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='249.6' cy='220' r='2.6' fill='%23fff' fill-opacity='0.9' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3C/svg%3E"); }
html.design-light .snowfall i:nth-child(2) { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Ccircle cx='114.3' cy='175.5' r='2.2' fill='%23fff' fill-opacity='0.75' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='100.5' cy='286.8' r='2.2' fill='%23fff' fill-opacity='0.75' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='62.4' cy='80.7' r='2.3' fill='%23fff' fill-opacity='0.75' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='43.5' cy='190.5' r='2.1' fill='%23fff' fill-opacity='0.75' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='178.2' cy='218.7' r='2.2' fill='%23fff' fill-opacity='0.75' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='130.8' cy='150.3' r='2' fill='%23fff' fill-opacity='0.75' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3C/svg%3E"); }
html.design-light .snowfall i:nth-child(3) { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='250'%3E%3Ccircle cx='190' cy='203.2' r='1.5' fill='%23fff' fill-opacity='0.6' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='82.8' cy='155.5' r='1.4' fill='%23fff' fill-opacity='0.6' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='157.5' cy='113.8' r='1.7' fill='%23fff' fill-opacity='0.6' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='86' cy='114.2' r='1.6' fill='%23fff' fill-opacity='0.6' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='246.8' cy='245.8' r='1.5' fill='%23fff' fill-opacity='0.6' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3Ccircle cx='228.5' cy='80' r='1.2' fill='%23fff' fill-opacity='0.6' stroke='%23352214' stroke-opacity='.45' stroke-width='.8'/%3E%3C/svg%3E"); }

@media (prefers-reduced-motion: reduce) {
  .snowfall { display: none; }
}
