/**
 * hero-builder.css — 15-Second Cinematic Live-Building / Multiplayer Cursors
 * ==========================================================================
 * Ultra-crisp 60fps GPU-accelerated Figma-style live assembly performance:
 * Stage 1: Layout & Grid Setup (0s - 3s)
 * Stage 2: Component Assembly & Nudge (3s - 8s)
 * Stage 3: Live Typing & Styling (8s - 12s)
 * Stage 4: Polish & Exit (12s - 15s)
 */

/* ── Container Overlay ── */
.hero-builder-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
  z-index: 50;
  overflow: hidden;
  contain: layout paint;
}


/* Ensure avatar wrapper keeps absolute centering with zero transform interference */
.hero-art .hero-avatar-wrap {
  transform: none !important;
}

/* ── Initial Element States during Live-Building ── */
.hero-building [data-hero-build] {
  opacity: 0 !important;
  transform: translate3d(0, 10px, 0) scale(0.98) !important;
  transition: none !important;
  will-change: transform, opacity;
}

/* Revealed State for Individual Elements */
.hero-building [data-hero-build].hero-built-item,
.hero-ready [data-hero-build] {
  opacity: 1 !important;
  transform: translate3d(0, 0, 0) scale(1) !important;
  transition: opacity 0.42s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.42s cubic-bezier(0.16, 1, 0.3, 1) !important;
  will-change: auto;
}

