/* =====================================================================
   saison.css - Aussehen der Jahreszeiten-Effekte
   Wird nur geladen, wenn gerade eine Saison aktiv ist (inc/config.php).
   Die Bewegung startet saison.js, die Zeichnungen liegen im Ordner saison/.
   ===================================================================== */

/* Durchsichtige Ebene ueber der ganzen Seite. Klicks gehen hindurch. */
.saison-ebene {
    position: fixed;
    inset: 0;
    z-index: 57;
    pointer-events: none;
    overflow: hidden;

    /* Startwerte. saison.js ueberschreibt sie fuer jedes einzelne Teil
       (Bildschirmhoehe, Einsinktiefe, Enddrehung, Bodenhoehe, Flugweg der Funken). */
    --saison-vh: 100vh;
    --tief: 4px;
    --dreh-ende: 120deg;
    --boden-hoehe: 50px;
    --fx: 40px;
    --fy: 40px;
    --ab-x: -80px;
    --ab-y: 100px;
    --naehe: 10px;
    --maus-x: 0;
    --maus-y: 0;
}

.saison-ebene img,
.saison-girlande {
    display: block;
    max-width: none;
    height: auto;
    -webkit-user-select: none;
    user-select: none;
}

/* ---------- 1. Fallende Teile ---------- */
.saison-teil {
    position: absolute;
    top: 0;
    /* Tiefe (nur Ostern): jedes Teil weicht der Maus aus - nahe Teile stark, ferne kaum */
    translate: calc(var(--maus-x) * var(--naehe) * -1) calc(var(--maus-y) * var(--naehe) * -0.4);
    transition: translate 0.7s ease-out;
    animation-name: saison-faellt;
    animation-timing-function: linear;
    animation-fill-mode: both;
}

@keyframes saison-faellt {
    from { transform: translate3d(0, -15vh, 0); }
    to   { transform: translate3d(0, 115vh, 0); }
}

/* Teile, die liegen bleiben: fallen genau bis auf den Boden (leicht abgebremst) */
.saison-teil.saison-lander {
    animation-name: saison-landet;
    animation-timing-function: cubic-bezier(0.35, 0, 0.75, 1);
}

@keyframes saison-landet {
    from { transform: translate3d(0, -15vh, 0); }
    to   { transform: translate3d(0, calc(var(--saison-vh, 100vh) - 100% - var(--tief, 4px)), 0); }
}

/* Aus dem Schlitten geworfen: faellt vom Schlitten (--ab-y) im Bogen bis auf den Boden */
.saison-teil.saison-abwurf {
    animation-name: saison-abwurf;
    animation-timing-function: cubic-bezier(0.45, 0, 0.9, 0.6);
}

@keyframes saison-abwurf {
    from { transform: translate3d(0, var(--ab-y, 100px), 0); }
    to   { transform: translate3d(var(--ab-x, -80px), calc(var(--saison-vh, 100vh) - 100% - var(--tief, 4px)), 0); }
}

.saison-innen {
    display: block;
    filter: drop-shadow(0 2px 3px rgba(20, 51, 111, 0.22));
}

