/* =============================================================================
   PSTU Conference Platform — Hero Section
   100vh · фон --color-primary-dark · геометрические декорации · stagger
   ============================================================================= */

@import './variables.css';


/* =============================================================================
   HERO — Корневой элемент
   ============================================================================= */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;

  /* Основной фон */
  background-color: var(--color-primary-dark);

  /* ── Декорация 1: Тонкая сетка линий 60×60px ── */
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.020) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.020) 1px, transparent 1px);
  background-size: 60px 60px;
}

/* Нижний градиент — помогает читаемости над fold */
.hero::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 220px;
  background: linear-gradient(to bottom, transparent, rgba(10, 42, 84, 0.45));
  pointer-events: none;
  z-index: 0;
}


/* =============================================================================
   HERO-BG — Декоративный слой (absolute fill)
   ============================================================================= */

.hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

/* ── Декорация 2: Диагональный бордовый градиент (skewX) ── */
.hero-bg::before {
  content: '';
  position: absolute;
  top: -30%;
  left: -5%;
  width: 55%;
  height: 160%;
  background: linear-gradient(
    140deg,
    var(--color-secondary) 0%,
    var(--color-secondary-dark) 40%,
    transparent 75%
  );
  transform: skewX(-12deg);
  opacity: 0.15;
  transform-origin: top left;
}

/* ── Декорация 4: Точечный паттерн ── */
.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(
    rgba(255, 255, 255, 0.14) 1px,
    transparent 1px
  );
  background-size: 120px 120px;
  background-position: 30px 30px;
  /* Не дублируем с сеткой — смещение 30px */
}

/* ── Декорация 3: Три декоративных круга ── */

.hero-bg__circle {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.07);
}

/* Большой — справа сверху */
.hero-bg__circle:nth-child(1) {
  width: 580px;
  height: 580px;
  right: -120px;
  top: -160px;
  animation: heroFloat 18s ease-in-out infinite;
}

/* Средний — правее, с бордовым оттенком */
.hero-bg__circle:nth-child(2) {
  width: 340px;
  height: 340px;
  right: 80px;
  top: 120px;
  border-color: rgba(172, 20, 34, 0.18);
  animation: heroFloat 14s ease-in-out infinite reverse;
  animation-delay: -4s;
}

/* Малый — слева снизу */
.hero-bg__circle:nth-child(3) {
  width: 180px;
  height: 180px;
  left: -40px;
  bottom: 120px;
  border-color: rgba(255, 255, 255, 0.05);
  animation: heroFloat 20s ease-in-out infinite;
  animation-delay: -9s;
}

@keyframes heroFloat {
  0%, 100% {
    transform: translateY(0)    rotate(0deg)   scale(1);
  }
  33% {
    transform: translateY(-24px) rotate(4deg)   scale(1.01);
  }
  66% {
    transform: translateY(16px)  rotate(-3deg)  scale(0.99);
  }
}


/* =============================================================================
   HERO INNER — Контейнер контента
   ============================================================================= */

.hero__inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding);
  padding-top: calc(var(--header-h) + 3rem);
  padding-bottom: 5rem;
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
}


/* =============================================================================
   HERO CONTENT — Основной текстовый блок
   ============================================================================= */

.hero__content {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  max-width: 820px;
}


/* =============================================================================
   BADGE — «🔬 Регистрация открыта»
   Скрыт по умолчанию, показывается через data-attribute
   ============================================================================= */

/*
   Управление видимостью — CSS-only через body[data-conference-status]:
   <body data-conference-status="registration_open">
   Значение устанавливает PHP / Битрикс.

   Альтернативно JS добавляет класс .is-visible
   (см. countdown.js → initStatusElements)
*/

.hero__badge {
  display: none; /* скрыт по умолчанию */
  align-items: center;
  gap: var(--space-2);
  align-self: flex-start;
  padding: 0.4rem 1rem 0.4rem 0.75rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-full);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-family: var(--font-family);
  font-size: var(--text-small);
  font-weight: var(--font-medium);
  letter-spacing: 0.01em;
  color: rgba(255, 255, 255, 0.92);
  animation: fadeInUp 0.6s var(--ease-out) 0.2s both;
}

