/* ---------------------------------------------------------------------------
   The "how it works" walkthrough.

   Every stage is driven by a single class on .demo (s-drop, s-upload, s-link,
   s-click, s-wall, s-type, s-verify, s-done), added in order by demo.js and
   cleared all at once on replay. Nothing here measures the DOM: elements rest
   at their natural position and start life translated away from it, so the
   animation holds up at any width.
   --------------------------------------------------------------------------- */

.demo {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
  align-items: center;
  cursor: pointer;
}

.demo > * { min-width: 0; }

/* ── Step captions ─────────────────────────────────────────────────────────── */

.demo-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: demostep;
  display: grid;
  gap: 22px;
}

.demo-steps li {
  counter-increment: demostep;
  padding-left: 42px;
  position: relative;
  opacity: 0.4;
  transition: opacity 0.35s ease;
}

.demo-steps li::before {
  content: counter(demostep);
  position: absolute;
  left: 0;
  top: 1px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 650;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e5ef);
  color: var(--muted, #666d85);
  transition: background 0.35s ease, color 0.35s ease, border-color 0.35s ease;
}

.demo-steps b {
  display: block;
  font-size: 15.5px;
  font-weight: 640;
  letter-spacing: -0.01em;
}

.demo-steps span {
  display: block;
  font-size: 14px;
  color: var(--muted, #666d85);
}

/* The caption tracks whichever scene is on screen. */
.demo.s-drop  .demo-steps li[data-step="upload"],
.demo.s-link  .demo-steps li[data-step="share"],
.demo.s-wall  .demo-steps li[data-step="collect"] { opacity: 1; }

.demo.s-drop  .demo-steps li[data-step="upload"]::before,
.demo.s-link  .demo-steps li[data-step="share"]::before,
.demo.s-wall  .demo-steps li[data-step="collect"]::before {
  background: var(--accent, #4f5bd5);
  border-color: var(--accent, #4f5bd5);
  color: #fff;
}

/* Once we move on, earlier steps stay lit but drop back to a resting weight. */
.demo.s-link .demo-steps li[data-step="upload"],
.demo.s-wall .demo-steps li[data-step="upload"],
.demo.s-wall .demo-steps li[data-step="share"] { opacity: 0.75; }

/* ── Browser frame ─────────────────────────────────────────────────────────── */

.demo-window {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e5ef);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 18px 40px rgba(20, 23, 42, 0.08);
}

.demo-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border, #e2e5ef);
  background: #fafbfe;
}

.demo-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #dfe2ec;
  flex: none;
}

