/*
 * hero-assembly.css
 * Akte 1 — "The Assembly" click-to-initiate hero.
 * Uses theme.css custom properties (--al-*).
 */

.hero-assembly {
  position: relative;
  height: 100vh;
  min-height: 640px;
  overflow: hidden;
  background: var(--al-gradient-bg, radial-gradient(ellipse at top, #1A2A4E 0%, #0B1426 55%));
  color: var(--al-text, #E8EAED);
  isolation: isolate;
}

.ha-stage {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  perspective: 1400px;
}

/* ---------------------------------------------------------------
   Start button — visible at idle, fades out on click
--------------------------------------------------------------- */
.ha-start-btn {
  position: absolute;
  bottom: 14vh;
  left: 50%;
  transform: translateX(-50%);
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 30px;
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: #0B1426;
  background: var(--al-gradient-primary, linear-gradient(135deg, #FF6B35, #FFB84D));
  border: none;
  border-radius: 999px;
  cursor: pointer;
  box-shadow:
    0 0 0 2px rgba(255, 184, 77, 0.35),
    0 10px 40px rgba(255, 107, 53, 0.55),
    0 0 60px rgba(255, 184, 77, 0.35);
  animation: haBtnPulse 2.4s ease-in-out infinite;
  transition: opacity 0.5s ease, transform 0.3s ease;
  will-change: transform, box-shadow;
}
.ha-start-btn:hover {
  transform: translateX(-50%) translateY(-2px);
  box-shadow:
    0 0 0 2px rgba(255, 184, 77, 0.55),
    0 16px 50px rgba(255, 107, 53, 0.7),
    0 0 80px rgba(255, 184, 77, 0.5);
}
.ha-start-btn:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 4px;
}
.ha-start-btn.faded {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-50%) translateY(10px);
}
.ha-start-btn-arrow { flex-shrink: 0; }
@keyframes haBtnPulse {
  0%, 100% {
    box-shadow:
      0 0 0 2px rgba(255, 184, 77, 0.35),
      0 10px 40px rgba(255, 107, 53, 0.55),
      0 0 60px rgba(255, 184, 77, 0.35);
  }
  50% {
    box-shadow:
      0 0 0 2px rgba(255, 184, 77, 0.6),
      0 14px 55px rgba(255, 107, 53, 0.75),
      0 0 90px rgba(255, 184, 77, 0.6);
  }
}

/* Idle hint above the button */
.ha-start-hint {
  position: absolute;
  bottom: calc(14vh + 70px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 7;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--al-text-secondary, #9AA0A6);
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.ha-start-hint.faded { opacity: 0; }

/* ---------------------------------------------------------------
   Phone frame
--------------------------------------------------------------- */
.ha-phone {
  position: relative;
  width: min(280px, 70vw);
  aspect-ratio: 9 / 19.5;
  background: linear-gradient(180deg, #111 0%, #060606 100%);
  border-radius: 42px;
  box-shadow:
    0 0 0 2px rgba(255,255,255,0.06),
    0 0 0 8px #0a0a0a,
    0 40px 120px rgba(0, 217, 255, 0.15),
    0 20px 60px rgba(255, 107, 53, 0.18);
  padding: 10px;
  z-index: 5;
  transform: translate3d(var(--ha-phone-x, 0), var(--ha-phone-y, 0), 0) scale(var(--ha-phone-s, 1));
  transition: transform 0.08s linear;
}

.ha-phone-notch {
  position: absolute;
  top: 14px; left: 50%;
  transform: translateX(-50%);
  width: 96px; height: 24px;
  background: #000;
  border-radius: 14px;
  z-index: 2;
}

.ha-phone-screen {
  position: relative;
  width: 100%; height: 100%;
  border-radius: 32px;
  overflow: hidden;
  background: var(--al-background, #0B1426);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}

.ha-phone-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(255, 107, 53, 0.22) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 80%, rgba(0, 217, 255, 0.18) 0%, transparent 55%),
    var(--al-background, #0B1426);
}

.ha-phone-logo {
  position: relative;
  width: 88px; height: 88px;
  opacity: var(--ha-logo-opacity, 1);
  transition: opacity 0.4s ease;
  filter: drop-shadow(0 4px 20px rgba(255, 107, 53, 0.5));
}

.ha-phone-waveform {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 80px;
  opacity: var(--ha-wave-opacity, 0);
  transition: opacity 0.5s ease;
}
.ha-phone-waveform span {
  display: inline-block;
  width: 4px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--al-secondary, #FFB84D), var(--al-primary, #FF6B35));
  animation: haWave 1.2s ease-in-out infinite;
}
.ha-phone-waveform span:nth-child(odd)   { animation-delay: 0.1s; }
.ha-phone-waveform span:nth-child(3n)    { animation-delay: 0.25s; }
.ha-phone-waveform span:nth-child(5n)    { animation-delay: 0.4s; }
.ha-phone-waveform span:nth-child(7n)    { animation-delay: 0.55s; }
@keyframes haWave {
  0%, 100% { height: 10%; }
  50%      { height: 90%; }
}

.ha-phone-label {
  position: relative;
  font-family: 'Orbitron', sans-serif;
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--al-wf-playhead, #00D9FF);
  opacity: var(--ha-wave-opacity, 0);
  transition: opacity 0.5s ease 0.1s;
}

/* ---------------------------------------------------------------
   Floating elements — positioned absolutely around phone center
--------------------------------------------------------------- */
.ha-float {
  position: absolute;
  top: 50%; left: 50%;
  z-index: 3;
  will-change: transform, opacity;
  /* The data-tx/data-ty attributes seed the resting position via JS */
  transform: translate3d(
    calc(-50% + var(--ha-tx, 0px)),
    calc(-50% + var(--ha-ty, 0px)),
    0
  );
  transition: transform 0.12s linear, opacity 0.25s ease;
  opacity: var(--ha-op, 1);
  filter: drop-shadow(0 10px 30px rgba(0,0,0,0.5));
}

.ha-crest {
  width: 140px; height: 140px;
}
.ha-obelisk {
  width: 170px; height: 170px;
  opacity: 0.85;
}
.ha-echo {
  width: 150px; height: 150px;
  opacity: 0.75;
}
.ha-map {
  width: 260px; height: 180px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--al-card-border, #2A3441);
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  opacity: 0.9;
}

.ha-grid {
  display: grid;
  grid-template-columns: repeat(2, 72px);
  grid-template-rows: repeat(2, 72px);
  gap: 12px;
  padding: 14px;
  background: rgba(26, 35, 50, 0.72);
  border: 1px solid var(--al-card-border, #2A3441);
  border-radius: 18px;
  backdrop-filter: blur(10px);
}
.ha-grid img {
  width: 72px; height: 72px;
  object-fit: contain;
  border-radius: 12px;
  background: var(--al-surface, #151F2E);
  padding: 6px;
}

.ha-mission {
  width: 260px;
  padding: 16px;
  background: linear-gradient(135deg, rgba(26,35,50,0.95), rgba(21,31,46,0.95));
  border: 1px solid var(--al-card-border, #2A3441);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  font-family: 'Inter', sans-serif;
}
.ha-mission-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 10px;
}
.ha-mission-xp { color: var(--al-xp, #9C27B0); font-weight: 600; }
.ha-mission-tag {
  color: var(--al-text-secondary, #9AA0A6);
  text-transform: uppercase;
  letter-spacing: 1.5px;
}
.ha-mission-title {
  font-family: 'Orbitron', sans-serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--al-text, #E8EAED);
  margin-bottom: 10px;
}
.ha-mission-bar {
  height: 6px;
  background: var(--al-surface, #151F2E);
  border-radius: 3px;
  overflow: hidden;
}
.ha-mission-bar span {
  display: block;
  height: 100%;
  background: var(--al-gradient-primary, linear-gradient(135deg, #FF6B35, #FFB84D));
  border-radius: 3px;
}

/* ---------------------------------------------------------------
   Tracers (paper-plane signal paths)
--------------------------------------------------------------- */
.ha-tracers {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  z-index: 2;
  opacity: var(--ha-tracer-opacity, 0.4);
  transition: opacity 0.3s ease;
}

/* ---------------------------------------------------------------
   Tagline — reveals after convergence
--------------------------------------------------------------- */
.ha-tagline {
  position: absolute;
  bottom: 10vh;
  left: 50%;
  transform: translate3d(-50%, var(--ha-tagline-y, 40px), 0);
  text-align: center;
  opacity: var(--ha-tagline-opacity, 0);
  transition: transform 0.5s cubic-bezier(0.2,0.9,0.3,1), opacity 0.5s ease;
  z-index: 6;
  max-width: 560px;
  padding: 0 24px;
}
.ha-pre {
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 4px;
  color: var(--al-wf-playhead, #00D9FF);
  margin: 0 0 12px;
  opacity: 0.9;
}
.ha-title {
  font-family: 'Orbitron', sans-serif;
  font-size: clamp(32px, 5vw, 56px);
  font-weight: 900;
  margin: 0 0 12px;
  background: linear-gradient(135deg, var(--al-text, #E8EAED) 0%, var(--al-primary, #FF6B35) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  line-height: 1.05;
}
.ha-sub {
  font-family: 'Inter', sans-serif;
  font-size: clamp(14px, 1.6vw, 18px);
  color: var(--al-text-secondary, #9AA0A6);
  margin: 0 0 24px;
}
.ha-cta { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.ha-btn {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  letter-spacing: 0.3px;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}
.ha-btn:hover { transform: translateY(-2px); }
.ha-btn-primary {
  color: #0B1426;
  background: var(--al-gradient-primary, linear-gradient(135deg, #FF6B35, #FFB84D));
  box-shadow: 0 10px 30px rgba(255, 107, 53, 0.35);
}
.ha-btn-primary:hover {
  box-shadow: 0 14px 40px rgba(255, 107, 53, 0.5);
}
.ha-btn-ghost {
  color: var(--al-text, #E8EAED);
  border: 1px solid var(--al-card-border, #2A3441);
  background: rgba(26, 35, 50, 0.5);
  backdrop-filter: blur(10px);
}

/* ---------------------------------------------------------------
   Responsive — mobile keeps the phone centered, shrinks floats
--------------------------------------------------------------- */
@media (max-width: 768px) {
  .ha-phone { width: 210px; }
  .ha-crest, .ha-obelisk, .ha-echo { width: 90px; height: 90px; }
  .ha-map { width: 180px; height: 120px; }
  .ha-grid {
    grid-template-columns: repeat(2, 48px);
    grid-template-rows: repeat(2, 48px);
    gap: 8px;
    padding: 10px;
  }
  .ha-grid img { width: 48px; height: 48px; }
  .ha-mission { width: 200px; padding: 12px; }
  .ha-tagline { bottom: 6vh; padding: 0 18px; }
}

/* Reduced motion — static resting layout, fade-in tagline immediately */
@media (prefers-reduced-motion: reduce) {
  .ha-float { transition: none; }
  .ha-tagline {
    --ha-tagline-opacity: 1;
    --ha-tagline-y: 0;
  }
  .ha-phone-waveform, .ha-phone-label { --ha-wave-opacity: 1; }
  .ha-phone-logo { --ha-logo-opacity: 0.35; }
}
