/* Halfvoice landing page. Dark only, no external assets. */

:root {
  --bg:            #050705;
  --panel:         #0a0f0a;
  --panel-2:       #0e150e;
  --text:          #c9f2c7;
  --muted:         #7f9f7d;
  --accent:        #3fb950;
  --border:        #162016;
  --border-strong: #223022;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --maxw: 58rem;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0 var(--gutter);
  /* Faint green wash bleeding down from the top, phosphor-style. */
  background:
    radial-gradient(70rem 32rem at 50% -12rem, rgba(63, 185, 80, 0.055), transparent 70%)
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  overflow-wrap: break-word;
}

main, .footer {
  max-width: var(--maxw);
  margin-inline: auto;
}

h1, h2, h3 {
  font-family: var(--mono);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0;
}

p { margin: 0; }

::selection {
  background: var(--accent);
  color: var(--bg);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}
a:hover { color: var(--text); }

code, kbd, pre { font-family: var(--mono); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 1px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip:focus {
  left: var(--gutter);
  top: 0.5rem;
  z-index: 10;
  padding: 0.5rem 0.85rem;
  background: var(--panel-2);
  border: 1px solid var(--accent);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.875rem;
  text-decoration: none;
}

/* ── Hero ─────────────────────────────────────────────────── */

.hero {
  padding: clamp(3.5rem, 12vw, 7rem) 0 clamp(2.5rem, 7vw, 4rem);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1.25rem;
}

h1 {
  font-size: clamp(2.5rem, 9vw, 3.75rem);
  letter-spacing: -0.03em;
}

.tagline {
  font-family: var(--mono);
  font-size: clamp(1.125rem, 3.6vw, 1.5rem);
  color: var(--accent);
  margin-top: 0.75rem;
  line-height: 1.35;
}

.lede {
  max-width: 44rem;
  margin-top: 1.125rem;
  color: var(--muted);
  font-size: 1.0625rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.5rem;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--mono);
  font-size: 0.9375rem;
  text-decoration: none;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.btn:hover {
  background: var(--panel);
  border-color: var(--accent);
  color: var(--text);
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
  box-shadow: 0 0 18px rgba(63, 185, 80, 0.35);
}

/* ── Hero demo (the one animated touch) ───────────────────── */

.demo {
  margin-top: 2.75rem;
  max-width: 32rem;
  background: var(--panel);
  border: 1px solid var(--border);
}

.demo-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.9rem;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.demo-dot {
  width: 0.5rem;
  height: 0.5rem;
  flex: none;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(63, 185, 80, 0.8);
  animation: hv-pulse 2s ease-in-out infinite;
}

.demo-line {
  display: flex;
  align-items: baseline;
  padding: 0.9rem;
  font-family: var(--mono);
  font-size: clamp(0.8125rem, 3.2vw, 0.9375rem);
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
}

/* No flex gap on .demo-line: the caret must sit flush against the last word. */
.demo-prompt { color: var(--accent); flex: none; margin-right: 0.6ch; }

.demo-type {
  display: inline-block;
  flex: none;
  overflow: hidden;
  white-space: pre;
  vertical-align: bottom;
  width: 0;
  animation: hv-type 9s steps(1, end) infinite;
}

.demo-caret {
  display: inline-block;
  flex: none;
  width: 0.55ch;
  height: 1.05em;
  background: var(--accent);
  transform: translateY(0.15em);
  animation: hv-caret 1.06s steps(1, end) infinite;
}

/* "words appear as you speak" → word boundaries at 5, 12, 15, 19, 25 ch */
@keyframes hv-type {
  0%   { width: 0;    }
  8%   { width: 5ch;  }
  20%  { width: 12ch; }
  32%  { width: 15ch; }
  44%  { width: 19ch; }
  56%  { width: 25ch; }
  92%  { width: 25ch; }
  100% { width: 0;    }
}

@keyframes hv-caret {
  0%, 49%   { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@keyframes hv-pulse {
  0%, 100% { opacity: 1;   }
  50%      { opacity: 0.3; }
}

/* ── 3-step strip ─────────────────────────────────────────── */

.steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem 0.9rem;
  list-style: none;
  margin: 1.5rem 0 0;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.steps li { display: flex; align-items: center; gap: 0.9rem; }
.steps li + li::before {
  content: "→";
  color: var(--border-strong);
}

/* ── Sections ─────────────────────────────────────────────── */

.section {
  padding: clamp(2.5rem, 7vw, 4rem) 0;
  border-top: 1px solid var(--border);
}

.section > h2 {
  font-size: 1.375rem;
  margin-bottom: 1.5rem;
}
.section > h2::before {
  content: "# ";
  color: var(--border-strong);
}

.section > p + p { margin-top: 0.85rem; }

.note {
  color: var(--muted);
  font-size: 0.9375rem;
}

.section p code,
.note code,
.features code {
  padding: 0.1em 0.4em;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 0.875em;
  white-space: nowrap;
}

kbd {
  padding: 0.15em 0.45em;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  font-size: 0.8125em;
  white-space: nowrap;
}

/* ── Code blocks + copy button ────────────────────────────── */

.code {
  position: relative;
  margin: 1.25rem 0;
  background: var(--panel);
  border: 1px solid var(--border);
}

.code pre {
  margin: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.75;
  tab-size: 2;
}

/* Keep the first line clear of the injected copy button. */
.code[data-has-copy] pre { padding-right: 5rem; }

/* Too narrow to sit beside the code, so give the button its own row instead. */
@media (max-width: 30rem) {
  .code[data-has-copy] pre { padding-right: 1.1rem; padding-top: 2.75rem; }
}

.code code { color: var(--text); }
.code .c { color: var(--muted); }

.copy {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.3rem 0.7rem;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  line-height: 1.4;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.copy:hover {
  color: var(--text);
  border-color: var(--accent);
}
.copy[data-done="true"] {
  color: var(--accent);
  border-color: var(--accent);
}

/* ── OS tabs (progressive enhancement) ────────────────────── */

.os-panel + .os-panel { margin-top: 2.5rem; }

.os-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 1.5rem;
}

.os-tab {
  padding: 0.5rem 1.1rem;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease, background-color 0.12s ease;
}
.os-tab:hover { color: var(--text); }
.os-tab[aria-selected="true"] {
  background: var(--panel-2);
  border-color: var(--accent);
  color: var(--accent);
}

/* With tabs active the panel heading is redundant on screen but kept for AT. */
.js-tabs .os-panel > h3 {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.js-tabs .os-panel + .os-panel { margin-top: 0; }
.js-tabs .os-panel:focus { outline: none; }

[hidden] { display: none !important; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Features ─────────────────────────────────────────────── */

.features {
  display: grid;
  /* 21rem caps this at two columns inside a 58rem page, so eight items
     fill four rows exactly, no empty trailing cell. */
  grid-template-columns: repeat(auto-fit, minmax(21rem, 1fr));
  gap: 1px;
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--border);
  border: 1px solid var(--border);
}

.features li {
  padding: 0.95rem 1.1rem;
  background: var(--panel);
  font-size: 0.9375rem;
}
.features li::before {
  content: "› ";
  color: var(--accent);
}

/* ── Footer ───────────────────────────────────────────────── */

.footer {
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.8125rem;
  color: var(--muted);
}

.footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
}
.footer li { display: flex; align-items: center; gap: 0.9rem; }
.footer li + li::before {
  content: "·";
  color: var(--border-strong);
}

/* ── Motion preferences ───────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .demo-type { width: auto; animation: none; }
  .demo-caret { animation: none; }
  .demo-dot { animation: none; }
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
