/* css/demo.css: owned by step demo-console. Centrepiece "Watch the team build your website". */

.demo { position: relative; }

.demo-nojs {
  max-width: 60ch; margin: 0 auto; padding: var(--s-4) var(--s-5);
  border: 1px dashed var(--line); border-radius: var(--r-m); color: var(--text-dim);
}
html.js .demo-nojs { display: none; }

.demo-app { display: grid; gap: var(--s-5); }
.demo-app[hidden] { display: none; }

/* ---------- inputs ---------- */
.demo-form { padding: var(--s-5); border-radius: var(--r-l); display: grid; gap: var(--s-5); }
.demo-field { display: grid; gap: var(--s-2); }
.demo-field label, .demo-types legend {
  font-family: var(--font-mono); font-size: .8125rem; letter-spacing: .08em; text-transform: uppercase; color: var(--cyan);
}
.demo-types legend { padding: 0; margin-bottom: var(--s-3); }
.demo-field input {
  width: 100%; min-height: 52px; padding: 0 var(--s-4);
  font: 500 1.125rem/1 var(--font-display); color: var(--cream);
  background: rgba(7, 20, 22, .7); border: 1px solid var(--line); border-radius: var(--r-m);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.demo-field input::placeholder { color: var(--text-dim); opacity: .85; }
.demo-field input:focus-visible { border-color: var(--cyan); box-shadow: var(--glow-cyan); outline: none; }
.demo-field input:disabled { opacity: .6; }

.demo-types { border: 0; margin: 0; padding: 0; min-width: 0; min-height: 560px; }
.demo-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
.demo-tile { position: relative; display: block; min-width: 0; cursor: pointer; }
.demo-tile:last-child:nth-child(odd) { grid-column: 1 / -1; justify-self: center; width: calc(50% - var(--s-3) / 2); }
.demo-tile input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 2; }
.demo-tile-body {
  display: grid; gap: var(--s-2); justify-items: center; align-content: start; text-align: center; height: 100%;
  padding: var(--s-3); border-radius: var(--r-m);
  background: var(--glass); border: 1px solid var(--line);
  transition: transform var(--t-med) var(--ease-out), border-color var(--t-fast), box-shadow var(--t-med);
}
.demo-tile-frame {
  width: 100%; max-width: 112px; aspect-ratio: 1; border-radius: 50%; padding: 3px;
  background: conic-gradient(from 200deg, var(--cyan), var(--orange), var(--cyan));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08), 0 6px 18px rgba(0, 0, 0, .4);
}
.demo-tile-frame img { display: block; width: 100%; height: 100%; border-radius: 50%; object-fit: cover; background: var(--bg-1); }
.demo-tile-name { font: 600 .9375rem/1.2 var(--font-display); color: var(--cream); }
.demo-tile-biz { font: 500 .75rem/1.2 var(--font-mono); letter-spacing: .04em; color: var(--text-dim); }
.demo-tile input:checked + .demo-tile-body {
  border-color: var(--cyan); box-shadow: var(--glow-cyan); transform: translateY(-2px);
  background: linear-gradient(180deg, rgba(62, 230, 224, .14), var(--glass));
}
.demo-tile input:checked + .demo-tile-body .demo-tile-biz { color: var(--cyan); }
.demo-tile input:focus-visible + .demo-tile-body { outline: 3px solid var(--cream); outline-offset: 2px; }
@media (hover: hover) {
  .demo-tile input:not(:checked):not(:disabled) + .demo-tile-body:hover { transform: translateY(-2px); border-color: rgba(62, 230, 224, .5); }
}
.demo-tile input:disabled + .demo-tile-body { opacity: .55; }

.demo-build { width: 100%; min-height: 56px; font-size: 1.125rem; justify-content: center; }
.demo-build:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- stage ---------- */
.demo-stage {
  --demo-h: 704px;
  position: relative; display: flex; flex-direction: column;
  height: var(--demo-h); padding: var(--s-4); border-radius: var(--r-xl); overflow: hidden;
  font-family: var(--font-mono);
}
.demo-top { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-2); }
.demo-crew-list { display: flex; gap: var(--s-2); list-style: none; margin: 0; padding: 0; min-width: 0; }
.demo-crew-item { display: grid; justify-items: center; gap: 2px; font-size: .6875rem; color: var(--text-dim); letter-spacing: .04em; }
.demo-crew-item img {
  width: 40px; height: 40px; border-radius: 50%; object-fit: cover; opacity: .45;
  border: 2px solid var(--line); transition: opacity var(--t-med), transform var(--t-med) var(--ease-spring);
}
.demo-crew-item.is-on { color: var(--cream); }
.demo-crew-item.is-on img { opacity: 1; transform: scale(1.12); border-color: var(--cyan); box-shadow: var(--glow-cyan); }
.demo-crew-item[data-who="kako"].is-on img { border-color: var(--orange); box-shadow: var(--glow-orange); }

