/*
 * Cloudspire Trade Show Booth Loop — full-screen kiosk.
 * Hidden URL — see /docs/superpowers/specs/2026-04-26-trade-show-booth-loop-design.md
 */

:root {
  --bg-deep:        #050510;
  --bg-primary:     #0a0a1a;
  --purple:         #7c3aed;
  --blue:           #2563eb;
  --cyan:           #06b6d4;
  --text:           #f8fafc;
  --text-muted:     #94a3b8;
  --gradient:       linear-gradient(135deg, #7c3aed 0%, #2563eb 50%, #06b6d4 100%);
  --gradient-glow:  linear-gradient(135deg, rgba(124,58,237,0.85) 0%, rgba(37,99,235,0.85) 50%, rgba(6,182,212,0.85) 100%);
  --safe-inset:     6vw;
  --safe-inset-y:   6vh;
  --transition-fade:         600ms;
  --transition-fade-chapter: 1100ms;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
}
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  cursor: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

#stage { position: fixed; inset: 0; }

/* Always-on animated brand background */
#bg-animated {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 0;
  opacity: 0.55;
}
#bg-tint {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(124,58,237,0.18) 0%, transparent 55%),
    radial-gradient(ellipse at 70% 80%, rgba(6,182,212,0.14) 0%, transparent 55%),
    linear-gradient(180deg, rgba(5,5,16,0.35) 0%, rgba(5,5,16,0.7) 100%);
  z-index: 1;
}

/* Scene slots - cross-fade between two */
.scene {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity var(--transition-fade) ease-in-out;
  z-index: 2;
  overflow: hidden;
  /*
   * Inactive slot mustn't intercept clicks. Both slots are full-bleed inset:0
   * with the same z-index, so whichever is later in DOM (scene-b) sits on
   * top in stacking. With opacity:0 alone the invisible slot was eating
   * every click — including the outro "Book a demo" CTA on the active slot.
   */
  pointer-events: none;
}
.scene--active { opacity: 1; pointer-events: auto; }
.scene--chapter-edge { transition-duration: var(--transition-fade-chapter); }

.scene-media {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.scene--image .scene-media {
  animation: ken-burns 10s ease-out forwards;
  transform-origin: center center;
}
@keyframes ken-burns {
  from { transform: scale(1.00); }
  to   { transform: scale(1.10); }
}

/*
 * Contain mode for ultra-wide or off-aspect screenshots — the image fits
 * fully inside the stage with the animated brand background showing through
 * on the letterbox bars. Ken Burns disabled because zooming a contained
 * image creates an unmotivated jump.
 */
.scene--image.scene--contain .scene-media {
  object-fit: contain;
  animation: none;
  transform: none;
  background: transparent;
}

/*
 * === Phone scenes — portrait iOS screenshots ===
 * phone-trio:  3 phones side-by-side, staggered fade-up entry
 * phone-single: 1 phone centered, slightly taller for hero treatment
 * Both let the animated brand background show through behind/around the phones.
 *
 * Sized large so the source 1206x2622 PNGs aren't aggressively downscaled —
 * trade-show monitors are typically non-retina 1080p, where heavy downscaling
 * softens the iOS UI text and icons.
 */
.scene--phone-trio,
.scene--phone-single {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 4vw 0;
}
.scene--phone-trio  { gap: 2vw; }
.scene--phone-single { padding-top: 3vh; }

.phone-frame {
  height: 78vh;
  aspect-ratio: 1206 / 2622;
  background: #050510;
  padding: 0.5vh;
  border-radius: 4vh;
  box-shadow:
    0 30px 80px rgba(0, 0, 0, 0.7),
    0 0 80px rgba(124, 58, 237, 0.18),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
  overflow: hidden;
  position: relative;
  flex-shrink: 0;
  z-index: 4;
  opacity: 0;
  transform: translateY(28px) scale(0.96);
  animation: phone-rise 750ms cubic-bezier(.2,.85,.2,1) forwards;
  animation-delay: calc(var(--phone-index, 0) * 220ms + 250ms);
}
.scene--phone-single .phone-frame {
  height: 80vh;
  animation-delay: 250ms;
}
.phone-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  display: block;
  border-radius: 3.5vh;
  /* Smooth high-quality downscaling. (Earlier crisp-edges was wrong — that's
   * nearest-neighbor for pixel art, which made screenshots look blocky.) */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: high-quality;
}
@keyframes phone-rise {
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/*
 * All overlay text sits at the bottom now, so the scrim just darkens
 * the bottom 35–40% strongly. Top has a faint tint for legibility of
 * the badge pill in the upper-right corner.
 */
.scene-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg,
      rgba(5,5,16,0.40) 0%,
      rgba(5,5,16,0)    14%,
      rgba(5,5,16,0)    45%,
      rgba(5,5,16,0.65) 70%,
      rgba(5,5,16,0.94) 100%);
  pointer-events: none;
  z-index: 3;
}

