/* Weihnachts-Popup – nur Startseite
   z-index UNTER Cookie-Banner (~10000), damit Cookie-Klick = Musik-Geste möglich ist */
.xmas-popup {
  position: fixed;
  inset: 0;
  z-index: 9900;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.xmas-popup[hidden] {
  display: none !important;
}

.xmas-popup__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 16, 40, 0.72);
  backdrop-filter: blur(6px);
}

.xmas-popup__dialog {
  position: relative;
  z-index: 1;
  width: min(920px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  border-radius: 18px;
  background: #06122c;
  box-shadow: 0 28px 80px rgba(0, 10, 40, 0.55);
  /* Eigenes Compositor-Layer: verhindert Soft-Blur durch backdrop-filter / Schnee */
  isolation: isolate;
  transform: translateZ(0);
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  animation: xmas-popup-in 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.xmas-popup__dialog picture {
  display: block;
  line-height: 0;
}

@keyframes xmas-popup-in {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateZ(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .xmas-popup__dialog {
    animation: none;
  }

  .xmas-popup__story,
  .xmas-popup__story-shine,
  .xmas-popup__story-glitter {
    animation: none !important;
  }
}

.xmas-popup__close {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #0a1b3d;
  font: 600 0.82rem/1 Figtree, system-ui, sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.xmas-popup__close:hover,
.xmas-popup__close:focus-visible {
  background: #fff;
  outline: 2px solid #0d5bff;
  outline-offset: 2px;
}

.xmas-popup__close svg {
  width: 1rem;
  height: 1rem;
}

.xmas-popup__media {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
  object-fit: contain;
  /* Scharf halten trotz GPU-Layer / Retina-Skalierung */
  image-rendering: auto;
  transform: translateZ(0);
}

body.xmas-popup-open {
  overflow: hidden;
}

/* Schnee unter dem Popup, solange es offen ist → Karte bleibt knackscharf */
body.xmas-popup-open #villex-seasonal-snow {
  z-index: 9800;
}

/* Goldener Glitzer-Button → Weihnachtsgeschichte (unten rechts im Popup) */
.xmas-popup__story {
  position: absolute;
  right: 3.5%;
  bottom: 4.5%;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: min(280px, 46%);
  padding: 0.72rem 1.05rem;
  border-radius: 4px;
  text-decoration: none;
  text-align: center;
  font: 800 0.82rem/1.25 Figtree, system-ui, sans-serif;
  letter-spacing: 0.01em;
  color: #111 !important;
  background: linear-gradient(
    125deg,
    #8a6a12 0%,
    #c9a227 18%,
    #ffe9a0 38%,
    #f0d78a 50%,
    #c9a227 68%,
    #ffe9a0 82%,
    #a67c00 100%
  );
  background-size: 220% 220%;
  box-shadow:
    0 0 0 1px rgba(255, 236, 170, 0.65),
    0 8px 22px rgba(0, 0, 0, 0.35),
    0 0 18px rgba(201, 162, 39, 0.55),
    0 0 36px rgba(255, 215, 100, 0.28);
  overflow: hidden;
  isolation: isolate;
  animation: xmas-gold-shift 2.8s ease-in-out infinite;
  transform: translateZ(0);
  transition: transform 0.2s ease, filter 0.2s ease;
}

.xmas-popup__story:hover,
.xmas-popup__story:focus-visible {
  transform: scale(1.04);
  filter: brightness(1.08);
  outline: none;
}

.xmas-popup__story-text {
  position: relative;
  z-index: 2;
}

.xmas-popup__story-shine {
  position: absolute;
  inset: -40% -30%;
  z-index: 1;
  background: linear-gradient(
    105deg,
    transparent 35%,
    rgba(255, 255, 255, 0.75) 48%,
    rgba(255, 248, 210, 0.9) 50%,
    rgba(255, 255, 255, 0.55) 52%,
    transparent 65%
  );
  animation: xmas-gold-shine 2.2s ease-in-out infinite;
  pointer-events: none;
}

.xmas-popup__story-glitter {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 30%, #fff 0 1.2px, transparent 2px),
    radial-gradient(circle at 78% 22%, #fff8dc 0 1.4px, transparent 2.2px),
    radial-gradient(circle at 62% 70%, #fff 0 1px, transparent 1.8px),
    radial-gradient(circle at 28% 78%, #ffe9a0 0 1.3px, transparent 2px),
    radial-gradient(circle at 88% 58%, #fff 0 1.1px, transparent 2px),
    radial-gradient(circle at 45% 18%, #fffef0 0 1.5px, transparent 2.3px),
    radial-gradient(circle at 8% 62%, #fff 0 1px, transparent 1.7px);
  animation: xmas-gold-glitter 1.1s steps(2, end) infinite;
  mix-blend-mode: screen;
  opacity: 0.95;
}

@keyframes xmas-gold-shift {
  0%,
  100% {
    background-position: 0% 50%;
    box-shadow:
      0 0 0 1px rgba(255, 236, 170, 0.65),
      0 8px 22px rgba(0, 0, 0, 0.35),
      0 0 16px rgba(201, 162, 39, 0.5),
      0 0 30px rgba(255, 215, 100, 0.22);
  }
  50% {
    background-position: 100% 50%;
    box-shadow:
      0 0 0 1px rgba(255, 248, 210, 0.9),
      0 10px 26px rgba(0, 0, 0, 0.38),
      0 0 28px rgba(255, 215, 80, 0.75),
      0 0 48px rgba(255, 230, 140, 0.45);
  }
}

@keyframes xmas-gold-shine {
  0% {
    transform: translateX(-45%) rotate(8deg);
  }
  100% {
    transform: translateX(45%) rotate(8deg);
  }
}

@keyframes xmas-gold-glitter {
  0% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0.7;
  }
}

/* —— Weihnachtsmann-Lasche (nur Startseite, unten rechts) —— */
.xmas-tab {
  position: fixed;
  right: 8px;
  bottom: 10px;
  top: auto;
  z-index: 9500;
  transform: none;
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  filter: drop-shadow(-6px 10px 18px rgba(0, 15, 40, 0.32));
  transform-origin: bottom right;
  transition: transform 0.25s ease;
}

.xmas-tab[hidden] {
  display: none !important;
}

.xmas-tab:hover,
.xmas-tab:focus-visible {
  outline: none;
  transform: scale(1.04);
}

.xmas-tab:focus-visible .xmas-tab__santa {
  outline: 3px solid #0d5bff;
  outline-offset: 4px;
  border-radius: 12px;
}

.xmas-tab__pic {
  display: block;
  line-height: 0;
}

.xmas-tab__santa {
  display: block;
  width: min(220px, 34vw);
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

@media (max-width: 720px) {
  .xmas-popup {
    padding: 0.35rem;
    align-items: center;
  }

  .xmas-popup__dialog {
    width: min(96vw, 520px);
    max-height: 96vh;
    border-radius: 12px;
  }

  .xmas-popup__media {
    width: 100%;
    max-height: 92vh;
    height: auto;
    object-fit: contain;
  }

  .xmas-popup__story {
    right: 4%;
    bottom: 3.5%;
    left: auto;
    max-width: min(240px, 72%);
    padding: 0.65rem 0.85rem;
    font-size: 0.74rem;
  }

  .xmas-popup__close span {
    display: none;
  }

  .xmas-tab {
    right: 4px;
    bottom: 8px;
  }

  .xmas-tab__santa {
    width: min(160px, 42vw);
  }

  .xmas-tab:hover,
  .xmas-tab:focus-visible {
    transform: scale(1.03);
  }
}
