:root {
  --bg-main: radial-gradient(circle at top, #283e51 0%, #0a2342 45%, #050816 100%);
  --accent: #ffd56b;
  --accent-soft: rgba(255, 213, 107, 0.18);
  --accent-strong: #ffb347;
  --text-main: #f9fafb;
  --text-soft: #d1d5db;
  --card-bg: rgba(15, 23, 42, 0.78);
  --card-border: rgba(148, 163, 184, 0.45);
  --shadow-soft: 0 24px 60px rgba(15, 23, 42, 0.8);
  --radius-xl: 24px;
  --radius-full: 999px;
  --transition-fast: 0.25s ease-out;
  --container-width: 1024px;
  --section-padding-y: 80px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Nunito", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

/* Блокировка скролла при открытой модалке */
body.modal-open {
  overflow: hidden;
}

/* Слой "снега" — крупные хлопья, длинная бесшовная анимация */
.snow-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background-image:
    radial-gradient(8px 8px at 20px 20px, rgba(255, 255, 255, 0.95), transparent),
    radial-gradient(10px 10px at 80px 60px, rgba(255, 255, 255, 0.85), transparent),
    radial-gradient(6px 6px at 140px 40px, rgba(255, 255, 255, 0.9), transparent);
  background-repeat: repeat;
  /* размеры паттернов */
  background-size: 260px 260px, 320px 320px, 280px 280px;
  opacity: 0.45;
  /* очень длинная анимация, но без видимого рывка */
  animation: snow-fall 5s linear infinite;
}

@keyframes snow-fall {
  0% {
    background-position: 0 0, 0 0, 0 0;
  }
  100% {
    /* смещение кратно высоте паттерна — визуально шва не видно */
    background-position: 0 260px, 0 320px, 0 280px;
  }
}

/* Модалка */

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  opacity: 1;
  transition: opacity 0.25s ease-out;
}

.modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(15, 23, 42, 0.7), rgba(15, 23, 42, 0.95));
  backdrop-filter: blur(6px);
}

.modal-dialog {
  position: relative;
  z-index: 21;
  max-width: 360px;
  width: 100%;
  margin: 0 20px;
  padding: 22px 20px 20px;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.97), rgba(30, 64, 175, 0.9));
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.7);
  text-align: center;
}

.modal-question {
  margin: 0 0 16px;
  font-size: 17px;
  line-height: 1.5;
}

.modal-button {
  border: none;
  cursor: pointer;
  padding: 10px 28px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #1f2933;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  transform: translateY(0);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    filter var(--transition-fast);
}

.modal-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.7);
  filter: brightness(1.05);
}

.modal-button:active {
  transform: translateY(1px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}

/* Контейнер секций */

.section-inner {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 20px;
  position: relative;
  z-index: 2;
}

/* HERO */

.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  padding: 40px 20px 60px;
  transition: opacity 0.25s ease-out;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(248, 250, 252, 0.2), transparent 60%);
  opacity: 0.8;
  z-index: 0;
}

.hero-inner {
  position: relative;
  z-index: 2;
  max-width: 680px;
  padding: 32px 24px 40px;
  border-radius: 32px;
  background: linear-gradient(145deg, rgba(15, 23, 42, 0.9), rgba(30, 64, 175, 0.7));
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.7);
  color: var(--accent);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hero-badge::before,
.hero-badge::after {
  content: "✶";
  font-size: 13px;
}

.hero-title {
  margin: 18px 0 12px;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.2;
}

.hero-subtitle {
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-soft);
}

.hero-button {
  border: none;
  cursor: pointer;
  padding: 12px 28px;
  border-radius: var(--radius-full);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #1f2933;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45);
  transform: translateY(0);
  transition:
    transform var(--transition-fast),
    box-shadow var(--transition-fast),
    filter var(--transition-fast);
}

.hero-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6);
  filter: brightness(1.05);
}

.hero-button:active {
  transform: translateY(1px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

/* Основные секции */

.section {
  position: relative;
  padding: var(--section-padding-y) 0;
}

.section::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top left, rgba(56, 189, 248, 0.04), transparent 60%);
  opacity: 0.7;
  z-index: 0;
}

.section-title {
  font-size: clamp(22px, 3vw, 30px);
  margin: 0 0 20px;
}

.section-text {
  margin: 0 0 12px;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-soft);
}

.section-text-center {
  text-align: center;
}

.section-text.small {
  font-size: 14px;
}

.emphasis {
  color: var(--accent);
  font-weight: 600;
}

