/* ══ Коледен модал (началната страница) ═══════════════════════ */
/* Фон: wwwroot/images/xmas/bg-tree.webp — снимка, предоставена от собственика на сайта. */
.xm-overlay {
  --navy: #09212D;
  --navy-2: #14374a;
  --accent: #5BA1AB;
  --accent-dark: #4a8a93;
  --gold: #F2C46D;
  --red: #E2553F;
}

/* ══ OVERLAY ══════════════════════════════════════════ */
.xm-overlay {
  position: fixed; inset: 0; z-index: 10050;
  background: rgba(9, 33, 45, .62);
  backdrop-filter: blur(3px);
  display: none; align-items: center; justify-content: center;
  padding: 16px;
}
.xm-overlay.is-open { display: flex; animation: xmFade .25s ease; }
@keyframes xmFade { from { opacity: 0 } to { opacity: 1 } }

/* ══ КУТИЯ ════════════════════════════════════════════ */
.xm-box {
  position: relative; overflow: hidden;
  width: 380px; max-width: 100%;
  border-radius: 20px;
  background:
    url('/images/xmas/bg-tree.webp') center top / 100% auto no-repeat,
    var(--navy);
  max-height: calc(100vh - 32px); overflow-x: hidden; overflow-y: auto;
  border: 1px solid rgba(91, 161, 171, .35);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .45);
  color: #fff; text-align: center;
  padding: 34px 26px 24px;
  animation: xmPop .4s cubic-bezier(.34, 1.56, .64, 1);
}
@keyframes xmPop { from { transform: scale(.88); opacity: 0 } to { transform: scale(1); opacity: 1 } }

.xm-box::before {               /* потъмняване към текста */
  content: ''; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: linear-gradient(to bottom,
    rgba(9, 33, 45, .45) 0px, rgba(9, 33, 45, 0) 90px,
    rgba(9, 33, 45, 0) 310px, rgba(9, 33, 45, .9) 410px, var(--navy) 480px);
}

/* ══ МУЗИКА ═══════════════════════════════════════════ */
.xm-music {
  position: absolute; top: 10px; left: 12px; z-index: 3;
  height: 32px; padding: 0 12px 0 10px; border-radius: 16px;
  border: 0; background: rgba(255, 255, 255, .1); color: #fff;
  font: 700 12px/32px inherit; font-family: inherit;
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  animation: xmMusicPulse 2.4s ease-in-out infinite;
}
.xm-music:hover { background: rgba(255, 255, 255, .18); }
.xm-music.is-playing { animation: none; background: rgba(91, 161, 171, .35); }
@keyframes xmMusicPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(242, 196, 109, .45); } 50% { box-shadow: 0 0 0 6px rgba(242, 196, 109, 0); } }
.xm-eq { display: none; align-items: flex-end; gap: 2px; height: 12px; }
.xm-eq i { width: 3px; background: var(--gold); border-radius: 1px; animation: xmEq .9s ease-in-out infinite; }
.xm-eq i:nth-child(2) { animation-delay: .25s; }
.xm-eq i:nth-child(3) { animation-delay: .5s; }
@keyframes xmEq { 0%, 100% { height: 3px; } 50% { height: 12px; } }
.xm-music.is-playing .xm-eq { display: inline-flex; }
.xm-music.is-playing .xm-note-icon { display: none; }

.xm-close {
  position: absolute; top: 8px; right: 8px; z-index: 4;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(9, 33, 45, .7); color: #fff;
  font-size: 20px; line-height: 38px; font-weight: 700; cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
  transition: background .15s ease, transform .15s ease;
}
.xm-close:hover, .xm-close:focus-visible { background: var(--red); border-color: var(--red); transform: scale(1.06); }


/* Гирлянд от светлинки горе */
.xm-lights {
  position: absolute; top: 0; left: 0; right: 0; height: 16px;
  display: flex; justify-content: space-around; align-items: flex-start;
  padding: 0 18px; pointer-events: none;
}
.xm-lights::before {
  content: ''; position: absolute; left: 0; right: 0; top: -14px; height: 22px;
  border-bottom: 1.5px solid rgba(255, 255, 255, .18);
  border-radius: 0 0 50% 50%;
}
.xm-lights i {
  width: 7px; height: 10px; margin-top: 6px; border-radius: 50% 50% 50% 50% / 40% 40% 60% 60%;
  background: var(--gold); box-shadow: 0 0 8px var(--gold);
  animation: xmTwinkle 1.8s ease-in-out infinite;
}
.xm-lights i:nth-child(3n+2) { background: var(--accent); box-shadow: 0 0 8px var(--accent); animation-delay: .6s; }
.xm-lights i:nth-child(3n)   { background: var(--red);    box-shadow: 0 0 8px var(--red);    animation-delay: 1.2s; }
@keyframes xmTwinkle { 0%, 100% { opacity: 1 } 50% { opacity: .25 } }

