/* ============================================================
   Landing Page — Emma AI · 划时代AI体验
   v24 — Neural network particles, morphing orbs, dynamic energy
   ============================================================ */

.landing {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
}

/* ── Background Layer ── */
.landing-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.landing-bg canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── Morphing Gradient Orbs ── */
.landing-orbs {
  position: absolute;
  inset: 0;
  z-index: 1;
  filter: blur(80px);
  opacity: 0.5;
  transition: transform 0.3s ease-out;
}

.landing-orb {
  position: absolute;
  border-radius: 50%;
  animation: orbFloat 20s ease-in-out infinite;
  will-change: transform;
}

.landing-orb.orb-1 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(124,58,237,0.4) 0%, transparent 70%);
  top: -15%; left: -10%;
  animation-delay: 0s;
  animation-duration: 18s;
}

.landing-orb.orb-2 {
  width: 350px; height: 350px;
  background: radial-gradient(circle, rgba(6,182,212,0.3) 0%, transparent 70%);
  top: 50%; right: -15%;
  animation-delay: -7s;
  animation-duration: 22s;
}

.landing-orb.orb-3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(139,92,246,0.35) 0%, transparent 70%);
  bottom: -10%; left: 30%;
  animation-delay: -14s;
  animation-duration: 19s;
}

/* ── Scan Line Overlay ── */
.landing-scanlines {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0,0,0,0.03) 2px,
    rgba(0,0,0,0.03) 4px
  );
  pointer-events: none;
}

/* ── Shooting Stars (Meteors) ── */
.landing-meteor {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  border-radius: 2px;
  filter: blur(0.6px);
}

/* ── Meteor Head (glowing core) ── */
.landing-meteor::after {
  content: '';
  position: absolute;
  bottom: -3px; left: 50%;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.95) 0%, rgba(196,181,253,0.8) 30%, rgba(139,92,246,0) 70%);
  box-shadow: 0 0 10px rgba(196,181,253,0.5), 0 0 25px rgba(139,92,246,0.25);
  transform: translateX(-50%);
}

/* ── Meteor 1: 标准流星，160deg渐变 ── */
.landing-meteor.meteor-1 {
  top: -5%;
  right: 20%;
  width: 2px; height: 200px;
  background: linear-gradient(160deg,
    transparent 0%,
    rgba(139,92,246,0.15) 40%,
    rgba(196,181,253,0.5) 70%,
    rgba(255,255,255,0.95) 100%);
  animation: meteorSlide1 9s ease-in-out 0s infinite;
}

@keyframes meteorSlide1 {
  0%   { opacity: 0; transform: translate(0, 0); }
  3%   { opacity: 1; }
  12%  { opacity: 0.8; transform: translate(-80px, 160px); }
  18%  { opacity: 0; transform: translate(-140px, 300px); }
  100% { opacity: 0; transform: translate(-140px, 300px); }
}

/* ── Meteor 2: 略陡，155deg渐变 ── */
.landing-meteor.meteor-2 {
  top: -3%;
  right: 45%;
  width: 1.8px; height: 170px;
  background: linear-gradient(155deg,
    transparent 0%,
    rgba(139,92,246,0.12) 45%,
    rgba(167,139,250,0.45) 72%,
    rgba(255,255,255,0.9) 100%);
  animation: meteorSlide2 11s ease-in-out 2.5s infinite;
}

.landing-meteor.meteor-2::after {
  width: 7px; height: 7px;
  box-shadow: 0 0 8px rgba(196,181,253,0.45), 0 0 20px rgba(139,92,246,0.2);
}

@keyframes meteorSlide2 {
  0%   { opacity: 0; transform: translate(0, 0); }
  3%   { opacity: 0.9; }
  11%  { opacity: 0.6; transform: translate(-60px, 140px); }
  16%  { opacity: 0; transform: translate(-110px, 260px); }
  100% { opacity: 0; transform: translate(-110px, 260px); }
}

/* ── Meteor 3: 平缓弧线，165deg渐变 ── */
.landing-meteor.meteor-3 {
  top: -4%;
  right: 10%;
  width: 2px; height: 220px;
  background: linear-gradient(165deg,
    transparent 0%,
    rgba(139,92,246,0.1) 45%,
    rgba(196,181,253,0.55) 68%,
    rgba(255,255,255,0.95) 100%);
  animation: meteorSlide3 10s ease-in-out 5s infinite;
}

