/* ===== КЕЙС «НУ, ПОГОДИ! КАНИКУЛЫ» =====
   Страница-макет 1440 × 2860 (как в Тильде), масштабируется под ширину окна.
   Координаты — в ед. макета: calc(N * var(--n)). Каждый элемент задаёт --x, --y, --w, --h в style. */

.np-page {
  /* — настройки — */
  --np-ink: #1d1d1d;          /* основной текст */
  --np-blue: #2970A7;         /* подписи счётчиков */
  --np-red: #DC2323;          /* «НЕ НАЖИМАТЬ!» */
  /* небо: утро наверху страницы → закат к титрам и городу внизу (было в Тильде: только голубое) */
  --np-sky: linear-gradient(180deg,
    #79c8fc 0%,      /* утро — как в Тильде */
    #84e3f8 48%,
    #a8e4f2 64%,
    #f6dcc0 78%,     /* тёплый свет */
    #ffbe94 88%,     /* закат */
    #ff9c8e 100%);

  background: var(--np-sky);
  color: var(--np-ink);
}

.np {
  container-type: inline-size;
  position: relative;
  overflow: hidden;
}
.np__stage {
  --n: calc(100cqw / 1440);
  position: relative;
  height: calc(2860 * var(--n));
}

/* — всё на странице стоит по координатам из макета — */
.np__stage > * {
  position: absolute;
  left: calc(var(--x) * var(--n));
  top: calc(var(--y) * var(--n));
  margin: 0;
}
.np__img {
  width: calc(var(--w) * var(--n));
  height: calc(var(--h) * var(--n));
  object-fit: cover;
  opacity: var(--op, 1);
  rotate: var(--rot, 0deg);
  translate: 0 var(--ty, 0px); /* «падение» облаков при скролле — js/parallax.js */
}
.np__img > img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* два облака разъезжаются при появлении страницы (как в Тильде: за 1 секунду) */
.np__drift { animation: np-drift 1s ease-out 0.2s both; }
@keyframes np-drift { to { translate: calc(var(--dx) * var(--n)) 0; } }

/* — тексты — */
.np__text {
  width: calc(var(--w) * var(--n));
  font-weight: 300;
  font-size: calc(11 * var(--n));
  line-height: calc(17 * var(--n));
}
.np__text--lead { font-weight: 300; font-size: calc(15 * var(--n)); line-height: calc(23 * var(--n)); }
.np__text--role { font-weight: 500; }
.np__text--white { color: #fff; font-weight: var(--fw, 700); }
.np__warn {
  font-weight: 900;
  font-size: calc(9 * var(--n));
  line-height: calc(14 * var(--n));
  color: var(--np-red);
}
.np__label {
  font-weight: 700;
  font-size: calc(9 * var(--n));
  line-height: calc(14 * var(--n));
  color: var(--np-blue);
}

/* — персонажи и выключатель — */
.np__chars { width: calc(var(--w) * var(--n)); }
.np__chars img { display: block; width: 100%; }
.np__chars.is-shock { animation: np-shock 0.07s infinite; }
@keyframes np-shock {
  0%   { transform: translate(0, 0); }
  20%  { transform: translate(-3px, 3px); }
  40%  { transform: translate(3px, -3px); }
  60%  { transform: translate(-2px, 2px); }
  80%  { transform: translate(2px, -2px); }
}

.np__switch {
  width: calc(var(--w) * var(--n));
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}
.np__switch img { display: block; width: 100%; }
.np__switch:hover { transform: scale(1.05); filter: brightness(1.1); }

/* — счётчики: цифры-картинки — */
.np__counter { display: flex; gap: calc(6 * var(--n)); }
.np__counter img { width: calc(25 * var(--n)); height: auto; }

/* — видео серий — */
.np__video {
  width: calc(306 * var(--n));
  height: calc(172.55 * var(--n));
  border-radius: calc(14 * var(--n));
  overflow: hidden;
  background: rgba(0, 0, 0, 0.15);
}
.np__video img, .np__video video { display: block; width: 100%; height: 100%; object-fit: cover; }
.np__play {
  position: absolute;
  left: 50%; top: 50%;
  width: calc(70 * var(--n));
  height: calc(70 * var(--n));
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpolygon points='40,30 70,50 40,70' fill='white'/%3E%3C/svg%3E") center / 46% no-repeat;
  translate: -50% -50%;
  cursor: pointer;
  transition: background-color 0.2s, scale 0.2s;
}
.np__play:hover { background-color: rgba(0, 0, 0, 0.75); scale: 1.08; }
.np__video--empty {
  display: grid;
  place-items: center;
  width: calc(306 * var(--n));
  border: 1px dashed rgba(29, 29, 29, 0.35);
  background: rgba(255, 255, 255, 0.25);
  font-size: calc(11 * var(--n));
  color: rgba(29, 29, 29, 0.6);
}

/* — аниматик против финала: шторка — */
.np__compare {
  width: calc(520 * var(--n));
  aspect-ratio: 16 / 9;
  border-radius: calc(14 * var(--n));
  overflow: hidden;
  background: #fff;
  box-shadow: 0 calc(14 * var(--n)) calc(40 * var(--n)) rgba(20, 60, 110, 0.25);
}
.np__compare video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.np__compare-top { position: absolute; inset: 0; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.np__compare-handle {
  position: absolute;
  top: 0; bottom: 0;
  left: var(--pos);
  width: 2px;
  translate: -50% 0;
  background: #fff;
  box-shadow: 0 0 calc(8 * var(--n)) rgba(0, 0, 0, 0.3);
  pointer-events: none;
}
.np__compare-handle::after {
  content: "‹ ›";
  position: absolute;
  top: 50%; left: 50%;
  translate: -50% -50%;
  display: grid;
  place-items: center;
  width: calc(38 * var(--n));
  height: calc(38 * var(--n));
  border-radius: 50%;
  background: #fff;
  color: var(--np-blue);
  font-weight: 700;
  font-size: calc(14 * var(--n));
  letter-spacing: calc(2 * var(--n));
  box-shadow: 0 calc(4 * var(--n)) calc(12 * var(--n)) rgba(0, 0, 0, 0.25);
}
.np__compare-tag {
  position: absolute;
  top: calc(10 * var(--n)); left: calc(10 * var(--n));
  padding: calc(4 * var(--n)) calc(10 * var(--n));
  border-radius: calc(20 * var(--n));
  background: rgba(255, 255, 255, 0.9);
  color: var(--np-ink);
  font-weight: 700;
  font-size: calc(10 * var(--n));
  pointer-events: none;
}
.np__compare-tag--r { left: auto; right: calc(10 * var(--n)); background: var(--np-blue); color: #fff; }
/* невидимый ползунок поверх всего — тянешь в любом месте окна */
.np__compare-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}

/* — закат: тёплое свечение у горизонта, облака и город в вечернем свете — */
.np__sun {
  width: calc(var(--w) * var(--n));
  height: calc(var(--h) * var(--n));
  background: radial-gradient(50% 60% at 62% 82%, rgba(255, 214, 140, 0.9), rgba(255, 170, 120, 0.45) 45%, transparent 75%);
  pointer-events: none;
}
.np__dusk { filter: sepia(0.35) saturate(1.5) hue-rotate(-18deg) brightness(1.05); }
.np__city { filter: sepia(0.18) saturate(1.12) hue-rotate(-6deg) brightness(0.98); }

/* — погоня Волка за Зайцем по мостовой (js/case-nupogodi.js) — */
.np__chase {
  width: calc(240 * var(--n));
  height: auto;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

/* — птица — */
.np__bird {
  width: calc(100 * var(--n));
  height: calc(100 * var(--n));
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  z-index: 2;
  transition: transform 0.25s ease, filter 0.25s ease;
}
.np__bird img { width: 100%; height: 100%; object-fit: contain; }
.np__bird:hover { transform: scale(1.06); filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.35)); }
.np__bird.is-scream { animation: np-bird-shake 0.12s infinite; }
@keyframes np-bird-shake {
  25% { transform: translate(7px, 7px); }
  50% { transform: translate(-7px, 7px); }
  75% { transform: translate(7px, -7px); }
}

/* — титры — */
.np__credits {
  width: calc(560 * var(--n));
  height: calc(600 * var(--n));
}
.np__credits img {
  position: absolute;
  left: 50%;
  translate: -50% 0;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.np__credits img.is-on { opacity: 1; }
.np__credits-title { top: calc(50 * var(--n)); width: calc(288 * var(--n)); }
.np__credits-role  { top: calc(200 * var(--n)); width: calc(400 * var(--n)); }
.np__credits-role.is-final { width: calc(320 * var(--n)); }

/* — кнопка «Назад» — */
.np-back {
  position: fixed;
  top: 20px; left: 20px;
  z-index: 60;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-image: linear-gradient(90deg, #ff6ec7, #7aa2ff, #6ef3ff) 1;
  background: linear-gradient(90deg, #ff6ec7, #7aa2ff, #6ef3ff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: all 0.25s ease;
}
.np-back:hover {
  background-clip: border-box;
  -webkit-background-clip: border-box;
  color: #18161A;
}

@media (prefers-reduced-motion: reduce) {
  .np__drift { animation: none; translate: calc(var(--dx) * var(--n)) 0; }
}

/* =====================================================================
   ЖИВОСТЬ СТРАНИЦЫ (js/case-nupogodi.js добавляет классы is-in, когда элемент доходит до экрана)
   ===================================================================== */

/* — 1. Пружинистое появление текстов, счётчиков и видео — как предметы в мультфильме — */
.np-reveal { opacity: 0; }
.np-reveal.is-in { animation: np-spring 0.8s cubic-bezier(.3, .7, .4, 1) both; }
@keyframes np-spring {
  0%   { opacity: 0; transform: translateY(calc(31 * var(--n))) scale(0.95, 0.9); }
  45%  { opacity: 1; transform: translateY(calc(-7.5 * var(--n))) scale(1.025, 0.975); }
  70%  { transform: translateY(calc(2.5 * var(--n))) scale(0.988, 1.018); }
  100% { opacity: 1; transform: none; }
}

/* просто проявляется из прозрачности — «НЕ НАЖИМАТЬ!», выключатель */
.np-fade { opacity: 0; transition: opacity 0.8s ease; }
.np-fade.is-in { opacity: var(--op, 1); }

/* — 2. Вывески разделов на верёвочке: падают сверху и раскачиваются — */
.np__sign { transform-origin: 50% calc(-35 * var(--n)); overflow: visible; }
.np__sign::before {
  content: "";
  position: absolute;
  left: 22%; right: 22%;
  bottom: 70%;
  height: calc(55 * var(--n));
  border-left: 1.5px solid rgba(110, 72, 40, 0.75);
  border-right: 1.5px solid rgba(110, 72, 40, 0.75);
  pointer-events: none;
}
.np__sign { opacity: 0; }
.np__sign.is-in { opacity: 1; animation: np-swing-in var(--swing-time, 1.6s) cubic-bezier(.3, .6, .4, 1) both; }
.np__sign.is-in:hover { animation: np-swing calc(var(--swing-time, 1.6s) * 0.75) ease-out; }
/* размах качания у каждой вывески свой: --swing (1 — обычный) */
@keyframes np-swing-in {
  0%   { transform: translateY(calc(-120 * var(--n))) rotate(calc(-14deg * var(--swing, 1))); opacity: 0; }
  30%  { transform: translateY(0) rotate(calc(10deg * var(--swing, 1))); opacity: 1; }
  50%  { transform: rotate(calc(-6deg * var(--swing, 1))); }
  68%  { transform: rotate(calc(3.5deg * var(--swing, 1))); }
  84%  { transform: rotate(calc(-1.5deg * var(--swing, 1))); }
  100% { transform: none; opacity: 1; }
}
@keyframes np-swing {
  20% { transform: rotate(calc(6deg * var(--swing, 1))); }
  45% { transform: rotate(calc(-4deg * var(--swing, 1))); }
  70% { transform: rotate(calc(2deg * var(--swing, 1))); }
  100% { transform: none; }
}

/* — 3. Жёлтый маркер на главных фразах — проводится, когда текст появился — */
.np-mark {
  padding: 0 0.1em;
  color: inherit;
  background: linear-gradient(104deg, transparent 0.6%, rgba(255, 214, 0, 0.82) 1.4%, rgba(255, 206, 0, 0.7) 97%, transparent 99%) no-repeat 0 62% / 0% 58%;
  border-radius: 0.2em 0.5em 0.3em 0.6em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background-size 1.1s cubic-bezier(.6, 0, .3, 1) 0.6s;
}
.is-in .np-mark { background-size: 100% 58%; }

/* — 5. Превью при наведении на серию — */
.np__video .np__preview {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
}
.np__video.is-previewing .np__preview { opacity: 1; }
.np__video .np__play { z-index: 1; }

/* — 6. Кинорежим — */
.np-cinema {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  background: rgba(8, 24, 48, 0.82);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: np-fade 0.25s ease both;
}
.np-cinema[hidden] { display: none; }
.np-cinema__box {
  width: min(90vw, calc(82vh * 16 / 9));
  animation: np-pop 0.35s cubic-bezier(.2, 1.2, .4, 1) both;
}
.np-cinema__title { margin: 0 0 10px; color: #fff; font-weight: 500; font-size: 15px; }
.np-cinema video { display: block; width: 100%; aspect-ratio: 16 / 9; border-radius: 14px; background: #000; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5); }
.np-cinema__close {
  position: absolute;
  top: 18px; right: 22px;
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 28px; line-height: 1;
  cursor: pointer;
}
.np-cinema__close:hover { background: rgba(255, 255, 255, 0.22); }
@keyframes np-fade { from { opacity: 0; } }
@keyframes np-pop { from { opacity: 0; transform: scale(0.92); } }
body.is-cinema { overflow: hidden; }

/* — 8. Счётчики-барабаны: цифры прокручиваются, как в игровом автомате — */
.np__counter { overflow: visible; }
.np__reel {
  display: block;
  width: calc(25 * var(--n));
  height: calc(25 * var(--n) * 130 / 87);
  overflow: hidden;
}
.np__reel-strip { display: flex; flex-direction: column; will-change: transform; }
.np__reel-strip img { display: block; width: 100%; height: auto; flex: none; }

/* — 9. Облака медленно плывут по ветру (параметры у каждого облака свои — js) — */
.np__cloud { animation: np-wind var(--wind-time, 26s) ease-in-out var(--wind-delay, 0s) infinite alternate; }
.np__cloud.np__drift { animation: np-drift 1s ease-out 0.2s both, np-wind var(--wind-time, 26s) ease-in-out 1.2s infinite alternate; }
@keyframes np-wind { to { transform: translateX(calc(var(--wind, 30) * var(--n))); } }

@media (prefers-reduced-motion: reduce) {
  .np-reveal, .np__sign, .np-fade { opacity: 1; }
  .np-reveal.is-in, .np__sign.is-in, .np__cloud { animation: none; }
  .np-mark { background-size: 100% 58%; transition: none; }
}
