/* ============================================================
   LOADER  ·  Loading screen · Learn-page animation · Preloader states
   ============================================================ */

/* ── Unified full-page loader overlay ── */
#loading-screen,
#loading-screen.show {
  position: fixed;
  inset: 0;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #1e1030;
  z-index: 10000;
  font-family: var(--font-heading, serif);
  color: #fff;
  padding: 0;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.6s ease-out, visibility 0.6s ease-out;
}
#loading-screen.hidden {
  opacity: 0;
  visibility: hidden;
  transition: opacity 600ms ease, visibility 600ms ease;
}

/* Landing-page loading text */
body.landing-page-body #loading-screen #loading-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 30ch;
  padding-left: 9ch;
  box-sizing: border-box;
  font-family: var(--font-heading, serif);
}
@media (max-width: 767px) {
  #loading-screen #loading-text {
    position: static !important;
    transform: none !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 1rem !important;
    font-size: 1.8rem !important;
    font-weight: 600 !important;
    white-space: normal !important;
    overflow-wrap: break-word !important;
    text-align: center !important;
    box-sizing: border-box !important;
  }
}

/* Hide page content until loading screen finishes */
body.loading-active > :not(#loading-screen) {
  display: none !important;
}

/* ── Learn page ── */
body.learn-page-body #loading-text,
body.learn-page-body #loading-text * {
  color: #000 !important;
}
body.learn-page-body .accent-word {
  color: #000 !important;
}
body.learn-page-body {
  background: #1e1030 !important;
}

/* ── Preloader × landing cross-fade ── */

/* Keep loader visible while body has .landing-loading */
body.landing-loading #loading-screen {
  display: flex !important;
  align-items: center;
  justify-content: center;
  opacity: 1;
  visibility: visible;
}

/* Hide hero elements while loader is up */
body.landing-loading .landing-header,
body.landing-loading .video-background-container,
body.landing-loading .landing-text-overlay,
body.landing-loading .landing-button {
  opacity: 0;
  visibility: hidden;
  transition: opacity 600ms ease, visibility 600ms ease;
}

/* Reveal hero once .landing-loading is removed */
body:not(.landing-loading) .landing-header,
body:not(.landing-loading) .video-background-container,
body:not(.landing-loading) .landing-text-overlay,
body:not(.landing-loading) .landing-button {
  opacity: 1;
  visibility: visible;
}

/* ── Learn page desktop tweaks ── */
body.learn-page-body #loading-text {
  width: 90% !important;
  max-width: 1200px !important;
  padding-left: 0 !important;
  text-align: center !important;
  white-space: normal !important;
  overflow-wrap: break-word !important;
}
body.learn-page-body #loading-screen {
  align-items: flex-start;
  justify-content: center;
  padding-top: 18vh;
}

/* "You are " prefix + dynamic word layout */
.hero-human-animation {
  position: absolute !important;
  top: 50% !important;
  left: 44% !important;
  transform: translateY(-50%) !important;
  width: 0 !important;
  height: auto !important;
}
#loading-prefix {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  white-space: nowrap !important;
}
#loading-word {
  position: absolute !important;
  top: 0 !important;
  left: 5.5ch !important;
  white-space: nowrap !important;
}

@media (max-width: 767px) {
  body.learn-page-body #loading-screen,
  body.learn-page-body #loading-screen.show {
    align-items: flex-start !important;
    justify-content: center !important;
    padding-top: 24vh !important;
  }
  body.learn-page-body #loading-text {
    position: static !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    width: 95% !important;
    max-width: none !important;
    padding: 0 !important;
    text-align: center !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: clip !important;
    font-size: 2.2rem !important;
  }
  body.learn-page-body .hero-simple h1 {
    width: 90% !important;
    font-size: 2rem !important;
    padding: 0 !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
  }
  .hero-human-animation {
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 100% !important;
    text-align: center !important;
    white-space: normal !important;
    margin-top: 1.5rem !important;
  }
  #loading-prefix,
  #loading-word {
    position: static !important;
    display: block !important;
    width: 100% !important;
    margin: 0 auto !important;
    text-align: center !important;
    white-space: normal !important;
  }
}