@keyframes meteorSlide3 {
  0%   { opacity: 0; transform: translate(0, 0); }
  4%   { opacity: 0.85; }
  14%  { opacity: 0.5; transform: translate(-50px, 120px); }
  20%  { opacity: 0; transform: translate(-100px, 230px); }
  100% { opacity: 0; transform: translate(-100px, 230px); }
}

/* ── Meteor 4: 远景小流星，160deg渐变 ── */
.landing-meteor.meteor-4 {
  top: 2%;
  right: 55%;
  width: 1.5px; height: 140px;
  background: linear-gradient(160deg,
    transparent 0%,
    rgba(139,92,246,0.1) 50%,
    rgba(196,181,253,0.35) 75%,
    rgba(255,255,255,0.75) 100%);
  animation: meteorSlide4 12s ease-in-out 7.5s infinite;
}

.landing-meteor.meteor-4::after {
  width: 5px; height: 5px;
  box-shadow: 0 0 6px rgba(196,181,253,0.35), 0 0 15px rgba(139,92,246,0.15);
}

@keyframes meteorSlide4 {
  0%   { opacity: 0; transform: translate(0, 0); }
  3%   { opacity: 0.65; }
  10%  { opacity: 0.4; transform: translate(-40px, 100px); }
  15%  { opacity: 0; transform: translate(-80px, 200px); }
  100% { opacity: 0; transform: translate(-80px, 200px); }
}

/* ── Content Layer ── */
.landing-content {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 100%;
  padding: 28px 24px 52px;
  padding:
    max(env(safe-area-inset-top, 0px), 28px)
    24px
    max(env(safe-area-inset-bottom, 0px), 52px);
  text-align: center;
  box-sizing: border-box;
  pointer-events: auto;
}

/* ── Hero Brand Section ── */
.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  flex: 1 1 auto;
  padding: 16px 0;
}

/* ── Avatar with orbiting particles ── */
.landing-avatar-ring {
  position: relative;
  width: 128px; height: 128px;
}

/* Voice pulse rings — the "AI is listening" signature */
.landing-voice-pulse {
  position: absolute;
  inset: -30px;
  border-radius: 50%;
  border: 1.5px solid rgba(139,92,246,0.2);
  animation: voicePulse 3s ease-out infinite;
}

.landing-voice-pulse.delay {
  animation-delay: 1.5s;
}

@keyframes voicePulse {
  0% { transform: scale(0.85); opacity: 0.6; }
  100% { transform: scale(1.4); opacity: 0; }
}

.landing-avatar-orbit {
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  border: 1px dashed rgba(139,92,246,0.15);
  animation: avatarOrbit 8s linear infinite;
}

.landing-avatar-orbit::before {
  content: '';
  position: absolute;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--primary-400);
  box-shadow: 0 0 10px var(--primary-400), 0 0 20px var(--primary-500);
  top: 0; left: 50%;
  transform: translateX(-50%) translateY(-50%);
}

.landing-avatar-orbit.orbit-2 {
  inset: -24px;
  animation-duration: 12s;
  animation-direction: reverse;
  border-color: rgba(6,182,212,0.15);
}

.landing-avatar-orbit.orbit-2::before {
  background: var(--accent-400);
  box-shadow: 0 0 10px var(--accent-400), 0 0 20px var(--accent-500);
}

.landing-avatar {
  width: 120px; height: 120px;
  border-radius: 50%;
  background: var(--gradient-primary-light);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 2;
  box-shadow:
    0 0 60px rgba(124,58,237,0.4),
    0 0 120px rgba(124,58,237,0.15),
    inset 0 0 30px rgba(255,255,255,0.05);
  transition: transform var(--transition-base);
  animation: avatarFloat 4s ease-in-out infinite;
}

.landing-avatar::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(139,92,246,0.6), rgba(6,182,212,0.4), rgba(139,92,246,0.6));
  z-index: -1;
  animation: avatarBorderSpin 4s linear infinite;
  opacity: 0.6;
}

.landing-avatar:hover {
  transform: translateY(-4px) scale(1.08);
  box-shadow:
    0 0 80px rgba(124,58,237,0.6),
    0 0 160px rgba(124,58,237,0.25),
    inset 0 0 40px rgba(255,255,255,0.08);
}

.landing-avatar svg { width: 72px; height: 72px; }

