/* ═══════════════════════════════════════════════════════════════════════════
 * KosmoLand — новогодний слой сайта (сезон 2026/27)
 *
 * Подключается ПОСЛЕДНИМ в <head> каждой страницы (nginx sub_filter, см.
 * kosmoland-newyear-inject.conf) вместе с newyear.js. Ничего в шаблонах сайта
 * не меняет: только перекрывает цвета и добавляет украшения. Убрать после
 * праздников = убрать подключение (rollback.sh).
 *
 * Палитра — общая с новогодней темой лаунчера 1.0.45: зимняя ночь (сине-
 * фиолетовая, в тон бренду), снежно-белый, хвойный зелёный #1f7a4a,
 * акценты — золото #f2c14e и ёлочный красный #d6463e.
 *
 * Шапки снега, иней, иллюстрации и ленточка «С Новым годом!» — всегда, пока
 * подключён слой. Снег и гирлянда — по переключателю «Украшения» (newyear.js,
 * класс html.ny-decor). Все картинки — свои SVG из img/.
 * ═══════════════════════════════════════════════════════════════════════════ */

:root {
  --ny-gold: #f2c14e;
  --ny-gold-2: #ffe39a;
  --ny-red: #d6463e;
  --ny-red-2: #9e2a2e;
  --ny-green: #1f7a4a;
  --ny-snow: #f4f8ff;
  --ny-ice: #c3cdff;

  /* Страницы на общем шаблоне (главная, моды, кабинет, админка):
     фиолетовый сдвигается к «зимней ночи». */
  --accent: #a194ff;
  --accent2: #c9c0ff;
  --accent3: #6d5dfc;
  --glow: rgba(150, 160, 255, 0.32);
  --surface: #10132b;
  --surface2: #181c3d;
  --bg3: #0b0e23;
  --border: rgba(165, 180, 255, 0.16);
  --border2: rgba(165, 180, 255, 0.32);
  --text3: #7d8bb3;
}

/* ─── фон: та же картинка, но холоднее и с зимней дымкой ─────────────────── */
html::before {
  filter: blur(4px) brightness(1.12) contrast(1.14) saturate(0.82) hue-rotate(-22deg);
}
body::after {
  background:
    radial-gradient(70% 50% at 50% 32%, rgba(4, 8, 24, 0.5), transparent 72%),
    radial-gradient(1100px 720px at 80% -8%, rgba(140, 150, 255, 0.16), transparent 60%),
    radial-gradient(900px 760px at 0% 14%, rgba(120, 200, 255, 0.09), transparent 55%),
    radial-gradient(140% 55% at 50% 112%, rgba(205, 225, 255, 0.13), transparent 62%),
    rgba(5, 9, 28, 0.36);
}

/* ─── шапка ──────────────────────────────────────────────────────────────── */
nav {
  background: rgba(6, 9, 26, 0.93);
  border-bottom-color: rgba(190, 205, 255, 0.22);
}
.nav-logo { position: relative; }
/* Сугроб на квадратном логотипе слева от «KOSMOLAND» */
.nav-logo::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -7px;
  width: 50px;
  height: 14px;
  background: url('img/snowcap.svg') no-repeat center bottom / 100% 100%;
  filter: drop-shadow(0 1px 1px rgba(4, 13, 32, 0.5));
  pointer-events: none;
  z-index: 1;
}
/* Страницы входа/регистрации (styles.css): та же шапка снега на значке «K» */
.brand { position: relative; }
.brand::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -7px;
  width: 52px;
  height: 14px;
  background: url('img/snowcap.svg') no-repeat center bottom / 100% 100%;
  filter: drop-shadow(0 1px 1px rgba(4, 13, 32, 0.5));
  pointer-events: none;
  z-index: 2;
}

