/* WINE4YOU – adventní věnec v desktopové hlavičce.
   Dvě umístění, přepíná je window.W4Y_ADVENT_VARIANTA ("a" | "b")
   a třída na <html>: data-w4y-advent-var / .w4y-advent--a / .w4y-advent--b.
   A: ve volném místě mezi sloganem „Vína s příběhem“ a fotkou citátu.
   B: menší věnec u dolní strany kosočtverce loga, jako ozdoba.
   Viditelný od 1. adventní neděle do 26. 12. (datum počítá JS, Europe/Prague).
   Pod 1024 px se schovává. Citát se neposouvá. */

#w4y-advent {
  display: none;
}

@media (min-width: 1024px) {
  html.w4y-advent-on #header .header-in-wrap {
    position: relative;
    overflow: visible;
  }

  #w4y-advent {
    display: block;
    position: absolute;
    z-index: 3;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    line-height: 0;
    pointer-events: none;
  }

  #w4y-advent[hidden] {
    display: none;
  }

  /* A: mezi sloganem a fotkou citátu, svisle na střed řádku. */
  #w4y-advent.w4y-advent--a {
    top: 50%;
    width: 4.5rem; /* ≈ 72 px; JS může zúžit, kdyby byla mezera těsnější */
    transform: translateY(-50%);
  }

  /* B: menší věnec, přilepený k dolní straně kosočtverce. Pozici dává JS. */
  #w4y-advent.w4y-advent--b {
    top: auto;
    width: 3.35rem; /* ≈ 54 px */
    transform: none;
  }

  .w4y-advent__img {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: top;
  }

  .w4y-advent__plamen {
    position: absolute;
    left: var(--w4y-ax);
    top: var(--w4y-ay);
    width: 11%;
    height: 20%;
    transform: translate(-50%, -90%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .w4y-advent__plamen.is-lit {
    opacity: 1;
    visibility: visible;
  }

  /* Perspektiva po otočení o ~45°: přední svíčky (1, 4) jsou blíž, zadní (2, 3) dál. */
  .w4y-advent__plamen--1,
  .w4y-advent__plamen--4 {
    width: 12%;
    height: 22%;
  }
  .w4y-advent__plamen--2,
  .w4y-advent__plamen--3 {
    width: 10%;
    height: 18.5%;
  }

  .w4y-advent__glow {
    position: absolute;
    left: 50%;
    top: 62%;
    width: 220%;
    height: 190%;
    transform: translate(-50%, -50%);
    background: radial-gradient(
      circle,
      rgba(255, 214, 120, 0.8) 0%,
      rgba(255, 160, 50, 0.28) 42%,
      rgba(255, 140, 40, 0) 72%
    );
    filter: blur(1.2px);
  }

  .w4y-advent__ohen {
    position: absolute;
    left: 50%;
    bottom: 4%;
    width: 58%;
    height: 92%;
    transform: translateX(-50%);
    transform-origin: 50% 90%;
    background: linear-gradient(
      to top,
      #a8240c 0%,
      #e35a10 32%,
      #f6b133 68%,
      #fff4c8 100%
    );
    border-radius: 50% 50% 46% 46% / 62% 62% 36% 36%;
    filter: blur(0.2px);
    box-shadow: 0 0 4px 1px rgba(255, 180, 60, 0.45);
  }

  .w4y-advent__jadro {
    position: absolute;
    left: 50%;
    bottom: 8%;
    width: 28%;
    height: 48%;
    transform: translateX(-50%);
    transform-origin: 50% 90%;
    background: radial-gradient(
      ellipse at 50% 80%,
      #fffef6 0%,
      #ffe9a0 45%,
      rgba(255, 200, 80, 0) 80%
    );
    border-radius: 50%;
  }

  .w4y-advent__plamen.is-lit .w4y-advent__ohen,
  .w4y-advent__plamen.is-lit .w4y-advent__jadro {
    animation: w4y-advent-flicker 1.2s ease-in-out infinite;
  }

  .w4y-advent__plamen--2.is-lit .w4y-advent__ohen,
  .w4y-advent__plamen--2.is-lit .w4y-advent__jadro {
    animation-duration: 1.05s;
    animation-delay: -0.25s;
  }

  .w4y-advent__plamen--3.is-lit .w4y-advent__ohen,
  .w4y-advent__plamen--3.is-lit .w4y-advent__jadro {
    animation-duration: 1.35s;
    animation-delay: -0.55s;
  }

  .w4y-advent__plamen--4.is-lit .w4y-advent__ohen,
  .w4y-advent__plamen--4.is-lit .w4y-advent__jadro {
    animation-duration: 1.12s;
    animation-delay: -0.8s;
  }
}

@keyframes w4y-advent-flicker {
  0%,
  100% {
    transform: translateX(-50%) scale(1) rotate(-0.7deg);
    opacity: 0.92;
  }
  22% {
    transform: translateX(-50%) scale(1.07, 0.95) rotate(1deg);
    opacity: 1;
  }
  46% {
    transform: translateX(-50%) scale(0.95, 1.07) rotate(-0.5deg);
    opacity: 0.9;
  }
  70% {
    transform: translateX(-50%) scale(1.05, 0.98) rotate(0.6deg);
    opacity: 0.98;
  }
  86% {
    transform: translateX(-50%) scale(0.98, 1.04) rotate(-0.9deg);
    opacity: 0.94;
  }
}

@media (min-width: 1024px) and (prefers-reduced-motion: reduce) {
  .w4y-advent__plamen.is-lit .w4y-advent__ohen,
  .w4y-advent__plamen.is-lit .w4y-advent__jadro {
    animation: none;
    opacity: 1;
    transform: translateX(-50%);
  }
}
