/* The interactive demo (demo.js). Uses the site's colour tokens throughout. */

.demo {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  overflow: hidden;
}

.demo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.demo-chapters { display: flex; gap: 6px; flex-wrap: wrap; }
.demo-chapters button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 5px;
  padding: 7px 12px;
  font-size: 14px;
  color: var(--muted);
}
.demo-chapters button span {
  font: 12.5px ui-monospace, SFMono-Regular, Consolas, monospace;
  color: var(--faint);
  margin-right: 8px;
}
.demo-chapters button:hover { color: var(--ink); border-color: var(--blue); }
.demo-chapters button[aria-selected='true'] { color: var(--blue); background: var(--soft); border-color: var(--blue); }
.demo-chapters button[aria-selected='true'] span { color: var(--blue); }

.demo-modes { display: flex; gap: 8px; }
.demo-modes button {
  border-radius: 5px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  border: 1px solid var(--blue);
}
.demo-play { background: var(--blue); color: #fff; }
:root[data-theme='dark'] .demo-play { color: #0d233c; }
.demo-play:hover { filter: brightness(0.92); }
.demo-try { background: transparent; color: var(--blue); }
.demo-try[aria-pressed='true'] { background: var(--soft); }

/* The stage keeps one shape; each screenshot is fitted inside it by demo.js. */
.demo-stage {
  position: relative;
  aspect-ratio: 1389 / 868;
  background: #0b1520;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.demo-shot { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.demo-img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }

.demo-cursor {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: -3px 0 0 -5px;   /* the arrow's tip, not its box, sits on the point */
  pointer-events: none;
  z-index: 3;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.45));
}
.demo-cursor.is-moving {
  transition: left 1.15s cubic-bezier(0.45, 0, 0.2, 1), top 1.15s cubic-bezier(0.45, 0, 0.2, 1);
}

.demo-ring {
  position: absolute;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  border: 3px solid #5b9dff;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.demo-ring.is-clicking { animation: demo-click 0.6s ease-out; }
@keyframes demo-click {
  from { opacity: 0.95; transform: scale(0.35); }
  to { opacity: 0; transform: scale(1.4); }
}

/* Try it yourself: the control to press, outlined and pulsing. */
.demo-hotspot {
  position: absolute;
  transform: translate(-50%, -50%);
  border: 2px solid #fff;
  border-radius: 6px;
  background: rgba(91, 157, 255, 0.12);
  box-shadow: 0 0 0 3px rgba(91, 157, 255, 0.85), 0 0 18px 4px rgba(91, 157, 255, 0.55);
  cursor: pointer;
  z-index: 2;
  padding: 0;
  box-sizing: content-box;
  min-width: 24px;
  min-height: 20px;
}
.demo-hotspot::after {
  content: '';
  position: absolute;
  inset: -9px;
  border-radius: 10px;
  border: 2px solid #9cc3ff;
  opacity: 0;
  animation: demo-pulse 1.6s ease-out infinite;
}
@keyframes demo-pulse {
  0% { opacity: 0.8; transform: scale(0.92); }
  100% { opacity: 0; transform: scale(1.12); }
}
.demo-hotspot:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

.demo-nudge {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  background: rgba(8, 16, 26, 0.92);
  color: #e6eef7;
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 5px;
  z-index: 4;
  pointer-events: none;
}

.demo-caption {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px 28px;
  align-items: start;
  padding: 20px 22px 18px;
  border-top: 1px solid var(--line);
}
.demo-caption h3 { font-size: 21px; letter-spacing: -0.4px; margin: 6px 0 8px; }
.demo-caption p { font-size: 16px; line-height: 1.65; color: var(--muted); max-width: 64ch; }
.demo-step { font: 12.5px ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: 1px; color: var(--blue); }
.demo-link { display: inline-block; margin-top: 10px; font-size: 15px; text-decoration: none; }
.demo-link:hover { text-decoration: underline; }

.demo-nav { display: flex; align-items: center; gap: 8px; }
.demo-nav button {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 5px;
  padding: 8px 13px;
  font-size: 14px;
  color: var(--ink);
}
.demo-nav button:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.demo-nav button:disabled { opacity: 0.4; }
.demo-count { font: 13px ui-monospace, SFMono-Regular, Consolas, monospace; color: var(--muted); min-width: 52px; text-align: center; }

.demo-progress { height: 3px; background: var(--line); }
.demo-progress span { display: block; height: 100%; background: var(--blue); width: 0; transition: width 0.3s; }

.demo-hint { font-size: 14px; color: var(--muted); padding: 0 22px 16px; }
.demo:not(.is-trying) .demo-hint-try, .demo.is-trying .demo-hint-play { display: none; }

@media (max-width: 700px) {
  .demo-bar { padding: 10px 12px; }
  .demo-caption { grid-template-columns: 1fr; padding: 16px; }
  .demo-caption h3 { font-size: 19px; }
  .demo-cursor { width: 20px; height: 20px; }
  .demo-hint { padding: 0 16px 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .demo-cursor.is-moving { transition: none; }
  .demo-hotspot::after, .demo-ring.is-clicking { animation: none; }
}
