/* CopyShot demo (see demo.js). Shared by the welcome page and the website, so every rule is scoped to
   .cs-demo and nothing depends on the host page's tokens. The mock site stays light in both themes,
   like a real web page; the frame takes its border from --cs-demo-border when the host sets it. */

.cs-demo {
  position: relative;
  width: 100%;
  max-width: 600px;
  aspect-ratio: 16 / 11;
  overflow: hidden;
  border: 1px solid var(--cs-demo-border, #e4e4eb);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 30px 80px -30px rgba(40, 30, 120, 0.35), 0 2px 6px rgba(16, 16, 40, 0.08);
  color: #17171f;
  font: 13px/1.35 "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, sans-serif;
  text-align: left;
  user-select: none;
}
.cs-demo *, .cs-demo *::before, .cs-demo *::after { box-sizing: border-box; }
.cs-demo kbd { display: inline-block; min-width: 16px; padding: 0 4px; border: 1px solid #e2e2ea; border-bottom-width: 2px; border-radius: 4px; background: #f4f4f8; color: #55556a; font-family: inherit; font-size: 9.5px; font-weight: 600; line-height: 1.4; text-align: center; }

.cs-demo .chrome-bar { position: relative; z-index: 4; display: flex; align-items: center; gap: 14px; height: 38px; padding: 0 10px 0 14px; border-bottom: 1px solid #e8e8ef; background: #f4f4f8; }
.cs-demo .dots { display: flex; gap: 6px; }
.cs-demo .dots i { width: 10px; height: 10px; border-radius: 50%; background: #d9d9e3; }
.cs-demo .url .u-chat, .cs-demo[data-phase="app"] .url .u-site, .cs-demo[data-phase="keys"] .url .u-site, .cs-demo[data-phase="pasted"] .url .u-site, .cs-demo[data-phase="sent"] .url .u-site { display: none; }
.cs-demo[data-phase="app"] .url .u-chat, .cs-demo[data-phase="keys"] .url .u-chat, .cs-demo[data-phase="pasted"] .url .u-chat, .cs-demo[data-phase="sent"] .url .u-chat { display: inline; }
.cs-demo .url { flex: 1; max-width: 300px; padding: 4px 12px; border-radius: 7px; background: #fff; color: #8a8a99; font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-demo .tb-icon { display: grid; place-items: center; width: 26px; height: 26px; margin-left: auto; border-radius: 7px; transition: background 0.15s; }
.cs-demo .tb-icon img { display: block; }
.cs-demo[data-pop="open"] .tb-icon { background: #e4e2fb; }

.cs-demo .viewport { position: absolute; inset: 38px 0 0; overflow: hidden; }

/* mock site */
.cs-demo .site { position: absolute; inset: 0; background: #fbfbfd; }
.cs-demo .site-inner { padding: 18px 22px; transition: transform 0.6s cubic-bezier(0.45, 0, 0.2, 1); transform: translateY(var(--scroll, 0px)); }
.cs-demo .site-nav { display: flex; gap: 18px; align-items: center; margin-bottom: 18px; font-size: 12px; color: #77778a; }
.cs-demo .site-nav b { color: #17171f; margin-right: 8px; }
.cs-demo .site-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 14px; }
.cs-demo .m-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid #ececf2; border-radius: 12px; background: #fff; }
.cs-demo .m-card.wide { grid-column: span 2; }
.cs-demo .m-label { font-size: 11px; color: #8a8a99; font-weight: 600; }
.cs-demo .m-card strong, .cs-demo .shot strong { font-size: 22px; letter-spacing: -0.02em; }
.cs-demo .m-card em, .cs-demo .shot em { font-style: normal; font-size: 12px; color: #15a14a; font-weight: 650; }
.cs-demo .m-bars { display: flex; align-items: flex-end; gap: 6px; height: 64px; }
.cs-demo .m-bars.short { height: 40px; }
.cs-demo .m-bars i { flex: 1; height: var(--h); border-radius: 4px 4px 2px 2px; background: linear-gradient(#8b7bff, #6355f6); }
.cs-demo .m-btn { align-self: flex-start; margin-top: 4px; padding: 5px 10px; border-radius: 7px; background: #f1f0ff; color: #5446ea; font-size: 11px; font-weight: 650; }
.cs-demo .m-line { height: 8px; border-radius: 4px; background: #efeff5; }
.cs-demo .m-line.short { width: 60%; }

/* area picker (as in src/content/select.js) */
.cs-demo .dim { position: absolute; inset: 0; background: rgba(12, 12, 24, 0.28); opacity: 0; transition: opacity 0.25s; }
.cs-demo .sel {
  position: absolute;
  left: var(--x0);
  top: var(--y0);
  width: 0;
  height: 0;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35), 0 0 0 999px rgba(12, 12, 24, 0.42);
  opacity: 0;
  transition: width 1.1s cubic-bezier(0.45, 0, 0.2, 1), height 1.1s cubic-bezier(0.45, 0, 0.2, 1), opacity 0.2s;
}
.cs-demo .size { position: absolute; left: 0; top: calc(100% + 8px); padding: 3px 7px; border-radius: 6px; background: rgba(20, 20, 28, 0.88); color: #fff; font-size: 11px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cs-demo .cross-x, .cs-demo .cross-y { position: absolute; background: rgba(255, 255, 255, 0.8); mix-blend-mode: difference; opacity: 0; transition: opacity 0.2s; }
.cs-demo .cross-x { left: 0; right: 0; height: 1px; top: calc(var(--my) - 38px); }
.cs-demo .cross-y { top: 0; bottom: 0; width: 1px; left: var(--mx); }
.cs-demo.gliding .cross-x { transition: top 0.9s cubic-bezier(0.45, 0, 0.2, 1), opacity 0.2s; }
.cs-demo.gliding .cross-y { transition: left 0.9s cubic-bezier(0.45, 0, 0.2, 1), opacity 0.2s; }
.cs-demo[data-phase="aim"] .dim, .cs-demo[data-phase="aim"] .cross-x, .cs-demo[data-phase="aim"] .cross-y { opacity: 1; }
.cs-demo[data-phase="drag"] .sel, .cs-demo[data-phase="drag"] .cross-x, .cs-demo[data-phase="drag"] .cross-y { opacity: 1; }
.cs-demo[data-phase="drag"] .sel { width: var(--w); height: var(--h); }

/* camera flash: transparent at rest, so it never covers the scene when animations are off */
.cs-demo .viewport::after { content: ""; position: absolute; inset: 0; z-index: 5; background: #fff; opacity: 0; pointer-events: none; }
.cs-demo[data-phase="copied"] .viewport::after { animation: cs-flash 0.45s ease-out; }
@keyframes cs-flash { from { opacity: 0.85; } to { opacity: 0; } }


/* confirmation (as in src/content/page-toast.js) */
/* the shade behind it, in the top-right corner (z-index 1: over the page, under the toast) */
.cs-demo .viewport::before { content: ""; position: absolute; top: 0; right: 0; z-index: 1; width: 75%; height: 45%; background: radial-gradient(ellipse 100% 100% at 100% 0%, rgba(12, 12, 32, 0.24), transparent 72%); opacity: 0; pointer-events: none; transition: opacity 0.3s; }
.cs-demo[data-phase="copied"] .viewport::before, .cs-demo[data-phase="toast"] .viewport::before { opacity: 1; }
.cs-demo .toast {
  position: absolute;
  right: 16px;
  top: 16px;
  z-index: 2;
  display: grid;
  gap: 9px;
  width: 196px;
  padding: 10px 10px 10px 12px;
  border: 1px solid #e6e6ee;
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 14px 40px rgba(16, 16, 40, 0.26);
  font-size: 12px;
  opacity: 0;
  transform: translateY(-14px) scale(0.98);
  transition: opacity 0.3s, transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.cs-demo[data-phase="copied"] .toast, .cs-demo[data-phase="toast"] .toast { opacity: 1; transform: none; }
.cs-demo .t-head { display: flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 600; }
.cs-demo .t-mark { width: 14px; height: 14px; flex: none; display: block; }
.cs-demo .t-x { margin-left: auto; padding: 0 3px; font-size: 14px; line-height: 1; }
.cs-demo .t-title { font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.cs-demo .t-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cs-demo .t-btn, .cs-demo .t-btn2 { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 5px 8px; border-radius: 999px; background: #f1f1f5; font-weight: 600; font-size: 10.5px; white-space: nowrap; transition: background 0.15s, color 0.15s; }
.cs-demo .t-btn svg, .cs-demo .t-btn2 svg { width: 11px; height: 11px; flex: none; }
.cs-demo .t-foot { padding-top: 8px; border-top: 1px solid #ececf2; color: #77778a; font-size: 10px; }
.cs-demo .t-foot b { color: #17171f; font-weight: 600; }
.cs-demo[data-press="annotate"] .t-btn { background: #6355f6; color: #fff; }

/* paste: a generic team chat, where the copied shot lands with Ctrl+V */
.cs-demo .chat-app { position: absolute; inset: 0; z-index: 3; display: grid; grid-template-columns: 130px 1fr; background: #fff; opacity: 0; visibility: hidden; transition: opacity 0.35s, visibility 0.35s; }
.cs-demo[data-phase="app"] .chat-app, .cs-demo[data-phase="keys"] .chat-app, .cs-demo[data-phase="pasted"] .chat-app, .cs-demo[data-phase="sent"] .chat-app { opacity: 1; visibility: visible; }
.cs-demo .c-side { display: flex; flex-direction: column; gap: 4px; padding: 16px 10px; background: #2b2540; color: #b9b3d6; font-size: 11.5px; }
.cs-demo .c-side b { margin: 0 6px 10px; color: #fff; font-size: 13px; }
.cs-demo .c-side span { padding: 4px 8px; border-radius: 6px; }
.cs-demo .c-side .on { background: rgba(255, 255, 255, 0.14); color: #fff; }
.cs-demo .c-main { display: flex; flex-direction: column; justify-content: flex-end; gap: 12px; padding: 16px 18px; background: #fbfbfd; }
.cs-demo .c-thread { display: grid; gap: 14px; }
.cs-demo .c-msg { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; }
.cs-demo .c-msg b { display: block; margin-bottom: 2px; font-size: 12px; }
.cs-demo .c-msg p { margin: 0; color: #44445a; }
.cs-demo .c-av { flex: none; width: 28px; height: 28px; border-radius: 8px; }
.cs-demo .c-av.a1 { background: linear-gradient(135deg, #f7b267, #f25c54); }
.cs-demo .c-av.a2 { background: linear-gradient(135deg, #8b7bff, #5642e8); }
.cs-demo .c-mine { opacity: 0; transform: translateY(8px); transition: opacity 0.3s, transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.cs-demo[data-phase="sent"] .c-mine { opacity: 1; transform: none; }
/* the pasted shot: the signups card, scaled down */
.cs-demo .c-img { position: relative; display: block; width: 150px; height: 96px; overflow: hidden; border: 1px solid #e6e6ee; border-radius: 8px; background: #fff; }
.cs-demo .c-card { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; gap: 6px; width: 330px; padding: 14px; transform: scale(0.455); transform-origin: top left; }
.cs-demo .c-card strong { font-size: 22px; letter-spacing: -0.02em; }
.cs-demo .c-card em { font-style: normal; font-size: 12px; color: #15a14a; font-weight: 650; }
.cs-demo .c-compose { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 10px 12px; border: 1px solid #dedde8; border-radius: 12px; background: #fff; transition: border-color 0.2s, box-shadow 0.2s; }
.cs-demo[data-press="compose"] .c-compose, .cs-demo[data-phase="keys"] .c-compose, .cs-demo[data-phase="pasted"] .c-compose { border-color: #8b7bff; box-shadow: 0 0 0 3px rgba(99, 85, 246, 0.15); }
.cs-demo .c-att { grid-column: 1 / -1; height: 0; overflow: hidden; transition: height 0.3s ease; }
.cs-demo .c-att .c-img { transform: scale(0.7); opacity: 0; transform-origin: top left; transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.4), opacity 0.2s; }
.cs-demo[data-phase="pasted"] .c-att { height: 104px; }
.cs-demo[data-phase="pasted"] .c-att .c-img { transform: none; opacity: 1; }
.cs-demo .c-ph { align-self: center; color: #9b9ba8; font-size: 12px; }
.cs-demo .c-send { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: #e4e4eb; color: #fff; font-weight: 700; transition: background 0.2s; }
.cs-demo[data-phase="pasted"] .c-send { background: #6355f6; }
.cs-demo .c-keys { position: absolute; left: 50%; top: 42%; display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-radius: 14px; background: rgba(20, 20, 28, 0.88); color: #fff; font-weight: 700; font-size: 16px; box-shadow: 0 16px 40px rgba(16, 16, 40, 0.3); opacity: 0; transform: translate(-50%, -50%) scale(0.9); transition: opacity 0.2s, transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.4); }
.cs-demo .c-keys kbd { min-width: 34px; padding: 3px 8px; border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.12); color: #fff; font-size: 14px; }
.cs-demo[data-phase="keys"] .c-keys { opacity: 1; transform: translate(-50%, -50%); }

/* editor */
.cs-demo .editor { position: absolute; inset: 0; z-index: 3; background: #f4f4f8; opacity: 0; visibility: hidden; transition: opacity 0.35s, visibility 0.35s; }
.cs-demo[data-phase="draw"] .editor, .cs-demo[data-phase="mark"] .editor { opacity: 1; visibility: visible; }
.cs-demo .ed-bar { display: flex; gap: 6px; align-items: center; padding: 10px 14px; border-bottom: 1px solid #e8e8ef; background: #fff; font-size: 11.5px; }
.cs-demo .ed-tool { padding: 5px 9px; border-radius: 7px; color: #66667a; font-weight: 600; white-space: nowrap; }
.cs-demo .ed-tool.on { background: #f1f0ff; color: #5446ea; }
.cs-demo .ed-copy { margin-left: auto; padding: 4px 9px; border-radius: 999px; background: rgba(21, 161, 74, 0.12); color: #15a14a; font-weight: 650; opacity: 0; transition: opacity 0.3s; white-space: nowrap; }
.cs-demo[data-phase="mark"] .ed-copy { opacity: 1; }
.cs-demo .ed-canvas { position: absolute; inset: 47px 0 0; display: grid; place-items: center; }
.cs-demo .shot { position: relative; display: flex; flex-direction: column; gap: 6px; width: 62%; padding: 16px; border-radius: 10px; background: #fff; box-shadow: 0 10px 30px rgba(16, 16, 40, 0.12); }
.cs-demo .arrow { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; fill: none; stroke: #e5484d; stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.cs-demo .arrow path { stroke-dasharray: 220; stroke-dashoffset: 220; }
.cs-demo .arrow .head { stroke-dasharray: 50; stroke-dashoffset: 50; }
.cs-demo[data-phase="draw"] .arrow path, .cs-demo[data-phase="mark"] .arrow path { transition: stroke-dashoffset 0.8s ease-out; stroke-dashoffset: 0; }
.cs-demo[data-phase="draw"] .arrow .head, .cs-demo[data-phase="mark"] .arrow .head { transition-delay: 0.65s; transition-duration: 0.25s; }
.cs-demo .marker { position: absolute; left: 46%; top: 14px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #e5484d; color: #fff; font-weight: 700; font-size: 14px; box-shadow: 0 4px 12px rgba(229, 72, 77, 0.4); transform: scale(0); transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.5); }
.cs-demo[data-phase="mark"] .marker { transform: scale(1); }

/* popup replica (as in src/popup) */
.cs-demo .pop {
  position: absolute;
  top: 42px;
  right: 8px;
  z-index: 5;
  width: 210px;
  padding: 10px;
  border: 1px solid #e4e4eb;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(16, 16, 40, 0.22);
  font-size: 10px;
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.cs-demo[data-pop="open"] .pop { opacity: 1; transform: none; }
.cs-demo .p-head { display: flex; align-items: center; gap: 6px; font-size: 11px; }
.cs-demo .p-head img { border-radius: 4px; }
.cs-demo .p-gear { margin-left: auto; color: #9b9ba8; }
.cs-demo .p-tabs { display: flex; margin: 8px -10px; border-bottom: 1px solid #ececf2; }
.cs-demo .p-tabs span { flex: 1; padding: 5px 0 6px; text-align: center; color: #9b9ba8; font-weight: 600; }
.cs-demo .p-tabs .on { color: #17171f; box-shadow: inset 0 -2px 0 #6355f6; }
.cs-demo .p-hero { position: relative; display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px; background: #6355f6; color: #fff; overflow: hidden; transition: background 0.15s; }
.cs-demo .p-hero-text { flex: 1; display: grid; }
.cs-demo .p-hero b { font-size: 11px; }
.cs-demo .p-hero small { opacity: 0.8; font-size: 9px; }
.cs-demo .p-done { position: absolute; inset: 0; display: grid; place-items: center; background: #15a14a; font-weight: 650; font-size: 11px; opacity: 0; transition: opacity 0.2s; }
.cs-demo[data-press="hero"] .p-hero { background: #5446ea; }
.cs-demo[data-phase="hero-done"] .p-hero .p-done { opacity: 1; }
.cs-demo .p-minis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; margin-top: 6px; }
.cs-demo .p-mini { display: grid; justify-items: center; gap: 3px; padding: 6px 2px; border: 1px solid #ececf2; border-radius: 7px; color: #77778a; transition: background 0.15s, border-color 0.15s, color 0.15s; }
.cs-demo .p-mini svg { display: block; }
.cs-demo .p-mini small { color: #17171f; font-size: 9px; font-weight: 600; }
/* full page: progress on the button while it stitches (as in popup.css .working), then the check */
.cs-demo .p-full { position: relative; overflow: hidden; }
.cs-demo .p-full .p-done { font-size: 9.5px; color: #fff; }
.cs-demo .p-work { position: absolute; inset: 0; display: grid; place-content: center; padding: 0 4px; background: #f1f0ff; color: #6355f6; font-size: 9px; font-weight: 650; line-height: 1.25; text-align: center; opacity: 0; transition: opacity 0.2s; }
.cs-demo .p-work::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: var(--pct, 0%); background: #6355f6; transition: width 0.5s; }
.cs-demo[data-phase="scroll"] .p-work { opacity: 1; }
.cs-demo[data-phase="full-done"] .p-full .p-done { opacity: 1; }
.cs-demo[data-press="area"] .p-area, .cs-demo[data-press="full"] .p-full { background: #f1f0ff; border-color: #c9c3ff; color: #6355f6; }

/* cursor */
.cs-demo .cursor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 6;
  width: 18px;
  height: 18px;
  fill: #17171f;
  stroke: #fff;
  stroke-width: 1.3;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
  transform: translate(var(--mx, 70%), var(--my, 70%));
  transition: transform 0.8s cubic-bezier(0.45, 0, 0.2, 1);
}
.cs-demo.gliding .cursor { transition-duration: 0.9s; }
.cs-demo.dragging .cursor { transition-duration: 1.1s; }
.cs-demo.clicking .cursor { animation: cs-click 0.22s ease-out; }
@keyframes cs-click { 50% { scale: 0.82; } }
.cs-demo[data-phase="aim"] .cursor, .cs-demo[data-phase="drag"] .cursor { opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .cs-demo *, .cs-demo *::before, .cs-demo *::after { transition-duration: 0s !important; transition-delay: 0s !important; animation: none !important; }
}
