/**
 * Christmas seasonal styling
 *
 * - Schneefall-Canvas (vom snow.js erzeugt)
 * - Lichterkette zwischen photo-wall und content-wrapper, haengt in den
 *   page-content-Bereich hinein
 *
 * Alle Effekte greifen nur wenn body[data-season="christmas"] gesetzt ist.
 * Lichterkette ist pure CSS und braucht kein JS.
 */

/* ========================================
   Saisonales Theme — ueberschreibt Brand-Akzente, Backgrounds, Borders
   und Text-Toene damit die Seite nicht nur "anders" sondern wirklich
   weihnachtlich wirkt.
   ----------------------------------------------------------------
   Light (Tag): warme Creme-Backgrounds wie altes Geschenkpapier,
   Tannengruen als Akzent, warm-getoente Borders.
   Dark (Abend): tief-gruener Tannenwald-Hintergrund mit Sparkle-Gold-
   Akzent — Stimmung wie Lichterkette in der Stube.
   Alle Kombinationen sind AA-kontrastgeprueft (>= 4.5:1 fuer Text).
   ======================================== */
body[data-season="christmas"] {
    /* Akzente */
    --accent-color: #0e6b3a;
    --accent-hover: #0a5a30;
    --primary-color: #0e6b3a;
    --warning-bg: rgba(14, 107, 58, 0.10);
    --shadow-red-sm: 0 2px 8px rgba(14, 107, 58, 0.30);
    --shadow-red-md: 0 4px 16px rgba(14, 107, 58, 0.40);
    --shadow-red-lg: 0 8px 24px rgba(14, 107, 58, 0.50);

    /* Backgrounds — warme Creme-Toene */
    --bg-primary: #fdf8eb;
    --bg-secondary: #f5ebd5;
    --bg-tertiary: #e8dcc0;

    /* Borders — festliches Rot statt warmem Tan, fuer noch mehr Gruen+Rot-Combo */
    --border-color: #c41e1e;

    /* Text — leicht waermer, behaelt aber maximalen Kontrast */
    --text-primary: #2a1f17;
    --text-secondary: #6b5a4a;
    --text-tertiary: #a89880;

    /* Heading-Trennlinien (page-title, page-header, sidebar-titles) auf
       festliches Rot umfaerben — laesst Buttons/Links gruen, ergibt
       die klassische Gruen+Rot-Combo. */
    --divider-color: #c41e1e;
}

[data-theme="dark"] body[data-season="christmas"] {
    /* Akzente */
    --accent-color: #d4af37;
    --accent-hover: #b8941c;
    --primary-color: #d4af37;
    --warning-bg: rgba(212, 175, 55, 0.12);
    --shadow-red-sm: 0 2px 8px rgba(212, 175, 55, 0.30);
    --shadow-red-md: 0 4px 16px rgba(212, 175, 55, 0.40);
    --shadow-red-lg: 0 8px 24px rgba(212, 175, 55, 0.50);

    /* Backgrounds — tiefer Tannenwald statt neutralem Grau */
    --bg-primary: #1a1f1a;
    --bg-secondary: #252e25;
    --bg-tertiary: #2f3a2f;

    /* Borders — waermeres Rot fuer dunklen Hintergrund */
    --border-color: #e8413a;

    /* Text — warmer Creme-Ton statt neutralem Hellgrau */
    --text-primary: #f2eadc;
    --text-secondary: #b8ab95;
    --text-tertiary: #7d7565;

    /* Heading-Trennlinien auf waermeres Rot fuer dunklen Hintergrund */
    --divider-color: #e8413a;
}

/* Photo-Wall Border + Footer Glow — keine Headings, eigene Selektoren.
   Nutzen den --divider-color als gemeinsamen Sekundaer-Akzent. */
body[data-season="christmas"] .photo-wall {
    border-bottom-color: var(--divider-color);
    border-bottom-width: 2px;
}

body[data-season="christmas"] .footer {
    /* Fallback fuer Browser ohne color-mix (Safari < 16.2): leicht abgedunkelter Schatten. */
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.18);
    box-shadow: 0 -2px 8px color-mix(in srgb, var(--divider-color) 22%, transparent);
}

