/* Voice-first hero experience */

.voice-hero {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100svh;
  padding: calc(var(--header-h) + clamp(1.25rem, 4vw, 2rem)) var(--pad-x) clamp(1.5rem, 4vw, 2.75rem);
  overflow: hidden;
}

.voice-hero__background {
  position: absolute;
  inset: 0;
  background:
    var(--voice-hero-poster, url("../assets/horz-mountain-over-clouds-poster.jpg")) center / cover no-repeat,
    radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.2), transparent 40rem),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-ink) 100%);
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.voice-hero__background::after {
  position: absolute;
  inset: 0;
  content: "";
  background:
    linear-gradient(180deg, rgba(12, 9, 20, 0.42), rgba(12, 9, 20, 0.68)),
    radial-gradient(circle at 50% 20%, rgba(217, 168, 255, 0.18), transparent 24rem);
  z-index: 2;
}

.voice-hero__background-poster,
.voice-hero__background-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.voice-hero__background-poster {
  z-index: 0;
}

.voice-hero__background-video {
  display: block;
  z-index: 1;
}

.voice-hero__background-video.is-hidden {
  display: none;
}

.voice-hero__content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 920px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: clamp(2rem, 4vw, 3.25rem);
}

/* Brand section */
.voice-hero__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(0.75rem, 2vw, 1.5rem);
  text-align: center;
  width: 100%;
  transition: opacity 0.35s ease, transform 0.35s ease, max-height 0.35s ease;
}

.voice-hero--playing {
  justify-content: flex-start;
  min-height: 100svh;
  overflow: visible;
}

.voice-hero--playing .voice-hero__content {
  gap: 1.25rem;
}

.voice-hero--playing .voice-hero__brand {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(-0.75rem);
  pointer-events: none;
}

.voice-hero__mark {
  width: clamp(84px, 10vw, 150px);
  height: clamp(84px, 10vw, 150px);
  color: #f0b8ff;
  opacity: 1;
  filter:
    drop-shadow(0 2px 1px rgba(0, 0, 0, 0.95))
    drop-shadow(0 5px 8px rgba(0, 0, 0, 0.85))
    drop-shadow(0 0 14px rgba(240, 184, 255, 0.72))
    drop-shadow(0 0 30px rgba(236, 72, 153, 0.38));
}

.voice-hero__wordmark {
  max-width: none;
  margin: 0;
  color: var(--text);
  font-size: clamp(4.25rem, 10vw, 8.75rem);
  font-weight: 500;
  letter-spacing: 0.2em;
  text-indent: 0.2em;
  text-shadow:
    0 2px 1px rgba(0, 0, 0, 0.95),
    0 5px 8px rgba(0, 0, 0, 0.9),
    0 0 2px rgba(0, 0, 0, 0.95);
}

.voice-hero__subtitle {
  font-size: clamp(1.65rem, 3.1vw, 2.75rem);
  color: var(--text-soft);
  margin: 0;
  max-width: 760px;
  text-shadow:
    0 2px 1px rgba(0, 0, 0, 0.95),
    0 4px 7px rgba(0, 0, 0, 0.9);
}

/* Input section */
.voice-hero__form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 2.4vw, 2rem);
  align-items: center;
  justify-content: center;
}

.voice-hero__input-group {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}

.voice-hero__input {
  flex: 1;
  min-width: 240px;
  max-width: 520px;
  padding: 1.125rem 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(217, 168, 255, 0.42);
  border-radius: 8px;
  color: var(--text);
  font-size: clamp(1.25rem, 1.65vw, 1.6rem);
  transition: all 0.3s ease;
}

.voice-hero__input::placeholder {
  color: var(--muted);
}

.voice-hero__input:focus {
  outline: none;
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--lavender);
  box-shadow: 0 0 0 3px rgba(217, 168, 255, 0.1);
}

/* CTA Button - press and hold */
.voice-hero__cta {
  position: relative;
  width: 100%;
  max-width: 520px;
  height: clamp(64px, 5vw, 76px);
  padding: 0;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  border: none;
  border-radius: 12px;
  color: var(--text);
  font-size: clamp(1.2rem, 1.55vw, 1.5rem);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

.voice-hero__cta * {
  -webkit-user-select: none;
  user-select: none;
}

.voice-hero__cta:hover:not(.voice-hero__cta--loading) {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.4);
}

.voice-hero__cta:active:not(.voice-hero__cta--loading) {
  transform: translateY(0);
}

/* Press and hold fill animation */
.voice-hero__cta-fill {
  position: absolute;
  inset: 0;
  background: var(--lavender);
  border-radius: 12px;
  transform-origin: left;
  transform: scaleX(0);
  pointer-events: none;
  z-index: 0;
}

.voice-hero__cta-fill.active {
  will-change: transform;
}

.voice-hero__cta-text {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 100%;
  letter-spacing: 0.15em;
}

.voice-hero__cta-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.voice-hero__cta--loading {
  opacity: 0.7;
  cursor: not-allowed;
}

.voice-hero__cta--loading .voice-hero__cta-fill {
  animation: none;
  transform: scaleX(1);
  background: var(--lavender);
  opacity: 0.6;
}

/* CTA Hint */
.voice-hero__cta-hint {
  font-size: clamp(1.12rem, 1.25vw, 1.3rem);
  color: var(--muted);
  margin: 0;
  margin-top: -0.5rem;
  text-align: center;
  letter-spacing: 0.05em;
}

/* Spinner */
.spinner {
  display: inline-flex;
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--text);
  border-radius: 50%;
  transform: translateZ(0) rotate(0deg);
  will-change: transform;
}

