/*
 * loading-state.css
 * Owns: whimsical loading overlay styles for the brief generator.
 * Does NOT own: brief output cards, form inputs, or any post-load UI.
 */

/* ── Loading overlay ──────────────────────────────────────────────────── */
.ld-overlay {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 3rem 1rem 2.5rem;
  text-align: center;
  gap: 2rem;
}

.ld-overlay.is-active {
  display: flex;
}

/* ── SVG illustration ─────────────────────────────────────────────────── */
.ld-illustration {
  width: 180px;
  height: 200px;
  flex-shrink: 0;
}

/* Guest figure animations */
@keyframes ld-phone-tilt {
  0%, 100% { transform: rotate(-3deg) translateY(0); }
  50%       { transform: rotate(2deg) translateY(-3px); }
}

@keyframes ld-blink {
  0%, 90%, 100% { opacity: 1; }
  95%           { opacity: 0; }
}

@keyframes ld-particle-float {
  0%   { transform: translateY(0) scale(1); opacity: 0.7; }
  100% { transform: translateY(-18px) scale(0.5); opacity: 0; }
}

@keyframes ld-screen-fill {
  0%   { clip-path: inset(100% 0 0 0); opacity: 0.6; }
  100% { clip-path: inset(0% 0 0 0); opacity: 1; }
}

@keyframes ld-cursor-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

.ld-guest-group {
  animation: ld-phone-tilt 2.8s ease-in-out infinite;
  transform-origin: 90px 160px;
}

.ld-eye-left,
.ld-eye-right {
  animation: ld-blink 4s ease-in-out infinite;
  transform-origin: center;
}

.ld-screen-content {
  animation: ld-screen-fill 3s ease-out forwards;
}

.ld-cursor {
  animation: ld-cursor-blink 1s step-end infinite;
}

.ld-particle-1 {
  animation: ld-particle-float 2.2s ease-out infinite;
}
.ld-particle-2 {
  animation: ld-particle-float 2.8s ease-out 0.6s infinite;
}
.ld-particle-3 {
  animation: ld-particle-float 2.4s ease-out 1.2s infinite;
}

/* ── Micro-copy ───────────────────────────────────────────────────────── */
.ld-copy-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  min-height: 5rem;
}

.ld-status {
  font-size: 1.5rem;
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  letter-spacing: 0.01em;
  text-align: center;
  color: var(--fg);
  line-height: 1.5;
  max-width: 380px;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.ld-status.is-fading {
  opacity: 0;
  transform: translateY(4px);
}

/* ── Heartbeat dots ──────────────────────────────────────────────────── */
.ld-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}

.ld-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.3;
}

@keyframes ld-heartbeat {
  0%, 60%, 100% { transform: scale(1); opacity: 0.3; }
  30%           { transform: scale(1.5); opacity: 0.9; }
}

.ld-dot:nth-child(1) { animation: ld-heartbeat 1.4s ease-in-out infinite 0s; }
.ld-dot:nth-child(2) { animation: ld-heartbeat 1.4s ease-in-out infinite 0.2s; }
.ld-dot:nth-child(3) { animation: ld-heartbeat 1.4s ease-in-out infinite 0.4s; }

/* ── 'Not stuck' signals ─────────────────────────────────────────────── */
.ld-signal {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.5;
  max-width: 340px;
  min-height: 1.5rem;
  transition: opacity 0.5s ease;
  opacity: 0;
}

.ld-signal.is-visible {
  opacity: 1;
}

.ld-signal a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ── Reduced-motion fallback ─────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ld-guest-group,
  .ld-eye-left,
  .ld-eye-right,
  .ld-screen-content,
  .ld-cursor,
  .ld-particle-1,
  .ld-particle-2,
  .ld-particle-3,
  .ld-dot {
    animation: none !important;
  }

  .ld-status {
    transition: none;
  }

  .ld-dot { opacity: 0.6; }
  .ld-screen-content { clip-path: inset(0); opacity: 1; }
}
