/* Genie voice demo: the mic → listening → send moment from the app
   (src/features/composer/VoiceOverlay.js, Waveform.js, VoiceComposer.js),
   laid out landscape for the web. Front end only, no dependencies.

   Timings and curves are the app's Motion tokens (brand/Motion.js):
     ease-out   cubic-bezier(0.23, 1, 0.32, 1)     enter / exit
     ease-inout cubic-bezier(0.77, 0, 0.175, 1)    moving on screen
     enter 215ms · exit 170ms · press 120/160ms · press scale 0.97
   Everything is scoped under .gv so it can't leak into the rest of the page. */

.gv {
  --gv-ink: #111827;
  /* Colors.text.primary */
  --gv-ink-fresh: #9CA3AF;
  /* Colors.text.muted: a word that just arrived */
  --gv-ink-soft: #6B7280;
  /* Colors.text.tertiary */
  --gv-page: #f2f2f2;
  /* case-study card fill */
  --gv-line: rgba(0, 0, 0, 0.07);
  --gv-ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --gv-ease-inout: cubic-bezier(0.77, 0, 0.175, 1);
  --gv-enter: 215ms;
  --gv-exit: 170ms;

  font-family: "Maison", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--gv-ink);
  padding: 0 16px;
}

/* ── Stage: landscape, never taller than the viewport ──────────────────── */
.gv__stage {
  position: relative;
  width: min(100%, 1200px, calc((100svh - 160px) * 16 / 9));
  aspect-ratio: 16 / 9;
  margin: 0 auto;
  border-radius: 20px;
  overflow: hidden;
  background: var(--gv-page);
  border: 1px solid var(--gv-line);
  isolation: isolate;
}

/* Pills rail: phones only (see the phone layout below) */
.gv__rail {
  display: none;
}

/* The feed behind the veil: a real story playing, with the app's story
   bar on top (StoryBar.js). Asking pauses and blurs it; sending adds a
   new segment that blinks while the story is being made. */
.gv__feed {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 380px);
  justify-content: center;
  gap: 6%;
  padding: 5% 6% 17%;
  align-items: center;
  transition: filter 320ms var(--gv-ease-out), transform 320ms var(--gv-ease-out);
}

.gv[data-phase="listening"] .gv__feed {
  filter: blur(14px);
  transform: scale(0.98);
  transition-duration: 420ms;
}

.gv__feed-media {
  position: relative;
  height: 100%;
  aspect-ratio: 4 / 5;
  border-radius: 14px;
  overflow: hidden;
  background: #111827;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.12);
}

.gv__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 400ms var(--gv-ease-out);
}

.gv__video.is-on {
  opacity: 1;
}

/* A soft shine sweeps across the story once when a new story is added */
.gv__feed-media::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background: linear-gradient(105deg, rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.38) 50%, rgba(255, 255, 255, 0) 70%);
  transform: translateX(-110%);
}

.gv__feed-media.is-shine::after {
  animation: gv-shine 1100ms var(--gv-ease-inout) forwards;
}

@keyframes gv-shine {
  to {
    transform: translateX(110%);
  }
}

/* Story bar: white segments over the video, like the app */
.gv__storybar {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  z-index: 1;
  display: flex;
  gap: 5px;
}

.gv__storybar::before {
  content: "";
  position: absolute;
  inset: -10px -10px -26px;
  z-index: -1;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.32), rgba(0, 0, 0, 0));
}

.gv__seg {
  flex: 1 1 0;
  height: 3px;
  border-radius: 2px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.35);
}

.gv__seg i {
  display: block;
  height: 100%;
  background: #fff;
  transform-origin: left center;
  transform: scaleX(0);
}

/* A new story joins the bar: it grows in, pushing the others along, then
   blinks until it's ready. flex-grow is the one layout property animated:
   the neighbours have to make room. */
.gv__seg--new {
  flex-grow: 0;
  opacity: 0;
  margin-left: -5px;
  transition: flex-grow 600ms var(--gv-ease-inout), margin 600ms var(--gv-ease-inout), opacity 300ms var(--gv-ease-out);
}

.gv__seg--new.is-in {
  flex-grow: 1;
  opacity: 1;
  margin-left: 0;
}

.gv__seg--new.is-making {
  animation: gv-blink 1.1s ease-in-out 600ms infinite;
}

@keyframes gv-blink {
  0%, 100% {
    background: rgba(255, 255, 255, 0.35);
  }

  50% {
    background: rgba(255, 255, 255, 0.95);
  }
}

