@keyframes fade-up {
  from { opacity: 0; transform: translateY(1.5rem); }
  to { opacity: 1; transform: translateY(0); }
}

/* Scroll-reveal: script.js toggles [data-reveal-state="visible"] via IntersectionObserver */
[data-reveal] {
  opacity: 0;
  transform: translateY(1.5rem);
  transition: opacity 0.7s ease-out, transform 0.7s ease-out;
}

[data-reveal-state="visible"] {
  opacity: 1;
  transform: translateY(0);
}

/* ---------------------------------------------------------------
   Journey thread — script.js reveals .msg bubbles cumulatively as
   you scroll through #journey-scroll, and translates #journey-thread
   upward so the newest message stays in view, like a real text
   thread scrolling itself.

   No transition here: this transform is recalculated straight from
   scroll position on every scroll frame (see updateJourney() in
   script.js), so it has to move 1:1 with the scroll or fast/back-
   and-forth scrolling makes it visibly chase a moving target instead
   of tracking where you actually are.
   --------------------------------------------------------------- */
#journey-thread {
  transition: none;
}

.msg {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.msg-revealed {
  opacity: 1;
  transform: translateY(0);
}

/* ---------------------------------------------------------------
   Chat bubble tail — a small curl at the bottom corner, like
   iMessage, built from two overlapping pseudo-elements: ::before
   draws the tail's outer curve in the bubble's own color, ::after
   (page-background color) carves the inner curve out of it,
   leaving a crescent that reads as a curling tail. Shared by every
   chat-style bubble on the site (thread messages, prompts, updates)
   so they all read as one consistent shape.
   --------------------------------------------------------------- */
.tail-left,
.tail-right {
  position: relative;
}
.tail-left::before,
.tail-left::after,
.tail-right::before,
.tail-right::after {
  content: "";
  position: absolute;
  bottom: 0;
  height: 1.25rem;
}
.tail-left::before {
  left: -0.5rem;
  width: 1.25rem;
  background-color: inherit;
  border-bottom-right-radius: 0.9375rem;
}
.tail-left::after {
  left: -0.625rem;
  width: 0.625rem;
  background-color: var(--tail-bg, #fff);
  border-bottom-right-radius: 0.625rem;
}
.tail-right::before {
  right: -0.5rem;
  width: 1.25rem;
  background-color: inherit;
  border-bottom-left-radius: 0.9375rem;
}
.tail-right::after {
  right: -0.625rem;
  width: 0.625rem;
  background-color: var(--tail-bg, #fff);
  border-bottom-left-radius: 0.625rem;
}

/* The tail's carve color has to match whatever surface a bubble sits
   on. Prompts/updates demo chips sit on the features section, whose
   background flips with dark mode; journey-thread bubbles sit inside
   the phone mockup's screen, which stays a literal white "screenshot"
   in both themes, so it's pinned back to white below. */
.dark {
  --tail-bg: #1c1917; /* stone-900, matches the features section's dark:bg-stone-900 */
}

#journey-screen {
  --tail-bg: #fff;
}

/* Final beat: the shared gallery takes over the whole phone screen */
#journey-gallery {
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

#journey-gallery.gallery-revealed {
  opacity: 1;
}

/* Gallery cycles one item at a time (script.js toggles .gallery-item-active
   as you keep scrolling through the gallery phase) instead of showing a
   static grid of everything at once. Short transition: which item is
   active is recalculated on every scroll frame, so a long crossfade here
   fights fast/back-and-forth scrolling the same way the journey thread's
   transform did above. */
.gallery-item {
  opacity: 0;
  transition: opacity 0.15s ease;
}

.gallery-item.gallery-item-active {
  opacity: 1;
}

/* Progress dots hidden for now, keep the elements + JS logic in place */
#journey-dots,
#feature-dots {
  display: none;
}

#journey-dots button,
#feature-dots button {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 999px;
  background: var(--color-blush-200, #f1c3b4);
  transition: background 0.3s ease, width 0.3s ease;
  border: none;
  cursor: pointer;
  padding: 0;
}

#journey-dots button.dot-active,
#feature-dots button.dot-active {
  background: var(--color-blush-500, #c47b6c);
  width: 1.5rem;
}

/* ---------------------------------------------------------------
   Feature slides
   --------------------------------------------------------------- */
.feature-slide {
  scroll-snap-align: center;
}

/* ---------------------------------------------------------------
   Mobile feature regions — one tall sticky-pinned region per
   feature (script.js scrubDemo()/scrollProgress()), mirroring the
   hero journey's pin mechanic on the vertical axis instead of
   desktop's shared horizontal track. Text fades in as the region
   is reached; the demo/graphic scrubs frame-by-frame with scroll.
   --------------------------------------------------------------- */
