/* --- Weihnachten --------------------------------------------------------
   Schnee, Lichterkette, Samichlaus im Schlitten und Zipfelmützen auf den
   Logos. Alles hängt an der Klasse «xmas»: Sie steht heute nur auf der
   Schoggi-Seite (pages/schoggi.py). Für die ganze Website reicht es, sie auf
   .app-shell zu setzen und statas.xmas.decorations() ins Grundlayout zu
   nehmen. Die Elemente für Schnee und Schlitten baut statas/xmas.py. */

:root {
    --xmas-red: #B8322A;
    --xmas-snow: #FFFFFF;
    --xmas-snow-edge: rgba(74, 92, 105, 0.28);  /* hebt Weiss vom Crème ab */
}

/* Zipfelmütze auf dem Logo im Kopf: schräg auf der linken oberen Kachel. */
body:has(.xmas) .brand { position: relative; }
body:has(.xmas) .brand::before {
    content: "";
    position: absolute;
    left: -4px;
    top: -15px;
    width: 30px;
    height: 26px;
    background: url("xmas/santa-hat.svg") no-repeat center / contain;
    transform: rotate(-18deg);
    pointer-events: none;
}

/* … und auf dem Logo rechts über jeder Grafik. */
body:has(.xmas) .panel-chart-head { position: relative; }
body:has(.xmas) .panel-chart-head:has(.panel-logo)::after {
    content: "";
    position: absolute;
    right: 19px;
    bottom: 27px;
    width: 24px;
    height: 21px;
    background: url("xmas/santa-hat.svg") no-repeat center / contain;
    transform: rotate(-18deg);
    pointer-events: none;
}

/* Lichterkette unter dem Kopf: Birnen in den Markenfarben, die abwechselnd
   aufleuchten. */
body:has(.xmas) .app-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -13px;
    height: 10px;
    pointer-events: none;
    background:
        radial-gradient(circle 4px at 12px 6px, var(--xmas-red) 98%, transparent) 0 0 / 72px 10px,
        radial-gradient(circle 4px at 36px 6px, #D9A451 98%, transparent) 0 0 / 72px 10px,
        radial-gradient(circle 4px at 60px 6px, #8C9A7E 98%, transparent) 0 0 / 72px 10px;
    animation: xmas-twinkle 2.4s steps(1) infinite;
}
@keyframes xmas-twinkle {
    0%   { filter: brightness(1);   opacity: 1; }
    50%  { filter: brightness(1.35); opacity: 0.75; }
}

/* Ein Hauch Festliches auf der Seite selbst. */
.xmas .page-intro h1::after {
    content: " 🎄";
}
.xmas .chart-section {
    border-top: 3px solid var(--xmas-red);
}

/* Schnee: feste Ebene über der Seite, unter dem Kopf; fängt keine Klicks. */
.xmas-snow {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 9;
}
.xmas-flake {
    position: absolute;
    top: -12px;
    left: var(--x);
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: var(--xmas-snow);
    box-shadow: 0 0 0 0.5px var(--xmas-snow-edge), 0 0 3px var(--xmas-snow-edge);
    opacity: var(--o);
    animation: xmas-fall var(--dur) linear var(--delay) infinite;
    will-change: transform;
}
.xmas-flake--star {
    width: auto;
    height: auto;
    background: none;
    box-shadow: none;
    color: #AFC0CC;
    font-size: calc(var(--size) * 2.2);
    line-height: 1;
}
@keyframes xmas-fall {
    0%   { transform: translate3d(0, 0, 0) rotate(0deg); }
    50%  { transform: translate3d(var(--drift), 52vh, 0) rotate(180deg); }
    100% { transform: translate3d(0, 106vh, 0) rotate(360deg); }
}

/* Samichlaus fliegt alle 30 Sekunden einmal von links nach rechts durch den
   Kopf («über den Himmel»), über den Links, aber ohne Klicks abzufangen, und
   wippt dabei. So kreuzt er nie den Text der Seite. */
.xmas-sleigh {
    position: fixed;
    top: 2px;
    left: 0;
    width: 240px;
    pointer-events: none;
    z-index: 11;
    transform: translateX(-320px);
    animation: xmas-fly 30s linear 3s infinite;
}
.xmas-sleigh img {
    display: block;
    width: 100%;
    height: auto;
    animation: xmas-bob 1.6s ease-in-out infinite alternate;
}
@keyframes xmas-fly {
    0%   { transform: translate(-320px, 8px); }
    45%  { transform: translate(calc(100vw + 40px), -2px); }
    100% { transform: translate(calc(100vw + 40px), -2px); }
}
@keyframes xmas-bob {
    from { transform: translateY(-4px) rotate(-2deg); }
    to   { transform: translateY(4px) rotate(1deg); }
}

@media (max-width: 860px) {
    .xmas-sleigh { width: 180px; top: 4px; }
    body:has(.xmas) .brand::before { left: -3px; top: -12px; width: 24px; height: 21px; }
    .xmas-flake:nth-child(2n) { display: none; }  /* halb so viel Schnee */
}

/* Kleineres Grafik-Logo auf dem Handy (statas.css: .panel-logo 26px). */
@media (max-width: 520px) {
    body:has(.xmas) .panel-chart-head:has(.panel-logo)::after {
        right: 15px; bottom: 23px; width: 20px; height: 17px;
    }
}

/* Wer weniger Bewegung wünscht: kein Fallen, kein Flug, kein Blinken. Die
   Mützen bleiben, ein paar Flocken stehen still. */
@media (prefers-reduced-motion: reduce) {
    .xmas-flake { animation: none; top: var(--rest); }
    .xmas-sleigh { display: none; }
    body:has(.xmas) .app-header::after { animation: none; }
}