.demo-skip { flex: none; min-height: 44px; padding: 0 var(--s-3); font-size: .8125rem; }
.demo-skip[hidden] { display: none; }

.demo-layers { position: relative; flex: 1; min-height: 0; margin-top: var(--s-3); }
.demo-console, .demo-result { position: absolute; inset: 0; }

/* console */
.demo-console {
  display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-3);
  border-radius: var(--r-m); background: rgba(4, 12, 14, .78); border: 1px solid var(--line);
  overflow: hidden; transition: opacity var(--t-med);
}
.demo-console::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 40%; pointer-events: none;
  background: linear-gradient(180deg, transparent, rgba(62, 230, 224, .06), transparent);
  animation: demo-scan 5s linear infinite;
}
@keyframes demo-scan { from { transform: translateY(-100%); } to { transform: translateY(260%); } }
.demo-stage[data-phase="scan"] .demo-console, .demo-stage[data-phase="done"] .demo-console {
  opacity: 0; visibility: hidden; transition: opacity var(--t-med), visibility 0s var(--t-med);
}

.demo-bar-row { display: flex; align-items: center; gap: var(--s-3); flex: none; }
.demo-ring { flex: none; transform: rotate(-90deg); }
.demo-ring circle { fill: none; stroke-width: 4; }
.demo-ring-bg { stroke: rgba(255, 255, 255, .1); }
.demo-ring-fg { stroke: var(--cyan); stroke-linecap: round; stroke-dasharray: 113.1; stroke-dashoffset: 113.1; transition: stroke-dashoffset 120ms linear; }
.demo-bar-col { flex: 1; min-width: 0; display: grid; gap: 6px; }
.demo-bar-label { display: flex; justify-content: space-between; gap: var(--s-2); font-size: .75rem; color: var(--text-dim); }
.demo-bar-label span:first-child { color: var(--cream); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.demo-bar { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.demo-bar i {
  display: block; height: 100%; width: 100%; transform: scaleX(0); transform-origin: left center;
  background: linear-gradient(90deg, var(--cyan), var(--orange)); border-radius: inherit; transition: transform 120ms linear;
}

.demo-palette { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--s-2); flex: none; }
.demo-sw { display: grid; gap: 4px; font-size: .625rem; color: var(--text-dim); text-align: center; }
.demo-sw i {
  display: block; height: 36px; border-radius: var(--r-s); border: 1px dashed var(--line);
  transform: scale(.6); opacity: .35; transition: transform var(--t-med) var(--ease-spring), opacity var(--t-med);
}
.demo-sw.is-in i { transform: scale(1); opacity: 1; border: 1px solid rgba(255, 255, 255, .25); }
.demo-sw span { opacity: 0; transition: opacity var(--t-med); }
.demo-sw.is-in span { opacity: 1; }

.demo-term {
  flex: none; height: 126px; padding: var(--s-2) var(--s-3); border-radius: var(--r-s);
  background: #020909; border: 1px solid rgba(62, 230, 224, .22); overflow: hidden;
  display: flex; flex-direction: column; justify-content: flex-end;
  font-size: .75rem; line-height: 18px; color: var(--cyan);
}
.demo-term-line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.demo-term-line.c1 { color: var(--orange); }
.demo-term-line.c2 { color: var(--cream); }
.demo-term-line.c3 { color: var(--text-dim); }

.demo-log {
  flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 6px;
  font-size: .8125rem; line-height: 1.4;
}
.demo-line { display: flex; gap: var(--s-2); align-items: baseline; flex: none; }
.demo-ts { flex: none; color: var(--text-dim); }
.demo-who { flex: none; font-weight: 500; color: var(--cyan); }
.demo-who[data-who="kako"] { color: var(--orange); }
.demo-who[data-who="dubu"] { color: #ff8fc0; }
.demo-who[data-who="coco"] { color: #b9f26b; }
.demo-who[data-who="ai"] { color: var(--text-dim); }
.demo-msg { min-width: 0; overflow-wrap: anywhere; color: var(--cream); }
.demo-line.is-new { animation: demo-line-in 240ms var(--ease-out); }
@keyframes demo-line-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.demo-cursor { display: inline-block; width: .55em; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--cyan); animation: demo-blink 1s steps(2, start) infinite; }
@keyframes demo-blink { to { opacity: 0; } }

/* stamps */
.demo-stamp {
  position: absolute; left: 50%; top: 46%; z-index: 3; display: grid; justify-items: center; gap: var(--s-2);
  width: max-content; max-width: 92%; pointer-events: none; opacity: 0;
  transform: translate(-50%, -50%) rotate(-9deg);
}
.demo-stamp-word {
  padding: var(--s-2) var(--s-4); border: 5px solid currentColor; border-radius: var(--r-s);
  font: 700 clamp(1.75rem, 9vw, 3rem)/1 var(--font-display); letter-spacing: .06em; text-transform: uppercase;
  background: rgba(4, 12, 14, .88); box-shadow: 0 0 0 2px rgba(0, 0, 0, .4), 0 10px 30px rgba(0, 0, 0, .5);
}
.demo-stamp-reason {
  padding: 4px var(--s-3); border-radius: var(--r-pill); background: rgba(4, 12, 14, .94);
  font: 500 .8125rem/1.3 var(--font-mono); color: var(--cream); text-align: center;
}
.demo-stamp.is-bad { color: var(--bad); }
.demo-stamp.is-ok { color: var(--ok); }
.demo-stamp.is-in { opacity: 1; }

/* result */
.demo-result {
  display: grid; justify-items: center; align-content: start; gap: var(--s-3); padding: var(--s-2) 0 0;
  opacity: 0; visibility: hidden; transition: opacity var(--t-med);
}
.demo-stage[data-phase="scan"] .demo-result, .demo-stage[data-phase="done"] .demo-result { opacity: 1; visibility: visible; }
.demo-result-copy { display: grid; gap: var(--s-3); justify-items: center; text-align: center; width: 100%; font-family: var(--font-body); }
.demo-result-title { margin: 0; font: 600 1.25rem/1.2 var(--font-display); color: var(--cream); overflow-wrap: anywhere; }
.demo-result-title:focus-visible { outline: 3px solid var(--cream); outline-offset: 4px; border-radius: 4px; }
.demo-result-sub { margin: 0; color: var(--text-dim); font-size: .9375rem; }
.demo-actions { display: grid; gap: var(--s-2); width: 100%; }
.demo-actions .btn { width: 100%; min-height: 48px; justify-content: center; }
.demo-result-copy > * { opacity: 0; visibility: hidden; transition: opacity var(--t-med); }
.demo-stage[data-phase="done"] .demo-result-copy > *,
.demo-stage[data-phase="scan"][data-found="1"] .demo-result-sub { opacity: 1; visibility: visible; }
.demo-phone-wrap { position: relative; width: min(176px, 54%); flex: none; }
.demo-phone-wrap .ds-phone { width: 100%; }
.demo-lens {
  position: absolute; left: 0; top: 0; width: 72px; height: 72px; z-index: 4; pointer-events: none; opacity: 0;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .5));
}
.demo-stage[data-phase="scan"] .demo-lens { opacity: 1; }
.demo-lens svg { width: 100%; height: 100%; display: block; }