/* Сняг */
.xm-snow { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.xm-snow span {
  position: absolute; top: -10px; border-radius: 50%;
  background: #fff; opacity: .7;
  animation: xmFall linear infinite;
}
@keyframes xmFall { to { transform: translateY(560px) translateX(20px); } }


/* ══ ЕЛХИ НА ФОНА ═════════════════════════════════════ */
.xm-scene { position: absolute; left: 0; right: 0; bottom: 0; height: 150px; z-index: 0; pointer-events: none; }
.xm-scene svg { position: absolute; bottom: 0; }
.xm-forest { left: 0; width: 100%; height: 100%; }
.xm-tree-big { right: -22px; width: 124px; height: 190px; opacity: .55; }
.xm-tree-small { left: -12px; width: 80px; height: 130px; opacity: .4; }
.xm-orn { animation: xmTwinkle 2.2s ease-in-out infinite; }
.xm-orn:nth-of-type(2n) { animation-delay: .7s; }
.xm-orn:nth-of-type(3n) { animation-delay: 1.4s; }
.xm-star { transform-origin: 75px 18px; animation: xmStar 3s ease-in-out infinite; }
@keyframes xmStar { 0%,100% { opacity: 1; transform: scale(1); } 50% { opacity: .7; transform: scale(.85); } }

.xm-content { position: relative; z-index: 1; }

.xm-eyebrow {
  display: inline-block;
  font-size: 11px; font-weight: 800; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--gold);
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
  margin-bottom: 0;
}

/* ══ ЖЕТОНИТЕ (двустранни, обръщат се при докосване) ══ */
.xm-chips {
  position: relative; height: 150px; margin: 160px auto 14px;
  display: flex; justify-content: center; align-items: center;
}
.xm-chips::before {
  content: ''; position: absolute; width: 220px; height: 120px;
  background: radial-gradient(closest-side, rgba(255, 214, 140, .28), transparent);
  filter: blur(6px);
}
.xm-chip {
  position: relative; width: 128px; height: 128px;
  padding: 0; border: 0; background: none; cursor: pointer;
  perspective: 700px;
  animation: xmFloat 3.4s ease-in-out 1.2s infinite;
  transform: rotate(var(--tilt));
  -webkit-tap-highlight-color: transparent;
}
.xm-chip::after {               /* сянка под монетата */
  content: ''; position: absolute; left: 14%; right: 14%; bottom: -10px; height: 16px;
  background: radial-gradient(closest-side, rgba(0, 0, 0, .5), transparent);
  z-index: -1;
}
.xm-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 50%; }
.xm-chip--10 { --tilt: -10deg; margin-right: -18px; z-index: 2; }
.xm-chip--5  { --tilt: 9deg; z-index: 1; }
.xm-chip--5 .xm-coin { animation-delay: .15s; }
.xm-chip--5 { animation-delay: 1.6s; }

