/* Julklädsel for the Forma pages, paired with christmas.js. Loaded only while CHRISTMAS is true. */

.xm { pointer-events: none; user-select: none; }

/* falling snow */
.xm-snow { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 70; pointer-events: none; }

/* ---------- snow on photos ---------- */
.xm-photo { position: absolute; inset: 0; z-index: 4; border-radius: inherit; overflow: hidden; }
.xm-frost {
	position: absolute; inset: 0;
	background:
		radial-gradient(circle at 0 0, rgba(255, 255, 255, .7), rgba(255, 255, 255, 0) 16%),
		radial-gradient(circle at 100% 0, rgba(255, 255, 255, .6), rgba(255, 255, 255, 0) 14%),
		radial-gradient(circle at 0 100%, rgba(255, 255, 255, .55), rgba(255, 255, 255, 0) 15%),
		radial-gradient(circle at 100% 100%, rgba(255, 255, 255, .65), rgba(255, 255, 255, 0) 17%),
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cg fill='%23fff'%3E%3Ccircle cx='12' cy='18' r='2.2'/%3E%3Ccircle cx='48' cy='6' r='1.4'/%3E%3Ccircle cx='86' cy='30' r='2.8'/%3E%3Ccircle cx='130' cy='12' r='1.6'/%3E%3Ccircle cx='166' cy='44' r='2.4'/%3E%3Ccircle cx='24' cy='70' r='1.5'/%3E%3Ccircle cx='70' cy='90' r='2'/%3E%3Ccircle cx='116' cy='72' r='1.3'/%3E%3Ccircle cx='150' cy='104' r='2.6'/%3E%3Ccircle cx='8' cy='130' r='2.6'/%3E%3Ccircle cx='54' cy='150' r='1.5'/%3E%3Ccircle cx='98' cy='128' r='2.2'/%3E%3Ccircle cx='140' cy='160' r='1.7'/%3E%3Ccircle cx='176' cy='140' r='1.2'/%3E%3C/g%3E%3C/svg%3E");
	box-shadow: inset 0 0 60px rgba(255, 255, 255, .35);
	-webkit-mask-image: radial-gradient(ellipse at center, transparent 46%, #000 92%);
	mask-image: radial-gradient(ellipse at center, transparent 46%, #000 92%);
	opacity: .9;
}
/* the drift (drawn per photo by christmas.js), a light dusting below it, and the fir */
.xm-snowbed { position: absolute; left: 0; right: 0; top: 0; line-height: 0; }
.xm-snowbed svg { display: block; overflow: visible; }
.xm-hero .xm-snowbed { top: auto; bottom: 0; }
.xm-dust { position: absolute; left: 0; right: 0; top: 0; height: 90px; background: linear-gradient(rgba(255, 255, 255, .2), rgba(255, 255, 255, 0)); }
.xm-spark { animation: xm-spark 4s ease-in-out infinite; }
@keyframes xm-spark { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }

.xm-fir { position: absolute; left: 0; right: 0; top: 0; line-height: 0; filter: drop-shadow(0 5px 5px rgba(0, 0, 0, .35)); }
.xm-fir svg { display: block; overflow: visible; }
.xm-sprig { right: auto; }
.xm-sprig.xm-right { left: auto; right: 0; transform: scaleX(-1); }
.xm-warm { animation: xm-warm 3s ease-in-out infinite; }
@keyframes xm-warm { 0%, 100% { opacity: 1; } 45% { opacity: .5; } 60% { opacity: .85; } }
.xm-hero .xm-frost {
	-webkit-mask-image: radial-gradient(ellipse at center, transparent 58%, #000 100%);
	mask-image: radial-gradient(ellipse at center, transparent 58%, #000 100%);
}

/* ---------- tomteluva ---------- */
.xm-hat { position: absolute; z-index: 3; width: 38px; left: -5px; top: -22px; transform: rotate(-10deg); transform-origin: 41% 76%; filter: drop-shadow(0 1.5px 1.5px rgba(0, 0, 0, .28)); }
.xm-hat svg { display: block; width: 100%; height: auto; }
/* on the demo pill the hat sits on the top-right corner, tip hanging over the edge */
.xm-hat-sm { width: 30px; left: auto; right: 2px; top: -17px; transform: rotate(10deg); }

/* ---------- snow caps on the buttons ---------- */
.xm-cap {
	position: absolute; z-index: 2; left: 10%; right: 10%; top: -5px; height: 9px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 12' preserveAspectRatio='none'%3E%3Cpath d='M2 9C3 4 8 1 16 2c8 0 10-2 20-2s14 3 24 2 14-2 22-1 15 2 16 6c1 3-3 4-6 3-5-2-9 2-15 1-6-1-9-3-15-1-6 2-11 3-18 1-6-1-10 1-16 1C6 12 1 12 2 9z' fill='%23fff'/%3E%3C/svg%3E") no-repeat center / 100% 100%;
	filter: drop-shadow(0 1px 1.5px rgba(20, 40, 70, .3));
}
.nav .demo .xm-cap { left: 14%; right: 26%; }

/* ---------- lights under the header ---------- */
.xm-lights { position: absolute; left: 0; right: 0; bottom: -20px; height: 30px; z-index: 1; overflow: visible; }
.xm-navfir { position: absolute; left: 0; top: 0; display: block; overflow: visible; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .3)); }
.xm-lights i {
	position: absolute; top: 6px; width: 8px; height: 12px; margin-left: -4px;
	border-radius: 50% 50% 48% 48% / 40% 40% 60% 60%;
	background: var(--c);
	box-shadow: 0 0 10px 2px var(--c);
	animation: xm-twinkle 2.4s ease-in-out infinite;
}
.xm-lights i::before { content: ""; position: absolute; left: 2px; top: -3px; width: 4px; height: 4px; border-radius: 1px; background: #4a514a; }
.xm-lights i.tilt { transform: rotate(14deg); }
@keyframes xm-twinkle { 0%, 100% { opacity: 1; } 50% { opacity: .45; box-shadow: 0 0 3px 0 var(--c); } }

/* ---------- garland and stockings over the footer ---------- */
.foot.xm-foot { padding-top: 150px; }
.xm-mantle { position: absolute; left: 0; right: 0; top: 0; height: 130px; z-index: 2; }
.xm-garland {
	position: absolute; left: 0; right: 0; top: -14px; height: 42px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='42' viewBox='0 0 160 42'%3E%3Cpath d='M0 10q80 34 160 0' fill='none' stroke='%23173d22' stroke-width='14' stroke-linecap='round'/%3E%3Cpath d='M0 10q80 34 160 0' fill='none' stroke='%232f6b3b' stroke-width='9' stroke-dasharray='3 4' stroke-linecap='round'/%3E%3Cpath d='M0 8q80 34 160 0' fill='none' stroke='%23477f4f' stroke-width='3' stroke-dasharray='2 6' stroke-linecap='round'/%3E%3Ccircle cx='80' cy='30' r='6' fill='%23c8102e'/%3E%3Ccircle cx='78' cy='28' r='1.8' fill='%23fff' opacity='.7'/%3E%3Ccircle cx='40' cy='23' r='3.4' fill='%23e8b547'/%3E%3Ccircle cx='120' cy='23' r='3.4' fill='%23e8b547'/%3E%3Ccircle cx='0' cy='10' r='5' fill='%23c8102e'/%3E%3Ccircle cx='160' cy='10' r='5' fill='%23c8102e'/%3E%3C/svg%3E") repeat-x 0 0 / 160px 42px;
	filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .3));
}
.xm-stockings { position: absolute; left: 0; right: 0; top: 14px; display: flex; justify-content: space-around; padding-inline: 4vw; }
.xm-stocking { width: 46px; transform-origin: 50% 0; animation: xm-sway 4.2s ease-in-out infinite; filter: drop-shadow(0 4px 5px rgba(0, 0, 0, .3)); }
.xm-stocking:nth-child(even) { margin-top: 10px; }
.xm-stocking svg { display: block; width: 100%; height: auto; }
@keyframes xm-sway { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }

@media (max-width: 720px) {
	.xm-stocking { width: 38px; }
	.xm-stocking:nth-child(n + 5) { display: none; }
	.foot.xm-foot { padding-top: 130px; }
	.xm-sprig svg { width: 120px; height: auto; }
}

@media (prefers-reduced-motion: reduce) {
	.xm-lights i, .xm-stocking, .xm-warm, .xm-spark { animation: none; }
}
