/* Vault Capsule Interface — full-screen paper unroll, no side queue */

.vault-movement-mode.is-capsule-interface {
  /* Return the marble — same surface as the homepage so opening a capsule
     feels like the same room, not a different app. */
  background: #ece3d0 url('../images/vault-marble-light.jpg') center / cover no-repeat fixed !important;
}

.vault-movement-mode.is-capsule-interface .vmm-tint,
.vault-movement-mode.is-capsule-interface .vmm-stage--legacy,
.vault-movement-mode.is-capsule-interface .vmm-mic-orb,
.vault-movement-mode.is-capsule-interface .vmm-onboard,
.vault-movement-mode.is-capsule-interface #vciQueue,
.vault-movement-mode.is-capsule-interface .vci-queue {
  /* Voice is fully HANDS-FREE in the Capsule Interface — no visual mic.
     The engine still runs (see _startVoice); the user just speaks. */
  display: none !important;
}

.vault-movement-mode.is-capsule-interface {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.vault-movement-mode.is-capsule-interface .vmm-header {
  background: linear-gradient(180deg, rgba(10, 7, 4, 0.96), rgba(8, 6, 4, 0.75)) !important;
  border-bottom: 1px solid rgba(180, 150, 90, 0.14);
  flex-shrink: 0;
  z-index: 10;
}

.vault-movement-mode.is-capsule-interface .trace-brand-back-pill-marble,
.vault-movement-mode.is-capsule-interface .trace-brand-status-pill-marble {
  background: rgba(22, 16, 10, 0.9) !important;
  border-color: rgba(180, 150, 90, 0.32) !important;
  color: rgba(255, 248, 235, 0.92) !important;
}

.vault-movement-mode.is-capsule-interface .vmm-card-slot,
.vault-movement-mode.is-capsule-interface #vmmCardSlot {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  transform: none !important;
  width: 100% !important;
  height: auto !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: min(100%, 560px);
  margin: 0 auto;
  perspective: none !important;
  pointer-events: auto !important;
}

.vault-movement-mode.is-capsule-interface .vci-stage-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.vault-movement-mode.is-capsule-interface .vci-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 16px 16px;
  min-height: 0;
}

.vci-incoming {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: min(40vh, 320px);
}

/* ── Open: paper frame + portrait ── */
.vci-capsule--open {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  --reveal: 0;
}

.vci-paper-frame {
  position: relative;
  display: flex;
  justify-content: center;
  width: 100%;
}

/* Retired: the paper-scroll lip (a Bond holdover). The capsule is a round
   glass LENS now — continuous with the homepage tokens. */
.vci-paper-lip { display: none; }

/* The round LENS: the wall's glass token, grown large. Teal rim by default
   (standard); gold rim when verified (.vci-capsule.is-verified). */
.vci-roll-shell {
  position: relative;
  /* Sized so the WHOLE unit (lens + name + waveform + actions + transport)
     fits and centers on the marble without overflowing. Off the smaller
     viewport axis (~40vh) and capped so a tall desktop window doesn't balloon
     it; still fills a phone width. Was 60vh/560px which overflowed tall
     windows and pushed the lens to the top with dead marble below. */
  width: clamp(220px, min(52vw, 40vh), 400px);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  overflow: hidden;
  /* TEAL glass gem — the homepage token, grown large. Luminous (top dome
     sheen + bright bottom caustic + 3D dome shadow) so an unplayed capsule
     reads as a glass object, not a black hole. */
  background:
    radial-gradient(ellipse 56% 40% at 40% 22%, rgba(255, 255, 255, 0.55), rgba(255, 255, 255, 0) 60%),
    radial-gradient(ellipse 86% 32% at 50% 106%, rgba(190, 250, 244, 0.55), rgba(120, 220, 224, 0) 70%),
    radial-gradient(circle at 50% 58%, rgba(34, 168, 190, 0.5), rgba(15, 116, 138, 0.66) 64%, rgba(8, 86, 106, 0.8) 100%);
  background-color: rgba(20, 140, 165, 0.3);
  box-shadow:
    0 0 0 2px rgba(96, 200, 220, 0.82),
    0 0 0 5px rgba(22, 116, 136, 0.5),
    inset 0 7px 18px rgba(255, 255, 255, 0.42),
    inset 0 -24px 42px -16px rgba(2, 26, 34, 0.5),
    0 26px 54px -16px rgba(20, 40, 50, 0.5);
}

