/* /early — the consumer-app early-access page.
   Scoped to this one page (like pay.css) because its audience is the only
   non-developer audience the site has: same palette, same dark identity, but
   plain language and a single action instead of the terminal furniture.
   Phone-first — this is reached almost entirely from a phone. */

.early-body {
  /* the homepage's wash, pulled tighter around a short one-screen page */
  background-image:
    radial-gradient(760px 460px at 50% -160px, var(--accent-glow), transparent 70%),
    linear-gradient(180deg, var(--bg-2), var(--bg) 520px);
}

.early {
  max-width: 34rem;
  margin: 0 auto;
  padding: 3.4rem 26px 4rem;
}

.early-mark {
  font-family: var(--mono);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--fg-soft);
  margin: 0 0 3.2rem;
}

.early-h1 {
  font-size: clamp(2rem, 8.5vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 650;
  color: var(--fg);
  margin: 0 0 1.1rem;
  text-wrap: balance;
}
.early-h1 em {
  font-style: normal;
  color: var(--accent);
}

.early-lead {
  font-size: 1.08rem;
  color: var(--fg-soft);
  margin: 0 0 1.6rem;
}

.early-status-line {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  font-size: 0.97rem;
  color: var(--fg);
  margin: 0 0 2rem;
}
.early-status-line .dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
  transform: translateY(-2px);
}

/* ---------- the form ---------- */

.early-form { margin: 0; }

