/* ===== Новогодняя открытка 067.by (компактный виджет) ===== */
.ny-overlay {
  --ny-w: 220px;
  --ny-h: 314px;
  --ny-bottom: 250px; /* высота от низа экрана — подними/опусти под плашку cookie */
  --ny-ease: ease-in-out;
  display: none;
  position: fixed;
  left: 0;
  bottom: var(--ny-bottom);
  width: calc(var(--ny-w) * 2 + 60px);
  height: calc(var(--ny-h) + 60px);
  z-index: 9990;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.ny-overlay.is-visible { display: block; }
.ny-overlay.is-shown { opacity: 1; }
.ny-overlay *, .ny-overlay *::before, .ny-overlay *::after { box-sizing: border-box; }

@media (max-width: 767px) {
  .ny-overlay { --ny-w: 150px; --ny-h: 214px; --ny-bottom: 300px; }
}

/* Кнопка закрытия */
.ny-close {
  position: absolute;
  top: 0;
  left: calc(20px + var(--ny-w) * 1.5 - 32px);
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: #ffffff;
  color: #0c1247;
  font-size: 22px;
  line-height: 32px;
  text-align: center;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  z-index: 5;
}
.ny-close:hover { background: #e9ecff; }

/* Открытка */
.ny-card {
  position: absolute;
  left: calc(20px + var(--ny-w) / 2);
  top: 40px;
  width: var(--ny-w);
  height: var(--ny-h);
  perspective: 1500px;
  pointer-events: auto;
  transition: transform 1s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  transform: rotate(-6deg) translate(0, 0);
  animation: nyCardIn 1s alternate cubic-bezier(0.87, -0.41, 0.19, 1.44);
}
.ny-card::before {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
}
.ny-card.is-opened {
  transform: rotate(0deg) translate(calc(var(--ny-w) / 2), 0);
}
.ny-card.is-opened .ny-page-front { transform: rotateY(-180deg); }

/* Улёт за экран */
.ny-card.is-leaving {
  transition: transform 0.9s cubic-bezier(0.6, -0.3, 0.9, 0.5), opacity 0.9s ease;
  transform: rotate(18deg) translate(0, -140vh);
  opacity: 0;
}

@keyframes nyCardIn {
  0%   { opacity: 0; transform: rotate(-6deg) translate(0, 60px); }
  100% { opacity: 1; transform: rotate(-6deg) translate(0, 0); }
}

/* Страницы */
.ny-page {
  position: absolute;
  width: var(--ny-w);
  height: var(--ny-h);
  cursor: pointer;
  outline: 1px solid transparent;
  transition: transform 1s var(--ny-ease);
}
.ny-page-front {
  transform-origin: 0 50% 0;
  transform-style: preserve-3d;
  transform: rotateY(-12deg);
  z-index: 2;
}
.ny-page-outside,
.ny-page-inside {
  position: absolute;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

/* Обложка */
.ny-page-outside {
  width: 100%;
  height: 100%;
  border: 6px solid #f7f0e3;
  background-color: #b3191c;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 120'%3E%3Cpolygon points='50,18 78,58 22,58' fill='%23166534'/%3E%3Cpolygon points='50,38 88,86 12,86' fill='%231a7a3f'/%3E%3Cpolygon points='50,60 96,108 4,108' fill='%23166534'/%3E%3Crect x='44' y='108' width='12' height='10' fill='%238b5a2b'/%3E%3Cpolygon points='50,2 54,12 65,12 56,18 59,28 50,22 41,28 44,18 35,12 46,12' fill='%23f5c542'/%3E%3C/svg%3E"),
    radial-gradient(rgba(255, 255, 255, 0.28) 1.5px, transparent 2px),
    radial-gradient(circle at 50% 40%, #d62d2f 0%, #8f1215 100%);
  background-repeat: no-repeat, repeat, no-repeat;
  background-position: center 68%, 0 0, 0 0;
  background-size: 46% auto, 22px 22px, 100% 100%;
}
.ny-page-outside::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid #f5c542;
}
.ny-page-outside::after {
  content: "0,67";
  position: absolute;
  top: 9%;
  left: 0;
  right: 0;
  text-align: center;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  font-size: 30px;
  letter-spacing: 2px;
  color: #f5c542;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* Внутренние страницы */
.ny-page-inside,
.ny-page-bottom {
  background-color: #f7f0e3;
  background-image: radial-gradient(rgba(0, 0, 0, 0.05) 1.5px, transparent 2px);
  background-size: 16px 16px;
  padding: 18px;
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
}
.ny-page-inside::before,
.ny-page-bottom::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid #c9a24b;
  pointer-events: none;
}
.ny-page-inside { transform: rotateY(-180deg); }
.ny-page-inside::before { border-right: none; right: 0; }
.ny-page-bottom { z-index: 1; }
.ny-page-bottom::before { border-left: none; left: 0; }

/* Надпись слева */
.ny-greeting {
  display: block;
  transform: rotate(-8deg);
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 700;
  font-size: 25px;
  line-height: 1.25;
  color: #b3191c;
}

/* Текст справа */
.ny-page-bottom p {
  margin: 0;
  padding: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 15px;
  line-height: 1.3;
  color: #2b2b2b;
}

/* Подсказка «нажмите» */
.ny-click-icon {
  position: absolute;
  left: calc(20px + var(--ny-w));
  top: calc(40px + var(--ny-h) - 54px);
  transform: translate(-50%, 0);
  animation: nyIconAnim 1s infinite alternate var(--ny-ease);
  transition: opacity 0.5s var(--ny-ease);
  opacity: 1;
  pointer-events: none;
}
.ny-click-icon svg { width: 40px; height: 40px; }
.ny-click-icon.is-hidden { opacity: 0; }

@keyframes nyIconAnim {
  0%   { transform: translate(-50%, 0); }
  100% { transform: translate(-50%, 6px); }
}

@media (max-width: 767px) {
  .ny-page-outside::after { font-size: 22px; }
  .ny-greeting { font-size: 16px; }
  .ny-page-bottom p { font-size: 10px; }
  .ny-page-inside, .ny-page-bottom { padding: 12px; }
  .ny-click-icon svg { width: 32px; height: 32px; }
}
/* ===== Оригинальный орнамент, большая рука, левый нижний угол ===== */
.ny-overlay {
  --ny-w: 200px;
  --ny-h: 303px;
  --ny-bottom: 16px;
}
@media (max-width: 767px) {
  .ny-overlay {
    --ny-w: 150px;
    --ny-h: 214px;
    --ny-bottom: 16px;
  }
}

/* Обложка с орнаментом */
.ny-page-outside {
  border: 10px solid #fbfbfb;
  background: #e0312b url("../img/ny/front-bg.png") no-repeat center;
  background-size: cover;
}
.ny-page-outside::before,
.ny-page-outside::after {
  content: none;
  display: none;
}
@media (max-width: 767px) {
  .ny-page-outside { border-width: 5px; }
}

/* Внутренние страницы с орнаментом */
.ny-page-inside,
.ny-page-bottom {
  background-color: #d4d1d0;
  background-image: url("../img/ny/pattern.png");
  background-repeat: repeat;
  background-size: auto;
}
.ny-page-inside { background-position: 0 80px; }
.ny-page-bottom { background-position: -22px 80px; }
.ny-page-inside::before,
.ny-page-bottom::before {
  display: none;
}

/* Белая рука: крупнее и с движением вверх-вниз */
.ny-click-icon {
  top: calc(40px + var(--ny-h) - 100px);
}
.ny-click-icon svg {
  width: 80px;
  height: 80px;
}
@media (max-width: 767px) {
  .ny-click-icon { top: calc(40px + var(--ny-h) - 70px); }
  .ny-click-icon svg { width: 52px; height: 52px; }
}
@keyframes nyIconAnim {
  0%   { transform: translate(-50%, 0); }
  100% { transform: translate(-50%, 10px); }
}
/* ===== Открытка прижата к левому краю ===== */
.ny-overlay {
  --ny-left: 16px; /* отступ от левого края: меняй под себя */
}
.ny-card {
  left: var(--ny-left);
}
.ny-card.is-opened {
  transform: rotate(0deg) translate(var(--ny-w), 0);
}
.ny-close {
  left: calc(var(--ny-left) + var(--ny-w) - 32px);
}
.ny-click-icon {
  left: calc(var(--ny-left) + var(--ny-w) / 2);
}
/* ===== Гирлянда под меню (по центру) ===== */
.ny-garland {
  position: relative;
  height: 0;
  z-index: 50;
  pointer-events: none;
}
.ny-garland__in {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  overflow: hidden;
}
.ny-garland svg {
  display: block;
  position: relative;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  min-width: 900px;
  height: auto;
}

.ny-garland .light_cord {
  fill: none;
  stroke: #2f8f3a;
  stroke-width: 2;
}
.ny-garland .light_fixture { fill: #1f6b2a; }
.ny-garland .red_bulb   { fill: #CA2128; stroke: #6D6D6D; stroke-miterlimit: 10; }
.ny-garland .green_bulb { fill: #2D754A; stroke: #6D6D6D; stroke-miterlimit: 10; }
.ny-garland .blue_bulb  { fill: #2C3EA8; stroke: #6D6D6D; stroke-miterlimit: 10; }
.ny-garland .white_bulb { fill: #F5EED7; stroke: #6D6D6D; stroke-miterlimit: 10; }
.ny-garland .gold_bulb  { fill: #ffcc5e; stroke: #6D6D6D; stroke-miterlimit: 10; }

.ny-garland .bulb {
  animation-name: nyGlow;
  animation-duration: 0.5s;
  animation-iteration-count: infinite;
  animation-timing-function: ease-in-out;
  animation-direction: alternate;
}
@keyframes nyGlow {
  0%   { fill-opacity: 0.25; }
  100% { fill-opacity: 1; }
}

.ny-garland .blink-1  { animation-delay: 0.6s; }
.ny-garland .blink-2  { animation-delay: 2s; }
.ny-garland .blink-3  { animation-delay: 2s; }
.ny-garland .blink-4  { animation-delay: 6s; }
.ny-garland .blink-5  { animation-delay: 2.5s; }
.ny-garland .blink-6  { animation-delay: 0.3s; }
.ny-garland .blink-7  { animation-delay: 2s; }
.ny-garland .blink-8  { animation-delay: 0.2s; }
.ny-garland .blink-9  { animation-delay: 0.95s; }
.ny-garland .blink-10 { animation-delay: 1.2s; }

@media (prefers-reduced-motion: reduce) {
  .ny-garland .bulb { animation: none; fill-opacity: 1; }
}

/* ===== Открытка меньше в 1,5 раза (только компьютеры и планшеты) ===== */
@media (min-width: 768px) {
  .ny-overlay {
    --ny-left: 24px;
    transform: scale(0.6667);
    transform-origin: 0 100%;
  }
  .ny-greeting { font-size: 28px; }
  .ny-page-bottom p { font-size: 17px; }
  .ny-close {
    width: 48px;
    height: 48px;
    font-size: 33px;
    line-height: 48px;
    left: calc(var(--ny-left) + var(--ny-w) - 48px);
  }
}