/* Verified = Truth Glow: GOLD glass gem, same finish as the verified tokens. */
.vci-capsule.is-verified .vci-roll-shell {
  background:
    radial-gradient(ellipse 58% 42% at 40% 22%, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0) 60%),
    radial-gradient(ellipse 86% 32% at 50% 106%, rgba(255, 244, 200, 0.55), rgba(240, 205, 120, 0) 70%),
    radial-gradient(circle at 50% 58%, rgba(232, 184, 82, 0.5), rgba(200, 152, 50, 0.66) 64%, rgba(160, 114, 30, 0.8) 100%);
  background-color: rgba(216, 168, 64, 0.32);
  box-shadow:
    0 0 0 2px rgba(224, 180, 78, 0.95),
    0 0 0 5px rgba(126, 92, 24, 0.6),
    inset 0 7px 18px rgba(255, 250, 230, 0.5),
    inset 0 -24px 42px -16px rgba(60, 38, 8, 0.5),
    0 26px 54px -16px rgba(60, 40, 12, 0.5);
}

/* Polished-glass specular glint (sits above the photo for a glassy read). */
.vci-roll-shell::after {
  content: "";
  position: absolute;
  top: 8%;
  left: 22%;
  width: 34%;
  height: 20%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0) 70%);
  pointer-events: none;
  z-index: 5;
}

/* Ambient "listening" cue — a faint, slow breath of light around the lens
   while hands-free voice is live, so the user knows it's listening without a
   mic button. Deliberately subtle. */
body.vmm-voice-listening .vault-movement-mode.is-capsule-interface .vci-roll-shell {
  animation: vciListenBreath 3.4s ease-in-out infinite;
}
@keyframes vciListenBreath {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(170, 240, 250, 0)); }
  50%      { filter: drop-shadow(0 0 12px rgba(170, 240, 250, 0.5)); }
}
@media (prefers-reduced-motion: reduce) {
  body.vmm-voice-listening .vault-movement-mode.is-capsule-interface .vci-roll-shell { animation: none; }
}

.vci-portrait {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  /* Transparent base so the glass gem glows through when there's no photo
     or before playback; the photo develops over it as --reveal rises. */
  background-color: transparent;
  background-size: cover;
  background-position: center;
  /* The photo is ALWAYS fully present and simply comes into FOCUS in perfect
     time with the voice: soft at the first word, crystal-clear exactly as the
     last word lands (--reveal = currentTime/duration). No darkness, no rise —
     it reads as a memory crystallizing as you listen. A whisper of warmth
     blooms as it resolves. */
  filter: blur(calc(16px * (1 - var(--reveal, 0)))) brightness(calc(1 + 0.05 * var(--reveal, 0)));
  opacity: 1;
  transition: filter 0.16s linear;
}

/* Non-verified: an elegant, EVEN soft-defocus that holds — you can sense the
   image but it never resolves to sharp (privacy), and it reads as a tasteful
   out-of-focus lens, not a heavy gaussian smear. It clears only when the user
   chooses "View" (.is-photo-opt-in). Higher specificity than the base + the
   opt-in rule, and excluded once opted-in. */
