/* Hero entrance: branded loader, word-by-word title, signal sweep, autoplaying
   tablet and live chips. Timing is driven by body.is-ready (set by hero.js). */

/* ---------- Loader ---------- */
.loader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background: var(--color-bg);
  transition: transform 0.9s var(--ease-out-expo), opacity 0.6s;
}

.loader img {
  width: 64px;
  animation: loader-pulse 1.6s ease-in-out infinite;
}

.loader__word {
  margin: 0;
  font: 500 0.95rem / 1 var(--font-sans);
  letter-spacing: 0.5em;
  margin-right: -0.5em;
  color: var(--color-ink);
}

.loader__bar {
  width: 160px;
  height: 2px;
  background: var(--color-line);
  border-radius: 2px;
  overflow: hidden;
}

.loader__bar i {
  display: block;
  height: 100%;
  background: var(--color-brand);
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
  transition: transform 0.25s;
}

body.is-ready .loader { transform: translateY(-100%); pointer-events: none; }
body.is-intro { overflow: hidden; }

@keyframes loader-pulse { 50% { transform: scale(0.92); opacity: 0.7; } }

/* ---------- Staggered entrance ---------- */
.intro-item {
  opacity: 0;
  transform: translateY(22px);
}

body.is-ready .intro-item {
  opacity: 1;
  transform: none;
  transition: opacity 1s var(--ease-out-expo), transform 1s var(--ease-out-expo);
  transition-delay: calc(500ms + var(--d, 0) * 120ms);
}

/* Title words rise from behind a mask, one after another */
.hero__title .word {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}

.hero__title .word > span {
  display: inline-block;
  transform: translateY(110%);
}

body.is-ready .hero__title .word > span {
  transform: none;
  transition: transform 1.1s var(--ease-out-expo);
  transition-delay: calc(450ms + var(--w) * 75ms);
}

/* ---------- Signal sweep ---------- */
.hero__signal {
  position: absolute;
  inset: auto 0 12% 0;
  width: 100%;
  height: 46%;
  pointer-events: none;
}

.hero__signal path {
  fill: none;
  stroke: var(--color-brand);
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 2400;
  stroke-dashoffset: 2400;
  opacity: 0.55;
}

body.is-ready .hero__signal path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 2.4s cubic-bezier(0.65, 0, 0.35, 1) 0.6s;
}

/* ---------- Visual: autoplaying tablet + chips ---------- */
/* The oversized canvas and chips bleed past the column; keep them inside the hero */
.hero { overflow: clip; }

.hero__visual {
  position: relative;
  perspective: 1200px;
  opacity: 0;
}

body.is-ready .hero__visual { opacity: 1; transition: opacity 0.8s 0.4s; }

.hero__tilt {
  position: relative;
  transform: rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform 0.6s var(--ease-out-expo);
}

.hero__canvas {
  display: block;
  width: 150%;
  margin: -12% 0 -12% -24%;
  aspect-ratio: 16 / 9;
  -webkit-mask-image: radial-gradient(ellipse 58% 60% at 50% 50%, #000 60%, transparent 100%);
  mask-image: radial-gradient(ellipse 58% 60% at 50% 50%, #000 60%, transparent 100%);
}

.chip {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px -12px rgba(15, 27, 38, 0.28), inset 0 0 0 1px rgba(255, 255, 255, 0.9);
  font: 400 0.76rem / 1 var(--font-mono);
  color: var(--color-muted);
  white-space: nowrap;
  opacity: 0;
  transform: translateY(14px) scale(0.96);
}

.chip b { font-weight: 500; color: var(--color-ink); }
.chip em { font-style: normal; color: var(--color-muted); margin-left: -4px; }

.chip__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.18);
  animation: chip-blink 2s ease-in-out infinite;
}

.chip--a { top: 8%; left: 2%; }
.chip--b { top: 42%; right: -6%; }
.chip--c { bottom: 8%; left: 10%; }

body.is-ready .chip {
  opacity: 1;
  transform: none;
  transition: opacity 0.8s var(--ease-out-expo), transform 0.8s var(--ease-out-expo);
}

body.is-ready .chip--a { transition-delay: 2.7s; }
body.is-ready .chip--b { transition-delay: 2.95s; }
body.is-ready .chip--c { transition-delay: 3.2s; }

/* Gentle idle float once they are in */
body.is-ready .chip--a { animation: chip-float 6s ease-in-out 3.6s infinite; }
body.is-ready .chip--b { animation: chip-float 7s ease-in-out 3.8s infinite reverse; }
body.is-ready .chip--c { animation: chip-float 6.5s ease-in-out 4s infinite; }

@keyframes chip-blink { 50% { opacity: 0.4; } }
@keyframes chip-float { 50% { translate: 0 -8px; } }

@media (max-width: 768px) {
  .hero__canvas { width: 118%; margin-left: -9%; }
  .chip { font-size: 0.68rem; padding: 8px 11px; }
  .chip--b { right: 0; }
  .hero__signal { bottom: 30%; }
}

@media (prefers-reduced-motion: reduce) {
  .loader { display: none; }
  body.is-intro { overflow: auto; }
  .intro-item,
  .hero__visual,
  .chip,
  .hero__title .word > span { opacity: 1; transform: none; transition: none !important; animation: none !important; }
  .hero__signal path { stroke-dashoffset: 0; }
}