/* ── Avatar Eye Blink ── */
.avatar-eye {
  animation: eyeBlink 4s ease-in-out infinite;
  transform-origin: center center;
}

.avatar-pupil {
  animation: pupilShrink 4s ease-in-out infinite;
  transform-origin: center center;
}

.avatar-smile {
  animation: smilePulse 3s ease-in-out infinite;
}

/* ── Title ── */
.landing-title-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.landing-title {
  font-size: clamp(42px, 8vw, 56px);
  font-weight: 800;
  margin: 0;
  letter-spacing: -1.5px;
  background: linear-gradient(180deg, #ffffff 0%, #e9d5ff 40%, #a78bfa 75%, #7c3aed 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 40px rgba(124,58,237,0.5));
  animation: titleGlow 3s ease-in-out infinite alternate;
  line-height: 1.1;
}

.landing-subtitle {
  font-size: var(--text-md);
  color: rgba(255,255,255,0.75);
  margin: 0;
  max-width: 300px;
  line-height: var(--leading-normal);
  letter-spacing: 0.02em;
  min-height: 1.5em;
}

.landing-cursor {
  display: inline-block;
  width: 2px;
  height: 1em;
  background: var(--primary-400);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: cursorBlink 1s step-end infinite;
  box-shadow: 0 0 8px var(--primary-400);
}

.landing-tagline {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.4);
  margin: -6px 0 0;
  letter-spacing: 0.04em;
  font-weight: var(--font-weight-normal);
}

/* ── Features Grid ── */
.landing-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 340px;
  flex-shrink: 0;
}

.landing-feature {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 20px;
  background: rgba(255,255,255,0.025);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  transition: all 0.4s cubic-bezier(0.16,1,0.3,1);
  opacity: 0;
  transform: translateY(20px);
  overflow: hidden;
}

.landing-feature.visible {
  opacity: 1;
  transform: translateY(0);
  transition: all 0.6s cubic-bezier(0.16,1,0.3,1);
}

.landing-feature::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(255,255,255,0.08), rgba(139,92,246,0.15), rgba(255,255,255,0.03));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  transition: opacity 0.4s;
}

/* Subtle inner highlight */
.landing-feature::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255,255,255,0.04), transparent);
  border-radius: inherit;
  pointer-events: none;
}

.landing-feature:hover {
  background: rgba(255,255,255,0.05);
  transform: translateY(-3px);
  box-shadow:
    0 12px 40px rgba(0,0,0,0.25),
    0 0 60px rgba(124,58,237,0.08),
    inset 0 1px 0 rgba(255,255,255,0.06);
}

.landing-feature:hover::before {
  background: linear-gradient(135deg, rgba(255,255,255,0.12), rgba(139,92,246,0.3), rgba(6,182,212,0.1));
}

.landing-feature-icon {
  width: 38px; height: 38px;
  border-radius: var(--radius-xs);
  background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(139,92,246,0.08));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
}

.landing-feature-icon::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(139,92,246,0.3), transparent);
  z-index: -1;
}

.landing-feature-icon svg {
  width: 19px; height: 19px;
  color: var(--primary-400);
  filter: drop-shadow(0 0 6px rgba(139,92,246,0.4));
}

.landing-feature-text {
  flex: 1;
  text-align: left;
  min-width: 0;
}

.landing-feature-title {
  font-size: var(--text-base);
  font-weight: var(--font-weight-semibold);
  color: rgba(255,255,255,0.92);
  margin-bottom: 2px;
}

.landing-feature-desc {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.45);
  line-height: 1.4;
}

/* ── CTA Section ── */
.landing-cta {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
  padding-top: 20px;
}

.landing-btn {
  width: 100%;
  padding: 15px 20px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: var(--text-md);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: all var(--transition-smooth);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}

.landing-btn:active { transform: scale(0.97); }

.landing-btn-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.landing-btn svg { width: 20px; height: 20px; flex-shrink: 0; }

.landing-btn small {
  font-size: var(--text-xs);
  font-weight: var(--font-weight-normal);
  opacity: 0.75;
}

/* Primary CTA — breathing glow */
.landing-btn-primary {
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
  color: var(--white);
  position: relative;
  box-shadow:
    0 4px 24px rgba(124,58,237,0.35),
    0 0 80px rgba(124,58,237,0.1);
  animation: btnPulse 3s ease-in-out infinite;
}