.vci-capsule:not(.is-verified):not(.is-photo-opt-in) .vci-portrait {
  /* Keeps the photo's real colour (saturation near-natural) so it reads as a
     genuine OUT-OF-FOCUS lens, not a desaturated grey smear. The blur radius
     still obscures identity for privacy; it clears to sharp on "View". This is
     a HOLD (reveal-independent) by design: only verified capsules develop. */
  filter: blur(8px) saturate(0.98) brightness(1.05);
  opacity: 0.96;
}

/* ── Cross-roll transition between capsules ──
   The outgoing and incoming letters overlap in the slot (no blank gap).
   Transform + opacity ONLY — no blur / clip-path during motion — so it
   stays a clean 60fps. The blur/focus reveal is decoupled (tied to audio).
   scaleY from the top origin reads as the letter rolling up into the lip. */
.vmm-card-slot.is-vci-rolling {
  position: relative;
}

.vmm-card-slot.is-vci-rolling .vci-capsule--open {
  position: absolute;
  inset: 0;
  width: 100%;
}

.vci-capsule--open {
  transform-origin: 50% 50%;
  backface-visibility: hidden;
}

.vci-capsule--open.vci-roll-in,
.vci-capsule--open.vci-roll-out {
  will-change: transform, opacity;
}

/* Forward (next): old rolls up off the top, new rolls up from below. */
.vci-capsule--open.vci-roll-out.is-dir-next {
  animation: vciRollOutUp 0.46s cubic-bezier(0.5, 0, 0.75, 0.2) forwards;
}
.vci-capsule--open.vci-roll-in.is-dir-next {
  animation: vciRollInUp 0.46s cubic-bezier(0.16, 0.84, 0.3, 1) forwards;
}

/* Back (prev): mirror direction. */
.vci-capsule--open.vci-roll-out.is-dir-prev {
  animation: vciRollOutDown 0.46s cubic-bezier(0.5, 0, 0.75, 0.2) forwards;
}
.vci-capsule--open.vci-roll-in.is-dir-prev {
  animation: vciRollInDown 0.46s cubic-bezier(0.16, 0.84, 0.3, 1) forwards;
}

/* Initial entry (no direction) — a gentle rise from the stack. */
.vci-capsule--open.vci-roll-in:not(.is-dir-prev):not(.is-dir-next) {
  animation: vciRollInUp 0.5s cubic-bezier(0.16, 0.84, 0.3, 1) forwards;
}

/* Tap to advance: the current capsule FADES away as the next emerges
   (a soft cross-fade with a whisper of scale). Direction-agnostic. */
@keyframes vciRollOutUp   { from { opacity: 1; transform: scale(1); }    to { opacity: 0; transform: scale(0.95); } }
@keyframes vciRollInUp    { from { opacity: 0; transform: scale(1.05); } to { opacity: 1; transform: scale(1); } }
@keyframes vciRollOutDown { from { opacity: 1; transform: scale(1); }    to { opacity: 0; transform: scale(0.95); } }
@keyframes vciRollInDown  { from { opacity: 0; transform: scale(1.05); } to { opacity: 1; transform: scale(1); } }

/* Real voice waveform on the open view */
.vci-voice {
  display: block;
  width: 100%;
  max-width: 520px;
  height: 42px;
  margin: 0 auto;
}

@media (prefers-reduced-motion: reduce) {
  .vci-capsule--open.vci-roll-in,
  .vci-capsule--open.vci-roll-out {
    animation: none !important;
  }
}

.vci-portrait__mono {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(3.5rem, 16vw, 6rem);
  font-weight: 500;
  color: rgba(212, 175, 55, 0.18);
}

.vci-capsule.is-photo-opt-in .vci-portrait,
.vci-capsule.is-agdvr-complete .vci-portrait {
  filter: blur(0);
  opacity: 1;
}

.vci-portrait-veil {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(20, 14, 8, 0.15) 0%, rgba(8, 5, 3, 0.5) 100%);
  opacity: calc(1 - var(--reveal, 0) * 0.88);
}