/* === Title card === */
.scene--title { display: grid; place-items: center; }
.title-card {
  text-align: center;
  padding: 0 var(--safe-inset);
  max-width: 92vw;
  position: relative; z-index: 4;
  animation: title-rise 900ms cubic-bezier(.2,.85,.2,1) both;
}
.title-card .eyebrow {
  font-weight: 700;
  font-size: 1.4vw;
  letter-spacing: 0.45em;
  text-transform: uppercase;
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  margin-bottom: 1.6vw;
}
.title-card .headline {
  font-weight: 900;
  font-size: 7.6vw;
  line-height: 0.96;
  letter-spacing: -0.025em;
  margin-bottom: 1.6vw;
}
.title-card .headline em {
  font-style: normal;
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.title-card .subhead {
  font-weight: 400;
  font-size: 1.7vw;
  line-height: 1.45;
  color: var(--text-muted);
  max-width: 88vw;
  margin: 0 auto;
}
@keyframes title-rise {
  from { opacity: 0; transform: translateY(28px) scale(0.99); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

/* === Overlays (over video / image scenes) === */
.overlay {
  position: absolute;
  z-index: 5;
  opacity: 0;
  transform: translateY(14px);
  animation: overlay-in 420ms cubic-bezier(.2,.85,.2,1) 250ms forwards;
}
@keyframes overlay-in {
  to { opacity: 1; transform: translateY(0); }
}

/*
 * Bottom-anchored caption styles — both lower-third and headline now sit
 * at the bottom-left so the screenshot stays visible. Right margin is
 * tight by default; widen to 20% only when a stat pill sits in the corner.
 */
.overlay--lower-third,
.overlay--headline {
  bottom: var(--safe-inset-y);
  left: var(--safe-inset);
  right: 6%;
  font-weight: 900;
  font-size: 3.2vw;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-shadow: 0 4px 30px rgba(0,0,0,0.7);
}
.overlay--lower-third::before,
.overlay--headline::before {
  content: "";
  display: block;
  width: 10vw; height: 5px;
  background: var(--gradient);
  border-radius: 3px;
  margin-bottom: 0.9vw;
}

/*
 * Bullets stack ABOVE the headline, both anchored to the bottom-left.
 * Container's bottom edge sits just above the headline; children stack
 * downward inside, so the last bullet ends just above the headline.
 */
.overlay--bullets {
  bottom: calc(var(--safe-inset-y) + 5.5vw);
  left: var(--safe-inset);
  right: 6%;
  display: flex;
  flex-direction: column;
  gap: 0.6vw;
  opacity: 1; transform: none;
  animation: none;
}
.bullet {
  font-weight: 700;
  font-size: 1.6vw;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.9vw;
  text-shadow: 0 2px 18px rgba(0,0,0,0.6);
  opacity: 0;
  transform: translateX(-18px);
  animation: bullet-in 480ms cubic-bezier(.2,.85,.2,1) forwards;
  animation-delay: calc(var(--bullet-index, 0) * 160ms + 450ms);
}
.bullet::before {
  content: "";
  display: inline-block;
  width: 0.85vw; height: 0.85vw;
  border-radius: 50%;
  background: var(--gradient);
  flex-shrink: 0;
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.7);
}
@keyframes bullet-in {
  to { opacity: 1; transform: translateX(0); }
}

/* Badge — top-right pill */
.overlay--badge {
  top: var(--safe-inset-y);
  right: var(--safe-inset);
  font-weight: 800;
  font-size: 1.3vw;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.75em 1.5em;
  border-radius: 999px;
  background: var(--gradient-glow);
  box-shadow: 0 8px 32px rgba(124, 58, 237, 0.4),
              inset 0 1px 0 rgba(255,255,255,0.18);
  color: #fff;
}

/*
 * Stat — top-right (same corner as badge). No current scene uses both
 * badge AND stat together; if that ever changes we'll need to stack them.
 */
.overlay--stat {
  top: var(--safe-inset-y);
  right: var(--safe-inset);
  font-weight: 900;
  font-size: 1.5vw;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.65em 1.3em;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.18);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* === CTA card === */
.scene--cta { display: grid; place-items: center; }
.cta-card {
  text-align: center;
  padding: 0 var(--safe-inset);
  max-width: 92vw;
  position: relative; z-index: 4;
  animation: title-rise 900ms cubic-bezier(.2,.85,.2,1) both;
}
.cta-card .cta-mark {
  display: flex;
  justify-content: center;
  margin-bottom: 2.5vw;
}
.cta-card .cta-logo {
  height: 5.5vw;
  width: auto;
  display: block;
}
.cta-card .cta-headline {
  font-weight: 900;
  font-size: 5.0vw;
  letter-spacing: -0.025em;
  line-height: 1.0;
  margin-bottom: 1.4vw;
}
.cta-card .cta-headline em {
  font-style: normal;
  background: var(--gradient);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.cta-card .cta-tagline {
  font-weight: 400;
  font-size: 2.1vw;
  color: var(--text-muted);
  margin-bottom: 2.5vw;
}
.cta-card .cta-callout {
  display: inline-block;
  padding: 1.0em 2.4em;
  font-weight: 900;
  font-size: 2.2vw;
  letter-spacing: 0.01em;
  background: var(--gradient);
  border-radius: 9999px;
  box-shadow: 0 16px 48px rgba(124, 58, 237, 0.45),
              inset 0 1px 0 rgba(255,255,255,0.2);
  color: #fff;
  margin-bottom: 2vw;
}

/* Clickable variant for the outro CTA in playOnce / sales-tour mode. */
.cta-card .cta-callout-link {
  text-decoration: none;
  cursor: pointer;
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.cta-card .cta-callout-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 60px rgba(124, 58, 237, 0.6),
              inset 0 1px 0 rgba(255,255,255,0.25);
}
.cta-card .cta-urls {
  font-weight: 700;
  font-size: 1.3vw;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: flex;
  justify-content: center;
  gap: 1.5em;
}
.cta-card .cta-urls span + span::before {
  content: "·";
  margin-right: 1.5em;
  opacity: 0.5;
}

/* === Persistent chrome === */
#chrome {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2.4vh 3vw;
  z-index: 10;
  pointer-events: none;
}
.chrome-tl {
  display: flex;
  align-items: center;
  gap: 0.9vw;
  background: rgba(5,5,16,0.55);
  border: 1px solid rgba(124, 58, 237, 0.22);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.55vw 1.25vw 0.55vw 1.0vw;
  border-radius: 999px;
}
.chrome-logo {
  height: 2.0vw;
  width: auto;
  display: block;
}
.chrome-tld {
  font-weight: 400;
  font-size: 1.0vw;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-left: 1px solid rgba(255,255,255,0.18);
  padding-left: 0.9vw;
}

.noscript {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: var(--bg-deep);
  color: var(--text);
  font-size: 2vw;
  z-index: 999;
}

/*
 * Audio hint — small unobtrusive banner shown only when narration was blocked
 * by the browser's autoplay policy. First click anywhere unlocks audio and
 * the hint hides. Tour mode only (booth has no audioSrc anywhere in its
 * content, so playNarration is a no-op there).
 */
.audio-hint {
  position: fixed;
  right: 2vw;
  bottom: 2vh;
  z-index: 50;
  padding: 0.7vw 1.4vw;
  background: rgba(5,5,16,0.7);
  border: 1px solid rgba(124, 58, 237, 0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: 999px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.0vw;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 400ms ease-out, transform 400ms ease-out;
}
.audio-hint::before {
  content: '🔊  ';
}
.audio-hint--visible {
  opacity: 1;
  transform: translateY(0);
}

/*
 * Tour mode (loopMode === "playOnce") — interactive sales loop on the
 * marketing sites. Engine adds .mode--tour to <body> when in this mode.
 * Booth (default) keeps the kiosk-style cursor:none + no close button.
 */
body.mode--tour { cursor: auto; }

/* Outro CTA pill stays clickable as a real link. */
body.mode--tour .cta-card .cta-callout-link {
  position: relative;
  z-index: 6;          /* above scene-scrim and overlays */
  pointer-events: auto;
  cursor: pointer;
}

/*
 * Tour close affordance — a tiny circular × top-right. Default state is
 * subtle (low opacity, just the icon) so it doesn't compete with the
 * video. The "Back to ..." label is hidden by default and slides in only
 * when the user hovers, so accessibility/clarity is preserved without
 * visual clutter while the tour plays.
 */
.tour-close {
  display: none;            /* booth never shows it */
  align-items: center;
  gap: 0;
  height: 2.4vw;
  min-height: 32px;
  padding: 0;
  background: rgba(5,5,16,0.4);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 999px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.85vw;
  pointer-events: auto;
  cursor: pointer;
  opacity: 0.5;
  overflow: hidden;
  transition: opacity 250ms ease, background 250ms ease, border-color 250ms ease, gap 250ms ease, padding 250ms ease;
}
body.mode--tour .tour-close { display: inline-flex; }
.tour-close__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4vw;
  min-width: 32px;
  height: 100%;
  font-size: 1.4vw;
  font-weight: 400;
  line-height: 1;
  flex-shrink: 0;
}
.tour-close__label {
  max-width: 0;             /* hidden by default */
  white-space: nowrap;
  overflow: hidden;
  letter-spacing: 0.04em;
  transition: max-width 300ms ease, padding 300ms ease;
  padding: 0;
}
.tour-close:hover {
  opacity: 1;
  background: rgba(15, 15, 35, 0.75);
  border-color: rgba(124, 58, 237, 0.45);
  color: var(--text);
  gap: 0.4vw;
  padding-right: 1vw;
}
.tour-close:hover .tour-close__label {
  max-width: 14vw;
  padding-left: 0.1vw;
}

/* Chrome header keeps interactive in tour mode (so the close button is clickable). */
body.mode--tour #chrome { pointer-events: auto; }