/* ─── гирлянда (строит newyear.js, только при html.ny-decor) ─────────────── */
.ny-garland {
  position: fixed;
  left: 0;
  width: 100%;
  height: 24px;
  z-index: 99;  /* под шапкой (100): выпадающий список языка в шапке — поверх гирлянды */
  pointer-events: none;
  overflow: hidden;
}
.ny-garland.ny-in-header {
  position: absolute;
  top: 100%;
  margin-top: -2px;
}
.ny-garland svg {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 24px;
}
.ny-bulb {
  position: absolute;
  top: 10px;
  width: 8px;
  height: 11px;
  margin-left: -4px;
  border-radius: 45% 45% 50% 50% / 40% 40% 60% 60%;
  background: radial-gradient(circle at 40% 35%, #fff 0%, var(--b) 48%, var(--b) 100%);
  box-shadow: 0 0 7px 1px var(--b), 0 0 16px 2px color-mix(in srgb, var(--b) 45%, transparent);
  /* Мерцание — только opacity: его анимирует компоновщик, без перерисовки. */
  animation: ny-twinkle var(--d, 2.8s) ease-in-out var(--dl, 0s) infinite alternate;
}
.ny-bulb::before {
  content: '';
  position: absolute;
  left: 2px;
  top: -3px;
  width: 4px;
  height: 3px;
  border-radius: 1px;
  background: #2a3152;
}
@keyframes ny-twinkle {
  from { opacity: 1; }
  to { opacity: 0.35; }
}

/* ─── снег (canvas от newyear.js) ────────────────────────────────────────── */
.ny-snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 60;
  pointer-events: none;
}

/* ─── герой главной ──────────────────────────────────────────────────────── */
.hero {
  position: relative;
  isolation: isolate;
}
/* Иней по верхним углам, как на замёрзшем окне */
.hero::before,
.hero::after,
.page-header::before,
.page-header::after {
  content: '';
  position: absolute;
  top: 0;
  width: clamp(150px, 16vw, 280px);
  aspect-ratio: 1;
  background: url('img/frost.svg') no-repeat left top / contain;
  opacity: 0.32;
  pointer-events: none;
  z-index: -1;
}
.hero::before,
.page-header::before { left: 0; }
.hero::after,
.page-header::after { right: 0; transform: scaleX(-1); }