/* ── Figma Guide Lines / Alignment Grid (Stage 1) ── */
.hero-grid-guide-h {
  position: absolute;
  left: 0;
  width: 100%;
  height: 0;
  border-top: 1px dashed rgba(0, 240, 255, 0.45);
  pointer-events: none;
  z-index: 51;
  opacity: 0;
  transform: scaleX(0.4);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.hero-grid-guide-h.active {
  opacity: 1;
  transform: scaleX(1);
}

.hero-grid-guide-v {
  position: absolute;
  top: 0;
  height: 100%;
  width: 0;
  border-left: 1px dashed rgba(255, 45, 120, 0.45);
  pointer-events: none;
  z-index: 51;
  opacity: 0;
  transform: scaleY(0.4);
  transition: opacity 0.4s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}
.hero-grid-guide-v.active {
  opacity: 1;
  transform: scaleY(1);
}

.hero-guide-badge {
  position: absolute;
  padding: 1px 6px;
  border-radius: 3px;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: #00F0FF;
  background: rgba(8, 12, 20, 0.92);
  border: 1px solid rgba(0, 240, 255, 0.5);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  user-select: none;
  white-space: nowrap;
}

/* ── Macro Frame Box (Stage 1) ── */
.hero-macro-box {
  position: absolute;
  pointer-events: none;
  z-index: 51;
  border: 1.5px dashed rgba(0, 240, 255, 0.6);
  border-radius: 6px;
  background: rgba(0, 240, 255, 0.025);
  box-sizing: border-box;
  opacity: 0;
  transform: scale(0.97);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.hero-macro-box.active {
  opacity: 1;
  transform: scale(1);
}
.hero-macro-dim {
  position: absolute;
  top: -22px;
  left: 0;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 3px;
  background: #070B14;
  border: 1px solid rgba(0, 240, 255, 0.6);
  color: #00F0FF;
  white-space: nowrap;
}

/* ── Component Wireframe / Blueprint Bounding Box (Stage 2) ── */
.hero-blueprint-box {
  position: absolute;
  pointer-events: none;
  z-index: 52;
  border-style: dashed;
  border-width: 1.5px;
  box-sizing: border-box;
  will-change: transform, opacity;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.hero-blueprint-box.active {
  opacity: 1;
  transform: scale(1);
}

.hero-bp-handle {
  position: absolute;
  width: 6px;
  height: 6px;
  box-sizing: border-box;
  background-color: currentColor;
  box-shadow: 0 0 5px currentColor;
}
.hero-bp-handle.tl { top: -3px; left: -3px; }
.hero-bp-handle.tr { top: -3px; right: -3px; }
.hero-bp-handle.bl { bottom: -3px; left: -3px; }
.hero-bp-handle.br { bottom: -3px; right: -3px; }

.hero-bp-dim {
  position: absolute;
  top: -21px;
  left: -1px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 3px;
  background: #080C16;
  border: 1px solid currentColor;
  color: currentColor;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  white-space: nowrap;
}

/* ── Multiplayer Cursor ── */
.mp-cursor {
  position: absolute;
  top: 0;
  left: 0;
  width: 24px;
  height: 24px;
  pointer-events: none;
  z-index: 55;
  will-change: transform, opacity;
  transform: translate3d(-120px, -120px, 0);
  transition: opacity 0.4s ease;
}

.mp-cursor-svg {
  display: block;
  width: 22px;
  height: 22px;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.6));
}

.mp-cursor-tag {
  position: absolute;
  left: 14px;
  top: 16px;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  pointer-events: none;
  user-select: none;
}

/* Click/Snap Ripple Effect */
.mp-cursor-ping {
  position: absolute;
  top: 0;
  left: 0;
  width: 28px;
  height: 28px;
  margin-top: -14px;
  margin-left: -14px;
  border-radius: 50%;
  pointer-events: none;
  border: 2px solid currentColor;
  opacity: 0;
  transform: scale(0.3);
  animation: mp-ping-expand 0.45s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes mp-ping-expand {
  0% {
    opacity: 0.95;
    transform: scale(0.3);
  }
  100% {
    opacity: 0;
    transform: scale(2.4);
  }
}

/* ── Stage 3: Typewriter Caret ── */
.hero-type-caret {
  display: inline-block;
  width: 2px;
  height: 1.15em;
  background: #00F0FF;
  vertical-align: -0.15em;
  margin-left: 2px;
  animation: hero-caret-blink 0.65s infinite ease-in-out;
}
@keyframes hero-caret-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* ── Stage 4: Polish Luminous Flash ── */
.hero-finish-flash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 53;
  background: linear-gradient(90deg, transparent 0%, rgba(0, 240, 255, 0.12) 50%, transparent 100%);
  opacity: 0;
  transform: translate3d(-100%, 0, 0);
  animation: hero-finish-sweep 1.1s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}
@keyframes hero-finish-sweep {
  0% {
    opacity: 0.8;
    transform: translate3d(-100%, 0, 0);
  }
  100% {
    opacity: 0;
    transform: translate3d(100%, 0, 0);
  }
}

/* ── Stage 5: Floating HUD Bar (Progress & Skip Control) ── */
.hero-builder-hud {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: auto !important;
  z-index: 60;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 6px 14px 6px 16px;
  border-radius: 999px;
  background: rgba(10, 14, 24, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6), 0 0 20px rgba(0, 240, 255, 0.15);
  opacity: 0;
  animation: hero-hud-fade-in 0.4s ease 0.3s forwards;
  transition: opacity 0.35s ease, transform 0.35s ease;
  user-select: none;
}

@keyframes hero-hud-fade-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.hero-hud-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.hero-hud-pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00F0FF;
  box-shadow: 0 0 8px #00F0FF;
  animation: hero-pulse-glow 1.4s infinite ease-in-out;
}
@keyframes hero-pulse-glow {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.hero-hud-text {
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 11px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.hero-hud-pct {
  color: #F4B41A;
  font-weight: 700;
}

.hero-hud-track {
  width: 72px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
  position: relative;
}

.hero-hud-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #00F0FF, #F4B41A);
  border-radius: 2px;
  transition: width 0.1s linear;
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.6);
}

.hero-hud-skip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  color: #FFFFFF;
  font-family: var(--font-mono, 'DM Mono', monospace);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}
.hero-hud-skip:hover {
  background: rgba(244, 180, 26, 0.18);
  border-color: #F4B41A;
  color: #FFE072;
  box-shadow: 0 0 12px rgba(244, 180, 26, 0.35);
  transform: translateY(-1px);
}
.hero-hud-skip:active {
  transform: translateY(0);
}

.hero-hud-skip-icon {
  font-size: 10px;
}

/* ── Reduce Motion Accessibility ── */
@media (prefers-reduced-motion: reduce) {
  .hero-builder-overlay,
  .hero-builder-hud {
    display: none !important;
  }
  .hero-building [data-hero-build] {
    opacity: 1 !important;
    transform: none !important;
  }
}