.xm-coin {
  display: block; position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d;
  transition: transform .7s cubic-bezier(.3, 1.4, .5, 1);
  animation: xmCoin 1s cubic-bezier(.2, .9, .3, 1.15) both;
}
.xm-coin.is-landed { animation: none; }
.xm-chip.is-flipped .xm-coin { transform: rotateY(180deg); }
.xm-face {
  display: block; position: absolute; inset: 0; width: 100%; height: 100%;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.xm-face--back { transform: rotateY(180deg); }

@keyframes xmCoin {
  0%   { transform: translateY(-140px) rotateY(0) scale(.6); opacity: 0; }
  55%  { opacity: 1; }
  75%  { transform: translateY(6px) rotateY(680deg) scale(1.04); }
  100% { transform: translateY(0) rotateY(720deg) scale(1); }
}
@keyframes xmFloat {
  0%, 100% { transform: translateY(0) rotate(var(--tilt)); }
  50%      { transform: translateY(-6px) rotate(calc(var(--tilt) * .6)); }
}
.xm-hint { font-size: 11px; color: rgba(255, 255, 255, .6); text-shadow: 0 1px 4px rgba(0,0,0,.6); margin: 0 0 14px; }

.xm-title { font-size: 21px; font-weight: 800; line-height: 1.25; margin: 0 0 10px; text-wrap: balance; }
.xm-nowrap { white-space: nowrap; }
.xm-text  { font-size: 14px; line-height: 1.55; color: rgba(255, 255, 255, .75); margin: 0 auto 18px; max-width: 310px; text-wrap: pretty; }
.xm-text strong { color: #fff; }

.xm-wish { font-size: 13px; font-style: italic; line-height: 1.5; color: var(--gold); opacity: .9; margin: -6px auto 18px; max-width: 300px; text-wrap: balance; }
.xm-actions { display: flex; flex-direction: column; gap: 8px; }
.xm-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 18px; border-radius: 50px;
  font-weight: 800; font-size: 14px; text-decoration: none;
  transition: transform .15s ease, background .15s ease;
}
.xm-btn--primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(91, 161, 171, .35); }
.xm-btn--primary:hover { background: var(--accent-dark); transform: translateY(-1px); }
.xm-btn--ghost { color: rgba(255, 255, 255, .9); border: 1px solid rgba(255, 255, 255, .22); }
.xm-btn--ghost:hover { background: rgba(255, 255, 255, .06); }

.xm-note { font-size: 11px; color: rgba(255, 255, 255, .45); margin-top: 14px; }

@media (max-height: 740px) {
  .xm-box { padding-top: 26px; }
  .xm-box::before {
    background: linear-gradient(to bottom,
      rgba(9, 33, 45, .45) 0px, rgba(9, 33, 45, 0) 80px,
      rgba(9, 33, 45, 0) 230px, rgba(9, 33, 45, .9) 310px, var(--navy) 370px);
  }
  .xm-chips { margin-top: 120px; height: 124px; }
  .xm-chip { width: 106px; height: 106px; }
  .xm-title { font-size: 19px; }
  .xm-text { margin-bottom: 14px; }
  .xm-wish { margin-bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .xm-music, .xm-eq i, .xm-chip, .xm-coin, .xm-lights i, .xm-snow span, .xm-box, .xm-overlay.is-open, .xm-orn, .xm-star { animation: none !important; }
  .xm-coin { transition: none; }
  .xm-chip { transform: rotate(var(--tilt)); }
}

/* ══ КОМПЮТЪР — широко оформление в две колони ═══════════════════
   Вляво елхата с жетоните, вдясно текстът и бутоните.
   Същото условие е в xmas-modal.js (DESKTOP_QUERY). */
@media (min-width: 900px) and (min-height: 560px) {
  .xm-box {
    width: 780px;
    padding: 0;
    text-align: left;
    background:
      url('/images/xmas/bg-tree.webp') left top / 380px auto no-repeat,
      var(--navy);
  }
  .xm-box::before {
    background:
      linear-gradient(to right, rgba(9, 33, 45, 0) 250px, rgba(9, 33, 45, .85) 340px, var(--navy) 380px),
      linear-gradient(to bottom, rgba(9, 33, 45, .4) 0, rgba(9, 33, 45, 0) 90px, rgba(9, 33, 45, 0) 430px, var(--navy) 548px);
  }

  .xm-content {
    display: grid;
    grid-template-columns: 380px 1fr;
    grid-template-areas:
      "chips eyebrow"
      "chips title"
      "chips text"
      "chips wish"
      "chips actions";
    grid-template-rows: auto auto auto auto 1fr;
    min-height: 548px;
  }
  .xm-chips   { grid-area: chips; align-self: start; margin: 168px auto 0; }
  .xm-eyebrow { grid-area: eyebrow; padding: 56px 44px 0 8px; font-size: 12px; }
  .xm-title   { grid-area: title; font-size: 28px; margin: 12px 44px 14px 8px; }
  .xm-text    { grid-area: text; font-size: 16px; max-width: none; margin: 0 44px 18px 8px; }
  .xm-wish    { grid-area: wish; font-size: 14px; max-width: none; margin: 0 44px 22px 8px; }
  .xm-actions { grid-area: actions; margin: 0 44px 32px 8px; align-self: start; }
  .xm-btn     { font-size: 15px; padding: 13px 20px; }

  .xm-chip { width: 140px; height: 140px; }
}