.landing-btn-primary::before {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(139,92,246,0.5), rgba(6,182,212,0.3));
  z-index: -1;
  opacity: 0;
  transition: opacity 0.3s;
}

.landing-btn-primary:hover::before { opacity: 1; }

.landing-btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  animation: btnShine 3s ease-in-out infinite;
}

.landing-btn-primary:hover {
  transform: translateY(-3px);
  box-shadow:
    0 8px 32px rgba(124,58,237,0.5),
    0 0 100px rgba(124,58,237,0.2);
}

.landing-btn-primary:active { transform: translateY(0); }

/* Secondary CTA */
.landing-btn-secondary {
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.8);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  flex-direction: row;
  gap: 10px;
}

.landing-btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.2);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

/* ── Footer hint ── */
.landing-footer {
  margin-top: 16px;
}

.landing-footer-text {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.25);
  letter-spacing: 0.04em;
}

/* ============================================================
   Keyframes
   ============================================================ */

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25% { transform: translate(40px, -30px) scale(1.08); }
  50% { transform: translate(-20px, 20px) scale(0.95); }
  75% { transform: translate(-35px, -15px) scale(1.05); }
}

@keyframes avatarOrbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes avatarBorderSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes titleGlow {
  0% { filter: drop-shadow(0 0 25px rgba(124,58,237,0.4)); }
  100% { filter: drop-shadow(0 0 45px rgba(124,58,237,0.6)); }
}

@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

@keyframes btnPulse {
  0%, 100% {
    box-shadow:
      0 4px 24px rgba(124,58,237,0.35),
      0 0 80px rgba(124,58,237,0.1);
  }
  50% {
    box-shadow:
      0 6px 32px rgba(124,58,237,0.5),
      0 0 100px rgba(124,58,237,0.2);
  }
}

@keyframes btnShine {
  0% { left: -100%; }
  50%, 100% { left: 100%; }
}

@keyframes avatarFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes eyeBlink {
  0%, 44%, 56%, 100% { transform: scaleY(1); }
  46%, 54% { transform: scaleY(0.1); }
}

@keyframes pupilShrink {
  0%, 44%, 56%, 100% { transform: scale(1); }
  46%, 54% { transform: scale(0.3); }
}

@keyframes smilePulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 0.85; }
}

/* ── Landing Hide Transition ── */
.landing {
  transition: opacity 0.6s ease;
}

.landing.hidden {
  opacity: 0;
  pointer-events: none;
}

.landing.hidden .landing-bg canvas {
  opacity: 0;
  transition: opacity 0.6s ease;
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-height: 720px) {
  .landing-content {
    padding: 20px 24px 40px;
    padding:
      max(env(safe-area-inset-top, 0px), 20px)
      24px
      max(env(safe-area-inset-bottom, 0px), 40px);
  }
  .landing-hero { gap: 12px; padding: 8px 0; }
  .landing-avatar-ring, .landing-avatar { width: 96px; height: 96px; }
  .landing-avatar svg { width: 48px; height: 48px; }
  .landing-title { font-size: var(--text-4xl); }
  .landing-subtitle { font-size: 14px; }
  .landing-features { gap: 8px; }
  .landing-feature { padding: 10px 14px; }
  .landing-cta { padding-top: 14px; gap: 10px; }
  .landing-btn { padding: 12px 20px; }
}

@media (max-height: 600px) {
  .landing-hero { padding: 4px 0; }
  .landing-features { display: none; }
  .landing-cta { padding-top: 6px; }
}

@media (max-width: 360px) {
  .landing-content { padding-left: 16px; padding-right: 16px; }
  .landing-title { font-size: 32px; }
  .landing-features, .landing-cta { max-width: 100%; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .landing-avatar-orbit,
  .landing-orb,
  .landing-feature::after,
  .landing-btn-primary,
  .landing-btn-primary::after,
  .landing-avatar,
  .avatar-eye,
  .avatar-pupil,
  .avatar-smile,
  .landing-meteor,
  .landing-meteor::before,
  .landing-voice-pulse {
    animation: none !important;
  }
  .landing-avatar::after { animation: none !important; opacity: 0.3; }
  .landing-title {
    animation: none !important;
    filter: drop-shadow(0 0 30px rgba(124,58,237,0.4)) !important;
  }
  .landing-hero, .landing-features, .landing-cta {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}