/* ========================================
   Schneefall-Canvas
   ======================================== */
.bfr-snow-canvas {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 50; /* unter Modals (2000+), aber ueber normalem Content */
}

/* ========================================
   Lichterkette
   Variante 1: Sibling zwischen photo-wall und content-wrapper. Per
   margin-bottom:-22px haengt sie visuell von der photo-wall-Unterkante in
   den page-content hinein, ohne Layout-Push.
   Variante 2: Innerhalb von .footer absolut positioniert am oberen Rand,
   ausgedehnt ueber die rechte Sidebar.
   z-index: 200 ueberdeckt right-sidebar (z:101) und detail-page-section-nav
   (z:100), bleibt unter Modals (2000+) und linker Sidebar (1000).
   ======================================== */
.christmas-lights {
    position: relative;
    height: 24px;
    margin-bottom: -22px; /* ueberlappt page-content, kein Layout-Push */
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0 12px;
    pointer-events: none;
    z-index: 200;
}

/* Variante in der Footer: Chain haengt am oberen Rand des Footers,
   bleibt aber innerhalb der Footer-Breite (geht nicht ueber die rechte
   Sidebar hinweg). */
.footer {
    position: relative; /* Anker fuer absolute Lights */
}

.footer .christmas-lights {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    width: auto;
    height: 24px;
    margin-bottom: 0;
}

/* Schnur: dunkler 2px-Strich oben, leichter Schatten als "Schwingung" */
.christmas-lights::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    background: rgba(45, 30, 20, 0.55);
    border-radius: 2px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

/* Birnchen — kleine Tropfen-Form mit Glow */
.christmas-light {
    position: relative;
    width: 11px;
    height: 16px;
    border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
    margin-top: 2px;
    transform-origin: top center;
    animation: christmas-bulb-glow 2.4s ease-in-out infinite;
    box-shadow:
        0 0 6px currentColor,
        inset 1px -2px 2px rgba(0, 0, 0, 0.18),
        inset -1px 2px 1.5px rgba(255, 255, 255, 0.35);
}

/* Kleiner Sockel oben, der die Birne mit der Schnur verbindet */
.christmas-light::before {
    content: '';
    position: absolute;
    top: -3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 3px;
    background: #2d2018;
    border-radius: 1px;
}