/* confetti */
.demo-confetti { position: absolute; inset: 0; z-index: 6; pointer-events: none; overflow: hidden; border-radius: inherit; }
.demo-paw {
  position: absolute; left: 50%; top: 45%; width: 22px; height: 22px; opacity: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='%233ee6e0'%3E%3Cellipse cx='12' cy='16' rx='6' ry='5'/%3E%3Ccircle cx='5' cy='10' r='2.4'/%3E%3Ccircle cx='9.5' cy='5.5' r='2.4'/%3E%3Ccircle cx='14.5' cy='5.5' r='2.4'/%3E%3Ccircle cx='19' cy='10' r='2.4'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
.demo-paw.is-o {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='%23ff9a4d'%3E%3Cellipse cx='12' cy='16' rx='6' ry='5'/%3E%3Ccircle cx='5' cy='10' r='2.4'/%3E%3Ccircle cx='9.5' cy='5.5' r='2.4'/%3E%3Ccircle cx='14.5' cy='5.5' r='2.4'/%3E%3Ccircle cx='19' cy='10' r='2.4'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- wider screens ---------- */
@media (min-width: 560px) {
  .demo-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .demo-tile:last-child:nth-child(odd) { grid-column: auto; justify-self: stretch; width: auto; }
  .demo-types { min-height: 0; }
}
@media (min-width: 900px) {
  .demo-form { padding: var(--s-6); grid-template-columns: minmax(0, 1fr) auto; align-items: end; }
  .demo-types { grid-column: 1 / -1; grid-row: 2; }
  .demo-tiles { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .demo-build { grid-row: 1; grid-column: 2; width: auto; min-width: 200px; }
  .demo-stage { --demo-h: 640px; padding: var(--s-5); }
  .demo-console { padding: var(--s-4); }
  .demo-crew-list { gap: var(--s-4); }
  .demo-crew-item img { width: 52px; height: 52px; }
  .demo-term { height: 150px; }
  .demo-result { grid-template-columns: auto minmax(0, 420px); justify-content: center; align-content: center; gap: 48px; padding: 0; }
  .demo-phone-wrap { width: 250px; }
  .demo-result-copy { justify-items: start; text-align: left; }
  .demo-result-title { font-size: 1.75rem; }
}

@media (prefers-reduced-motion: reduce) {
  .demo-console::after, .demo-cursor, .demo-line.is-new { animation: none; }
  .demo-tile-body, .demo-sw i, .demo-crew-item img, .demo-bar i, .demo-ring-fg { transition: none; }
}
