/* Introdução inspirada no ohzi.io (overlay montado pelo intro.js): wireframe do
   símbolo + barra de boot, materialização sobre piso de grade com reflexo e o
   voo até o logo do header. Enquanto ela está na frente, a intro do hero espera. */
html.intro-lock {
  overflow: hidden;
}
body:has(> .intro:not(.leaving)) :is(.top, .hero *, .lang, .lang-note),
body:has(> .intro:not(.leaving)) .frame::before,
body:has(> .intro:not(.leaving)) .frame::after,
body:has(> .intro:not(.leaving)) .stars::after {
  animation-play-state: paused !important;
}

.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: hidden;
  text-align: center;
  outline: none;
}
.intro.leaving {
  pointer-events: none;
}
.intro-bg {
  position: absolute;
  inset: 0;
  background: radial-gradient(90% 60% at 50% 0%, #0a1820, transparent 70%), var(--bg);
  transition: opacity 1s ease 0.15s;
}
.intro.leaving .intro-bg {
  opacity: 0;
}
.intro .spot {
  opacity: 0;
  animation: none;
  transition: opacity 1.4s ease 0.2s;
}
.intro.ready .spot {
  opacity: 1;
}
@keyframes intro-in {
  from {
    opacity: 0;
  }
}
.intro-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 1px solid rgba(0, 240, 255, 0.35);
  animation: intro-in 1s ease 0.2s both;
}
.intro-corner.tl {
  top: 20px;
  left: 20px;
  border-width: 1px 0 0 1px;
}
.intro-corner.tr {
  top: 20px;
  right: 20px;
  border-width: 1px 1px 0 0;
}
.intro-corner.bl {
  bottom: 20px;
  left: 20px;
  border-width: 0 0 1px 1px;
}
.intro-corner.br {
  bottom: 20px;
  right: 20px;
  border-width: 0 1px 1px 0;
}
.intro-tag,
.intro-skip {
  position: absolute;
  top: 28px;
  font: 400 0.66rem/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-3);
}
.intro-tag {
  left: 60px;
  animation: intro-in 1s ease 0.3s both;
}
.intro-skip {
  right: 56px;
  top: 18px;
  z-index: 2;
  padding: 10px 4px;
  border: 0;
  background: none;
  cursor: pointer;
  transition:
    color 0.2s ease-out,
    opacity 0.3s ease;
}
.intro-skip:hover {
  color: var(--text);
}
.intro.leaving .intro-skip {
  opacity: 0;
}

/* ── Palco ──────────────────────────────────────────────────────────────── */
.intro-ui {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--gutter);
}
.intro-title,
.intro-sub {
  margin: 0;
  text-wrap: balance;
  opacity: 0;
  transform: translateY(10px);
  transition:
    opacity 1.2s ease 0.5s,
    transform 1.2s var(--ease-out) 0.5s;
}
.intro-title {
  font: 700 clamp(1.5rem, 4.4vw, 2.9rem) / 1.1 var(--display);
  background: linear-gradient(180deg, #f6feff 30%, #8fdcec 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.intro-sub {
  margin-top: 12px;
  color: var(--text-2);
  transition-delay: 0.7s;
}
.ready .intro-title,
.ready .intro-sub {
  opacity: 1;
  transform: none;
}
.go .intro-title,
.go .intro-sub {
  opacity: 0;
  transform: translateY(-8px);
  transition-duration: 0.35s;
  transition-delay: 0s;
}
.intro-mark-wrap {
  position: relative;
  width: clamp(104px, 22vw, 150px);
  aspect-ratio: 243 / 351;
  margin-top: clamp(32px, 7vh, 64px);
}
.intro-mark,
.intro-float,
.intro-solid,
.intro-wire {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.intro-mark {
  z-index: 2;
}
.ready .intro-float {
  animation: hover 6s ease-in-out infinite;
}
@keyframes hover {
  0%,
  100% {
    transform: perspective(600px) translateY(0) rotateY(-12deg);
  }
  50% {
    transform: perspective(600px) translateY(-10px) rotateY(12deg);
  }
}

/* Wireframe: cada traço se desenha (pathLength=1) e some quando o sólido acende. */
.intro-wire {
  overflow: visible;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.8));
  transition: opacity 0.8s ease 0.35s;
}
.intro-wire path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: wire 1.2s var(--ease-ui) calc(var(--k) * 60ms + 0.15s) forwards;
}
.intro-wire .hot {
  stroke: var(--action);
}
@keyframes wire {
  to {
    stroke-dashoffset: 0;
  }
}
.ready .intro-wire {
  opacity: 0;
}
.intro-solid {
  opacity: 0;
  filter: drop-shadow(0 0 18px rgba(0, 240, 255, 0.45));
}
.ready .intro-solid {
  opacity: 1;
  animation: materialize 1s linear both;
}
@keyframes materialize {
  0% {
    opacity: 0;
  }
  12% {
    opacity: 0.75;
  }
  18% {
    opacity: 0.15;
  }
  30% {
    opacity: 0.9;
  }
  38% {
    opacity: 0.4;
  }
  55%,
  100% {
    opacity: 1;
  }
}
.go .intro-solid {
  animation: charge 0.55s ease-out both;
}
@keyframes charge {
  40% {
    filter: brightness(2) drop-shadow(0 0 36px rgba(0, 240, 255, 0.9));
  }
  100% {
    filter: brightness(1.25) drop-shadow(0 0 22px rgba(0, 240, 255, 0.6));
  }
}
.intro-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 150%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(0, 240, 255, 0.8);
  box-shadow: 0 0 24px rgba(0, 240, 255, 0.4);
  transform: translate(-50%, -50%) scale(0.4);
  opacity: 0;
  pointer-events: none;
}
.go .intro-ring {
  animation: ring 0.8s var(--ease-out) forwards;
}
@keyframes ring {
  0% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.9);
  }
}

