/* ==========================================================================
   Adventsschmuck – Ebene über den Templates Klassisch, Heitersberg und
   Heitersberg 2.0 (Verwaltung → Design → Adventsschmuck). Farben und Schriften
   des Templates bleiben; dazu kommt Schmuck, der mit jedem Advent wächst.
   Die Stufe setzt der Server als Klasse am <html> (advent-0 … advent-5,
   app/themes.php, advent_layer()); Kranz, Girlande, Schnee und Sterne fügt
   advent.js ein.
   0 vor dem Advent: Kranz ohne Kerzenlicht
   1 rotes Band über der Kopfzeile, eine Kerze brennt
   2 + Tannengirlande unter der Kopfzeile
   3 + rote Schleifen und Schnee auf der Girlande, Schneefall im Kopfbild, Sterne in der Fusszeile
   4 + Kugeln an der Girlande, Sterne in Seitenköpfen und im Willkommensbereich
   5 Weihnachten (24.12.–6.1.): Lichterkette, alle Kerzen, Stern über dem Kranz, dichter Schnee
   ========================================================================== */

:root.advent-layer {
  --adv-red: #a3192e;            /* Kerzenrot */
  --adv-red-text: #a3192e;       /* als Schrift auf hellem Grund (7:1) */
  --adv-gold: #c9a14a;
  --adv-ring: #1d4a36;
  --adv-needles: #3d7a5a;
}
@media (prefers-color-scheme: dark) {
  :root.advent-layer:not([data-theme="light"]) { --adv-red-text: #f08a9a; --adv-needles: #4c8c6a; }
}
:root.advent-layer[data-theme="dark"] { --adv-red-text: #f08a9a; --adv-needles: #4c8c6a; }

/* ---------- Ab dem 1. Advent: rotes Band über der Kopfzeile */
.advent-layer:not(.advent-0) .site-header { border-top: 5px solid var(--adv-red); }

/* ---------- Adventskranz */
.advent-layer .brand { margin-right: 0; }
.adv-wreath-head { display: flex; align-items: center; gap: 8px; margin-right: auto; flex: none; }
.adv-wreath-head .adv-svg { width: 58px; }
.adv-label { font-family: var(--serif); font-style: italic; font-size: 1.05rem; color: var(--adv-red-text); white-space: nowrap; }
.adv-wreath-hero {
  position: absolute; z-index: 2; right: clamp(16px, 5vw, 72px); bottom: clamp(24px, 6vw, 80px);
  width: clamp(150px, 19vw, 250px); text-align: center; pointer-events: none;
}
.adv-svg { display: block; width: 100%; height: auto; overflow: visible; }
.adv-caption {
  margin: 6px 0 0; color: #fff; font-family: var(--serif); font-style: italic; font-size: clamp(1.05rem, 1.6vw, 1.4rem);
  text-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 2px 14px rgba(0, 0, 0, .45);
}
.adv-ring { fill: none; stroke: var(--adv-ring); stroke-width: 18; }
.adv-svg .adv-needle { stroke-width: 2; }
.adv-wax { fill: var(--adv-red); }
.advent-0 .adv-wax { fill: #ece4d2; }
.adv-rim { fill: none; stroke: #fff; stroke-opacity: .35; stroke-width: .8; stroke-linecap: round; }
.adv-cup { fill: #000; opacity: .22; }
.adv-wick { fill: none; stroke: #2a2420; stroke-width: 1.4; stroke-linecap: round; }
.adv-flame { transform-box: fill-box; transform-origin: 50% 100%; }
.adv-flame-core { fill: #fffdf2; }
.adv-glow { opacity: .55; }
.adv-holly { fill: #2c6b46; stroke: #173d28; stroke-width: .5; }
.adv-berry { fill: #c0263b; }
.adv-cone ellipse { fill: #7a4f2c; }
.adv-cone path { fill: none; stroke: #4a2e17; stroke-width: .8; }
.adv-ball { display: none; fill: var(--adv-gold); }
.advent-4 .adv-ball, .advent-5 .adv-ball { display: inline; }
.adv-star { fill: #e9c46a; }
.adv-wreath-head .adv-glow { opacity: .35; }

/* ---------- Tannengirlande: hängt in Bögen unter der Kopfzeile (ab dem 2. Advent) */
.adv-garland { position: absolute; left: 0; right: 0; top: 100%; height: 60px; overflow: hidden; pointer-events: none; margin-top: -4px; }
.adv-garland svg { display: block; }
.adv-needle { stroke-width: 1.7; stroke-linecap: round; }
.adv-n0 { stroke: #1d4a36; }
.adv-n1 { stroke: #2f6b4f; }
.adv-n2 { stroke: #4c8c6a; }
.adv-snowcap { fill: #ffffff; }
.adv-bow ellipse, .adv-bow circle { fill: #b3202f; stroke: #7d1222; stroke-width: 1; }
.adv-bow path { fill: none; stroke: #b3202f; stroke-width: 3; stroke-linecap: round; }
.adv-string { stroke: #8a6a1f; stroke-width: 1; }
.adv-cap { fill: #8a6a1f; }
.adv-bauble.is-gold { fill: var(--adv-gold); }
.adv-bauble.is-red { fill: #b3202f; }
.adv-bauble-shine { fill: #fff; opacity: .7; }
.adv-light { fill: #ffd36b; filter: drop-shadow(0 0 3px #ffcf4a); }

/* ---------- Schnee im Kopfbild (ab dem 3. Advent), unter dem Text */
.adv-snow {
  position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background-image:
    radial-gradient(circle, rgba(255, 255, 255, .95) 1.4px, transparent 2px),
    radial-gradient(circle, rgba(255, 255, 255, .8) 2px, transparent 2.6px),
    radial-gradient(circle, rgba(255, 255, 255, .7) 2.8px, transparent 3.4px);
  background-size: 110px 110px, 190px 190px, 300px 300px;
  background-position: 0 0, 40px 70px, 120px 30px;
  opacity: .55;
}
.advent-4 .adv-snow { opacity: .75; }
.advent-5 .adv-snow { opacity: .95; }

/* ---------- Sterne (Fusszeile ab dem 3., Seitenköpfe ab dem 4. Advent), hinter dem Text */
.advent-layer .site-footer, .advent-layer .page-head, .advent-layer .welcome { position: relative; }
.advent-layer .site-footer > .wrap, .advent-layer .page-head > .wrap, .advent-layer .welcome > .wrap { position: relative; z-index: 1; }
.adv-stars { position: absolute; inset: 0; z-index: 0; pointer-events: none; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160' viewBox='0 0 160 160'%3E%3Cpath d='M30 22l1.6 5.4 5.4 1.6-5.4 1.6L30 36l-1.6-5.4-5.4-1.6 5.4-1.6z' fill='%23c9a14a'/%3E%3Cpath d='M118 96l1.2 3.8 3.8 1.2-3.8 1.2-1.2 3.8-1.2-3.8-3.8-1.2 3.8-1.2z' fill='%23c9a14a'/%3E%3Ccircle cx='92' cy='34' r='1.4' fill='%23c9a14a'/%3E%3Ccircle cx='54' cy='120' r='1.2' fill='%23c9a14a'/%3E%3Ccircle cx='140' cy='146' r='1' fill='%23c9a14a'/%3E%3C/svg%3E") 0 0 / 160px 160px; }
.page-head .adv-stars, .welcome .adv-stars { opacity: .7; }

@media (prefers-reduced-motion: no-preference) {
  .adv-flame { animation: adv-flicker 1.8s ease-in-out infinite alternate; }
  .adv-glow { animation: adv-glow 2.6s ease-in-out infinite alternate; }
  .adv-snow { animation: adv-snow 26s linear infinite; }
  .adv-light { animation: adv-twinkle 2.4s ease-in-out infinite alternate; }
}
@keyframes adv-flicker {
  0% { transform: scale(1, 1) rotate(0deg); }
  40% { transform: scale(.94, 1.06) rotate(-2deg); }
  70% { transform: scale(1.03, .96) rotate(1.5deg); }
  100% { transform: scale(.97, 1.04) rotate(-1deg); }
}
@keyframes adv-glow { from { opacity: .4; } to { opacity: .7; } }
@keyframes adv-twinkle { from { opacity: .35; } to { opacity: 1; } }
@keyframes adv-snow { to { background-position: 0 220px, 40px 450px, 120px 630px; } }

@media (max-width: 1180px) {
  .adv-label { display: none; }
}
@media (max-width: 700px) {
  .adv-wreath-hero { top: 14px; bottom: auto; right: 12px; width: 112px; }
  .adv-caption { font-size: .95rem; margin-top: 2px; }
  /* Heitersberg zeigt das Bild auf dem Handy über dem Text: Schnee nur auf dem Bild */
  .theme-heitersberg .adv-snow { bottom: auto; aspect-ratio: 4 / 3; }
}
@media (max-width: 560px) {
  .adv-wreath-head { display: none; }
  .advent-layer .brand { margin-right: auto; }
}
@media print {
  .adv-wreath, .adv-garland, .adv-snow, .adv-stars { display: none; }
}