.gv__feed-copy {
  display: grid;
  gap: 10px;
}

.gv__feed-kicker {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--gv-ink-soft);
  text-transform: uppercase;
}

.gv__feed-title {
  font-size: clamp(18px, 2.2vw, 30px);
  font-family: "Tiempos", Georgia, serif; letter-spacing: -0.04em;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.04em;
  margin: 0;
}

.gv__feed-body {
  font-size: clamp(13px, 1.2vw, 16px);
  font-weight: 500;
  line-height: 1.7;
  color: var(--gv-ink-soft);
  margin: 0;
}

/* ── Veil: the feed washes out under white (VoiceOverlay) ─────────────── */
.gv__veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  pointer-events: none;
  /* No backdrop-filter: Chrome ignores the stage's rounded clip for it.
     The feed blurs itself instead (see .gv__feed). */
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0.88) 50%, #fff 100%);
  transition: opacity var(--gv-exit) var(--gv-ease-out);
}

.gv[data-phase="listening"] .gv__veil {
  opacity: 1;
  transition: opacity 240ms var(--gv-ease-out);
}

.gv[data-phase="sending"] .gv__veil {
  opacity: 0;
  transition: opacity 320ms var(--gv-ease-out) 100ms;
}

/* ── Waveform: five pills, centred high (Waveform.js) ──────────────────── */
.gv__wave {
  position: absolute;
  top: 16%;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 5px;
  height: 44px;
  opacity: 0;
  transition: opacity var(--gv-exit) var(--gv-ease-out);
}

.gv[data-phase="listening"] .gv__wave {
  opacity: 1;
  transition-duration: var(--gv-enter);
}

.gv__bar {
  width: 6px;
  height: 6px;
  /* a dot at rest */
  border-radius: 3px;
  background: var(--gv-ink);
  transition: height 110ms var(--gv-ease-out);
  /* one tick */
}

/* ── Words: newest arrive light, settle dark (VoiceOverlay Words) ──────── */
.gv__words {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  width: min(80%, 760px);
  margin: 0;
  text-align: center;
  font-size: clamp(22px, 2.8vw, 40px);
  font-weight: 600;
  /* MaisonNeue-Demi, the app's TITLE */
  line-height: 1.3;
  letter-spacing: -0.01em;
  opacity: 0;
  transform: translate(-50%, calc(-50% + 12px));
  transition:
    opacity var(--gv-exit) var(--gv-ease-out),
    transform var(--gv-exit) var(--gv-ease-out);
}

.gv[data-phase="listening"] .gv__words {
  opacity: 1;
  transform: translate(-50%, -50%);
  transition-duration: var(--gv-enter);
}

/* Send: the question lifts off toward the top, scales to 0.94 and fades
   over the last 40% of the trip (460ms ease-in-out). */
.gv[data-phase="sending"] .gv__words {
  animation: gv-lift 460ms var(--gv-ease-inout) forwards;
}

@keyframes gv-lift {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  60% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 45cqh)) scale(0.94);
  }
}

.gv__stage {
  container-type: size;
}

.gv__word {
  transition: color 320ms var(--gv-ease-out);
}

.gv__word--fresh {
  color: var(--gv-ink-fresh);
}

.gv__hint {
  color: var(--gv-ink-fresh);
}

/* ── Bottom bar: ✕/bookmark · mic pill · keyboard (VoiceComposer) ───────── */
.gv__bar-row {
  position: absolute;
  left: 50%;
  bottom: 6%;
  z-index: 3;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 28px;
}

.gv__btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  color: var(--gv-ink);
  /* Glass, light tone */
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.07), 0 8px 24px rgba(16, 24, 40, 0.10), 0 1px 2px rgba(16, 24, 40, 0.06);
  transition: transform 160ms var(--gv-ease-out);
}

.gv__btn:active {
  transform: scale(0.97);
  transition-duration: 120ms;
}

.gv__btn:focus-visible {
  outline: 2px solid var(--gv-ink);
  outline-offset: 3px;
}

/* Glass, dark tone: the primary action */
.gv__btn--mic {
  width: 84px;
  color: #fff;
  background: rgba(0, 0, 0, 0.86);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 8px 24px rgba(16, 24, 40, 0.18);
}

.gv__btn svg {
  width: 22px;
  height: 22px;
}

/* Glyph swaps crossfade in place (micro, 170ms) */
.gv__glyph {
  position: absolute;
  display: grid;
  place-items: center;
  transition: opacity 170ms var(--gv-ease-out), transform 170ms var(--gv-ease-out);
}

