/* The hero animation: a long video becomes a Status, a chat message and a feed post.
   Everything sits on a fixed 960 × 540 "stage" that demo.js scales to fit the purple
   box, so the choreography stays exact at any screen size.
   Layout numbers here are mirrored at the top of demo.js; change both together. */

.demo {
  width: min(1200px, calc(100% - 32px));
  margin: 48px auto 80px;
  padding: clamp(6px, 1.4vw, 18px);
  border-radius: 24px;
  background: var(--ink);
  overflow: hidden;
}
.demo-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; }
.stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 960px;
  height: 540px;
  transform-origin: 0 0;
  transform: scale(var(--s, 1));
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}
.stage canvas { display: block; width: 100%; height: 100%; }

/* ================= the browser window (a Mac window) ================= */
.b-window {
  position: absolute;
  left: 20px;
  top: 30px;
  width: 654px;
  height: 479px; /* 34 chrome + 368 video + 77 below */
  border-radius: 12px;
  background: #0F0D16;
  overflow: hidden;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.b-chrome {
  position: relative;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  background: #ECE9F3;
}
.b-chrome .tl { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 0.5px rgba(0, 0, 0, 0.18); }
.b-chrome .tl.r { background: #FF5F57; }
.b-chrome .tl.y { background: #FEBC2E; }
.b-chrome .tl.g { background: #28C840; }
.b-url {
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  width: 300px;
  height: 22px;
  padding: 0 10px;
  border-radius: 7px;
  background: #fff;
  color: #4A4462;
  font-size: 12px;
  font-weight: 500;
}
.b-url svg { width: 10px; height: 10px; flex: none; color: #8A84A3; }
.b-url-text { white-space: nowrap; }
.b-caret { width: 1.5px; height: 13px; margin-left: -4px; background: var(--violet); animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

.player { position: absolute; left: 0; top: 34px; width: 654px; height: 368px; overflow: hidden; background: #000; }
.player video { width: 100%; height: 100%; object-fit: cover; display: block; }
.p-bar { position: absolute; left: 14px; right: 14px; bottom: 10px; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.3); }
.p-bar i { display: block; width: 38%; height: 100%; border-radius: 2px; background: #FF3B5C; }

/* The video page under the player (what the site shows before Vclip opens) */
.v-info { position: absolute; left: 0; right: 0; bottom: 0; height: 77px; padding: 12px 16px; background: #0F0D16; }
.v-title { color: #F2F0F8; font-size: 14px; font-weight: 600; }
.v-meta { display: flex; align-items: center; gap: 8px; margin-top: 9px; color: #9A95AE; font-size: 11px; }
.v-meta i { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, #5DCAA5, #1D9E75); }
.v-meta b { color: #E6E3EF; font-weight: 600; }
.v-meta .v-follow { margin-left: auto; padding: 5px 12px; border-radius: 999px; background: #F2F0F8; color: #0F0D16; font-weight: 600; }

/* Vclip's hover button */
.d-pill {
  position: absolute;
  left: 14px;
  top: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px 6px 9px;
  border-radius: 999px;
  background: rgba(20, 20, 24, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}
.d-pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #8B6CFF; }

/* Recording timer, then "Saved to My Clips" */
.d-rec {
  position: absolute;
  right: 14px;
  top: 14px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(20, 20, 24, 0.88);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.d-rec .dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: #EF4444; vertical-align: 0; }
.d-rec.done .dot { background: #4ADE80; }

/* The crop frame (Status 9:16, Feed 4:5) and the whole-frame outline (Original) */
.d-crop {
  position: absolute;
  top: 0;
  left: 224px;
  width: 207px; /* 368 × 9/16 */
  height: 368px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.55);
}
.d-crop span, .d-full span {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(20, 20, 24, 0.85);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.d-full { position: absolute; inset: 0; border: 2px solid #fff; }

/* The Vclip panel: slides up over the video page */
.d-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 77px;
  padding: 12px 16px;
  background: #141418;
  border-top: 1px solid #2E2E38;
}
.d-track { position: relative; height: 16px; margin: 0 6px; }
.d-track::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; height: 6px; border-radius: 3px; background: #2E2E38; }
.d-range { position: absolute; top: 2px; height: 12px; background: rgba(139, 108, 255, 0.35); border-top: 2px solid #8B6CFF; border-bottom: 2px solid #8B6CFF; }
.d-handle {
  position: absolute;
  top: -3px;
  width: 11px;
  height: 22px;
  margin-left: -5.5px;
  border-radius: 4px;
  background: #fff;
  border: 2px solid #8B6CFF;
}
.d-row { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.d-chip {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid #2E2E38;
  background: #1E1E25;
  color: #E8E6F0;
  font-size: 11px;
  transition: background 0.2s, border-color 0.2s;
}
.d-chip.on { background: rgba(139, 108, 255, 0.32); border-color: #8B6CFF; }
.d-len { margin-left: auto; color: #9A9AA8; font-size: 11px; font-variant-numeric: tabular-nums; }
.d-save {
  position: relative;
  overflow: hidden;
  min-width: 96px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--violet);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
}
.d-save i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: #EF4444; }
.d-save b { position: relative; font-weight: 600; }

/* ================= the phone (iPhone proportions) ================= */
.phone {
  position: absolute;
  left: 698px;
  top: 20px;
  width: 242px;
  height: 500px;
  border-radius: 46px;
  background: #0A0910;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5), 0 0 0 1.5px #3A3450, inset 0 0 0 1px #2A2540;
}
/* Side buttons: action and volume on the left, power on the right */
.phone::before, .phone::after { content: ""; position: absolute; width: 3px; border-radius: 2px; background: #3A3450; }
.phone::before { left: -3px; top: 96px; height: 52px; box-shadow: 0 -32px 0 -10px #3A3450, 0 66px 0 0 #3A3450; }
.phone::after { right: -3px; top: 130px; height: 74px; }

.ph-screen {
  position: absolute;
  inset: 7px;
  border-radius: 39px;
  overflow: hidden;
  background: #16121F;
}
.ph-island { position: absolute; left: 50%; top: 9px; width: 72px; height: 21px; margin-left: -36px; border-radius: 12px; background: #000; z-index: 8; }
.ph-status {
  position: absolute;
  left: 0;
  right: 0;
  top: 9px;
  height: 21px;
  /* Like a real iPhone: the time and the icons each sit centred in the space
     either side of the Dynamic Island, so they never touch it. */
  display: grid;
  grid-template-columns: 1fr 90px 1fr; /* middle = island (72px) + 9px clear each side */
  align-items: center;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  z-index: 7;
  transition: color 0.3s;
}
.ph-status.dark { color: #111; }
.ph-status svg { height: 9px; fill: currentColor; }
.ph-time { justify-self: center; padding-left: 6px; }
.ph-icons { grid-column: 3; justify-self: center; display: flex; align-items: center; gap: 4px; padding-right: 4px; }
.scr { position: absolute; inset: 0; }

/* Screen 0: the lock screen, where Vclip's "saved" notification arrives */
.scr-lock {
  z-index: 5;
  background: radial-gradient(120% 70% at 30% 20%, #8B6CFF 0%, #5B2BE0 38%, #1B1530 100%);
  color: #fff;
  text-align: center;
}
.lk-date { margin-top: 58px; font-size: 13px; font-weight: 500; opacity: 0.9; }
.lk-time { font: 700 64px/1 var(--display); letter-spacing: -1px; }
.lk-note {
  position: absolute;
  left: 10px;
  right: 10px;
  top: 150px;
  display: flex;
  gap: 9px;
  padding: 10px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  color: #111;
  text-align: left;
  font-size: 11px;
  line-height: 1.35;
  backdrop-filter: blur(8px);
}
.lk-note img { width: 30px; height: 30px; padding: 5px; border-radius: 8px; background: #fff; flex: none; }
.lk-note b { display: flex; justify-content: space-between; font-size: 11px; }
.lk-note b small { color: #6B6585; font-weight: 400; }
.lk-bar { position: absolute; left: 50%; bottom: 8px; width: 90px; height: 4px; margin-left: -45px; border-radius: 2px; background: rgba(255, 255, 255, 0.85); }

/* Screen 1: a Status */
.st-clip { position: absolute; inset: 0; background: #000; }
.ph-bars { position: absolute; left: 12px; right: 12px; top: 44px; display: flex; gap: 4px; z-index: 2; }
.ph-bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.35); overflow: hidden; }
.ph-bars i b { display: block; height: 100%; width: 0; background: #fff; }
.ph-who { position: absolute; left: 12px; top: 56px; display: flex; align-items: center; gap: 7px; color: #fff; font-size: 11px; font-weight: 600; z-index: 2; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); }
.ph-who span { width: 24px; height: 24px; border-radius: 50%; background: linear-gradient(135deg, #8B6CFF, #5B2BE0); border: 1.5px solid #fff; }
.ph-who small { color: rgba(255, 255, 255, 0.8); font-weight: 400; }
.ph-reply {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 20px;
  height: 32px;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.55);
  color: rgba(255, 255, 255, 0.85);
  font-size: 11px;
  line-height: 30px;
  padding-left: 14px;
  z-index: 2;
}
.ph-bubble {
  position: absolute;
  right: 12px;
  bottom: 62px;
  padding: 8px 12px;
  border-radius: 14px 14px 4px 14px;
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  z-index: 3;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

/* Screen 2: a chat, where the clip arrives as a message */
.scr-chat { background: #F3F0FA; display: flex; flex-direction: column; }
.ch-head { display: flex; align-items: center; gap: 8px; padding: 44px 12px 10px; background: #fff; border-bottom: 1px solid #E8E3F5; }
.ch-back { color: var(--violet); font-size: 22px; line-height: 1; margin-right: -2px; }
.ch-av { width: 28px; height: 28px; border-radius: 50%; background: #FFB84D; color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.ch-head b { display: block; font-size: 12px; color: var(--ink); }
.ch-head small { display: block; font-size: 10px; color: #2BA84A; }
.ch-body { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 8px; padding: 12px 10px; }
.msg { max-width: 86%; padding: 7px 10px; border-radius: 14px; font-size: 11.5px; line-height: 1.35; color: var(--ink); }
.msg.in { align-self: flex-start; background: #fff; border-bottom-left-radius: 4px; }
.msg.out { align-self: flex-end; background: #E3DAFF; border-bottom-right-radius: 4px; padding: 4px; }
.ch-media { position: relative; width: 168px; height: 94.5px; border-radius: 10px; overflow: hidden; background: #2A2540; } /* 16:9, fits the bubble */
.ch-media .play {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
}
.ch-media .play::after { content: ""; position: absolute; left: 11px; top: 9px; border-left: 9px solid #fff; border-top: 5px solid transparent; border-bottom: 5px solid transparent; }
.ch-media .dur { position: absolute; right: 6px; bottom: 5px; padding: 0 4px; border-radius: 4px; background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 9px; font-weight: 600; }
.msg .meta { display: block; text-align: right; font-size: 9px; color: #6B6585; padding: 2px 4px 0; }
.msg .meta b { color: var(--violet); }
.ch-typing { align-self: flex-start; display: flex; gap: 3px; padding: 10px 12px; background: #fff; border-radius: 14px; border-bottom-left-radius: 4px; }
.ch-typing i { width: 5px; height: 5px; border-radius: 50%; background: #A49FB8; animation: dots 1s infinite; }
.ch-typing i:nth-child(2) { animation-delay: 0.15s; }
.ch-typing i:nth-child(3) { animation-delay: 0.3s; }
@keyframes dots { 0%, 60%, 100% { transform: none; opacity: 0.5; } 30% { transform: translateY(-3px); opacity: 1; } }
.ch-input { margin: 0 10px 18px; height: 32px; border-radius: 16px; background: #fff; color: #A49FB8; font-size: 11px; line-height: 32px; padding-left: 14px; }

/* Screen 3: a feed post, in the 4:5 size */
.scr-feed { background: #fff; }
.fd-top { display: flex; align-items: baseline; justify-content: space-between; padding: 46px 12px 8px; }
.fd-top b { font: 700 18px/1 var(--display); color: var(--ink); }
.fd-top span { color: var(--ink); font-size: 14px; letter-spacing: 2px; }
.fd-head { display: flex; align-items: center; gap: 7px; padding: 6px 10px; font-size: 11px; color: var(--ink); }
.fd-av { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, #8B6CFF, #5B2BE0); }
.fd-head small { color: #8A84A3; }
.fd-head .more { margin-left: auto; color: #8A84A3; letter-spacing: 1px; }
.fd-media { position: relative; width: 228px; height: 285px; background: #EDE7FF; overflow: hidden; } /* 4:5; lilac until the clip lands */
/* Playing cues, like a real feed video: sound-off badge and a thin progress line */
.fd-sound { position: absolute; right: 8px; bottom: 10px; width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 0, 0, 0.55); color: #fff; display: grid; place-items: center; }
.fd-sound svg { width: 12px; height: 12px; fill: currentColor; }
.fd-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.35); }
.fd-prog i { display: block; width: 0; height: 100%; background: #fff; }
.fd-heart { position: absolute; left: 50%; top: 50%; margin: -30px 0 0 -32px; font-size: 60px; line-height: 1; color: #fff; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35)); }
.fd-actions { display: flex; gap: 12px; padding: 9px 10px 4px; color: var(--ink); }
.fd-actions svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fd-actions .liked { fill: #EF4444; stroke: #EF4444; }
.fd-likes { padding: 0 10px; font-size: 11px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.fd-cap { padding: 3px 10px; font-size: 11px; color: #3E3858; }

/* The piece of video that flies from the browser into the phone */
.d-flyer { position: absolute; overflow: hidden; border-radius: 4px; z-index: 5; visibility: hidden; } /* demo.js shows it */
.d-flyer canvas { object-fit: cover; }

/* The cursor */
.d-cursor { position: absolute; left: 0; top: 0; width: 22px; height: 28px; z-index: 10; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.4)); }

@media (prefers-reduced-motion: reduce) {
  .b-caret, .ch-typing i { animation: none; }
}