.section-note {
  margin-top: 20px;
  font-size: 13px;
  color: var(--text-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.section-note span {
  font-weight: 600;
  color: var(--accent);
}

/* Фото */

.section-photos .section-inner {
  text-align: center;
}

.photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 20px;
  margin-top: 26px;
}

.photo-frame {
  position: relative;
  padding: 2px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(248, 250, 252, 0.4), rgba(94, 234, 212, 0.1));
  box-shadow: 0 14px 40px rgba(15, 23, 42, 0.85);
}

.photo-inner {
  border-radius: 16px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.95);
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.photo-inner img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
  filter: grayscale(20%) contrast(1.05);
  transition:
    transform 0.4s ease-out,
    filter 0.4s ease-out;
}

.photo-frame:hover img {
  transform: scale(1.04);
  filter: grayscale(0) contrast(1.08);
}

.photo-label {
  padding: 10px 12px 12px;
  font-size: 13px;
  color: var(--text-soft);
  text-align: center;
  border-top: 1px solid rgba(148, 163, 184, 0.3);
}

/* === ТАЙМЛАЙН: дата слева, линия по центру, карточка справа === */

.section-timeline .section-inner {
  max-width: 760px;
}

/* общий контейнер линии */
.timeline {
  margin-top: 26px;
  position: relative;
}

/* вертикальная линия по центру между датой и карточкой */
.timeline::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 70px; /* линия на 70px от левого края секции */
  width: 2px;
  background: linear-gradient(
    to bottom,
    rgba(148, 163, 184, 0.4),
    rgba(248, 250, 252, 0.9)
  );
  z-index: 0;
}

.timeline-item {
  position: relative;
  margin-bottom: 40px;
  z-index: 1; /* выше линии */
}

/* дата строго слева от линии */
.timeline-label {
  position: absolute;
  left: 0;
  top: 8px;
  width: 60px;          /* ширина под дату */
  padding-right: 8px;   /* маленький отступ до линии */
  text-align: right;    /* текст прижат к линии */
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft);
  opacity: 0.9;
}

/* жёлтая точка — на линии, но не касается карточки */
.timeline-dot {
  position: absolute;
  left: 62px;           /* центр точки ровно на линии (70 - 8) */
  top: 16px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(255, 213, 107, 0.26);
  z-index: 2;
}

/* карточка всегда справа от линии */
.timeline-content {
  margin-left: 100px;   /* линия на 70, точка ~62, ещё >30px воздуха до карточки */
  background: var(--card-bg);
  border-radius: 18px;
  padding: 14px 16px 14px;
  border: 1px solid var(--card-border);
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.8);
  position: relative;
}

/* вариант с фото во всю карточку (как раньше) */
.timeline-content.timeline-has-photo {
  padding: 0;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #020617;
  cursor: pointer;
}

/* фото целиком, без обрезки */
.timeline-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 1;
  filter: none;
}

/* оверлей с текстом на всю карточку (прячется по клику) */
.timeline-body {
  position: absolute;
  inset: 0;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(
    135deg,
    rgba(15, 23, 42, 0.85),
    rgba(15, 23, 42, 0.7)
  );
  transition: opacity 0.3s ease-out;
}

.timeline-title {
  margin: 0 0 8px;
  font-size: 16px;
}

.timeline-text {
  margin: 0;
  font-size: 14px;
  color: var(--text-soft);
}

.highlight {
  color: var(--accent);
  font-weight: 600;
}

.line-through {
  text-decoration: line-through;
  color: var(--text-soft);
}

/* когда по карточке кликнули — убираем оверлей */
.timeline-content.overlay-hidden .timeline-body {
  opacity: 0;
  pointer-events: none;
}

/* мобильная подстройка таймлайна */
@media (max-width: 480px) {
  .timeline::before {
    left: 60px;
  }

  .timeline-dot {
    left: 52px;
  }

  .timeline-label {
    width: 52px;
    font-size: 11px;
  }

  .timeline-content {
    margin-left: 90px;
  }

  .timeline-content.timeline-has-photo {
    aspect-ratio: 16 / 10;
  }
}


/* Мобильная подстройка */
@media (max-width: 480px) {
  .timeline {
    padding-left: 100px;
  }

  .timeline::before {
    left: 70px;
  }

  .timeline-dot {
    left: 62px;
  }

  .timeline-label {
    width: 60px;
    font-size: 11px;
  }

  .timeline-content.timeline-has-photo {
    aspect-ratio: 16 / 10;
  }
}

/* Финальный блок */

