/* ====================================================
   LOWKEY SYSTEM PRELOADER
   Preloads fonts, textures & scripts to eliminate jank
   ==================================================== */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 100000;
  background: #090a0f;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: all;
}

.preloader.is-loaded {
  opacity: 0;
  transform: scale(0.985);
  pointer-events: none;
}

.preloader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 280px;
}

.preloader-header {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.preloader-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.85);
  animation: preloader-pulse 1s ease-in-out infinite;
}

@keyframes preloader-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}

.preloader-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--text-muted);
}

.preloader-bar {
  width: 160px;
  height: 2px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
  position: relative;
}

.preloader-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #10b981, #34d399);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.8);
  transition: width 0.16s ease-out;
}

.preloader-status {
  width: 160px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text-subtle);
  letter-spacing: -0.01em;
}

.preloader-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preloader-pct {
  color: var(--text-muted);
  font-weight: 600;
}

/* ====================================================
   SIGNATURE HEADLINE INTRO SEQUENCE
   Snappy word reveal + smooth camera flight to #hero-title
   ==================================================== */

.boot {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
}

.boot__title {
  position: fixed;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  opacity: 0;
  will-change: transform;

  display: block;
  font-family: var(--font-sans);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.22;
  color: #fff;
  max-width: 820px;
}

@media (max-width: 992px) {
  .boot__title {
    font-size: 1.85rem;
  }
}

.boot__word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  padding: 0.12em 0 0.04em;
  margin: -0.12em 0 -0.04em;
}

.boot__word-in {
  display: inline-block;
  transform: translateY(132%);
  will-change: transform;
}

.boot__status {
  position: fixed;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  opacity: 0;
  will-change: transform, opacity;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-subtle);
}

.boot__status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.9);
  animation: boot-pulse 900ms ease-in-out infinite;
}

.boot__status.is-ready {
  color: var(--accent);
}

.boot__status.is-ready .boot__status-dot {
  animation: none;
  background: var(--accent);
}

@keyframes boot-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

/* Page holdback rules during intro */
html.is-intro-head #hero-title {
  opacity: 0 !important;
}

html.is-intro .hero-badge,
html.is-intro .bento-hero p,
html.is-intro .hero-cta-group,
html.is-intro .hero-stats-banner,
html.is-intro .tools-ribbon,
html.is-intro .bento-grid,
html.is-intro .bento-sidebar,
html.is-intro .mobile-top-header,
html.is-intro .mobile-dock,
html.is-intro #chat-btn,
html.is-intro .cursor-ring,
html.is-intro .cursor-dot,
html.is-intro .scroll-progress-track {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
  transform: translateY(14px);
}

html.is-intro .bento-sidebar {
  transform: translateX(-18px);
}

html.is-intro .bento-sidebar .nav-item {
  opacity: 0 !important;
  transform: translateX(-12px);
}

.bento-sidebar .nav-item {
  transition: opacity 0.4s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.bento-sidebar .nav-item:nth-child(2) { transition-delay: 80ms; }
.bento-sidebar .nav-item:nth-child(3) { transition-delay: 130ms; }
.bento-sidebar .nav-item:nth-child(4) { transition-delay: 180ms; }
.bento-sidebar .nav-item:nth-child(5) { transition-delay: 230ms; }

.hero-badge,
.bento-hero p,
.hero-cta-group,
.hero-stats-banner,
.tools-ribbon,
.bento-grid,
.bento-sidebar,
.mobile-top-header,
.mobile-dock,
#chat-btn {
  transition: opacity 0.52s cubic-bezier(0.16, 1, 0.3, 1), transform 0.65s cubic-bezier(0.16, 1, 0.3, 1);
}

.hero-badge { transition-delay: 50ms; }
.bento-hero p { transition-delay: 100ms; }
.hero-cta-group { transition-delay: 140ms; }
.hero-stats-banner { transition-delay: 180ms; }
.tools-ribbon { transition-delay: 220ms; }
.bento-grid { transition-delay: 260ms; }
#chat-btn { transition-delay: 300ms; }

@media (prefers-reduced-motion: reduce) {
  .preloader,
  .boot { display: none !important; }
  html.is-intro-head #hero-title,
  html.is-intro .hero-badge,
  html.is-intro .bento-hero p,
  html.is-intro .hero-cta-group,
  html.is-intro .hero-stats-banner,
  html.is-intro .tools-ribbon,
  html.is-intro .bento-grid,
  html.is-intro .bento-sidebar,
  html.is-intro .mobile-top-header,
  html.is-intro .mobile-dock,
  html.is-intro #chat-btn {
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
  }
}
