/* Seasonal themes for the landing page. Only loaded while a season is on (Shared/Seasonal.razor), and every rule
   keys off the .season-* element, which only the landing page renders. Replaces seasonal/xmas/snow.css
   (250 flakes with ~10 000 lines of keyframes) and seasonal/newyear/newyears.css. */

.season-fx { display: contents; }
/* "Året som gått 2026 →" in the New Year intro */
.season-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; font: 700 14px var(--sans); color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--gold); padding-bottom: 2px; }
.lg-page a.season-link:hover { color: var(--tomato); }

/* the hat (or wreath, semla, bun) on the logo, dropped in with the same kind of animation as before */
body:has(.season-fx) .topnav .logo::after { content: ""; position: absolute; pointer-events: none; background: no-repeat top right / contain; }

/* ---------- Christmas ---------- */
body:has(.season-jul) .topnav .logo::after {
    background-image: url('seasonal/xmas/santashat.png');
    width: 64%; height: 64%; top: -24%; right: -28%; transform: rotate(40deg);
    animation: hat-xmas 3s ease-in-out;
}
@keyframes hat-xmas {
    0% { opacity: 0; top: -170%; right: -38%; transform: rotate(-20deg); }
    20% { top: -135%; right: -18%; transform: rotate(20deg); }
    40% { opacity: 1; top: -100%; right: -38%; transform: rotate(-20deg); }
    60% { top: -70%; right: -18%; transform: rotate(20deg); }
    80% { top: -45%; right: -38%; transform: rotate(-20deg); }
    100% { top: -24%; right: -28%; transform: rotate(40deg); }
}
body:has(.season-jul) { cursor: url('seasonal/xmas/christmas-cursor-32x32.png'), auto; }
body:has(.season-jul) :is(a, button, label, summary, input[type=search]) { cursor: url('seasonal/xmas/christmas-pointer-32x32.png'), pointer; }

/* Snow: ~40 flakes sharing one animation; position, size, opacity, speed, start and drift come in as inline values */
.snow { position: fixed; inset: 0; pointer-events: none; z-index: 4; overflow: hidden; }
.snow i {
    position: absolute; top: -6vh; left: var(--x); font-size: var(--s); font-style: normal; line-height: 1;
    color: #e3ebf2; text-shadow: 0 0 1px #8a99a6, 0 1px 3px #6a5e5566; opacity: var(--o);
    animation: snowfall var(--d) linear var(--delay) infinite;
}
.snow i::after { content: "\2744"; }
@keyframes snowfall { to { transform: translate(var(--drift), 112vh) rotate(var(--turn, 360deg)); } }

/* ---------- New Year ---------- */
body:has(.season-nyar) .topnav .logo::after {
    background-image: url('seasonal/newyear/partyhat2024.png');
    width: 84%; height: 84%; top: -52%; right: -36%; transform: rotate(30deg);
    animation: hat-ny 2s ease-in;
}
@keyframes hat-ny { 0% { opacity: 0; top: -200%; transform: rotate(-1080deg); } 40% { opacity: 1; } 100% { top: -52%; transform: rotate(30deg); } }
/* A short dark intro at page load: the page starts dimmed with the fireworks on top, and after 5 s fades to
   its normal colours. The fireworks then keep going behind the content. Neither ever blocks a click. */