.section-final {
  padding-bottom: 90px;
}

.final-inner {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
  background: radial-gradient(circle at top left, rgba(248, 250, 252, 0.1), transparent 55%),
              radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.15), transparent 60%);
  border-radius: 28px;
  padding: 30px 20px 32px;
  border: 1px solid rgba(148, 163, 184, 0.6);
  box-shadow: var(--shadow-soft);
}

.script-font {
  font-family: "Marck Script", "Nunito", cursive;
}

.final-image {
  display: block;
  width: 100%;
  max-width: 420px;          /* чтобы не разъезжалась */
  margin: 18px auto 14px;    /* аккуратные отступы */
  object-fit: contain;       /* НЕ обрезаем */
  border-radius: 14px;
}

.signature {
  margin-top: 22px;
  font-size: 26px;
}

/* Подвал */

.footer {
  padding: 22px 16px 30px;
  text-align: center;
  font-size: 12px;
  color: var(--text-soft);
  border-top: 1px solid rgba(148, 163, 184, 0.25);
}

/* Анимация появления при скролле */

.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.8s ease-out,
    transform 0.8s ease-out;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Адаптив */

@media (max-width: 768px) {
  :root {
    --section-padding-y: 60px;
  }

  .hero-inner {
    padding: 26px 18px 30px;
  }

  .photos-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-inner img {
    height: 150px;
  }

  .timeline {
    padding-left: 16px;
  }

  .timeline::before {
    left: 8px;
  }

  .timeline-dot {
    left: 0;
  }

  .final-inner {
    padding: 26px 18px 30px;
  }

  .signature {
    font-size: 22px;
  }

  .modal-dialog {
    padding: 20px 18px 18px;
  }
}

@media (max-width: 480px) {
  .photos-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .hero-title {
    font-size: 26px;
  }

  .hero-subtitle {
    font-size: 14px;
  }

  .hero-button {
    width: 100%;
  }
}

/* === MOBILE PATCH (узкие экраны) === */
@media (max-width: 520px) {

  /* общий контейнер — меньше боковые отступы */
  .section-inner {
    padding: 22px 14px 0 14px;
  }

  /* фото-карточки */
  .photo-inner img {
    height: 400px;
  }

  /* таймлайн: делаем линию ближе к краю, карточку на всю ширину */
  .timeline {
    padding-left: 0 !important;
  }

  .timeline::before {
    left: 18px !important;
  }

  .timeline-item {
    padding-left: 0 !important;
    margin-bottom: 26px !important;
  }

  .timeline-dot {
    left: 10px !important;
    top: 18px !important;
  }

  /* дата переносится вверх, чтобы не “липла” на фото */
  .timeline-label {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: auto !important;
    text-align: left !important;
    padding: 0 0 8px 38px !important; /* отступ чтобы не залезать на линию */
    font-size: 12px !important;
    opacity: 0.9;
  }

  /* карточка уходит вправо от линии, но на всю доступную ширину */
  .timeline-content {
    margin-left: 38px !important;
    width: calc(100% - 38px) !important;
    max-width: calc(100% - 38px) !important;
  }

  /* фото-таймлайн: на мобилке лучше слегка выше, чтобы текст читался */
  .timeline-content.timeline-has-photo {
    aspect-ratio: 16 / 10 !important;
  }

  /* оверлей текста: чуть компактнее */
  .timeline-body {
    padding: 14px 14px !important;
  }

  .timeline-title {
    font-size: 15px !important;
  }

  .timeline-text {
    font-size: 13px !important;
    line-height: 1.55;
  }
}

.countdown {
  margin: 14px 0 10px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.countdown-item {
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.55);
  border-radius: 14px;
  padding: 10px 8px;
}

.countdown-num {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--accent);
  line-height: 1.1;
}

.countdown-label {
  margin-top: 4px;
  font-size: 11px;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Прячем hero только когда открыт countdown */
#countdown-modal:not(.hidden) ~ header.hero {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease-out;
}

/* чтобы плавно возвращалось */
header.hero {
  transition: opacity 0.25s ease-out;
}

body.modal-open-intro {
  overflow: hidden;
}

/* До инициализации прячем контент, чтобы не мигал */
html.preload body > header,
html.preload body > main,
html.preload body > footer {
  opacity: 0;
}

/* Снег оставляем видимым всегда */
html.preload .snow-layer {
  opacity: 0.45; /* или как у тебя было */
}

/* Модалки тоже можно показывать сразу (когда скрытый класс снят) */
html.preload .modal {
  opacity: 1;
}
