/* readback landing — the page is the terminal.
   Palette = the CLI's Ghost theme (src/cli/src/theme.ts). */

:root {
  --bg: #0a0a0a;
  --panel: #121212;
  --line: #232323;
  --text: #f0f0f0;
  --dim: #808080;
  --accent: #4da3ff;   /* Xcode blue — wordmark "BACK", caret, fills */
  --accent-hi: #6cb4ff; /* brighter accent for hover/glow */
  --green: #5dd17a;
  --red: #ff5d5d;
  /* motion curves (per emil-design-eng): strong ease-out for entrances/press,
     iOS-style drawer curve for slides. No bounce in functional UI. */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --radius: 8px;       /* soften the boxy sharp corners */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 15px;
  line-height: 1.7;
  /* faint scanline texture, like a tired CRT */
  background-image: repeating-linear-gradient(
    0deg, transparent 0 2px, rgba(255, 255, 255, 0.012) 2px 4px);
}

.term {
  max-width: 760px;
  margin: 0 auto;
  padding: 64px 24px 48px;
}

section, footer { margin-top: 104px; }

/* section headers: a single hairline rule does the separating — no boxes */
h2 {
  font-family: "Martian Mono", "IBM Plex Mono", monospace;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding-bottom: 14px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* invisible-correctness details: clear focus rings, on-brand selection, a
   scrollbar that doesn't fight the dark theme. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 1px; }
::selection { background: rgba(77, 163, 255, 0.28); color: var(--text); }

* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line); border: 3px solid var(--bg); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #333; }

.dim    { color: var(--dim); }
.bright { color: var(--text); font-weight: 500; }
.accent { color: var(--accent); }
.small  { font-size: 13px; }
.center { text-align: center; }

/* ── hero ─────────────────────────────────────────────── */

.hero { text-align: center; position: relative; }

/* soft accent glow behind the wordmark — depth without breaking the flat look */
.hero::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 70px;
  width: min(560px, 96%);
  height: 280px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(77, 163, 255, 0.13), transparent 68%);
  pointer-events: none;
  z-index: -1;
}

.prompt-line {
  text-align: left;
  font-size: 13px;
  margin-bottom: 40px;
}

.caret {
  display: inline-block;
  width: 9px;
  height: 3px;
  margin-left: 7px;
  vertical-align: baseline;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.kicker {
  font-family: "Martian Mono", monospace;
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--dim);
  margin-bottom: 26px;
  animation: rise 0.6s var(--ease-out) both;
}

.wordmark {
  max-width: min(487px, 100%);
  height: auto;
  animation: rise 0.6s var(--ease-out) 0.08s both;
}

.tagline {
  font-family: "Martian Mono", monospace;
  font-weight: 700;
  font-size: 23px;
  line-height: 1.3;
  margin-top: 26px;
  animation: rise 0.6s var(--ease-out) 0.16s both;
}

