/* =========================================================
   Northern Lights — Transition Overlay
   Эффект: логотип/заголовок/подзаголовок плавно проявляются
   и "оседают" на финальную позицию с небольшой задержкой
   между элементами. Используется:
     1) при первом заходе на сайт (полная заставка)
     2) при смене языка (короткая версия)
     3) при переключении вкладок (короткая версия)
   ========================================================= */

:root {
  --nl-bg: #0a0c11;
  --nl-text: #E2E2E5;
  --nl-subtext: #E2E2E5;
  --nl-accent-1: #35c6c6;
  --nl-accent-2: #7b6cf6;
  --nl-accent-3: #c65fd8;
}

.nl-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--nl-bg);
  opacity: 1;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.nl-overlay.nl-hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}

/* Contents wrapper — lets us center logo+title+subtitle as a block */
.nl-splash {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  justify-content: center;
}

.nl-logo {
  /* высота = от верха "Northern" до низа "Virtual Trucking Company" */
  width: 100px;
  height: 100px;
  position: relative;
  top: 6px;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.5s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nl-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.nl-text-block {
  display: flex;
  flex-direction: column;
}

.nl-title {
  font-family: "Rubik", "Segoe UI", Arial, sans-serif;
  font-weight: 800;
  font-size: 60px;
  color: var(--nl-text);
  letter-spacing: -0.5px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.nl-subtitle {
  font-family: "Rubik", "Segoe UI", Arial, sans-serif;
  font-weight: 500;
  font-size: 22px;
  color: var(--nl-subtext);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}

/* Staggered entrance — driven by a class toggled via JS a tick after render */
.nl-overlay.nl-play .nl-logo {
  opacity: 1;
  transform: scale(1);
}

.nl-overlay.nl-play .nl-title {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.08s;
}

.nl-overlay.nl-play .nl-subtitle {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.32s;
}

/* Short variant — used for language/tab switches, no delay stagger needed
   since it's a much quicker flash rather than a first-load intro */
.nl-overlay.nl-short .nl-title {
  transition-delay: 0.03s;
}
.nl-overlay.nl-short .nl-subtitle {
  transition-delay: 0.1s;
}

/* Instant — text/logo appear already settled, no entrance animation.
   Used right after a page reload where the animation was already played
   on the previous page just before navigating away (see language switch). */
.nl-overlay.nl-instant .nl-logo,
.nl-overlay.nl-instant .nl-title,
.nl-overlay.nl-instant .nl-subtitle {
  transition: none !important;
}

/* Prevent scroll/interaction with page underneath while overlay is visible */
.nl-lock-scroll {
  overflow: hidden;
}

/* =========================================================
   MOBILE ONLY (≤ 600px) — десктоп не затронут.
   Логотип над текстом, всё по центру, заголовок в одну строку
   и масштабируется под ширину экрана.
   ========================================================= */
@media (max-width: 600px) {
  .nl-overlay {
    padding: 0 24px;
    box-sizing: border-box;
  }

  .nl-splash {
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 16px;
    width: 100%;
    text-align: center;
  }

  .nl-logo {
    width: 88px;
    height: 88px;
    top: 0;
  }

  .nl-text-block {
    align-items: center;
    text-align: center;
    width: 100%;
  }

  .nl-title {
    /* "Northern Lights" ≈ 8.8em шириной → подгоняем под экран */
    font-size: clamp(26px, calc((100vw - 48px) / 9.2), 44px);
    line-height: 1.1;
    white-space: nowrap;
    letter-spacing: -0.3px;
  }

  .nl-subtitle {
    font-size: clamp(14px, 4.4vw, 18px);
    margin-top: 6px;
    white-space: nowrap;
  }
}