.gv__glyph--alt {
  opacity: 0;
  transform: scale(0.8);
}

.gv[data-phase="listening"] .gv__btn--swap .gv__glyph--main {
  opacity: 0;
  transform: scale(0.8);
}

.gv[data-phase="listening"] .gv__btn--swap .gv__glyph--alt {
  opacity: 1;
  transform: scale(1);
}

/* A soft ring on the mic before first tap, so people know to click it */
.gv[data-phase="idle"] .gv__btn--mic::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: inherit;
  border: 1.5px solid rgba(17, 24, 39, 0.35);
  animation: gv-ring 2.2s var(--gv-ease-out) infinite;
}

@keyframes gv-ring {
  0% {
    opacity: 0.9;
    transform: scale(0.96);
  }

  100% {
    opacity: 0;
    transform: scale(1.25);
  }
}

.gv__caption {
  margin: 14px auto 0;
  text-align: center;
  font-size: 16px;
  font-weight: 500;
  color: var(--gv-ink-soft);
}

/* ── Phones: the app's own layout ────────────────────────────────────────
   Pills rail on top, then one tall story card: video full-bleed, story
   bar at the top, title + body over a dark scrim, the bottom bar inside
   the card. Same width as the text column. */
@media (max-width: 640px) {
  .gv {
    padding: 0 var(--component-padding, 20px);
  }

  .gv__rail {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    white-space: nowrap;
    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
    mask-image: linear-gradient(90deg, #000 85%, transparent);
  }

  .gv__plus {
    flex: none;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 999px;
    color: #fff;
    background: var(--gv-ink);
    box-shadow: 0 6px 16px rgba(17, 24, 39, 0.18);
  }

  .gv__plus svg {
    width: 20px;
    height: 20px;
  }

  .gv__pill {
    flex: none;
    display: flex;
    align-items: center;
    gap: 6px;
    height: 40px;
    padding: 0 14px 0 6px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
    color: var(--gv-ink);
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(16, 24, 40, 0.06);
  }

  .gv__pill img {
    width: 28px;
    height: 28px;
    object-fit: contain;
  }

  .gv__pill.is-selected {
    color: #fff;
    background: var(--gv-ink);
    box-shadow: 0 6px 16px rgba(17, 24, 39, 0.18);
  }

  .gv__stage {
    width: 100%;
    aspect-ratio: auto;
    height: min(640px, calc(100svh - 170px));
    min-height: 480px;
    border: 0;
    border-radius: 22px;
    background: #111827;
  }

  .gv__feed {
    display: block;
    padding: 0;
  }

  .gv__feed-media {
    position: absolute;
    inset: 0;
    height: auto;
    aspect-ratio: auto;
    border-radius: 0;
    box-shadow: none;
  }

  .gv__storybar {
    top: 14px;
    left: 16px;
    right: 16px;
  }

  /* Scrim under the copy so white text reads on any frame */
  .gv__feed::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 62%;
    pointer-events: none;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.55) 45%, rgba(0, 0, 0, 0.82) 100%);
  }

  .gv__feed-copy {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 96px;
    z-index: 2;
    gap: 8px;
    text-align: left;
  }

  .gv__feed-title {
    font-family: inherit;
    font-size: 22px;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.01em;
    color: #fff;
  }

  .gv__feed-body {
    font-size: 15px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.86);
  }

  .gv__bar-row {
    left: 20px;
    right: 20px;
    bottom: 20px;
    transform: none;
    justify-content: space-between;
    gap: 0;
  }

  .gv__words {
    width: calc(100% - 40px);
    font-size: 24px;
  }

  .gv__wave {
    top: 20%;
  }
}

/* ── Reduced motion: opacity only, no travel ───────────────────────────── */
@media (prefers-reduced-motion: reduce) {

  .gv__words,
  .gv[data-phase="listening"] .gv__words {
    transform: translate(-50%, -50%);
  }

  .gv[data-phase="sending"] .gv__words {
    animation: gv-fade 300ms linear forwards;
  }

  .gv__bar {
    transition: none;
  }

  .gv[data-phase="idle"] .gv__btn--mic::after {
    animation: none;
    opacity: 0.5;
  }

  .gv__feed,
  .gv[data-phase="listening"] .gv__feed {
    transform: none;
  }

  .gv__seg--new.is-making {
    animation: none;
    background: rgba(255, 255, 255, 0.7);
  }

  .gv__feed-media.is-shine::after {
    animation: none;
  }
}

@keyframes gv-fade {
  to {
    opacity: 0;
  }
}