/* Показываем при статусе конференции */
body[data-conference-status="registration_open"] .hero__badge,
.hero__badge.is-visible {
  display: inline-flex;
}

/* Пульсирующая зелёная точка */
.hero__badge-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background-color: var(--color-success);
  flex-shrink: 0;
  animation: badgePulse 2.2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes badgePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
    opacity: 1;
  }
  60% {
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    opacity: 0.85;
  }
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    opacity: 1;
  }
}


/* =============================================================================
   TITLE
   ============================================================================= */

.hero__title {
  font-size: var(--text-hero);
  font-weight: var(--font-extrabold);
  line-height: var(--leading-tight);
  letter-spacing: -0.03em;
  color: var(--color-white);
  margin: 0;
  animation: fadeInUp 0.75s var(--ease-out) 0.4s both;
}

/* Слово «конференция» — приглушённый */
.hero__title-dim {
  color: rgba(255, 255, 255, 0.55);
}

/* Акцентное выделение (опционально) — бордовый underline */
.hero__title-accent {
  position: relative;
  display: inline;
}

.hero__title-accent::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0.05em;
  width: 100%;
  height: 0.06em;
  background-color: var(--color-secondary-light);
  border-radius: var(--radius-full);
}


/* =============================================================================
   SUBTITLE
   ============================================================================= */

.hero__subtitle {
  font-size: clamp(1rem, 1.6vw, 1.25rem);
  font-weight: var(--font-light);
  line-height: var(--leading-relaxed);
  color: rgba(255, 255, 255, 0.70);
  max-width: 640px;
  margin: 0;
  animation: fadeInUp 0.75s var(--ease-out) 0.6s both;
}


/* =============================================================================
   META — дата · место · участники
   ============================================================================= */

.hero__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  padding: 0;
  margin: 0;
  list-style: none;
  animation: fadeInUp 0.75s var(--ease-out) 0.8s both;
}

.hero__meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-small);
  font-weight: var(--font-medium);
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.hero__meta-icon {
  font-size: 1em;
  line-height: 1;
  flex-shrink: 0;
}

/* Разделитель · между элементами */
.hero__meta-sep {
  color: rgba(255, 255, 255, 0.25);
  font-size: 1.2em;
  line-height: 1;
  user-select: none;
}


/* =============================================================================
   CTA — Кнопки регистрации
   ============================================================================= */

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-4);
  animation: fadeInUp 0.75s var(--ease-out) 1.0s both;
}

/* btn-secondary адаптирован под тёмный hero */
.hero__cta .btn-secondary {
  background-color: transparent;
  color: rgba(255, 255, 255, 0.88);
  border-color: rgba(255, 255, 255, 0.32);
}

.hero__cta .btn-secondary:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.60);
  color: var(--color-white);
  transform: translateY(-1px);
  box-shadow: none;
}

.hero__cta .btn-secondary:active:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.06);
  transform: translateY(0);
}

.hero__cta .btn-secondary:focus-visible {
  outline-color: rgba(255, 255, 255, 0.7);
}


/* =============================================================================
   COUNTDOWN — Обратный отсчёт
   ============================================================================= */

.countdown {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  animation: fadeInUp 0.75s var(--ease-out) 1.2s both;
}

/* Заголовок над таймером */
.countdown__heading {
  font-size: var(--text-tiny);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.58);
}

/* Контейнер ячеек */
.countdown__numbers {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-md);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Ячейка (число + подпись) */
.countdown__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  min-width: 3.5rem;
}

/* Число */
.countdown__number {
  display: block;
  font-size: clamp(2rem, 4vw, 3.5rem);
  font-weight: var(--font-bold);
  letter-spacing: -0.04em;
  color: var(--color-white);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  /* Минимальная ширина — не прыгают соседи при смене 2-знак → 1-знак */
  min-width: 2ch;
  text-align: center;
}

/* Анимация при изменении числа */
.countdown__number.is-ticking {
  animation: cdTick 200ms var(--ease-out);
}