.vci-timer {
  /* Inside the round lens (bottom-centre) so the circular clip never cuts it. */
  position: absolute;
  bottom: 11%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  font-size: 0.74rem;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 248, 235, 0.92);
  background: rgba(6, 16, 20, 0.5);
  padding: 3px 12px;
  border-radius: 999px;
}

.vci-meta {
  text-align: center;
  width: 100%;
}

.vci-meta__name {
  margin: 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: #2a2018;
  text-shadow: 0 1px 0 rgba(255, 252, 244, 0.6);
}

.vci-meta__sub {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: #6a5436;
  letter-spacing: 0.04em;
}

.vci-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
  max-width: 480px;
}

.vci-btn {
  padding: 11px 20px;
  border-radius: 999px;
  border: 1px solid rgba(150, 110, 40, 0.4);
  background: rgba(255, 250, 238, 0.82);
  color: #3a2c16;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 2px 8px rgba(80, 50, 20, 0.12);
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.vci-btn:hover {
  background: rgba(255, 250, 238, 0.97);
  border-color: rgba(150, 110, 40, 0.6);
  transform: translateY(-1px);
}

.vci-btn--play {
  background: rgba(100, 75, 28, 0.55);
  border-color: rgba(212, 175, 55, 0.55);
  min-width: 108px;
}

.vci-btn--play:hover {
  background: rgba(120, 90, 35, 0.7);
}

.vci-btn--legacy {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.vci-legacy-pearl {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(212, 175, 55, 0.35);
  border: 1px solid rgba(212, 175, 55, 0.5);
  flex-shrink: 0;
}

.vmm-card__legacy.is-sealed .vci-legacy-pearl {
  background: radial-gradient(circle at 35% 30%, #fff6d0, #d4af37 55%, #8a6420);
  box-shadow: 0 0 8px rgba(212, 175, 55, 0.5);
}

.vci-btn--danger {
  border-color: rgba(150, 60, 45, 0.5);
  color: #7a2e22;
}

.vci-btn--ghost {
  background: rgba(255, 250, 238, 0.5);
  font-size: 0.85rem;
  color: #5a4a3a;
}

.vci-btn--disabled {
  opacity: 0.45;
  cursor: default;
}

.vci-unverified-hint {
  margin: 0;
  font-size: 0.8rem;
  color: #7a5a48;
  text-align: center;
  max-width: 360px;
}

/* Progress dots — position in the stack; tap to jump. */
.vci-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  margin: 16px auto 0;
  max-width: 320px;
}

.vci-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(150, 110, 40, 0.32);
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease;
}

.vci-dot.is-active {
  background: rgba(180, 130, 30, 0.95);
  transform: scale(1.5);
}

.vci-dot:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.65);
  outline-offset: 2px;
}

/* Standard transport: prev · play/pause · next. */
.vci-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
  margin-top: 14px;
  width: 100%;
  max-width: 420px;
}

.vci-nav__btn {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 1px solid rgba(150, 110, 40, 0.45);
  background: rgba(255, 250, 238, 0.85);
  color: #3a2c16;
  font-size: 1.45rem;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 2px 8px rgba(80, 50, 20, 0.14);
  transition: filter 160ms ease, transform 160ms ease, background 160ms ease;
}

.vci-nav__play {
  width: 62px;
  height: 62px;
  font-size: 1.4rem;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 244, 206, 0.7) 0%, transparent 55%),
    linear-gradient(140deg, #e9c869 0%, #c2962f 100%);
  border-color: rgba(120, 80, 30, 0.6);
  color: #2a1c08;
}

.vci-nav__play:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
}

.vci-nav__btn:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.65);
  outline-offset: 2px;
}

@media (max-width: 767px) {
  .vci-portrait {
    max-height: min(82vh, 680px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .vci-capsule--open.vci-roll-in,
  .vci-capsule--open.vci-roll-out {
    animation: none !important;
  }
  .vci-portrait {
    transition: none;
  }
}