/* Vier Farben durchwechseln (warm-rot, gold, mintgruen, eisblau) */
.christmas-light:nth-child(4n+1) { color: #e8413a; }
.christmas-light:nth-child(4n+2) { color: #f5b94a; }
.christmas-light:nth-child(4n+3) { color: #5fc9a3; }
.christmas-light:nth-child(4n+4) { color: #69b8e8; }

/* Versetzte Glow-Phasen, damit die Kette "lebt" */
.christmas-light:nth-child(2n)   { animation-delay: -0.3s; }
.christmas-light:nth-child(3n)   { animation-delay: -0.8s; }
.christmas-light:nth-child(5n)   { animation-delay: -1.4s; }
.christmas-light:nth-child(7n)   { animation-delay: -1.9s; }

/* Fallbacks fuer Browser ohne color-mix (Safari < 16.2): currentColor statt
   gemischter Tiefenfarbe — Glueh-Effekt ist dann uniformer, aber sichtbar. */
@keyframes christmas-bulb-glow {
    0%, 100% {
        background-color: currentColor;
        background-color: color-mix(in srgb, currentColor 70%, #1a0e0a);
        filter: brightness(0.8);
        box-shadow:
            0 0 4px currentColor,
            0 0 4px color-mix(in srgb, currentColor 40%, transparent),
            inset 1px -2px 2px rgba(0, 0, 0, 0.2),
            inset -1px 2px 1.5px rgba(255, 255, 255, 0.25);
    }
    50% {
        background-color: currentColor;
        filter: brightness(1.25);
        box-shadow:
            0 0 14px currentColor,
            0 0 22px currentColor,
            0 0 22px color-mix(in srgb, currentColor 50%, transparent),
            inset 1px -2px 2px rgba(0, 0, 0, 0.18),
            inset -1px 2px 1.5px rgba(255, 255, 255, 0.4);
    }
}

/* Auf sehr schmalen Layouts die Birnenanzahl optisch reduzieren */
@media (max-width: 600px) {
    .christmas-light:nth-child(n+13) {
        display: none;
    }
    .christmas-lights {
        justify-content: space-around;
    }
}

/* ========================================
   Gruss-Banner (1.–4. Advent, Heiligabend, Feiertage)
   ----------------------------------------------------------------
   Bewusst ein flacher Strip, NICHT der 280px-Vorhang des Neujahrs-
   Banners: der erscheint einmal im Jahr, dieser bis zu sieben Mal
   pro Saison. Eigene Klassen statt Wiederverwendung von
   .newyear-banner, damit an der Neujahrs-Saison nichts angefasst
   werden muss — die beiden teilen die Idee, nicht den Code.
   ======================================== */
.christmas-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 62px;
    padding: 0.85rem 3.5rem 0.85rem 1.25rem;
    /* Tannengruen-Verlauf mit Gold-Schimmer am Ende — dieselbe Familie
       wie die Theme-Akzente, aber fest kodiert: das Banner liegt ueber
       dem Header und muss in Light UND Dark gleich lesbar sein. */
    background: linear-gradient(135deg, #0a4f2b 0%, #0e6b3a 55%, #c8992f 100%);
    color: #fff;
    text-align: center;
    z-index: 1800; /* wie das Neujahrs-Banner: knapp unter Modals (2000+) */
    transform: translateY(-110%);
    transition: transform 0.55s cubic-bezier(0.18, 0.89, 0.32, 1.28);
    box-shadow: 0 3px 14px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    overflow: hidden;
}

/* Dezente Schneeflocken-Punkte als Overlay */
.christmas-banner::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        radial-gradient(circle at 10% 35%, rgba(255, 255, 255, 0.40) 0, rgba(255, 255, 255, 0) 2.5px),
        radial-gradient(circle at 30% 75%, rgba(255, 255, 255, 0.30) 0, rgba(255, 255, 255, 0) 2px),
        radial-gradient(circle at 62% 25%, rgba(255, 255, 255, 0.35) 0, rgba(255, 255, 255, 0) 3px),
        radial-gradient(circle at 85% 68%, rgba(255, 255, 255, 0.30) 0, rgba(255, 255, 255, 0) 2.5px),
        radial-gradient(circle at 95% 22%, rgba(255, 255, 255, 0.25) 0, rgba(255, 255, 255, 0) 2px);
    pointer-events: none;
    opacity: 0.85;
}

.christmas-banner.is-visible {
    transform: translateY(0);
}

.christmas-banner-inner {
    position: relative; /* ueber dem ::before-Pattern */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.7rem;
    font-weight: 600;
    font-size: 1.25rem;
    line-height: 1.35;
    letter-spacing: 0.01em;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.christmas-banner-emoji {
    font-size: 1.6rem;
    display: inline-block;
    animation: christmas-banner-sway 2.6s ease-in-out infinite;
}

.christmas-banner-emoji:last-child {
    animation-delay: 1.3s;
}

@keyframes christmas-banner-sway {
    0%, 100% { transform: translateY(0) rotate(-4deg); }
    50%      { transform: translateY(-2px) rotate(4deg); }
}

.christmas-banner-close {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.18);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.15s ease;
    z-index: 2;
}

.christmas-banner-close:hover {
    background: rgba(255, 255, 255, 0.32);
    transform: translateY(-50%) rotate(90deg);
}

.christmas-banner-close .material-symbols-outlined {
    font-size: 22px;
}

/* Ab Tablet abwaerts: inner wird ein Block, die Spans fliessen wieder als
   normaler Inline-Text. Als Flex-Container waeren Emoji und Text je EIN
   Item — der zu breite Text schiebt die Emoji dann auf eigene Zeilen, und
   aus dem Gruss wird ein vierzeiliger Klotz. Als Block umbricht der Satz
   an der Wortgrenze und die Emoji bleiben mitten im Text. */
@media (max-width: 768px) {
    .christmas-banner {
        min-height: 56px;
        padding: 0.7rem 3rem 0.7rem 1rem;
    }
    .christmas-banner-inner {
        display: block;
        font-size: 1.05rem;
    }
    .christmas-banner-emoji {
        font-size: 1.35rem;
        vertical-align: -0.15em;
        margin: 0 0.25rem;
    }
}

/* Handy — zweizeilig statt abgeschnitten; die Saetze sind laenger als
   "Frohes neues Jahr", deshalb hier mehr Luft als beim Neujahrs-Banner. */
@media (max-width: 480px) {
    .christmas-banner {
        min-height: 52px;
        padding: 0.6rem 2.75rem 0.6rem 0.75rem;
    }
    .christmas-banner-inner {
        font-size: 0.92rem;
    }
    .christmas-banner-emoji {
        font-size: 1.15rem;
        margin: 0 0.2rem;
    }
    .christmas-banner-close {
        width: 30px;
        height: 30px;
        right: 0.5rem;
    }
    .christmas-banner-close .material-symbols-outlined {
        font-size: 20px;
    }
}

/* ========================================
   Adventskranz — vier Kerzen im Footer
   ----------------------------------------------------------------
   Steht als erstes Element im .footer-content (zentrierte Flex-
   Spalte), also unterhalb der Lichterkette, die am oberen Footer-Rand
   absolut haengt. Keine absolute Positionierung: so kann der Kranz auf
   keiner Breite mit der Kette, der rechten Sidebar oder dem Footer-Text
   kollidieren.
   ======================================== */
.advent-wreath {
    display: flex;
    flex-direction: column;
    align-items: center;
    /* Der Kranz ist Zierde — er soll keine Klicks abfangen. Der Tooltip
       (title) funktioniert beim Hover trotzdem, weil der Browser ihn
       unabhaengig von pointer-events auswertet ... nicht ueberall:
       deshalb hier bewusst KEIN pointer-events:none. */
    user-select: none;
}

.advent-wreath-candles {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    margin-bottom: -9px; /* Kerzenfuesse verschwinden im Kranz */
}

/* Kerze — schmaler Wachs-Zylinder mit leichtem Verlauf fuer Rundung */
.advent-candle {
    position: relative;
    width: 9px;
    height: 34px;
    border-radius: 2px 2px 1px 1px;
    background: linear-gradient(90deg, #d8c9ad 0%, #f7f0e0 35%, #f7f0e0 55%, #cbb894 100%);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
}

/* Docht — sitzt auf jeder Kerze, auch auf den noch nicht entzuendeten */
.advent-candle::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 5px;
    background: #3b2f22;
    border-radius: 1px;
}

/* Flamme — nur an entzuendeten Kerzen sichtbar */
.advent-candle-flame {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%) scale(0);
    width: 9px;
    height: 14px;
    /* Tropfenform: oben spitz, unten rund */
    border-radius: 50% 50% 50% 50% / 68% 68% 32% 32%;
    background: radial-gradient(ellipse at 50% 72%, #fff6d0 0%, #ffd465 38%, #f2932a 72%, rgba(242, 147, 42, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.advent-candle.is-lit .advent-candle-flame {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    box-shadow:
        0 0 8px rgba(255, 196, 80, 0.85),
        0 0 18px rgba(255, 170, 40, 0.55);
    animation: advent-flame-flicker 1.9s ease-in-out infinite;
}

/* Entzuendete Kerze bekommt einen warmen Schein auf dem Wachs */
.advent-candle.is-lit {
    box-shadow:
        0 1px 2px rgba(0, 0, 0, 0.25),
        0 -3px 9px rgba(255, 190, 90, 0.45);
}

@keyframes advent-flame-flicker {
    0%, 100% { transform: translateX(-50%) scale(1) rotate(-1.5deg); opacity: 1; }
    35%      { transform: translateX(-50%) scale(1.09, 0.94) rotate(2deg); opacity: 0.93; }
    70%      { transform: translateX(-50%) scale(0.95, 1.06) rotate(-1deg); opacity: 0.98; }
}

/* Kranz — flache Tannen-Ellipse mit ein paar roten Beeren.
   Liegt per z-index ueber den Kerzenfuessen. */
.advent-wreath-ring {
    position: relative;
    z-index: 1;
    display: block;
    width: 142px;
    height: 24px;
    border-radius: 50%;
    background-color: #1f4d2b;
    background-image:
        radial-gradient(circle at 18% 42%, #b3271f 0, #b3271f 2.5px, rgba(179, 39, 31, 0) 3px),
        radial-gradient(circle at 54% 64%, #b3271f 0, #b3271f 2px, rgba(179, 39, 31, 0) 2.5px),
        radial-gradient(circle at 82% 38%, #b3271f 0, #b3271f 2.5px, rgba(179, 39, 31, 0) 3px),
        radial-gradient(ellipse at 30% 25%, rgba(120, 190, 130, 0.45) 0, rgba(120, 190, 130, 0) 55%),
        radial-gradient(ellipse at 72% 78%, rgba(10, 45, 22, 0.75) 0, rgba(10, 45, 22, 0) 60%),
        linear-gradient(180deg, #2c6438 0%, #1c4526 100%);
    box-shadow:
        inset 0 1px 2px rgba(255, 255, 255, 0.18),
        inset 0 -2px 4px rgba(0, 0, 0, 0.35),
        0 2px 6px rgba(0, 0, 0, 0.28);
}

/* Dark-Mode: Kranz etwas heller, sonst verschwindet er im
   Tannenwald-Hintergrund des Themes. */
[data-theme="dark"] .advent-wreath-ring {
    background-color: #29613a;
    background-image:
        radial-gradient(circle at 18% 42%, #d8382e 0, #d8382e 2.5px, rgba(216, 56, 46, 0) 3px),
        radial-gradient(circle at 54% 64%, #d8382e 0, #d8382e 2px, rgba(216, 56, 46, 0) 2.5px),
        radial-gradient(circle at 82% 38%, #d8382e 0, #d8382e 2.5px, rgba(216, 56, 46, 0) 3px),
        radial-gradient(ellipse at 30% 25%, rgba(150, 215, 160, 0.42) 0, rgba(150, 215, 160, 0) 55%),
        radial-gradient(ellipse at 72% 78%, rgba(12, 52, 26, 0.7) 0, rgba(12, 52, 26, 0) 60%),
        linear-gradient(180deg, #3a7d4a 0%, #235233 100%);
}

/* Tablet/Handy — gleicher Breakpoint wie die Lichterkette darueber */
@media (max-width: 600px) {
    .advent-wreath-candles {
        gap: 13px;
        margin-bottom: -8px;
    }
    .advent-candle {
        width: 8px;
        height: 28px;
    }
    .advent-candle-flame {
        top: -14px;
        width: 8px;
        height: 12px;
    }
    .advent-wreath-ring {
        width: 118px;
        height: 21px;
    }
}

/* Sehr schmale Geraete (iPhone SE & Co.) */
@media (max-width: 380px) {
    .advent-wreath-candles {
        gap: 11px;
        margin-bottom: -7px;
    }
    .advent-candle {
        width: 7px;
        height: 24px;
    }
    .advent-candle-flame {
        top: -12px;
        width: 7px;
        height: 10px;
    }
    .advent-wreath-ring {
        width: 100px;
        height: 18px;
    }
}

/* Wer Bewegung reduziert haben will, bekommt ruhige Flammen und ein
   Banner ohne Slide-in — der Inhalt bleibt vollstaendig erhalten. */
@media (prefers-reduced-motion: reduce) {
    .advent-candle.is-lit .advent-candle-flame {
        animation: none;
    }
    .christmas-banner-emoji {
        animation: none;
    }
    .christmas-banner {
        transition: none;
    }
}