.early-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.early-input {
  flex: 1 1 15rem;
  min-width: 0;
  font-family: var(--sans);
  /* 16px floor: anything smaller makes iOS Safari zoom on focus, which
     yanks a phone visitor out of the layout mid-signup. */
  font-size: 1rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 11px 14px;
  transition: border-color 160ms var(--ease), background-color 160ms var(--ease);
}
.early-input::placeholder { color: var(--faint); }
.early-input:focus {
  border-color: var(--accent-soft);
  background: var(--surface-2);
}
.early-input[aria-invalid="true"] { border-color: #d5604f; }

.early-btn {
  flex: 0 0 auto;
  align-self: auto;
}
.early-btn[disabled] { color: var(--dim); cursor: default; }

.early-note {
  font-size: 0.86rem;
  color: var(--dim);
  margin: 0.95rem 0 0;
}
.early-note.error { color: #e08475; }

.early-done {
  font-size: 1.05rem;
  color: var(--fg-soft);
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: 9px;
  padding: 1.1rem 1.2rem;
  margin: 0;
}
.early-done strong { color: var(--fg); display: block; margin-bottom: 0.2rem; }

.early-foot {
  margin: 3rem 0 0;
  font-family: var(--mono);
  font-size: 0.8rem;
}
.early-foot a { color: var(--faint); }
.early-foot a:hover { color: var(--accent); }

/* ---------- the demo loop ----------
   Six scenes on one shared 42s choreography (7s each), offset per scene by
   --sd. Every scene: the question lands as the one chat bubble, a typing
   indicator thinks, the answer arrives as a grey wall of text, and the
   wall becomes the designed artifact. Pure CSS; children end hidden (92%)
   so nothing flashes at the loop seam. --lo (set by early.js) rotates
   which scene leads: a video's ?v=12-budget suffix picks its match,
   otherwise random — JS-off gets the fixed order. */

.demo { margin: 2.6rem 0 0; }

/* Every scene sits in the same grid cell, so the panel is exactly as tall
   as the tallest scene AS RENDERED — text wrapping on a narrow phone or a
   big system font grows the box instead of clipping against a fixed
   height. Inside a scene the bubble is in normal flow, so a wrapped bubble
   pushes the answer down rather than overlapping it. */
.demo-stage {
  display: grid;
  padding: 1.1rem 1.15rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.scene {
  --sd: 0s;
  grid-area: 1 / 1;
  display: flex;
  flex-direction: column;
  pointer-events: none;
  opacity: 0;
  animation: kf-scene 42s var(--ease) calc(var(--sd) - var(--lo, 0s)) infinite both;
}
.s2 { --sd: 7s; }
.s3 { --sd: 14s; }
.s4 { --sd: 21s; }
.s5 { --sd: 28s; }
.s6 { --sd: 35s; }

.q {
  align-self: flex-end;
  max-width: 75%;
  margin: 0 0 1.1rem;
  font-size: 0.85rem;
  color: var(--fg);
  background: rgba(64, 209, 127, 0.1);
  border: 1px solid rgba(64, 209, 127, 0.25);
  border-radius: 13px 13px 4px 13px;
  padding: 7px 12px;
  opacity: 0;
  animation: kf-q 42s var(--ease) calc(var(--sd) - var(--lo, 0s)) infinite both;
}

/* typing, wall and artifact share one cell too — the artifact's rendered
   height is the answer area's height, whatever it wraps to. */
.ans {
  display: grid;
  align-items: start;
}
.ans > * { grid-area: 1 / 1; }

.typing {
  display: flex;
  gap: 5px;
  margin-top: 0.15rem;
}
.typing i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--faint);
  opacity: 0;
  animation: kf-typing 42s linear calc(var(--sd) + var(--td, 0s) - var(--lo, 0s)) infinite both;
}
.typing i:nth-child(2) { --td: 0.15s; }
.typing i:nth-child(3) { --td: 0.3s; }

.art { position: relative; }

.wall i {
  display: block;
  height: 9px;
  border-radius: 5px;
  background: var(--surface-3);
  margin-bottom: 11px;
  opacity: 0;
  transform-origin: left center;
  animation: kf-wall 42s var(--ease) calc(var(--sd) + var(--d, 0s) - var(--lo, 0s)) infinite both;
}
.wall i:nth-child(1) { width: 96%; }
.wall i:nth-child(2) { width: 88%; --d: 0.09s; }
.wall i:nth-child(3) { width: 93%; --d: 0.18s; }
.wall i:nth-child(4) { width: 78%; --d: 0.27s; }
.wall i:nth-child(5) { width: 52%; --d: 0.36s; }

.a {
  opacity: 0;
  animation: kf-pop 42s cubic-bezier(0.3, 1.35, 0.45, 1) calc(var(--sd) + var(--d, 0s) - var(--lo, 0s)) infinite both;
}
.art div.a:nth-of-type(2) { --d: 0.13s; }
.art div.a:nth-of-type(3) { --d: 0.26s; }
.art div.a:nth-of-type(4) { --d: 0.39s; }
.art div.a:nth-of-type(5) { --d: 0.52s; }

/* scene 1 — itinerary → timeline. The rail lives in .tl-days so it can
   only ever span the day rows — never the note below them. */
.tl-days { position: relative; }
.tl-rail {
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 16px;
  width: 2px;
  border-radius: 1px;
  background: var(--accent-dim);
  opacity: 0;
  transform-origin: center top;
  animation: kf-rail 42s var(--ease) calc(var(--sd) - var(--lo, 0s)) infinite both;
}
.tl-row {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
  padding-left: 1.3rem;
  margin-bottom: 0.95rem;
}
.tl-time {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--dim);
}
.tl-dot {
  position: absolute;
  left: 0;
  top: 0.12rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}
.tl-day {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  color: var(--accent);
  white-space: nowrap;
}
.tl-what { font-size: 0.84rem; color: var(--fg); }
.tl .note { padding-left: 1.3rem; }

/* scene 2 — recipe → a full recipe card */
.rcp-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.rcp-title { font-size: 0.92rem; font-weight: 600; color: var(--fg); }
.rcp-meta { font-family: var(--mono); font-size: 0.68rem; color: var(--dim); }
.rcp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.6rem 0 0.65rem;
}
.ing {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  color: var(--fg);
}
.ing b {
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--accent);
}
.rcp-steps {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-top: 1px solid var(--border-soft);
  padding-top: 0.55rem;
  font-size: 0.76rem;
  color: var(--fg-soft);
}
.rcp-steps b {
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--accent);
  margin-right: 0.4rem;
}
.art div.a.rcp-steps { --d: 0.52s; }