/* weiche Schneeflocke (runder, verlaufender Punkt) */
.saison-punkt {
    border-radius: 50%;
    background: radial-gradient(circle at 40% 35%, #ffffff 0 30%, #cfe2f7 60%, rgba(160, 200, 240, 0.25) 100%);
    box-shadow: 0 0 3px rgba(120, 170, 225, 0.55);
    filter: none;
}

.saison-schaukelt {
    animation: saison-schaukelt 3s ease-in-out infinite alternate;
}

@keyframes saison-schaukelt {
    from { transform: translateX(-18px); }
    to   { transform: translateX(18px); }
}

.saison-wirbelt {
    animation: saison-wirbelt 3s ease-in-out infinite alternate;
}

@keyframes saison-wirbelt {
    from { transform: translateX(-22px) rotate(-70deg); }
    to   { transform: translateX(22px) rotate(110deg); }
}

/* Weiche Lichtpunkte im Hintergrund (wie unscharfe Lichterketten auf einem Foto) */
.saison-licht {
    position: absolute;
    border-radius: 50%;
    background: radial-gradient(circle, currentColor 0 22%, transparent 70%);
    filter: blur(5px);
    opacity: 0;
    translate: calc(var(--maus-x) * var(--naehe) * -1) calc(var(--maus-y) * var(--naehe) * -0.4);
    transition: translate 0.9s ease-out;
    animation-name: saison-licht-zeit, saison-licht-funkelt;
    animation-timing-function: ease-in-out;
    animation-iteration-count: 1, infinite;
    animation-direction: normal, alternate;
    animation-fill-mode: both, none;
}

@keyframes saison-licht-zeit {
    0%, 100% { opacity: 0; }
    12%, 80% { opacity: 0.26; }
}

@keyframes saison-licht-funkelt {
    from { transform: scale(0.8) translateY(6px); }
    to   { transform: scale(1.15) translateY(-10px); }
}

/* dreht sich waehrend des Falls und bleibt am Ende so liegen */
.saison-taumelt {
    animation: saison-taumelt 6s linear both;
}

@keyframes saison-taumelt {
    from { transform: rotate(0deg); }
    to   { transform: rotate(var(--dreh-ende, 120deg)); }
}

/* ---------- 2. Boden und Haufen ---------- */
.saison-boden {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0;
    pointer-events: auto;
    cursor: pointer;
    animation-name: saison-waechst;
    animation-timing-function: ease-out;
    animation-fill-mode: both;
}

@keyframes saison-waechst {
    from { height: 0; }
    to   { height: var(--boden-hoehe, 50px); }
}

.saison-boden-schnee {
    background: url("saison/schnee-boden.svg") repeat-x left bottom / 600px 100%;
    filter: drop-shadow(0 -2px 4px rgba(120, 160, 215, 0.3));
}

.saison-boden-gras {
    background: url("saison/gras.svg") repeat-x left bottom / 240px 100%;
}

.saison-haufen {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 0;
}

/* ein Teil, das unten liegen geblieben ist */
.saison-gelandet {
    position: absolute;
    pointer-events: auto;
    cursor: pointer;
    animation: saison-setzt 0.4s ease-out;
}

.saison-gelandet img {
    width: 100%;
}

@keyframes saison-setzt {
    0%   { transform: translateY(0) scale(1, 1); }
    35%  { transform: translateY(2px) scale(1.12, 0.86); }
    70%  { transform: translateY(-3px) scale(0.96, 1.05); }
    100% { transform: none; }
}

/* frisch gelegtes Osterei: ploppt auf */
.saison-gelegt {
    animation: saison-ploppt 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}

@keyframes saison-ploppt {
    from { transform: scale(0) translateY(10px); }
    to   { transform: none; }
}

/* Wegklicken: Haufen und Boden rutschen nach unten weg */
.saison-geraeumt .saison-boden,
.saison-geraeumt .saison-haufen {
    transition: transform 0.9s cubic-bezier(0.5, 0, 0.9, 0.4), opacity 0.9s ease-in;
    transform: translateY(160px);
    opacity: 0;
    pointer-events: none;
}

.saison-geraeumt .saison-gelandet {
    pointer-events: none;
}

/* ---------- 3. Flieger: zieht von rechts nach links ---------- */
.saison-flieger {
    position: absolute;
    left: 0;
    animation-name: saison-fliegt;
    animation-timing-function: linear;
    animation-fill-mode: both;
}

@keyframes saison-fliegt {
    from { transform: translate3d(100vw, 0, 0); }
    to   { transform: translate3d(-110%, 0, 0); }
}

.saison-figur {
    width: 100%;
    filter: drop-shadow(0 6px 6px rgba(20, 51, 111, 0.25));
}

/* Halloween-Fledermaeuse: kommen aus der Ferne (klein, blass) und fliegen auf den Betrachter zu */
.saison-naht {
    transform-origin: 0 50%;
    animation-name: saison-fliegt, saison-naht;
}

@keyframes saison-naht {
    from { scale: 0.35; opacity: 0.55; }
    35%  { opacity: 1; }
    to   { scale: 1.25; opacity: 1; }
}

/* Schmetterling (Ostern): zwei Fluegel klappen im Raum auf und zu */
.saison-falter {
    width: 48px;
}

.saison-falter-figur {
    display: flex;
    perspective: 240px;
    filter: drop-shadow(0 5px 5px rgba(20, 51, 111, 0.22));
    animation: saison-gaukelt 1.7s ease-in-out infinite alternate;
}

.saison-ebene .saison-fluegel {
    width: 50%;
    animation: saison-fluegelschlag 0.24s ease-in-out infinite alternate;
}

.saison-fluegel-l { transform-origin: 100% 50%; }
.saison-fluegel-r { transform-origin: 0 50%; --spiegel: -1; }

@keyframes saison-fluegelschlag {
    from { transform: scaleX(var(--spiegel, 1)) rotateY(calc(var(--spiegel, 1) * 12deg)); }
    to   { transform: scaleX(var(--spiegel, 1)) rotateY(calc(var(--spiegel, 1) * 76deg)); }
}

@keyframes saison-gaukelt {
    from { transform: translateY(-34px) rotate(-14deg); }
    to   { transform: translateY(30px) rotate(-30deg); }
}

/* Schlitten: gross, fliegt in einem sanften Bogen */
.saison-schlitten {
    width: clamp(260px, 36vw, 480px);
}

.saison-schlitten .saison-figur {
    animation: saison-bogen 5.5s ease-in-out infinite alternate;
}

@keyframes saison-bogen {
    from { transform: translateY(46px) rotate(-5deg); }
    to   { transform: translateY(-18px) rotate(4deg); }
}

/* Funkenschweif hinter dem Schlitten */
.saison-funke {
    position: absolute;
    animation: saison-funkelt 1.5s ease-out both;
}

@keyframes saison-funkelt {
    0%   { transform: translate(0, 0) scale(0.2) rotate(0deg); opacity: 0; }
    15%  { transform: translate(calc(var(--fx) * 0.15), calc(var(--fy) * 0.1)) scale(1.15) rotate(40deg); opacity: 1; }
    100% { transform: translate(var(--fx), var(--fy)) scale(0.1) rotate(200deg); opacity: 0; }
}

/* Osterhase: huepft ueber das Gras (streckt und staucht sich dabei) */
.saison-hase {
    width: clamp(90px, 11vw, 140px);
}

.saison-hase .saison-figur {
    transform-origin: 50% 100%;
    animation: saison-huepft 0.55s cubic-bezier(0.3, 0, 0.6, 1) infinite alternate;
}

@keyframes saison-huepft {
    from { transform: translateY(0) scale(1.08, 0.88); }
    to   { transform: translateY(-46px) scale(0.96, 1.06) rotate(-6deg); }
}

/* Fledermaeuse: flattern auf und ab (die Fluegel schlagen in der Zeichnung selbst) */
.saison-fledermaus {
    width: 80px;
}

.saison-fledermaus .saison-figur {
    animation: saison-flattert 0.9s ease-in-out infinite alternate;
}

@keyframes saison-flattert {
    from { transform: translateY(-16px) rotate(-6deg); }
    to   { transform: translateY(16px) rotate(6deg); }
}

/* Gespenst: schwebt gemaechlich, blendet ein und aus */
.saison-geist {
    width: clamp(70px, 8vw, 110px);
}

.saison-geist .saison-figur {
    animation: saison-schwebt 2.6s ease-in-out infinite alternate, saison-spukt 16s ease-in-out both;
}

@keyframes saison-schwebt {
    from { transform: translateY(-20px) rotate(-5deg); }
    to   { transform: translateY(20px) rotate(5deg); }
}

@keyframes saison-spukt {
    0%, 100% { opacity: 0; }
    12%, 45% { opacity: 0.9; }
    55%      { opacity: 0.35; }
    65%, 88% { opacity: 0.9; }
}

/* ---------- 4. Feste Dekoration ---------- */

/* Girlande mit Schleife ueber die Ecke: haengt ganz oben an der Seite */
.saison-girlande {
    position: absolute;
    top: 0;
    z-index: 56;
    width: clamp(120px, 15vw, 250px);
    pointer-events: none;
    filter: drop-shadow(0 4px 5px rgba(20, 51, 111, 0.25));
    animation: saison-erscheint 1s ease-out both;
}

.saison-girlande-links {
    left: 0;
    display: none;              /* links sitzt das Logo: nur auf breiten Bildschirmen zeigen */
}

.saison-girlande-rechts {
    right: 0;
    transform: scaleX(-1);
}

@keyframes saison-erscheint {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Tannen im freien Rand neben dem Inhalt: nur wenn dort Platz ist */
.saison-ebene .saison-tanne {
    position: absolute;
    bottom: 0;
    display: none;
    transform-origin: 50% 100%;
    filter: drop-shadow(0 4px 6px rgba(20, 51, 111, 0.22));
    animation: saison-waechst-baum 1.2s cubic-bezier(0.3, 1.3, 0.5, 1) both;
}

@keyframes saison-waechst-baum {
    from { transform: scale(0.2); opacity: 0; }
    to   { transform: none; opacity: 1; }
}

.saison-tanne-1 { width: 132px; left: max(6px, calc((100vw - 1240px) / 2 - 150px)); }
.saison-tanne-2 { width: 110px; right: max(6px, calc((100vw - 1240px) / 2 - 128px)); animation-delay: 0.3s; }
.saison-tanne-3 { width: 70px; right: max(96px, calc((100vw - 1240px) / 2 - 40px)); animation-delay: 0.6s; }

@media (min-width: 1500px) {
    .saison-ebene .saison-tanne { display: block; }
    .saison-girlande-links { display: block; }
}

@media (min-width: 1500px) and (max-width: 1699px) {
    .saison-ebene .saison-tanne-3 { display: none; }     /* fuer die dritte Tanne ist es hier noch zu eng */
}

/* Kuerbisse mit Grimasse (Halloween) */
.saison-kuerbis {
    filter: drop-shadow(0 3px 4px rgba(60, 30, 0, 0.35));
}

/* =====================================================================
   Stille Zeichen, die in der Saison immer sichtbar sind
   ===================================================================== */

/* Ostern und Halloween: kleines Bild vor dem Wort "Besucher" */
body[data-saison="ostern"] .zaehler-titel::before,
body[data-saison="halloween"] .zaehler-titel::before {
    content: "";
    display: inline-block;
    width: 1.3em;
    height: 1.5em;
    margin-right: 6px;
    vertical-align: -0.4em;
    background: url("saison/ei-1.svg") center / contain no-repeat;
}

body[data-saison="halloween"] .zaehler-titel::before {
    width: 1.7em;
    background-image: url("saison/kuerbis.svg");
}

/* =====================================================================
   Besucherzaehler: statt Seifenblasen steigen passende Dinge auf.
   (Die Bewegung macht weiter zaehler.js, hier wird nur das Aussehen getauscht.)
   ===================================================================== */
body[data-saison] .blase-haut {
    border-radius: 0;
    box-shadow: none;
    background: center / contain no-repeat;
}

body[data-saison] .blase-haut::before,
body[data-saison] .blase-haut::after {
    display: none;
}

/* Weihnachten: Mandarinen */
body[data-saison="weihnachten"] .blase-haut {
    background-image: url("saison/mandarine.svg");
    filter: drop-shadow(0 3px 4px rgba(120, 60, 0, 0.3)) !important;
}

/* Ostern: Ostereier (jedes in einer etwas anderen Farbe) */
body[data-saison="ostern"] .blase-haut {
    background-image: url("saison/ei-2.svg");
}

/* Halloween: Kuerbisse mit Grimasse */
body[data-saison="halloween"] .blase-haut {
    background-image: url("saison/kuerbis.svg");
    filter: drop-shadow(0 3px 4px rgba(60, 30, 0, 0.35)) !important;
}

@media print {
    .saison-ebene,
    .saison-girlande {
        display: none !important;
    }
}
