/* Ugglan Jul – snöfall och julbelysning */

/* ---------- Ljusslinga ---------- */
.ugglan-jul-lights {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 44px;
	pointer-events: none;
	z-index: 99980;
	overflow: hidden;
}
body.admin-bar .ugglan-jul-lights { top: 32px; }
@media (max-width: 782px) {
	body.admin-bar .ugglan-jul-lights { top: 46px; }
}
.ugglan-jul-lights svg {
	display: block;
	width: 100%;
	height: 44px;
}
.ugglan-jul-lights .uj-wire {
	fill: none;
	stroke: #24412f;
	stroke-width: 2;
	stroke-linecap: round;
}
.ugglan-jul-lights .uj-socket { fill: #2f3a33; }
.ugglan-jul-lights .uj-bulb {
	transform-box: fill-box;
	transform-origin: 50% 0;
	animation: uj-twinkle 2.6s ease-in-out infinite;
}
.ugglan-jul-lights .uj-shine { fill: rgba(255, 255, 255, .55); }

.uj-c0 { fill: #d7263d; filter: drop-shadow(0 0 5px rgba(215, 38, 61, .85)); }
.uj-c1 { fill: #f4b942; filter: drop-shadow(0 0 5px rgba(244, 185, 66, .9)); }
.uj-c2 { fill: #2a9d5c; filter: drop-shadow(0 0 5px rgba(42, 157, 92, .85)); }
.uj-c3 { fill: #3f8fd8; filter: drop-shadow(0 0 5px rgba(63, 143, 216, .85)); }
.uj-c4 { fill: #f7f1e3; filter: drop-shadow(0 0 5px rgba(255, 236, 190, .95)); }

@keyframes uj-twinkle {
	0%, 100% { opacity: 1; }
	45%      { opacity: .45; }
	55%      { opacity: .45; }
}

/* ---------- Julgirlang ---------- */
.ugglan-jul-garland {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 72px;
	pointer-events: none;
	z-index: 99980;
	overflow: hidden;
	filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .18));
}
body.admin-bar .ugglan-jul-garland { top: 32px; }
@media (max-width: 782px) {
	body.admin-bar .ugglan-jul-garland { top: 46px; }
}
.ugglan-jul-garland canvas { display: block; }
.ujg-lights { position: absolute; inset: 0; }
.ujg-light {
	position: absolute;
	width: 5px;
	height: 5px;
	margin: -2.5px 0 0 -2.5px;
	border-radius: 50%;
	background: #fff6d8;
	box-shadow: 0 0 4px 2px rgba(255, 226, 140, .9), 0 0 12px 4px rgba(255, 200, 90, .45);
	animation: ujg-glow 3s ease-in-out infinite;
}
.ujg-light.ujg-gold {
	background: #ffd56b;
	box-shadow: 0 0 4px 2px rgba(255, 190, 60, .9), 0 0 12px 4px rgba(255, 160, 40, .45);
}
@keyframes ujg-glow {
	0%, 100% { opacity: 1; transform: scale(1); }
	50%      { opacity: .5; transform: scale(.8); }
}

/* ---------- Snö ---------- */
.ugglan-jul-snow {
	position: fixed;
	inset: 0;
	width: 100%;
	height: 100%;
	pointer-events: none;
	z-index: 99990;
}

/* ---------- Snöflingeknapp ---------- */
.ugglan-jul-toggle {
	position: fixed;
	left: 16px;
	bottom: var(--ujul-bottom, 16px);
	z-index: 99991;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	border: 1px solid rgba(36, 65, 47, .15);
	background: #fff;
	color: #3f6f9e;
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: transform .2s ease, opacity .2s ease, bottom .3s ease;
}
.ugglan-jul-toggle:hover { transform: scale(1.08); }
.ugglan-jul-toggle:focus-visible { outline: 3px solid #3f8fd8; outline-offset: 2px; }
.ugglan-jul-toggle.is-off { opacity: .55; }
.ugglan-jul-toggle.is-off::after {
	content: "";
	position: absolute;
	width: 24px;
	height: 2px;
	background: #b32d2e;
	transform: rotate(-45deg);
	border-radius: 2px;
}

/* ---------- Tomtens släde ---------- */
.ugglan-jul-sleigh {
	position: fixed;
	left: 0;
	top: 0;
	z-index: 99984;
	pointer-events: none;
	will-change: transform;
}
.ujs-flip { transition: transform .45s ease; }
.ujs-bob { animation: ujs-bob 1.6s ease-in-out infinite; }
.ugglan-jul-sleigh svg { display: block; width: 100%; height: auto; overflow: visible; filter: drop-shadow(0 4px 3px rgba(0, 0, 0, .15)); }
.ujs-deer { animation: ujs-gallop .5s ease-in-out infinite alternate; }
.ujs-deer2 { animation-delay: .25s; }
.ujs-nose { animation: ujs-nose 1.4s ease-in-out infinite; filter: drop-shadow(0 0 3px #ff2a3c); }
@keyframes ujs-bob {
	0%, 100% { transform: translateY(0) rotate(-1.5deg); }
	50%      { transform: translateY(-6px) rotate(1.5deg); }
}
@keyframes ujs-gallop {
	from { transform: translateY(0); }
	to   { transform: translateY(-3px); }
}
@keyframes ujs-nose { 50% { opacity: .55; } }
.ujs-spark {
	position: fixed;
	z-index: 9989;
	pointer-events: none;
	color: #f1c75b;
	font-size: 11px;
	line-height: 1;
	text-shadow: 0 0 6px rgba(255, 210, 100, .9);
	animation: ujs-spark 1.3s ease-out forwards;
}
@keyframes ujs-spark {
	from { opacity: 1; transform: translateY(0) scale(1); }
	to   { opacity: 0; transform: translateY(14px) scale(.4); }
}

/* ---------- Snödriva ---------- */
.ugglan-jul-drift {
	position: absolute;
	z-index: 50;
	height: 70px;
	pointer-events: none;
	overflow: hidden;
	filter: drop-shadow(0 -2px 3px rgba(0, 0, 0, .08));
}
.ugglan-jul-drift svg { display: block; }
.ujd-glint { fill: #fff; animation: ujd-glint 3s ease-in-out infinite; }
@keyframes ujd-glint {
	0%, 100% { opacity: .2; }
	50%      { opacity: 1; filter: drop-shadow(0 0 3px #bfe0ff); }
}

/* ---------- Julugglan ---------- */
.ugglan-jul-owl {
	position: absolute;
	z-index: 60;
}
.ujo-btn {
	display: block;
	width: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	background: none;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}
.ugglan-jul-owl .ujo-btn,
.ugglan-jul-owl .ujo-btn:hover,
.ugglan-jul-owl .ujo-btn:focus,
.ugglan-jul-owl .ujo-btn:active {
	background: transparent !important;
	background-color: transparent !important;
	border: 0 !important;
	box-shadow: none !important;
	padding: 0 !important;
	color: inherit !important;
}
.ugglan-jul-owl .ujo-btn:focus:not(:focus-visible) { outline: none; }
.ujo-btn:focus-visible { outline: 3px solid #3f8fd8; outline-offset: 4px; border-radius: 12px; }

/* Temats knappfärger (mörkgrått vid hover/klick) ska inte slå igenom på våra små knappar */
.ugglan-jul-toggle:hover, .ugglan-jul-toggle:focus, .ugglan-jul-toggle:active {
	background: #fff !important;
	color: #3f6f9e !important;
}
.ugglan-jul-cd .ujc-x:focus, .ugglan-jul-cd .ujc-x:active { background: rgba(255, 255, 255, .3) !important; color: #fff !important; }
.ugglan-jul-cd .ujc-x:hover { background: rgba(255, 255, 255, .3) !important; color: #fff !important; }
.ujo-btn svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
	filter: drop-shadow(0 4px 4px rgba(0, 0, 0, .25));
	transform-origin: 50% 100%;
	animation: ujo-sway 5s ease-in-out infinite;
}
.ujo-lids ellipse { transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(0); animation: ujo-blink 4.5s infinite; }
.ujo-pupils { animation: ujo-look 9s ease-in-out infinite; }
.ujo-wing-r { transform-box: fill-box; transform-origin: 30% 20%; animation: ujo-wave 7s ease-in-out infinite; }
.ugglan-jul-owl.is-hop .ujo-btn svg { animation: ujo-hop .55s ease-out; }
@keyframes ujo-sway { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
@keyframes ujo-blink { 0%, 90%, 100% { transform: scaleY(0); } 93%, 96% { transform: scaleY(1); } }
@keyframes ujo-look { 0%, 40%, 100% { transform: translateX(0); } 50%, 60% { transform: translateX(-3px); } 70%, 80% { transform: translateX(3px); } }
@keyframes ujo-wave { 0%, 80%, 100% { transform: rotate(0); } 84%, 92% { transform: rotate(-35deg); } 88%, 96% { transform: rotate(-15deg); } }
@keyframes ujo-hop { 0% { transform: translateY(0); } 40% { transform: translateY(-18px) rotate(-4deg); } 100% { transform: translateY(0); } }

.ujo-bubble {
	position: absolute;
	left: 70%;
	bottom: 88%;
	white-space: nowrap;
	padding: 8px 14px;
	border-radius: 14px 14px 14px 4px;
	background: #fff;
	color: #24543a;
	font: 700 14px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
	opacity: 0;
	transform: translateY(6px) scale(.9);
	transform-origin: 0 100%;
	transition: opacity .25s ease, transform .3s cubic-bezier(.2, .9, .25, 1.3);
	pointer-events: none;
}
.ugglan-jul-owl.is-talking .ujo-bubble { opacity: 1; transform: none; }
/* Ugglan till höger: pratbubblan åt vänster */
.ugglan-jul-owl.is-right .ujo-bubble { left: auto; right: 70%; border-radius: 14px 14px 4px 14px; transform-origin: 100% 100%; }
.ujo-flake {
	position: absolute;
	left: 50%;
	top: 40%;
	color: #fff;
	font-size: 13px;
	text-shadow: 0 0 6px rgba(160, 200, 255, .9);
	pointer-events: none;
	animation: ujo-puff 1s ease-out forwards;
}
@keyframes ujo-puff {
	from { opacity: 1; transform: translate(0, 0) scale(1); }
	to   { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(.5); }
}

/* ---------- Nedräkning ---------- */
.ugglan-jul-cd {
	position: fixed;
	right: 16px;
	bottom: var(--ujul-bottom, 16px);
	z-index: 99991;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 34px 10px 12px;
	border-radius: 16px;
	background: #24543a;
	color: #fff;
	font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	line-height: 1.15;
	box-shadow: 0 10px 28px rgba(0, 0, 0, .22);
	overflow: hidden;
	transition: bottom .3s ease, transform .3s ease;
	animation: ujc-in .6s cubic-bezier(.2, .9, .25, 1.2) both .8s;
}
.ugglan-jul-cd::before {
	content: "";
	position: absolute;
	left: 0; right: 0; top: 0;
	height: 4px;
	border-radius: 16px 16px 0 0;
	background: repeating-linear-gradient(135deg, #c41e2f 0 8px, #fff 8px 16px);
}
.ujc-tree { font-size: 28px; line-height: 1; }
.ujc-txt { display: flex; flex-direction: column; }
.ujc-num { font-size: 26px; font-weight: 800; color: #ffd56b; }
.ujc-word { font-size: 17px; font-weight: 800; color: #ffd56b; }
.ujc-small { font-size: 12.5px; opacity: .9; }
.ugglan-jul-cd .ujc-link {
	margin-top: 5px;
	font-size: 13px;
	font-weight: 700;
	color: #fff !important;
	text-decoration: underline !important;
	text-underline-offset: 2px;
}
.ugglan-jul-cd .ujc-link:hover { color: #ffd56b !important; }
.ujc-x {
	position: absolute;
	top: 6px;
	right: 6px;
	width: 22px;
	height: 22px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, .15);
	color: #fff;
	font-size: 16px;
	line-height: 22px;
	cursor: pointer;
}
.ujc-x:hover { background: rgba(255, 255, 255, .3); }
@keyframes ujc-in {
	from { opacity: 0; transform: translateY(20px) scale(.9); }
	to   { opacity: 1; transform: none; }
}
@media (max-width: 600px) {
	.ugglan-jul-cd { right: 10px; padding: 8px 30px 8px 10px; gap: 8px; }
	.ujc-tree { font-size: 22px; }
	.ujc-num { font-size: 21px; }
}

@media (prefers-reduced-motion: reduce) {
	.ujs-bob, .ujs-deer, .ujs-nose, .ujd-glint, .ugglan-jul-cd, .ujo-btn svg, .ujo-pupils, .ujo-wing-r { animation: none; }
	.ugglan-jul-lights .uj-bulb, .ujg-light { animation: none; }
}

@media print {
	.ugglan-jul-lights, .ugglan-jul-garland, .ugglan-jul-snow, .ugglan-jul-sleigh, .ujs-spark, .ugglan-jul-drift, .ugglan-jul-owl, .ugglan-jul-cd, .ugglan-jul-toggle { display: none !important; }
}