/* Audio playback section */
.voice-hero__audio-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.5s ease;
  pointer-events: none;
  align-items: center;
  justify-content: center;
}

.voice-hero__audio-section.active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.voice-hero__audio-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  width: 100%;
}

.voice-hero__greeting {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--lavender);
  text-align: center;
  text-shadow:
    0 2px 2px rgba(0, 0, 0, 0.9),
    0 8px 20px rgba(0, 0, 0, 0.85);
}

.voice-hero__sound-toggle {
  position: relative;
  width: 44px;
  height: 44px;
  padding: 0;
  background: rgba(217, 168, 255, 0.1);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.voice-hero__sound-toggle:hover {
  background: rgba(217, 168, 255, 0.15);
  border-color: var(--lavender);
}

.voice-hero__sound-toggle svg {
  width: 20px;
  height: 20px;
}

/* Chat bubbles */
.voice-hero__bubbles {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: min(100%, 680px);
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 120px;
  scroll-margin-block-end: max(2rem, env(safe-area-inset-bottom));
}

.voice-hero__bubble {
  padding: 0.875rem 1.25rem;
  background: rgba(124, 58, 237, 0.22);
  border: 1px solid rgba(124, 58, 237, 0.38);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.5;
  opacity: 1;
  transition: all 0.3s ease;
  visibility: hidden;
  scroll-margin-block-end: max(5rem, calc(env(safe-area-inset-bottom) + 3rem));
}

@keyframes bubbleIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.voice-hero__bubble[style*="visibility: visible"] {
  animation: bubbleIn 0.4s ease-out forwards;
}

.voice-hero__bubble.active {
  background: rgba(64, 36, 112, 0.66);
  border-color: rgba(124, 58, 237, 0.78);
}

.voice-hero__bubble.played {
  background: rgba(42, 30, 74, 0.46);
  border-color: rgba(124, 58, 237, 0.42);
  opacity: 0.7;
}

/* Progress bar */
.voice-hero__progress {
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  display: none;
}

.voice-hero__progress:not(.voice-hero__progress--hidden) {
  display: block;
}

.voice-hero__progress-bar {
  height: 100%;
  background: var(--lavender);
  width: 0%;
  border-radius: 2px;
  transition: width 0.1s linear;
}

/* Controls */
.voice-hero__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.voice-hero__control-btn {
  width: 48px;
  height: 48px;
  padding: 0;
  background: rgba(217, 168, 255, 0.1);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.voice-hero__control-btn:hover {
  background: rgba(217, 168, 255, 0.15);
  border-color: var(--lavender);
  transform: scale(1.05);
}

.voice-hero__control-btn svg {
  width: 24px;
  height: 24px;
}

/* Time display */
.voice-hero__time {
  font-size: 0.875rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* Hidden state for progress bar + controls after monologue ends */
.voice-hero__progress--hidden,
.voice-hero__controls--hidden {
  display: none;
}

/* Waitlist CTA — appears after monologue ends */
.voice-hero__waitlist-cta {
  display: none;
  width: 100%;
  max-width: 400px;
  margin: 0.75rem auto 0;
  padding: 0.875rem 1.25rem;
  background: linear-gradient(135deg, var(--purple), var(--pink));
  border: none;
  border-radius: 12px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.3s ease;
}

.voice-hero__waitlist-cta.active {
  display: block;
  animation: bubbleIn 0.5s ease-out forwards;
}

.voice-hero__waitlist-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(236, 72, 153, 0.4);
}

/* Responsive design (mobile overrides) */
@media (max-width: 640px) {
  .voice-hero {
    min-height: 100svh;
    padding: calc(var(--header-h) + 1rem) 1rem 1.5rem;
  }

  .voice-hero--playing {
    padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 2.5rem);
  }

  .voice-hero__background {
    background:
      var(--voice-hero-poster, url("../assets/vert-sunset-clouds-poster.jpg")) center / cover no-repeat,
      radial-gradient(circle at 50% 0%, rgba(124, 58, 237, 0.2), transparent 40rem),
      linear-gradient(180deg, var(--bg) 0%, var(--bg-ink) 100%);
  }

  .voice-hero__background::after {
    background:
      linear-gradient(180deg, rgba(12, 9, 20, 0.48), rgba(12, 9, 20, 0.72)),
      radial-gradient(circle at 50% 20%, rgba(217, 168, 255, 0.2), transparent 18rem);
  }

  .voice-hero__content {
    gap: 1.45rem;
  }

  .voice-hero--playing .voice-hero__content {
    gap: 1rem;
  }

  .voice-hero__audio-section {
    scroll-margin-block-start: calc(var(--header-h) + env(safe-area-inset-top) + 1.75rem);
  }

  .voice-hero__mark {
    width: 76px;
    height: 76px;
  }

  .voice-hero__title {
    font-size: 1.5rem;
  }

  .voice-hero__wordmark {
    font-size: clamp(2.5rem, 13.5vw, 4rem);
  }

  .voice-hero__subtitle {
    font-size: clamp(1.25rem, 5.2vw, 1.55rem);
  }

  .voice-hero__input {
    min-width: 100%;
    padding: 0.875rem 1.25rem;
    border-width: 1px;
    font-size: 1rem;
  }

  .voice-hero__cta {
    max-width: 100%;
    height: 56px;
    font-size: 1rem;
  }

  .voice-hero__cta-hint {
    font-size: 0.875rem;
  }

  .voice-hero__input-group {
    flex-direction: column;
  }

  .voice-hero__bubbles {
    min-height: auto;
    padding: 1rem;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .voice-hero__cta-fill.active {
    transform: scaleX(1);
  }
}
