/* The invite-only beta: its two pages (geo_beta/*), the inline prompts
   (shared/_geo_beta_placement) and the sidebar item (geo_beta/_sidebar_item).
   This file ships to every visitor, so it never names the product (see
   test/integration/geo_beta_privacy_test.rb). One-shot motion only, every
   piece with a prefers-reduced-motion fallback, colours from the
   light-dark() tokens. */

/* The join click morphs the prompt (or the invite page's illustration) into
   the joined page's hero: a Turbo view transition between pages that both
   carry <meta name="view-transition">. */
.geo-beta-prompt,
.geo-beta-hero {
  view-transition-name: geo-beta-hero;
}
::view-transition-group(geo-beta-hero) {
  animation-duration: 0.45s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
::view-transition-old(root),
::view-transition-new(root) {
  animation-duration: 0.35s;
}

/* Joined moment: the scalloped seal scales in with the success overshoot,
   then the tick knocked out of it draws on. Only on the render right after
   a join (.geo-beta-seal--animate). */
@keyframes geo-beta-tick-draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
.geo-beta-seal--animate svg {
  animation: success-scale-in 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.geo-beta-seal--animate .geo-beta-seal-tick {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: geo-beta-tick-draw 0.35s ease-out 0.3s forwards;
}

/* The maker's row in the answer card: a soft highlight draws around it,
   line by line. */
@keyframes geo-beta-outline-draw {
  from { stroke-dashoffset: 100; }
  to { stroke-dashoffset: 0; }
}
.geo-beta-maker-row {
  background-color: var(--surface);
}
.geo-beta-highlight rect {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: geo-beta-outline-draw 0.5s ease-out 0.35s forwards;
}

/* The invite card streams in like an assistant's reply (chat-stream
   controller): each step waits invisible, keeping its space, then fades up
   while its text types out. */
.geo-beta-stream-pending {
  opacity: 0;
}
.geo-beta-stream-in {
  animation: fade-up-in 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* The four loop badges: the joining line draws on left to right, the
   badges settle in one after another. */
.geo-beta-loop-line {
  animation: line-draw-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) 0.2s both;
}
.geo-beta-loop-step {
  animation: fade-up-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.geo-beta-loop-step:nth-of-type(1) { animation-delay: 0.1s; }
.geo-beta-loop-step:nth-of-type(2) { animation-delay: 0.2s; }
.geo-beta-loop-step:nth-of-type(3) { animation-delay: 0.3s; }
.geo-beta-loop-step:nth-of-type(4) { animation-delay: 0.4s; }

/* What happens next: a list that reveals top to bottom. */
.geo-beta-timeline-item {
  animation: fade-up-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.geo-beta-timeline-item:nth-child(1) { animation-delay: 0.1s; }
.geo-beta-timeline-item:nth-child(2) { animation-delay: 0.2s; }
.geo-beta-timeline-item:nth-child(3) { animation-delay: 0.3s; }
.geo-beta-timeline-item:nth-child(4) { animation-delay: 0.4s; }

/* The conversation's first render staggers in; messages that arrive later
   (live broadcasts) carry no stagger class and simply appear. */
.geo-beta-message--stagger {
  animation: fade-up-in 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.geo-beta-message--stagger:nth-child(2) { animation-delay: 0.05s; }
.geo-beta-message--stagger:nth-child(3) { animation-delay: 0.1s; }
.geo-beta-message--stagger:nth-child(4) { animation-delay: 0.15s; }
.geo-beta-message--stagger:nth-child(n + 5) { animation-delay: 0.2s; }

/* "Later" and "Leave": quiet text buttons, muted until hovered. */
.geo-beta-quiet-btn {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
  border-radius: 0.375rem;
  border: 0;
  background: transparent;
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 150ms ease-out;
}
.geo-beta-quiet-btn:hover,
.geo-beta-quiet-btn:focus-visible {
  color: var(--page-text);
}
.geo-beta-quiet-btn:focus-visible {
  outline: 2px solid var(--border);
  outline-offset: 2px;
}

/* The sidebar item fades in once, the first time it appears after an
   offer; each pill change cross-fades. */
@keyframes geo-beta-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.geo-beta-sidebar-arrive {
  animation: geo-beta-fade-in 0.5s ease-out both;
}
.geo-beta-pill-in {
  animation: geo-beta-fade-in 0.35s ease-out both;
}

/* The collapsed rail keeps a small dot on the icon (amber while something
   waits), so the item still stands out with its label and pill hidden. */
.geo-beta-sidebar-dot {
  display: none;
  position: absolute;
  top: 0.4rem;
  left: 1.6rem;
  width: 0.45rem;
  height: 0.45rem;
  border-radius: 9999px;
  box-shadow: 0 0 0 2px var(--surface-elevated);
}
@media (min-width: 768px) {
  .sidebar-collapsed .geo-beta-sidebar-dot {
    display: block;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none;
  }
  .geo-beta-seal--animate svg,
  .geo-beta-stream-in,
  .geo-beta-loop-line,
  .geo-beta-loop-step,
  .geo-beta-timeline-item,
  .geo-beta-message--stagger,
  .geo-beta-sidebar-arrive,
  .geo-beta-pill-in {
    animation: none;
  }
  .geo-beta-seal--animate .geo-beta-seal-tick,
  .geo-beta-highlight rect {
    animation: none;
    stroke-dashoffset: 0;
  }
}
