/* ============================================================================
   copyleast — the homepage demo check (animated)
   A real result examining itself: fake cursor walks to each finding, highlights
   reveal, the source panel lights up, an honest score chip. Auto-plays in view.
   Ported from the React CheckDemo/ReplayStage (reduced-motion stacked layout).
   ========================================================================== */

.replay-stage {
  position: relative;
  margin-inline: auto;
  max-width: 56rem;
}
.replay-stage__caption {
  margin-inline: auto;
  margin-top: var(--sp-4);
  max-width: var(--max-prose);
  text-align: center;
  color: var(--neutral-400);
}
.replay-stage__start {
  margin-inline: auto;
  max-width: 48rem;
}

/* Base layout (no-JS / reduced motion): a plain stack, everything present. */
.replay-stage__form {
  margin-top: var(--sp-16);
}
.replay-stage__runway {
  display: none;
}
.replay-hint {
  margin-top: var(--sp-4);
}
@media (min-width: 640px) {
  .replay-stage:not(.is-scroll) .replay-hint {
    display: inline-block;
    width: calc(50% - var(--sp-2));
    vertical-align: top;
  }
  .replay-stage:not(.is-scroll) .replay-hint--left {
    margin-right: var(--sp-4);
  }
}

/* Scroll choreography (JS on + motion allowed): the replay pins and dissolves
   as the form rises over it, then the form pins mid-screen while the hints
   reveal — flanking it at xl+. Mirrors the React ReplayStage exactly. */
.replay-stage.is-scroll .replay-stage__replay {
  position: sticky;
  top: 146px;
  z-index: 0;
  will-change: opacity, transform;
}
.replay-stage.is-scroll .replay-stage__form {
  position: sticky;
  margin-top: 310px;
  z-index: 10;
}
.replay-stage.is-scroll .replay-stage__form-inner {
  position: relative;
}
.replay-stage.is-scroll .replay-stage__runway {
  display: block;
  height: 820px;
}
.replay-stage.is-scroll .replay-hint {
  position: absolute;
  display: none;
  width: 13rem;
  margin-top: 0;
}
@media (min-width: 1280px) {
  .replay-stage.is-scroll .replay-hint {
    display: block;
  }
}
.replay-stage.is-scroll .replay-hint--left {
  right: 100%;
  margin-right: var(--sp-6);
  top: var(--sp-8);
}
.replay-stage.is-scroll .replay-hint--right {
  left: 100%;
  margin-left: var(--sp-6);
  top: 10rem;
}
.hint-card {
  border: 1px solid var(--neutral-200);
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-4);
}
.hint-card__title {
  margin-top: var(--sp-4);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--neutral-950);
}
.hint-card__body {
  margin-top: var(--sp-2);
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--neutral-500);
}

/* ── Demo frame ───────────────────────────────────────────────────────────── */
.cd {
  border: 1px solid var(--neutral-200);
  background: #fff;
  box-shadow: var(--shadow-md);
}
.cd__chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  border-bottom: 1px solid var(--neutral-200);
  padding: var(--sp-3) var(--sp-5);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--neutral-500);
}
.cd__file {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.cd__file::before {
  content: "";
  display: inline-block;
  height: 6px;
  width: 6px;
  flex-shrink: 0;
  border-radius: 9999px;
  background: var(--neutral-400);
}
.cd__stage {
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--neutral-400);
}

/* Desk + reading surface */
.cd__desk {
  position: relative;
  background: var(--neutral-50);
  padding: var(--sp-4);
}
@media (min-width: 640px) {
  .cd__desk {
    padding: var(--sp-5);
  }
}
.cd__layout {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
}
@media (min-width: 1024px) {
  .cd__layout {
    flex-direction: row;
  }
}
.cd__page {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--neutral-200);
  background: #fff;
  padding: var(--sp-5);
}
@media (min-width: 640px) {
  .cd__page {
    padding: var(--sp-6);
  }
}
.cd__prose {
  font-family: var(--font-serif);
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--neutral-950);
}

/* Finding highlights */
.cd-finding {
  border-bottom: 2px solid transparent;
  transition:
    background-color var(--dur-base) var(--ease-standard),
    box-shadow var(--dur-base) var(--ease-standard);
}
.cd-finding__marker {
  display: none;
  margin-left: 2px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--neutral-500);
  vertical-align: super;
  white-space: nowrap;
}
.cd-finding.is-revealed .cd-finding__marker {
  display: inline;
}
.cd-finding.is-revealed.cd-finding--match {
  background: var(--brand-200);
  border-bottom-color: var(--brand-500);
}
.cd-finding.is-revealed.cd-finding--probable {
  background: var(--brand-100);
  border-bottom: 2px dashed var(--brand-400);
}
.cd-finding.is-revealed.cd-finding--grey {
  background: var(--neutral-100);
  border-bottom: 2px dotted var(--neutral-400);
}
.cd-finding.is-selected {
  border-radius: 2px;
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--brand-500);
}