/* Piso de grade em perspectiva, poça de luz e reflexo invertido. */
.intro-floor,
.intro-pool,
.intro-reflect {
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s ease 0.2s;
}
.ready .intro-floor,
.ready .intro-pool {
  opacity: 1;
}
.ready .intro-reflect {
  opacity: 0.35;
  animation: hover-mirror 6s ease-in-out infinite;
}
.leaving .intro-floor,
.leaving .intro-pool,
.leaving .intro-reflect {
  opacity: 0;
  transition-duration: 0.8s;
  transition-delay: 0s;
}
.intro-floor {
  left: 50%;
  top: calc(100% + 14px);
  width: 300vw;
  height: 60vh;
  transform: translateX(-50%);
  overflow: hidden;
  perspective: 320px;
  perspective-origin: 50% 0;
  mask-image: linear-gradient(180deg, transparent, #000 25%, #000 55%, transparent);
}
.intro-floor i {
  position: absolute;
  inset: 0 0 auto;
  height: 400%;
  transform-origin: 50% 0;
  transform: rotateX(76deg);
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.2) 1px, transparent 1px);
  background-size: 44px 44px;
  background-position: 50% 0;
  animation: grid 3s linear infinite;
}
@keyframes grid {
  to {
    background-position: 50% 44px;
  }
}
.intro-pool {
  left: 50%;
  top: calc(100% + 14px);
  width: 280%;
  height: 70px;
  transform: translate(-50%, -50%);
  background: radial-gradient(closest-side, rgba(0, 240, 255, 0.4), transparent);
  filter: blur(6px);
}
.intro-reflect {
  left: 0;
  top: calc(100% + 28px);
  width: 100%;
  height: auto;
  filter: blur(1.5px);
  transform: scaleY(-1);
  mask-image: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent 55%);
}
@keyframes hover-mirror {
  0%,
  100% {
    transform: perspective(600px) scaleY(-1) translateY(0) rotateY(-12deg);
  }
  50% {
    transform: perspective(600px) scaleY(-1) translateY(-10px) rotateY(12deg);
  }
}

/* ── Boot e entrada ─────────────────────────────────────────────────────── */
.intro-foot {
  position: relative;
  width: 240px;
  height: 96px;
  margin-top: clamp(48px, 10vh, 96px);
}
.intro-boot {
  position: absolute;
  inset: 0 0 auto;
  transition: opacity 0.5s ease;
}
.ready .intro-boot {
  opacity: 0;
}
.intro-bar {
  height: 2px;
  border-radius: 2px;
  background: rgba(0, 240, 255, 0.14);
  overflow: hidden;
}
.intro-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, rgba(0, 240, 255, 0.4), var(--accent));
  box-shadow: 0 0 10px var(--accent);
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.intro-boot-row {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
  font: 400 0.64rem/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-3);
}
.intro-pct {
  color: var(--accent);
}
.intro-go-wrap {
  position: absolute;
  inset: 0 0 auto;
  display: grid;
  justify-items: center;
  gap: 16px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition:
    opacity 1s ease 0.9s,
    transform 1s var(--ease-out) 0.9s,
    visibility 0s 0.9s;
}
.ready .intro-go-wrap {
  opacity: 1;
  visibility: visible;
  transform: none;
}
.go .intro-go-wrap {
  opacity: 0;
  transition: opacity 0.3s ease;
}
.intro-go {
  font: 400 0.78rem/1 var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.intro-hint {
  font: 400 0.62rem/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-3);
}
.intro-hint::after {
  content: "↓";
  display: inline-block;
  margin-left: 8px;
  color: var(--accent);
  animation: nudge 1.6s ease-in-out infinite;
}
@keyframes nudge {
  50% {
    transform: translateY(3px);
  }
}

@media (max-width: 520px) {
  .intro-tag {
    display: none;
  }
}
