/* ================================================================
   /texts/ — swipeable phone deck + message pop-in
   Builds on styles.css (.phone-frame, .thread, .bubble, tokens)
   ================================================================ */

/* tighter hero for the demo page */
.hero--texts {
  padding: 64px 0 28px;
  text-align: center;
}
.hero--texts .eyebrow--pulse {
  margin-inline: auto;
}
.hero--texts .lead {
  margin-inline: auto;
}

/* ---- stage ----------------------------------------------------- */
.texts-stage {
  position: relative;
  z-index: 2;
  padding: 8px 0 72px;
}

.texts-caption {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  margin: 0 0 22px;
  min-height: 28px;
}
.texts-caption__index {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--lime);
}
.texts-caption__title {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 3.4vw, 30px);
  color: var(--lilac-50);
  line-height: 1.1;
}

/* ---- the card deck --------------------------------------------- */
/* Phone height is bounded so the caption, phone, and controls all fit
   in a normal viewport. Width is derived from height via aspect-ratio,
   then capped on very narrow screens. */
.texts-stage {
  --phone-h: clamp(480px, 60vh, 640px);
}
@media (max-width: 430px) {
  .texts-stage {
    --phone-h: calc(86vw * 2.055);
  }
}

.swipe-deck {
  position: relative;
  width: 100%;
  max-width: 360px;
  height: calc(var(--phone-h) + 40px);
  margin: 0 auto;
  touch-action: pan-y;
}

.swipe-card {
  position: absolute;
  top: 0;
  left: 50%;
  height: var(--phone-h);
  transform: translate(-50%, 0);
  will-change: transform, opacity;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.swipe-card.is-front {
  touch-action: none;
}
.swipe-card.is-dragging {
  cursor: grabbing;
}
.swipe-card .phone-frame {
  max-width: 86vw;
  width: auto;
  height: 100%;
  margin: 0;
}
/* subtle dim on the cards waiting behind the front one */
.swipe-card.is-back .phone-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(10, 5, 18, 0.4);
  z-index: 5;
  border-radius: inherit;
  pointer-events: none;
}

/* the thread should scroll as messages stack up */
.swipe-card .thread {
  overflow-y: auto;
  scrollbar-width: none;
  justify-content: flex-end;
  padding-right: 2px;
}
.swipe-card .thread::-webkit-scrollbar {
  display: none;
}

/* JS controls the timing, so neutralize the staggered delays from styles.css */
.swipe-card .thread .bubble {
  animation-delay: 0s !important;
}

/* ---- typing indicator ------------------------------------------ */
.bubble--typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 11px 13px;
}
.bubble--typing span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--lilac);
  opacity: 0.5;
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.bubble--typing span:nth-child(2) {
  animation-delay: 0.15s;
}
.bubble--typing span:nth-child(3) {
  animation-delay: 0.3s;
}
@keyframes typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 0.9;
  }
}

/* ---- controls -------------------------------------------------- */
.swipe-ui {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 28px;
}
.swipe-arrow {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(245, 238, 255, 0.18);
  background: rgba(245, 238, 255, 0.05);
  color: var(--lilac-50);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.swipe-arrow:hover {
  border-color: var(--lime);
  color: var(--lime);
  transform: translateY(-1px);
}
.swipe-arrow:active {
  transform: scale(0.94);
}

.swipe-dots {
  display: flex;
  gap: 9px;
}
.swipe-dot {
  width: 9px;
  height: 9px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: rgba(245, 238, 255, 0.22);
  cursor: pointer;
  transition: background 0.25s ease, transform 0.25s ease, width 0.25s ease;
}
.swipe-dot:hover {
  background: rgba(245, 238, 255, 0.4);
}
.swipe-dot.is-active {
  width: 22px;
  background: var(--lime);
}

.swipe-hint {
  text-align: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  color: var(--lilac);
  opacity: 0.6;
  margin: 14px 0 0;
}

.texts-noscript {
  text-align: center;
  color: var(--blush);
  margin-top: 24px;
}

/* ---- cta tweaks ------------------------------------------------ */
.texts-cta {
  text-align: center;
}
.texts-cta .hero-cta {
  justify-content: center;
}

@media (prefers-reduced-motion: reduce) {
  .bubble--typing span {
    animation: none;
  }
  .swipe-card {
    transition: none !important;
  }
}