.pitch {
  color: var(--dim);
  max-width: 540px;
  margin: 16px auto 0;
  animation: rise 0.6s var(--ease-out) 0.24s both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.cta {
  margin-top: 36px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
  animation: rise 0.6s var(--ease-out) 0.26s both;
}

/* dive-in band: a left-aligned closing CTA (variety vs the centered hero);
   the parent .reveal handles its entrance, so no per-element rise here */
.dive .cta { justify-content: flex-start; margin-top: 22px; animation: none; }

.btn {
  display: inline-block;
  padding: 10px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  transition: border-color 0.15s, color 0.15s, transform 0.14s var(--ease-out), background 0.15s;
}

.btn:active { transform: scale(0.97); }

/* primary CTA carries a faint accent fill so it reads above the ghost secondary */
.btn-accent { border-color: var(--accent); color: var(--accent); background: rgba(77, 163, 255, 0.07); }

/* hover movement only where a real pointer exists (touch fires :hover on tap) */
@media (hover: hover) and (pointer: fine) {
  .btn:hover { border-color: var(--dim); text-decoration: none; transform: translateY(-1px); }
  .btn:active { transform: translateY(0) scale(0.97); }
  .btn-accent:hover { background: rgba(77, 163, 255, 0.14); border-color: var(--accent-hi); color: var(--accent-hi); }
}

/* ── sample player (styled like the CLI's) ────────────── */

/* de-boxed: the waveform floats on the page, only the play control is framed */
.player {
  margin-top: 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 6px 0;
}

.play {
  background: none;
  border: 1px solid var(--accent);
  color: var(--accent);
  font: inherit;
  font-size: 13px;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.14s var(--ease-out);
}

.play:active { transform: scale(0.95); }
@media (hover: hover) and (pointer: fine) {
  .play:hover { background: rgba(77, 163, 255, 0.08); }
}

.wave {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 3px;
  height: 38px;
  cursor: pointer;
}

.wave i {
  flex: 1;
  height: var(--h);
  background: var(--line);
  transition: background 0.2s var(--ease-out);
}

.wave i.on { background: var(--accent); }
/* un-played bars lift toward accent on hover — signals the whole bar is seekable */
@media (hover: hover) and (pointer: fine) {
  .wave:hover i { background: #2f3a47; }
  .wave:hover i.on { background: var(--accent-hi); }
}

/* played bars sway while audio runs */
.playing .wave i.on {
  animation: sway 0.9s ease-in-out infinite alternate;
}

@keyframes sway { to { transform: scaleY(0.45); } }

.time {
  color: var(--dim);
  font-size: 13px;
  min-width: 86px;
  text-align: right;
  flex-shrink: 0;
}

/* ── "see it work" stepper-slider (CLI + dashboard, one flow) ── */

/* framed viewer — fixed height so the portrait dashboard + landscape CLI
   shots crossfade without the page jumping; object-fit centers/letterboxes. */
.demo-frame {
  position: relative;
  display: grid;
  height: 460px;
  margin-top: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.demo-slide {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  filter: blur(4px);
  transition: opacity 0.5s var(--ease-out), filter 0.5s var(--ease-out);
  pointer-events: none;
}

.demo-slide.on { opacity: 1; filter: blur(0); }

/* auto-advance progress: a thin accent bar that fills over the 4.5 s timer,
   flush under the frame (rAF-driven, transform-only, freezes on hover). */
.demo-progress {
  height: 2px;
  background: var(--line);
  overflow: hidden;
}

.demo-progress-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

/* step rail = underline tabs (no boxes); active tab carries an accent underline
   on a shared baseline rule */
.demo-steps {
  display: flex;
  gap: 24px;
  margin-top: 20px;
  border-bottom: 1px solid var(--line);
}

.demo-step {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  text-align: left;
  padding: 10px 0;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.2s var(--ease-out);
}

.demo-step .k {
  display: block;
  font-family: "Martian Mono", monospace;
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--dim);
}

.demo-step .t { display: block; font-size: 12.5px; color: var(--dim); margin-top: 3px; }
.demo-step .num { color: var(--accent); opacity: 0.5; }

.demo-step.on { border-bottom-color: var(--accent); }
.demo-step.on .k, .demo-step.on .num { color: var(--accent); opacity: 1; }
.demo-step.on .t { color: var(--text); }
.demo-step:hover .t { color: var(--text); }

.demo-cap { margin-top: 14px; min-height: 1.6em; text-align: left; transition: opacity 0.2s var(--ease-out); }
.demo-cap.fading { opacity: 0; }

@media (max-width: 600px) {
  .demo-frame { height: 300px; }
  .demo-steps { gap: 18px; flex-wrap: wrap; }
  .demo-step .t { display: none; }   /* labels only on small screens */
}

/* ── dashboard + home server grid ────────────────────────── */

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

a.dash-card { color: inherit; text-decoration: none; transition: transform 0.2s var(--ease-out); }
a.dash-card:active { transform: scale(0.98); }

.dash-card img {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease-out);
}

.dash-card p { margin-top: 8px; }

.reveal .dash-card {
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s var(--ease-out), transform 0.4s var(--ease-out);
}
.reveal .dash-card:nth-child(2) { transition-delay: 60ms; }
.reveal.in .dash-card { opacity: 1; transform: none; }

@media (hover: hover) and (pointer: fine) {
  a.dash-card:hover { text-decoration: none; }
  a.dash-card:hover img { border-color: var(--accent); }
}

@media (max-width: 600px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* ── features — a `readback --features` terminal listing ── */

.feat-term {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  font-size: 13.5px;
}

.feat-cmd { font-size: 13px; margin-bottom: 16px; }
.feat-cmd .caret { margin-left: 4px; }

.feat-list { list-style: none; display: flex; flex-direction: column; gap: 13px; }

/* ✓ │ key │ description — keys align in a fixed column, descriptions hang-indent */
.feat-list li {
  display: grid;
  grid-template-columns: auto 82px 1fr;
  gap: 0 12px;
  align-items: baseline;
}

.feat-list .ok { color: var(--green); }

.feat-list .fkey {
  font-family: "Martian Mono", monospace;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  color: var(--accent);
}

.feat-list .fdesc { color: var(--dim); line-height: 1.6; }
.feat-list .fdesc .bright { color: var(--text); }

.feat-foot {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--green);
}

@media (max-width: 600px) {
  .feat-list li { grid-template-columns: auto 1fr; }
  .feat-list .ok { grid-row: 1; }
  .feat-list .fkey { grid-column: 2; }
  .feat-list .fdesc { grid-column: 2; }
}

/* ── footer ───────────────────────────────────────────── */

footer {
  border-top: 1px solid var(--line);
  padding-top: 28px;
  text-align: center;
}

footer .prompt-line {
  text-align: center;
  margin: 26px 0 0;
}

/* inline code (used in the Features listing) */
code {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0 5px;
  font-size: 12.5px;
  font-family: inherit;
}

/* ── motion ───────────────────────────────────────────── */

/* scroll reveal — .reveal sections fade up when they enter the viewport */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal.in { opacity: 1; transform: none; }

/* staggered children: once the Features panel reveals, each line "prints" in
   one after the next, like terminal output. Opacity-only; --i set per row. */
.reveal .feat-list li {
  opacity: 0;
  transition: opacity 0.4s var(--ease-out);
  transition-delay: calc(var(--i, 0) * 70ms);
}
.reveal.in .feat-list li { opacity: 1; }

.feat-list li:nth-child(2) { --i: 1; }
.feat-list li:nth-child(3) { --i: 2; }
.feat-list li:nth-child(4) { --i: 3; }
.feat-list li:nth-child(5) { --i: 4; }
.feat-list li:nth-child(6) { --i: 5; }

/* the footer summary fades in last, after the rows have printed */
.reveal .feat-foot { opacity: 0; transition: opacity 0.4s var(--ease-out) 0.35s; }
.reveal.in .feat-foot { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  /* "fewer and gentler, not zero": keep opacity/color fades that aid
     comprehension (scroll-reveal fade, feature print-in, caret blink,
     caption/slide crossfade) — drop only movement. */
  .reveal { transform: none; }                     /* fade in place, no slide */
  .wordmark, .tagline, .pitch, .cta { animation-name: fade-in; } /* opacity, no translate */
  .playing .wave i.on { animation: none; }         /* no sway */
  .reveal .dash-card { transform: none; }          /* fade only, no slide */
  .demo-slide { filter: none; }                    /* no blur transition */
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ── small screens ────────────────────────────────────── */

@media (max-width: 600px) {
  .term { padding-top: 44px; }
  section, footer { margin-top: 64px; }

  /* player: stack waveform to full width below play + time row */
  .player { flex-wrap: wrap; row-gap: 10px; }
  .wave { width: 100%; order: 2; gap: 1px; }   /* full-width row; tighter bar gaps */
  .time { margin-left: auto; }                  /* push time to the right in row 1 */
}