/* Score chip */
.cd__score {
  display: inline-block;
  margin-top: var(--sp-6);
  border: 1px solid var(--neutral-200);
  background: var(--neutral-50);
  padding: var(--sp-4);
  opacity: 0.6;
  transition: opacity var(--dur-slow) var(--ease-standard);
}
.cd__score.is-active {
  border-color: var(--uncertain-border);
  background: var(--uncertain-bg);
  opacity: 1;
}
.cd__score-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--neutral-500);
}
.cd__score-figure {
  margin-top: var(--sp-1);
  font-family: var(--font-mono);
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--neutral-300);
}
.cd__score.is-active .cd__score-figure {
  color: var(--neutral-950);
}
.cd__score-ci {
  margin-top: var(--sp-1);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--neutral-400);
}
.cd__score-fpr {
  margin-top: var(--sp-2);
  font-size: 0.8125rem;
  color: var(--neutral-400);
}

/* Source panel */
.cd__aside {
  flex-shrink: 0;
}
@media (min-width: 1024px) {
  .cd__aside {
    width: 16rem;
  }
}
.cd-panel {
  height: 100%;
  border: 1px solid var(--neutral-200);
  background: rgba(245, 245, 245, 0.6);
  padding: var(--sp-4);
  transition: border-color var(--dur-slow) var(--ease-standard),
    background-color var(--dur-slow) var(--ease-standard);
}
.cd-panel.is-active {
  border-color: var(--neutral-300);
  background: #fff;
}
.cd-panel__marker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--neutral-300);
}
.cd-panel.is-active .cd-panel__marker {
  color: var(--brand-700);
}
.cd-panel__note {
  margin-top: var(--sp-2);
  min-height: 4.5rem;
  font-size: 0.875rem;
  line-height: 1.4;
  color: var(--neutral-400);
}
.cd-panel.is-active .cd-panel__note {
  color: var(--neutral-950);
}
.cd-panel__foot {
  margin-top: var(--sp-4);
  border-top: 1px solid var(--neutral-200);
  padding-top: var(--sp-3);
}
.cd-panel__title {
  min-height: 2.5rem;
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--neutral-600);
}
.cd-panel__url {
  margin-top: var(--sp-1);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--neutral-400);
}
.cd-panel__snip {
  margin-top: var(--sp-3);
  min-height: 4rem;
  border-left: 2px solid var(--neutral-200);
  padding-left: var(--sp-3);
}
.cd-panel__snip p {
  font-family: var(--font-serif);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--neutral-500);
}
.cd-panel__skeleton span {
  display: block;
  height: 6px;
  border-radius: 9999px;
  background: var(--neutral-200);
}
.cd-panel__skeleton span + span {
  margin-top: 6px;
}
.cd-panel__sim {
  margin-top: var(--sp-3);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--neutral-400);
}

/* Fake cursor + click pulse */
.cd__cursor {
  position: absolute;
  z-index: 20;
  pointer-events: none;
  transition: left var(--dur-slow) var(--ease-standard), top var(--dur-slow) var(--ease-standard), opacity var(--dur-base);
}
.cd__cursor[hidden] {
  display: none;
}
.cd__pulse {
  position: absolute;
  left: -10px;
  top: -10px;
  height: 20px;
  width: 20px;
  border-radius: 9999px;
  background: var(--brand-500);
}
@keyframes cd-click {
  from { transform: scale(0.3); opacity: 0.5; }
  to { transform: scale(1.9); opacity: 0; }
}
.cd__pulse.is-firing {
  animation: cd-click 620ms var(--ease-standard) both;
}

/* Transport */
.cd__transport {
  border-top: 1px solid var(--neutral-200);
  padding: var(--sp-4) var(--sp-5);
}
.cd__controls {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}
.cd__play {
  display: flex;
  height: 44px;
  width: 44px;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: var(--brand-500);
  color: #fff;
  transition: background-color var(--dur-fast) var(--ease-standard);
}
.cd__play:hover {
  background: var(--brand-400);
}
.cd__track {
  position: relative;
  height: 6px;
  flex: 1;
}
.cd__track-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 9999px;
  background: var(--neutral-200);
}
.cd__track-fill {
  position: absolute;
  inset-block: 0;
  left: 0;
  border-radius: 9999px;
  background: var(--brand-500);
}
.cd__scrub {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 100%;
  cursor: pointer;
  opacity: 0;
  margin: 0;
}
.cd__time {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--neutral-500);
}
.cd__ribbon {
  margin-top: var(--sp-3);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--neutral-400);
}
.cd__ribbon .m {
  color: var(--brand-700);
}
.cd__ribbon .p {
  color: var(--brand-600);
}
.cd__ribbon .g {
  color: var(--neutral-500);
}
.cd__ribbon .v {
  margin-left: auto;
}

/* Start-record box hint text (formats + drop line) */
.start-hint {
  font-size: 0.8125rem;
  line-height: 1.35;
  color: var(--neutral-400);
}