.feature-mobile-region {
  position: relative;
  height: 170vh;
}

.feature-mobile-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 2rem;
}

.feature-mobile-demo {
  margin-top: 2rem;
  transition-delay: 0.35s;
}

.demo {
  position: relative;
  height: 13rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Demos only animate while their slide is in view (script.js toggles .is-playing) */
.demo * {
  animation-play-state: paused;
}

.is-playing .demo * {
  animation-play-state: running;
}

/* --- uploads --- */
.demo-uploads { height: 22.5rem; }
.demo-uploads .d-up {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  width: 22rem;
}
.demo-uploads .d-bubble {
  display: flex;
  align-items: center;
  align-self: flex-end;
  background: var(--color-blush-500, #c47b6c);
  padding: 0.25rem;
  border-radius: 1.5rem;
  opacity: 0;
  transform: translateY(10px);
}
.demo-uploads .d-media {
  width: 13rem;
  height: 9.5rem;
  border-radius: 1.2rem;
  object-fit: cover;
  display: block;
}
@media (min-width: 768px) {
  .demo-uploads { height: 32rem; }
  .demo-uploads .d-up { width: 20rem; }
  .demo-uploads .d-media { width: 11rem; height: 15rem; }
}
.demo-uploads .d-up-photo { animation: d-up-photo-in 5s ease-in-out infinite; }
.demo-uploads .d-up-video { animation: d-up-video-in 5s ease-in-out infinite; }
@keyframes d-up-photo-in {
  0%, 8% { opacity: 0; transform: translateY(10px); }
  20%, 100% { opacity: 1; transform: translateY(0); }
}
@keyframes d-up-video-in {
  0%, 32% { opacity: 0; transform: translateY(10px); }
  44%, 100% { opacity: 1; transform: translateY(0); }
}
.demo-uploads .d-up-status-wrap {
  position: relative;
  width: 100%;
  height: 1.6rem;
}
.demo-uploads p.d-up-status1,
.demo-uploads p.d-up-status2 {
  position: absolute;
  top: 0;
  left: 50%;
  font-size: 0.9rem;
  font-weight: 600;
  opacity: 0;
  margin: 0;
  white-space: nowrap;
}
.demo-uploads .d-up-status1 {
  transform: translateX(-50%);
  color: var(--color-stone-400, #a8a29e);
  animation: d-up-status1 5s ease-in-out infinite;
}
.demo-uploads .d-up-status2 {
  color: #0e9f6e;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  animation: d-up-status2 5s ease-in-out infinite;
}
.demo-uploads .d-check-dot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 999px;
  background: #10b981;
  color: #fff;
  font-size: 0.7rem;
}
@keyframes d-up-status1 {
  0%, 46% { opacity: 0; transform: translateX(-50%); }
  56%, 76% { opacity: 1; transform: translateX(-50%); }
  86%, 100% { opacity: 0; transform: translateX(-50%); }
}
@keyframes d-up-status2 {
  0%, 78% { opacity: 0; transform: translateX(-50%) scale(0.7); }
  90%, 100% { opacity: 1; transform: translateX(-50%) scale(1); }
}

/* --- gallery --- */
.demo-gallery .d-gallery-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
}
.demo-gallery { height: 20rem; }
.demo-gallery .d-track {
  display: grid;
  grid-template-columns: repeat(3, 5.6rem);
  gap: 0.8rem;
}
.demo-gallery .d-photo {
  width: 5.6rem;
  height: 9.2rem;
  border-radius: 1.1rem;
  background-size: cover;
  background-position: center;
  object-fit: cover;
  opacity: 0;
  animation: d-gallery-in 8s ease-in-out infinite;
}
.demo-gallery .d-photo[data-delay="1"] { animation-delay: 1s; }
.demo-gallery .d-photo[data-delay="2"] { animation-delay: 2s; }
.demo-gallery .d-photo[data-delay="3"] { animation-delay: 3s; }
.demo-gallery .d-photo[data-delay="4"] { animation-delay: 4s; }
.demo-gallery .d-photo[data-delay="5"] { animation-delay: 5s; }
@keyframes d-gallery-in {
  0%, 4% { opacity: 0; transform: translateY(8px) scale(0.94); }
  14%, 100% { opacity: 1; transform: translateY(0) scale(1); }
}
@media (min-width: 768px) {
  .demo-gallery { height: 16rem; }
  .demo-gallery .d-track {
    grid-template-columns: repeat(6, 8rem);
    gap: 1rem;
  }
  .demo-gallery .d-photo {
    width: 8rem;
    height: 13rem;
  }
}

/* --- prompts: line up and stay, same "reveal and keep" feel as the
   broadcast updates below, instead of flashing one at a time --- */
.demo-prompts { height: 21rem; }
.demo-prompts .d-ticker {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  width: min(22rem, 84vw);
}
.demo-prompts .d-chip {
  text-align: left;
  background: var(--color-blush-100, #fbeae2);
  color: var(--color-blush-700, #874c42);
  border-radius: 1.1rem;
  font-size: 1rem;
  font-weight: 600;
  padding: 0.7rem 1.05rem;
  opacity: 0;
  transform: translateY(10px);
  animation: d-chip-in 10s ease-in-out infinite;
}
.demo-prompts .d-chip:nth-child(2) { animation-delay: 2s; }
.demo-prompts .d-chip:nth-child(3) { animation-delay: 4s; }
.demo-prompts .d-chip:nth-child(4) { animation-delay: 6s; }
.demo-prompts .d-chip:nth-child(5) { animation-delay: 8s; }
@keyframes d-chip-in {
  0%, 2% { opacity: 0; transform: translateY(10px); }
  10%, 100% { opacity: 1; transform: translateY(0); }
}
@media (min-width: 768px) {
  .demo-prompts { height: 19rem; }
}

/* --- broadcast updates --- */
.demo-updates .d-updates {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.9rem;
  width: 19rem;
}
.demo-updates .d-update {
  background: var(--color-blush-100, #fbeae2);
  color: var(--color-blush-700, #874c42);
  border-radius: 1.1rem;
  padding: 0.75rem 1.1rem;
  font-size: 1rem;
  font-weight: 600;
  text-align: left;
  opacity: 0;
  animation-duration: 6s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
.demo-updates .d-update:nth-child(1) { animation-name: d-upd-1; }
.demo-updates .d-update:nth-child(2) { animation-name: d-upd-2; }
.demo-updates .d-update:nth-child(3) { animation-name: d-upd-3; }
@keyframes d-upd-1 {
  0%, 5% { opacity: 0; transform: translateY(10px); }
  15%, 100% { opacity: 1; transform: translateY(0); }
}
@keyframes d-upd-2 {
  0%, 38% { opacity: 0; transform: translateY(10px); }
  48%, 100% { opacity: 1; transform: translateY(0); }
}
@keyframes d-upd-3 {
  0%, 71% { opacity: 0; transform: translateY(10px); }
  81%, 100% { opacity: 1; transform: translateY(0); }
}

/* --- delegate access --- */
.demo-delegate .d-cluster {
  position: relative;
  display: flex;
  align-items: center;
  padding-bottom: 2.4rem;
}
.demo-delegate .d-cluster-avatar {
  width: 5.2rem;
  height: 5.2rem;
  border-radius: 999px;
  border: 3px solid #fff;
  box-shadow: 0 4px 10px -2px rgba(0, 0, 0, 0.15);
  background-size: cover;
  background-position: center;
  opacity: 0;
  transform: scale(0.5);
  animation-duration: 5s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
.demo-delegate .d-cl-1 { margin-left: 0; animation-name: d-cl-1; z-index: 1; }
.demo-delegate .d-cl-2 { margin-left: -1.3rem; animation-name: d-cl-2; z-index: 2; }
.demo-delegate .d-cl-3 { margin-left: -1.3rem; animation-name: d-cl-3; z-index: 3; }
@media (min-width: 768px) {
  .demo-delegate .d-cluster-avatar { width: 6.4rem; height: 6.4rem; }
  .demo-delegate .d-cl-2 { margin-left: -1.6rem; }
  .demo-delegate .d-cl-3 { margin-left: -1.6rem; }
}
@keyframes d-cl-1 {
  0%, 4% { opacity: 0; transform: scale(0.5); }
  14%, 100% { opacity: 1; transform: scale(1); }
}
@keyframes d-cl-2 {
  0%, 24% { opacity: 0; transform: scale(0.5); }
  34%, 100% { opacity: 1; transform: scale(1); }
}
@keyframes d-cl-3 {
  0%, 44% { opacity: 0; transform: scale(0.5); }
  54%, 100% { opacity: 1; transform: scale(1); }
}
.demo-delegate .d-cluster-badge {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%) translateY(6px);
  white-space: nowrap;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-blush-700, #874c42);
  background: var(--color-blush-100, #fbeae2);
  padding: 0.4rem 1rem;
  border-radius: 999px;
  opacity: 0;
  animation: d-cl-badge 5s ease-in-out infinite;
}
@keyframes d-cl-badge {
  0%, 64% { opacity: 0; transform: translateX(-50%) translateY(6px); }
  74%, 100% { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* --- printed polaroids --- */
.demo-polaroids { height: 17rem; }
.demo-polaroids .d-collage {
  position: relative;
  width: 19rem;
  height: 15.5rem;
}
.demo-polaroids .d-polaroid {
  position: absolute;
  width: 5.3rem;
  height: 6.3rem;
  background: #fff;
  border-radius: 0.25rem;
  box-shadow: 0 10px 22px -4px rgba(0, 0, 0, 0.25);
  opacity: 0;
  animation-duration: 6s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
.demo-polaroids .d-polaroid::after {
  content: "";
  position: absolute;
  inset: 0.4rem 0.4rem 1.25rem 0.4rem;
  border-radius: 0.15rem;
  background-image: var(--pimg, none);
  background-size: cover;
  background-position: center;
}
.demo-polaroids .pc1 { top: 0; left: 0; animation-name: d-pc1; }
.demo-polaroids .pc2 { top: 0.4rem; left: 6.4rem; animation-name: d-pc2; }
.demo-polaroids .pc3 { top: 0.9rem; left: 12.8rem; animation-name: d-pc3; }
.demo-polaroids .pc4 { top: 8rem; left: 3.2rem; animation-name: d-pc4; }
.demo-polaroids .pc5 { top: 8.5rem; left: 10.2rem; animation-name: d-pc5; }
.demo-polaroids .pc1::after { background-color: var(--color-blush-200, #f1c3b4); }
.demo-polaroids .pc2::after { background-color: var(--color-blush-300, #e3a291); }
.demo-polaroids .pc3::after { background-color: var(--color-blush-400, #d18d7b); }
.demo-polaroids .pc4::after { background-color: var(--color-blush-500, #c47b6c); }
.demo-polaroids .pc5::after { background-color: var(--color-blush-300, #e3a291); }
@media (min-width: 768px) {
  .demo-polaroids { height: 26rem; }
  .demo-polaroids .d-collage { width: 33rem; height: 23.5rem; }
  .demo-polaroids .d-polaroid { width: 8.3rem; height: 9.9rem; }
  .demo-polaroids .d-polaroid::after { inset: 0.65rem 0.65rem 1.95rem 0.65rem; }
  .demo-polaroids .pc1 { top: 0; left: 0; }
  .demo-polaroids .pc2 { top: 0.5rem; left: 12.4rem; }
  .demo-polaroids .pc3 { top: 1rem; left: 23.4rem; }
  .demo-polaroids .pc4 { top: 12.5rem; left: 3rem; }
  .demo-polaroids .pc5 { top: 12.5rem; left: 14.5rem; }
}
@keyframes d-pc1 {
  0%, 0% { opacity: 0; transform: rotate(-8deg) scale(0.6); }
  20%, 100% { opacity: 1; transform: rotate(-8deg) scale(1); }
}
@keyframes d-pc2 {
  0%, 16% { opacity: 0; transform: rotate(6deg) scale(0.6); }
  36%, 100% { opacity: 1; transform: rotate(6deg) scale(1); }
}
@keyframes d-pc3 {
  0%, 32% { opacity: 0; transform: rotate(-4deg) scale(0.6); }
  52%, 100% { opacity: 1; transform: rotate(-4deg) scale(1); }
}
@keyframes d-pc4 {
  0%, 48% { opacity: 0; transform: rotate(5deg) scale(0.6); }
  68%, 100% { opacity: 1; transform: rotate(5deg) scale(1); }
}
@keyframes d-pc5 {
  0%, 64% { opacity: 0; transform: rotate(-6deg) scale(0.6); }
  84%, 100% { opacity: 1; transform: rotate(-6deg) scale(1); }
}

/* Generic pin-and-reveal region — one tall scroll region per item
   (testimonials, pricing), each with a sticky-centered card, same
   mechanic on every viewport. Mirrors the hero journey's pin, just
   for a static card instead of a scrubbed demo. */
.pin-region {
  position: relative;
  min-height: 315vh;
}

/* Touch-flick scrolling covers more viewport height per swipe than a mouse
   wheel does, so give pinned cards extra scroll distance on small screens
   to keep the same dwell feel as desktop. */
@media (max-width: 767px) {
  .pin-region {
    min-height: 378vh;
  }
}

.pin-sticky {
  position: sticky;
  top: 0;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal] {
    opacity: 1;
    transform: none;
    transition: none;
  }
  #journey-thread,
  .msg {
    transition: none;
  }
  .demo * {
    animation: none !important;
    opacity: 1 !important;
  }
}