/* scene 3 — comparison → table */
.tbl {
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
}
.tbl-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  align-items: baseline;
  padding: 0.5rem 0.7rem;
  border-top: 1px solid var(--border-soft);
}
.tbl-row span:first-child { font-size: 0.8rem; color: var(--dim); }
.tbl-row span + span {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--fg-soft);
}
.tbl-head {
  border-top: 0;
  background: var(--surface-2);
}
.tbl-head span + span {
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--dim);
}
.win { color: var(--fg) !important; }
.win::after {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  margin-left: 0.45rem;
}
.note {
  margin-top: 0.5rem;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  color: var(--dim);
}

/* scene 4 — budget → bars */
.bud-row {
  display: grid;
  grid-template-columns: 4.6rem 1fr 3.4rem;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0.85rem;
}
.bud-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--border-soft);
  padding-top: 0.55rem;
  margin-top: 0.15rem;
}
.bud-total span:first-child { font-size: 0.8rem; color: var(--fg-soft); }
.bud-val.acc { color: var(--accent); }
.bud-name { font-size: 0.8rem; color: var(--fg-soft); }
.bud-track {
  position: relative;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
}
.bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  animation: kf-bar 42s var(--ease) calc(var(--sd) + var(--d, 0s) + 0.1s - var(--lo, 0s)) infinite both;
}
.w100 { width: 100%; }
.w37 { width: 37%; }
.w29 { width: 29%; }
.w13 { width: 13%; }

/* scene 5 — workout → sets and reps */
.wo-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 0.5rem;
  margin-bottom: 0.55rem;
  font-size: 0.84rem;
  color: var(--fg);
}
.wo-sets {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--accent);
}

/* scene 6 — study guide → checklist */
.st-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
  font-size: 0.84rem;
  color: var(--fg);
}
.st-box {
  flex: none;
  width: 13px;
  height: 13px;
  border-radius: 3px;
  border: 1px solid var(--dim);
}
.st-row.done .st-box {
  background: var(--accent);
  border-color: var(--accent);
}
.st-row.done span:last-child {
  color: var(--fg-soft);
  text-decoration: line-through;
  text-decoration-color: var(--faint);
}

/* the shared choreography — % of the 42s loop (1s = 2.381%) */
@keyframes kf-scene {
  0% { opacity: 0; }
  1.07% { opacity: 1; }
  15.36% { opacity: 1; }
  16.67% { opacity: 0; }
  100% { opacity: 0; }
}
@keyframes kf-q {
  0%, 0.64% { opacity: 0; transform: translateY(8px); }
  1.79% { opacity: 1; transform: none; }
  92% { opacity: 1; }
  93%, 100% { opacity: 0; }
}
@keyframes kf-typing {
  0%, 1.31% { opacity: 0; }
  1.55% { opacity: 1; }
  1.9% { opacity: 0.35; }
  2.26% { opacity: 1; }
  2.62% { opacity: 0.35; }
  2.98% { opacity: 1; }
  3.33%, 100% { opacity: 0; }
}
@keyframes kf-wall {
  0%, 3.21% { opacity: 0; transform: none; }
  4.29% { opacity: 1; }
  6.9% { opacity: 1; transform: none; }
  7.86% { opacity: 0; transform: scaleX(0.55); }
  100% { opacity: 0; transform: scaleX(0.55); }
}
@keyframes kf-pop {
  0%, 8.1% { opacity: 0; transform: translateY(7px) scale(0.97); }
  9.29% { opacity: 1; transform: none; }
  92% { opacity: 1; transform: none; }
  93%, 100% { opacity: 0; transform: none; }
}
@keyframes kf-rail {
  0%, 8.1% { opacity: 1; transform: scaleY(0); }
  9.88% { opacity: 1; transform: scaleY(1); }
  92% { opacity: 1; transform: scaleY(1); }
  93%, 100% { opacity: 0; transform: scaleY(1); }
}
@keyframes kf-bar {
  0%, 8.57% { transform: scaleX(0); }
  10.48% { transform: scaleX(1); }
  92% { transform: scaleX(1); }
  93%, 100% { transform: scaleX(0); }
}

/* Frozen state: scene 1's finished artifact, no motion at all. */
@media (prefers-reduced-motion: reduce) {
  .demo * { animation: none !important; }
  .scene { opacity: 0; }
  .s1 { opacity: 1; }
  .s1 .wall { display: none; }
  .s1 .q, .s1 .a, .s1 .tl-rail { opacity: 1; transform: none; }
}