.hero-title {
  background: linear-gradient(135deg, #ffffff 0%, #e4e9ff 28%, #b3a8ff 62%, #93b8ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub { color: var(--ny-ice); }

/* Ленточка «С Новым годом!» (newyear.js вставляет её после заголовка) */
.ny-ribbon {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0.35rem auto 1.1rem;
  padding: 7px 34px;
  font-family: var(--font-display, 'Orbitron', sans-serif);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--ny-gold-2);
  text-shadow: 0 1px 0 rgba(60, 10, 10, 0.6);
  background: linear-gradient(180deg, #d84a43 0%, #b8343a 55%, #9e2a2e 100%);
  box-shadow: inset 0 2px 0 rgba(255, 227, 154, 0.55), inset 0 -2px 0 rgba(255, 227, 154, 0.4), 0 6px 22px rgba(160, 30, 40, 0.35);
  clip-path: polygon(0 0, 100% 0, calc(100% - 14px) 50%, 100% 100%, 0 100%, 14px 50%);
  white-space: nowrap;
}
.ny-ribbon img {
  width: 16px;
  height: 16px;
  flex: none;
}
/* На входе/регистрации — по левому краю, над «АВТОРИЗАЦИЯ» */
.section-heading .ny-ribbon {
  margin: 0 0 14px;
  font-size: 12px;
  letter-spacing: 3px;
}

/* Иллюстрации по сторонам заголовка — только там, где есть свободное место */
.ny-art {
  position: absolute;
  aspect-ratio: 320 / 260;
  background: no-repeat center bottom / contain;
  pointer-events: none;
  z-index: -1;
  filter: drop-shadow(0 10px 18px rgba(2, 6, 20, 0.55));
}
.ny-art-tree { background-image: url('img/scene-tree.svg'); }
.ny-art-snowman { background-image: url('img/scene-snowman.svg'); }
.hero > .ny-art {
  top: clamp(110px, 14vh, 170px);
  width: clamp(210px, 16vw, 320px);
}
.hero > .ny-art-tree { left: max(16px, 3vw); }
.hero > .ny-art-snowman { right: max(16px, 3vw); }
.page-header { position: relative; isolation: isolate; }
.page-header > .ny-art {
  right: max(16px, 4vw);
  bottom: 0;
  height: 150px;
}
.auth-shell { position: relative; }
.auth-form > .ny-art {
  /* .auth-shell обрезает всё за своими краями (overflow-x:hidden в styles.css);
     между формой (520px) и краем блока (760px) как раз 240px — там и стоит */
  left: calc(100% + 20px);
  bottom: -6px;
  width: 200px;
  z-index: 0;
}
@media (max-width: 1279px) {
  .hero > .ny-art { display: none; }
}
@media (max-width: 819px) {
  .auth-form > .ny-art { display: none; }
}
@media (max-width: 900px) {
  .page-header > .ny-art { display: none; }
}

/* ─── главные кнопки героя ───────────────────────────────────────────────── */
.hero-btns > .btn-primary { position: relative; }
.hero-btns > .btn-primary:not(.btn-ip) {
  background: linear-gradient(180deg, #b3a6ff 0%, #9384ff 100%);
  box-shadow: 0 0 30px rgba(140, 150, 255, 0.4);
}
.hero-btns > .btn-primary:not(.btn-ip):hover {
  box-shadow: 0 0 40px rgba(160, 170, 255, 0.6), 0 0 14px rgba(255, 214, 110, 0.25);
}
.btn-ip { box-shadow: 0 0 30px rgba(140, 150, 255, 0.22); }
/* Сугробы на верхних углах кнопок героя */
.hero-btns > .btn-primary::before {
  content: '';
  position: absolute;
  left: -5px;
  right: -5px;
  top: -9px;
  height: 14px;
  background:
    url('img/snowcap.svg') no-repeat left bottom / 54% 100%,
    url('img/snowcap.svg') no-repeat right bottom / 24% 72%;
  filter: drop-shadow(0 1px 1px rgba(4, 13, 32, 0.45));
  pointer-events: none;
}
/* «Список модов» — ёлочный шар на правом краю, «Скачать» — звезда */
.hero-btns > .btn-primary:not(.btn-ip)::after {
  content: '';
  position: absolute;
  right: 18px;
  top: -3px;
  width: 24px;
  height: 32px;
  background: url('img/ornament.svg') no-repeat center top / contain;
  filter: drop-shadow(0 3px 3px rgba(20, 10, 40, 0.45));
  transform-origin: 50% 0;
  transition: transform 0.35s ease;
  pointer-events: none;
}
.hero-btns > a.btn-primary[href*="setup"]::after {
  top: 50%;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  background-image: url('img/star.svg');
  background-position: center;
  filter: drop-shadow(0 0 6px rgba(255, 214, 110, 0.85));
}
.hero-btns > .btn-primary:not(.btn-ip):hover::after { transform: rotate(-12deg); }
.hero-btns > a.btn-primary[href*="setup"]:hover::after { transform: rotate(20deg) scale(1.12); }

/* ─── карточки: снег по верхнему краю ────────────────────────────────────── */
/* У этих карточек overflow:hidden — снег лежит внутри, по кромке. */
.info-card::before,
.mods-sidebar::before,
.card::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: -1px;
  height: 15px;
  background:
    url('img/snowcap.svg') no-repeat left bottom / 42% 100%,
    url('img/snowcap.svg') no-repeat right bottom / 18% 70%;
  pointer-events: none;
  z-index: 2;
  opacity: 0.95;
}
@media (max-width: 900px) {
  .mods-sidebar { position: relative; }
}
.mods-sidebar .sidebar-header { padding-top: 1.45rem; }

/* Остальные карточки и кнопки — шапка сверху снаружи */
.mod-card-full,
.login-card,
.auth-form,
.admin-card,
.button.primary,
.login-btn {
  position: relative;
}
.mod-card-full::before,
.login-card::before,
.auth-form::before,
.admin-card::before,
.button.primary::before,
.login-btn::before {
  content: '';
  position: absolute;
  left: -4px;
  right: -4px;
  top: -8px;
  height: 13px;
  background:
    url('img/snowcap.svg') no-repeat left bottom / 46% 100%,
    url('img/snowcap.svg') no-repeat right bottom / 20% 70%;
  filter: drop-shadow(0 1px 1px rgba(4, 13, 32, 0.45));
  pointer-events: none;
  z-index: 1;
}
.login-card::before,
.auth-form::before {
  top: -11px;
  height: 18px;
  left: -6px;
  right: -6px;
}
.mod-card-full:hover { border-color: rgba(190, 205, 255, 0.4); }

/* Заголовки карточек: снежинка вместо обычного пикселя не нужна — только
   маленькая снежинка у «МОДЫ» на странице модов */
.page-title::after {
  content: '';
  display: inline-block;
  width: 0.62em;
  height: 0.62em;
  margin-left: 0.35em;
  vertical-align: 0.08em;
  background: url('img/snowflake.svg') no-repeat center / contain;
  opacity: 0.9;
}

/* ─── переключатель «Украшения» ──────────────────────────────────────────── */
.ny-toggle {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 150;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 14px 0 10px;
  border: 1px solid rgba(190, 205, 255, 0.35);
  border-radius: 999px;
  color: #e6ecff;
  background: rgba(8, 12, 32, 0.82);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  font: 600 13px/1 'Exo 2', Inter, system-ui, sans-serif;
  letter-spacing: 0.3px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, opacity 0.2s;
  opacity: 0.88;
}
.ny-toggle:hover,
.ny-toggle:focus-visible {
  opacity: 1;
  border-color: var(--ny-gold);
}
.ny-toggle:focus-visible { outline: 2px solid var(--ny-gold); outline-offset: 2px; }
.ny-toggle img {
  width: 18px;
  height: 18px;
  transition: transform 0.4s ease, opacity 0.2s;
}
.ny-toggle b { color: var(--ny-gold); font-weight: 700; }
.ny-toggle[aria-pressed="false"] img { opacity: 0.45; }
.ny-toggle[aria-pressed="false"] b { color: #9aa6c8; }
.ny-toggle:hover img { transform: rotate(60deg); }

/* ─── телефон ────────────────────────────────────────────────────────────── */
@media (max-width: 560px) {
  .ny-ribbon {
    font-size: 0.68rem;
    letter-spacing: 2.5px;
    padding: 6px 26px;
    gap: 8px;
  }
  .ny-ribbon img { width: 13px; height: 13px; }
  .ny-toggle {
    left: 10px;
    bottom: 10px;
    min-height: 34px;
    padding: 0 10px 0 8px;
    font-size: 12px;
  }
  .hero::before,
  .hero::after { width: 120px; }
  .page-header::before,
  .page-header::after { display: none; }
  .ny-bulb { width: 7px; height: 10px; margin-left: -3.5px; }
}

/* Меньше движения: огоньки горят ровно, без покачиваний */
@media (prefers-reduced-motion: reduce) {
  .ny-bulb { animation: none; opacity: 0.92; }
  .hero-btns > .btn-primary::after,
  .ny-toggle img { transition: none; }
}

/* поправки после просмотра скриншотов */
.page-header::before,
.page-header::after { width: clamp(110px, 10vw, 170px); opacity: 0.22; }
/* Над живой картой снег не нужен (если вкладка «КАРТА» — страница SPA
   с id="page-map": холст снега идёт в <body> после всех .page). */
#page-map.active ~ .ny-snow { display: none; }