@keyframes cdTick {
  from {
    opacity: 0.5;
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Подпись под числом */
.countdown__label {
  font-size: 0.65rem;
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.58);
  line-height: 1;
}

/* Разделитель : между ячейками */
.countdown__sep {
  font-size: clamp(1.5rem, 3vw, 2.5rem);
  font-weight: var(--font-light);
  color: rgba(255, 255, 255, 0.20);
  line-height: 1;
  align-self: flex-start;
  padding-top: 0.1em;
  user-select: none;
  flex-shrink: 0;
}

/* Сообщение об окончании (вместо чисел) */
.countdown__message {
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: var(--font-semibold);
  color: rgba(255, 255, 255, 0.88);
  padding: var(--space-4) var(--space-6);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-md);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  max-width: none;
  margin: 0;
  animation: fadeInUp 0.5s var(--ease-out) both;
}

.countdown__message[hidden],
.countdown__numbers[hidden] {
  display: none;
}


/* =============================================================================
   SCROLL INDICATOR — Анимированная стрелка вниз
   ============================================================================= */

.hero__scroll {
  position: absolute;
  bottom: 1.75rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-1);
  color: rgba(255, 255, 255, 0.30);
  text-decoration: none;
  cursor: pointer;
  border: none;
  background: none;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  transition: color var(--transition-fast);
  /* Появляется после всех stagger-анимаций */
  animation:
    fadeInUp     0.6s var(--ease-out) 1.6s both,
    heroBounce   2.8s ease-in-out     2.2s infinite;
}

.hero__scroll:hover,
.hero__scroll:focus-visible {
  color: rgba(255, 255, 255, 0.70);
}

.hero__scroll:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 3px;
}

/* Короткая вертикальная линия над стрелкой */
.hero__scroll-line {
  width: 1px;
  height: 28px;
  background: linear-gradient(to bottom, transparent, currentColor);
  border-radius: var(--radius-full);
}

/* SVG-стрелка (чевron) */
.hero__scroll svg {
  display: block;
  flex-shrink: 0;
}

@keyframes heroBounce {
  0%, 100% {
    transform: translateX(-50%) translateY(0);
  }
  50% {
    transform: translateX(-50%) translateY(10px);
  }
}


/* =============================================================================
   АНИМАЦИИ — используем fadeInUp из base.css
   Stagger-цепочка встроена через animation-delay на каждый элемент
   ============================================================================= */

/*
  Порядок анимаций при загрузке:
  0.2s — badge
  0.4s — title
  0.6s — subtitle
  0.8s — meta
  1.0s — cta
  1.2s — countdown
  1.6s — scroll indicator

  Используем keyframe fadeInUp из base.css (opacity 0→1, translateY 32→0)
  fill-mode: both — элемент невидим до начала, остаётся видимым после.
*/


/* =============================================================================
   АДАПТИВ — Мобильные устройства
   ============================================================================= */

/* Планшеты (≤1024px) */
@media (max-width: 1024px) {
  .hero__inner {
    padding-top: calc(var(--header-h) + 2rem);
    gap: var(--space-10, 2.5rem);
  }

  .hero-bg__circle:nth-child(1) {
    width: 420px;
    height: 420px;
  }

  .hero-bg__circle:nth-child(2) {
    width: 240px;
    height: 240px;
  }
}

/* Мобильные (≤768px) */
@media (max-width: 768px) {
  .hero__inner {
    padding-top: calc(var(--header-h-mobile) + 1.5rem);
    padding-bottom: 4rem;
    gap: var(--space-8);
  }

  .hero__content {
    gap: var(--space-4);
  }

  /* CTA — вертикально на мобиле */
  .hero__cta {
    flex-direction: column;
    align-items: stretch;
  }

  .hero__cta .btn {
    width: 100%;
    justify-content: center;
  }

  /* Countdown 2×2 — см. responsive.css (≤900px) */

  /* Убираем декоративные круги на маленьких экранах (производительность) */
  .hero-bg__circle:nth-child(1) {
    width: 300px;
    height: 300px;
    right: -100px;
    top: -80px;
  }

  .hero-bg__circle:nth-child(2),
  .hero-bg__circle:nth-child(3) {
    display: none;
  }

  /* Скролл-индикатор скрываем (экономим место) */
  .hero__scroll {
    display: none;
  }
}

/* Маленькие телефоны (≤480px) */
@media (max-width: 480px) {
  .hero__meta {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-2);
  }

  .hero__meta-sep {
    display: none;
  }
}