.ny-dim { position: fixed; inset: 0; z-index: 999; pointer-events: none; background: linear-gradient(#0007, #0000), #123; opacity: .9; animation: ny-dim 1s ease 5s both; }
@keyframes ny-dim { to { opacity: 0; visibility: hidden; } }
.fireworks { position: absolute; left: 0; top: 0; width: 100%; height: 100vh; overflow: hidden; pointer-events: none; z-index: 1000; animation: ny-behind 1s step-end 5s both; }
@keyframes ny-behind { to { z-index: -1; } }

/* fireworks: carried over from newyears.css */
@keyframes firework {
    0% { transform: translate(var(--x), var(--initialY)); width: var(--initialSize); opacity: 1; }
    50% { width: .5vmin; opacity: 1; }
    100% { width: var(--finalSize); opacity: 0; }
}
.firework, .firework::before, .firework::after {
    --initialSize: .5vmin; --finalSize: 45vmin; --particleSize: .2vmin;
    --color1: yellow; --color2: khaki; --color3: white; --color4: lime; --color5: gold; --color6: mediumseagreen;
    --y: -30vmin; --x: -50%; --initialY: 60vmin;
    content: ""; animation: firework 2s infinite; position: absolute; top: 50%; left: 50%; transform: translate(-50%, var(--y)); width: var(--initialSize); aspect-ratio: 1;
    background:
        radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 50% 0%, radial-gradient(circle, var(--color2) var(--particleSize), #0000 0) 100% 50%,
        radial-gradient(circle, var(--color3) var(--particleSize), #0000 0) 50% 100%, radial-gradient(circle, var(--color4) var(--particleSize), #0000 0) 0% 50%,
        radial-gradient(circle, var(--color5) var(--particleSize), #0000 0) 80% 90%, radial-gradient(circle, var(--color6) var(--particleSize), #0000 0) 95% 90%,
        radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 90% 70%, radial-gradient(circle, var(--color2) var(--particleSize), #0000 0) 100% 60%,
        radial-gradient(circle, var(--color3) var(--particleSize), #0000 0) 55% 80%, radial-gradient(circle, var(--color4) var(--particleSize), #0000 0) 70% 77%,
        radial-gradient(circle, var(--color5) var(--particleSize), #0000 0) 22% 90%, radial-gradient(circle, var(--color6) var(--particleSize), #0000 0) 45% 90%,
        radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 33% 70%, radial-gradient(circle, var(--color2) var(--particleSize), #0000 0) 10% 60%,
        radial-gradient(circle, var(--color3) var(--particleSize), #0000 0) 31% 80%, radial-gradient(circle, var(--color4) var(--particleSize), #0000 0) 28% 77%,
        radial-gradient(circle, var(--color5) var(--particleSize), #0000 0) 13% 72%, radial-gradient(circle, var(--color6) var(--particleSize), #0000 0) 80% 10%,
        radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 95% 14%, radial-gradient(circle, var(--color2) var(--particleSize), #0000 0) 90% 23%,
        radial-gradient(circle, var(--color3) var(--particleSize), #0000 0) 100% 43%, radial-gradient(circle, var(--color4) var(--particleSize), #0000 0) 85% 27%,
        radial-gradient(circle, var(--color5) var(--particleSize), #0000 0) 77% 37%, radial-gradient(circle, var(--color6) var(--particleSize), #0000 0) 60% 7%,
        radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 22% 14%, radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 45% 20%,
        radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 33% 34%, radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 10% 29%,
        radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 31% 37%, radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 28% 7%,
        radial-gradient(circle, var(--color1) var(--particleSize), #0000 0) 13% 42%;
    background-size: var(--initialSize) var(--initialSize);
    background-repeat: no-repeat;
}
.firework::before { --x: -50%; --y: -50%; --initialY: -50%; transform: translate(-50%, -50%) rotate(40deg) scale(1.3) rotateY(40deg); }
.firework::after { --x: -50%; --y: -50%; --initialY: -50%; transform: translate(-50%, -50%) rotate(170deg) scale(1.15) rotateY(-30deg); }
.firework:nth-child(2) { --x: 30vmin; }
.firework:nth-child(2), .firework:nth-child(2)::before, .firework:nth-child(2)::after { --color1: pink; --color2: violet; --color3: fuchsia; --color4: orchid; --color5: plum; --color6: lavender; --finalSize: 40vmin; left: 30%; top: 60%; animation-delay: -.25s; }
.firework:nth-child(3) { --x: -30vmin; --y: -50vmin; }
.firework:nth-child(3), .firework:nth-child(3)::before, .firework:nth-child(3)::after { --color1: cyan; --color2: lightcyan; --color3: lightblue; --color4: PaleTurquoise; --color5: SkyBlue; --color6: lavender; --finalSize: 35vmin; left: 70%; top: 60%; animation-delay: -.4s; }
.firework:nth-child(4) { --x: 40vmin; --y: -10vmin; }
.firework:nth-child(4), .firework:nth-child(4)::before, .firework:nth-child(4)::after { --color1: cyan; --color2: lightcyan; --color3: lightblue; --color4: PaleTurquoise; --color5: SkyBlue; --color6: lavender; --finalSize: 35vmin; left: 20%; top: 60%; animation-delay: -.4s; }
.firework:nth-child(5) { --x: -30vmin; --y: -10vmin; }
.firework:nth-child(5), .firework:nth-child(5)::before, .firework:nth-child(5)::after { left: 70%; top: 60%; animation-delay: -.4s; }

/* ---------- Midsummer ---------- */
/* a flower wreath over the logo, and petals falling instead of snow (same animation, inline values from Seasonal.razor) */
body:has(.season-midsommar) .topnav .logo::after {
    background-image: url('seasonal/midsommar/krans.svg'); background-position: center;
    width: 130%; height: 71%; top: -24%; left: -16%; transform: rotate(-6deg);
    animation: wreath-in 1.6s cubic-bezier(.3, 1.4, .5, 1);
}
@keyframes wreath-in { from { opacity: 0; transform: translateY(-40px) rotate(-30deg); } }
.season-midsommar .snow i { width: var(--s); height: calc(var(--s) * .8); background: var(--c); border-radius: 80% 0 80% 0; box-shadow: inset 0 0 0 1px #0000000d; text-shadow: none; }
.season-midsommar .snow i::after { content: none; }

/* ---------- Shrove Tuesday ---------- */
/* a semla where the Christmas hat sits, and cream running down from under the menu (which is always 64px tall) */
body:has(.season-fettisdag) .topnav .logo::after {
    background-image: url('seasonal/fettisdag/semla.svg');
    width: 61%; height: 71%; top: -21%; right: -32%; transform: rotate(12deg);
    animation: semla-in 1.4s cubic-bezier(.3, 1.5, .5, 1);
}
@keyframes semla-in { from { opacity: 0; transform: translateY(-50px) rotate(-200deg); } }
.cream {
    position: fixed; left: 0; right: 0; top: 64px; height: 22px; z-index: 4; pointer-events: none; transform-origin: top;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 22' preserveAspectRatio='none'%3E%3Cpath d='M0 0H120V5Q114 5 113 9Q112 17 108 17Q104 17 104 9Q103 5 96 5Q88 5 87 8Q86 11 82 11Q78 11 78 7Q77 5 66 5Q57 5 56 10Q55 21 50 21Q45 21 45 11Q44 5 34 5Q26 5 25 8Q24 13 20 13Q16 13 16 8Q15 5 8 5Q2 5 0 6Z' fill='%23fffaf1' stroke='%23e6d6bd' stroke-width='.6'/%3E%3C/svg%3E") repeat-x 0 0 / 240px 22px;
    filter: drop-shadow(0 2px 2px #5e4a3022); animation: cream-run 2.4s ease-out both;
}
@keyframes cream-run { from { transform: scaleY(.2); opacity: .6; } }

/* ---------- Cinnamon Bun Day ---------- */
/* a slowly turning bun on the logo, steaming (the steam's own animation is inside steam.svg) */
body:has(.season-kanelbulle) .topnav .logo::after {
    background-image: url('seasonal/kanelbulle/bulle.svg');
    width: 54%; height: 71%; top: -14%; right: -27%;
    animation: bun-in 1.4s cubic-bezier(.3, 1.4, .5, 1), bun-turn 14s linear 1.4s infinite;
}
body:has(.season-kanelbulle) .topnav .logo::before {
    content: ""; position: absolute; pointer-events: none; z-index: 1; background: url('seasonal/kanelbulle/steam.svg') no-repeat center / contain;
    width: 47%; height: 40%; top: -30%; right: -21%;
}
@keyframes bun-in { from { opacity: 0; transform: translateY(-50px) rotate(-300deg); } }
@keyframes bun-turn { to { transform: rotate(360deg); } }

/* narrow phones: keep the semla and the bun off the menu */
@media (max-width: 480px) {
    body:has(.season-fettisdag) .topnav .logo::after { right: -18%; width: 54%; }
    body:has(.season-kanelbulle) .topnav .logo::after { right: -14%; width: 47%; }
    body:has(.season-kanelbulle) .topnav .logo::before { right: -10%; }
}

/* motion-sensitive visitors: keep the hats, skip everything that moves */
@media (prefers-reduced-motion: reduce) {
    .snow, .fireworks, .ny-dim { display: none; }
    body:has(.season-fx) .topnav .logo::after, .cream { animation: none; }
}