.demo-addr {
  margin-left: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  color: var(--muted, #666d85);
  background: #fff;
  border: 1px solid var(--border, #e2e5ef);
  border-radius: 999px;
  padding: 3px 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.demo-path { font-weight: 600; color: var(--text, #14172a); }

.demo-body {
  position: relative;
  height: 286px;
  overflow: hidden;
}

/* ── Scenes ────────────────────────────────────────────────────────────────── */

.scene {
  position: absolute;
  inset: 0;
  padding: 22px;
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.scene-wall {
  opacity: 0;
  transform: translateX(18px);
}

.demo.s-wall .scene-app {
  opacity: 0;
  transform: translateX(-18px);
}

.demo.s-wall .scene-wall {
  opacity: 1;
  transform: none;
}

/* ── Scene 1: dropzone ─────────────────────────────────────────────────────── */

.dropzone {
  position: relative;
  height: 128px;
  border: 1.5px dashed #cdd2e4;
  border-radius: 12px;
  display: grid;
  place-items: center;
  transition: border-color 0.35s ease, background 0.35s ease, transform 0.4s ease,
    opacity 0.4s ease;
}

.demo.s-drop .dropzone {
  border-color: var(--accent, #4f5bd5);
  background: rgba(79, 91, 213, 0.04);
}

.demo.s-link .dropzone {
  transform: translateY(-6px) scale(0.97);
  opacity: 0.45;
}

.dz-label {
  position: absolute;
  font-size: 13.5px;
  color: var(--muted, #666d85);
  transition: opacity 0.3s ease;
}

.demo.s-drop .dz-label { opacity: 0; }

/* The file rests inside the dropzone; it starts outside it and flies home. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e2e5ef);
  box-shadow: 0 6px 16px rgba(20, 23, 42, 0.08);
  font-size: 13.5px;
  font-weight: 550;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-96px, 104px) rotate(-9deg) scale(0.92);
  transition: transform 0.85s cubic-bezier(0.34, 0.8, 0.28, 1), opacity 0.3s ease;
}

.demo.s-drop .chip {
  opacity: 1;
  transform: none;
}

.chip em,
.wall-doc em {
  font-style: normal;
  font-weight: 500;
  color: var(--muted, #666d85);
  font-size: 12.5px;
}

.chip-icon {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 3px 6px;
  border-radius: 5px;
  background: var(--accent-soft, #eceefc);
  color: var(--accent, #4f5bd5);
}

.dz-bar {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 16px;
  height: 4px;
  border-radius: 999px;
  background: #e6e9f4;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.dz-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent, #4f5bd5);
}

.demo.s-upload .dz-bar { opacity: 1; }
.demo.s-upload .dz-bar i { width: 100%; transition: width 0.9s ease; }

/* ── Scene 1: the generated link ───────────────────────────────────────────── */

.linkrow {
  margin-top: 18px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.demo.s-link .linkrow {
  opacity: 1;
  transform: none;
}

.linkrow-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted, #666d85);
  margin-bottom: 7px;
}

.linkrow-value {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid var(--border, #e2e5ef);
  background: #fafbfe;
  transition: border-color 0.25s ease, background 0.25s ease;
}

.demo.s-click .linkrow-value {
  border-color: var(--accent, #4f5bd5);
  background: rgba(79, 91, 213, 0.05);
}

.linkrow-value code {
  flex: 1;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--accent, #4f5bd5);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.linkrow-copy {
  flex: none;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted, #666d85);
  border: 1px solid var(--border, #e2e5ef);
  background: #fff;
  border-radius: 7px;
  padding: 4px 10px;
}

/* ── The pointer that clicks the link ──────────────────────────────────────── */

.pointer {
  position: absolute;
  left: 28%;
  top: 100%;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  border: 2px solid var(--accent, #4f5bd5);
  background: rgba(79, 91, 213, 0.18);
  opacity: 0;
  transform: translate(0, 18px);
  transition: opacity 0.25s ease, transform 0.45s cubic-bezier(0.34, 0.8, 0.28, 1);
}

.demo.s-click .pointer {
  opacity: 1;
  transform: translate(0, -22px);
}

.demo.s-click .pointer::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--accent, #4f5bd5);
  animation: demo-ping 0.7s ease-out 0.45s 1;
}

@keyframes demo-ping {
  from { opacity: 0.6; transform: scale(0.5); }
  to   { opacity: 0;   transform: scale(1.5); }
}

/* ── Scene 2: the subscribe wall ───────────────────────────────────────────── */

.wall-doc {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13.5px;
  font-weight: 550;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--border, #e2e5ef);
}

.wall-lede {
  margin: 12px 0 16px;
  font-size: 13.5px;
  color: var(--muted, #666d85);
}

.wall-label {
  display: block;
  font-size: 12.5px;
  font-weight: 550;
  margin-bottom: 6px;
}

.wall-input {
  display: flex;
  align-items: center;
  height: 38px;
  padding: 0 12px;
  border-radius: 9px;
  border: 1px solid var(--border, #e2e5ef);
  background: #fff;
  font-size: 13.5px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.demo.s-type .wall-input {
  border-color: var(--accent, #4f5bd5);
  box-shadow: 0 0 0 3px rgba(79, 91, 213, 0.12);
}

.caret {
  width: 1.5px;
  height: 16px;
  margin-left: 1px;
  background: var(--accent, #4f5bd5);
  opacity: 0;
}

.demo.s-type .caret { animation: demo-blink 1s step-end infinite; }

@keyframes demo-blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

.wall-cta {
  margin-top: 12px;
  width: 100%;
  padding: 10px;
  border: 0;
  border-radius: 9px;
  background: var(--accent, #4f5bd5);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  cursor: default;
  transition: transform 0.15s ease, opacity 0.3s ease;
}

.demo.s-verify .wall-cta { transform: scale(0.97); }
.demo.s-verify .wall-cta,
.demo.s-done .wall-cta { opacity: 0; }

.wall-verify,
.wall-download {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 22px;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.wall-verify {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted, #666d85);
}

.demo.s-verify .wall-verify { opacity: 1; }

.wall-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px;
  border-radius: 9px;
  background: #16a34a;
  color: #fff;
  font-size: 13.5px;
  font-weight: 640;
  transform: scale(0.94);
}

.wall-download::before { content: "\2193"; font-weight: 700; }

.demo.s-done .wall-download {
  opacity: 1;
  transform: none;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .demo {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  .demo-steps {
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 18px;
  }
}

@media (max-width: 520px) {
  .demo-body { height: 300px; }
  .scene { padding: 18px; }
  .wall-verify, .wall-download { left: 18px; right: 18px; bottom: 18px; }
}

/* Reduced motion: demo.js jumps straight to the finished state, so all that's
   left to do here is remove the movement. */
@media (prefers-reduced-motion: reduce) {
  .demo { cursor: default; }

  .demo *,
  .demo *::after {
    transition-duration: 0.01ms !important;
    animation: none !important;
  }

  .chip { transform: none; }
}
