/* hushkey.ai — the site's ONLY stylesheet (D-02: plain static HTML/CSS, zero build step).
   MIRROR RULE: the :root blocks below copy src/tokens.css and src/App.css surface
   vars VERBATIM — never fork a brand value. website/tests/tokens.test.ts extracts
   the brand values from src/tokens.css at runtime and fails CI on any drift. */

/* ---------- tokens (mirrored verbatim from src/tokens.css) ---------- */
:root {
  /* spacing — app tokens verbatim + site-only section-rhythm extensions */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px; /* site-only: section padding-y (mobile) */
  --space-9: 96px; /* site-only: section padding-y (>=768px) */

  /* type — weights/leading verbatim; sizes are the marketing scale (08-UI-SPEC) */
  --weight-regular: 400;
  --weight-semibold: 600;
  --leading-body: 1.5;
  --leading-heading: 1.2;

  /* radii */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --radius-full: 999px;

  /* brand — the D-05 "Keywave" palette, byte-matched to src/tokens.css */
  --brand: #5560e0;
  --brand-contrast: #ffffff;
  --brand-soft-bg: rgba(85, 96, 224, 0.14);
  --brand-soft-border: rgba(85, 96, 224, 0.35);
}

/* Look direction B: brand lightened one step in dark mode (soft tints keep base hue). */
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #7d86f0;
  }
}

/* ---------- surfaces (mirrored verbatim from src/App.css:3-35; sidebar/status
   vars skipped — the site has no sidebar and no destructive/status states) ---------- */
:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
  --bg: #e9ecf5;
  --panel: #ffffff;
  --border: #e3e5ee;
  --card-shadow: 0 2px 6px rgba(16, 18, 35, 0.1), 0 14px 32px rgba(16, 18, 35, 0.12);
  --text: #1c1c22;
  --muted: #6b6b76;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f15;
    --panel: #20202b;
    --border: #343442;
    --card-shadow: 0 2px 6px rgba(0, 0, 0, 0.5), 0 14px 32px rgba(0, 0, 0, 0.45);
    --text: #ececf1;
    --muted: #9a9aa6;
  }
}

/* ---------- base ---------- */
* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  font-weight: var(--weight-regular);
  line-height: var(--leading-body);
}

/* Marketing type scale — exactly 4 layout sizes (08-UI-SPEC Typography). */
h1 {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: var(--weight-semibold);
  line-height: 1.15;
  margin: 0 0 var(--space-4);
}

h2 {
  font-size: clamp(26px, 4vw, 32px);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-heading);
  margin: 0 0 var(--space-5);
}

/* h3 = body size, semibold — no fifth layout size (feature cards, FAQ questions). */
h3 {
  font-size: 16px;
  font-weight: var(--weight-semibold);
  line-height: var(--leading-heading);
  margin: 0 0 var(--space-2);
}

p {
  margin: 0 0 var(--space-3);
}

a {
  color: var(--brand);
}

.caption,
.muted {
  font-size: 14px;
  color: var(--muted);
}

/* Focus: same treatment on every interactive element (08-UI-SPEC). */
:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ---------- layout ---------- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 var(--space-5);
}

section {
  padding: var(--space-8) 0;
}

@media (min-width: 768px) {
  section {
    padding: var(--space-9) 0;
  }
}

/* Feature grid: 1 column mobile → 2 at 600px → 3 at 900px. */
.feature-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}

@media (min-width: 600px) {
  .feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .feature-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ---------- nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 56px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

.nav .container {
  height: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-semibold);
  color: var(--text);
  text-decoration: none;
  margin-right: auto;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-links a {
  font-size: 14px;
  font-weight: var(--weight-semibold);
  color: var(--text);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--brand);
}

/* One-page site: below 600px the nav collapses to logo + CTA (scroll still works). */
@media (max-width: 599px) {
  .nav-links {
    display: none;
  }
}

/* ---------- buttons ---------- */
.btn-primary,
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px; /* touch target */
  padding: 12px 28px;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: var(--weight-semibold);
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--brand);
  color: var(--brand-contrast);
}

.btn-primary:hover {
  filter: brightness(0.94);
}

.btn-secondary {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
}

/* Compact variant for the 56px nav bar (full 48px button doesn't fit). */
.nav .btn-primary {
  min-height: 36px;
  padding: 6px 16px;
  font-size: 14px;
}

/* ---------- card ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  padding: var(--space-5);
}

/* ---------- soft chip (app translate-chip recipe, scaled per 08-UI-SPEC) ---------- */
.chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  background: var(--brand-soft-bg);
  border: 1px solid var(--brand-soft-border);
  color: var(--brand);
  font-size: 12px;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
}

/* ---------- FAQ (native details/summary — no JS accordion) ---------- */
.faq details {
  margin-bottom: var(--space-3);
}

.faq summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  font-size: 16px;
  font-weight: var(--weight-semibold);
  cursor: pointer;
  list-style: none;
}

.faq summary::-webkit-details-marker {
  display: none;
}

/* CSS-only chevron: rotates 90° when the item opens. */
.faq summary::after {
  content: "›";
  font-size: 20px;
  color: var(--muted);
  transition: transform 160ms ease;
}

.faq details[open] summary::after {
  transform: rotate(90deg);
}

.faq details p {
  margin-top: var(--space-3);
  color: var(--muted);
}

/* ---------- landing-page layout (08-03; consumes the components above,
   redefines nothing) ---------- */
.hero {
  text-align: center;
}

/* Subline is Body-size muted (UI-SPEC) — .muted/.caption are 14px, so one rule. */
.hero-sub {
  max-width: 640px;
  margin: 0 auto var(--space-5);
  color: var(--muted);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.glyph {
  display: inline-block;
  color: var(--muted); /* brandless glyphs (UI-SPEC feature grid) */
  margin-bottom: var(--space-2);
}

/* Pricing: the $19 figure is the section's display element (UI-SPEC Typography). */
.pricing-card {
  max-width: 420px;
  margin: 0 auto var(--space-6);
  text-align: center;
}

.price-figure {
  font-size: clamp(36px, 6vw, 56px);
  font-weight: var(--weight-semibold);
  line-height: 1.15;
  margin: 0;
}

/* Comparison row: 14px cells, Hushkey column soft-brand highlighted (D-04). */
.compare {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  border-collapse: collapse;
  font-size: 14px;
}

.compare th,
.compare td {
  padding: var(--space-2) var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.compare thead th {
  font-weight: var(--weight-semibold);
}

.compare tbody th {
  font-weight: var(--weight-regular);
  color: var(--muted);
}

.compare .compare-hushkey {
  background: var(--brand-soft-bg);
  border-left: 1px solid var(--brand-soft-border);
  border-right: 1px solid var(--brand-soft-border);
  font-weight: var(--weight-semibold);
}

/* Center the FAQ column and the download section like the hero. */
.faq .container {
  max-width: 760px;
}

#download .container {
  text-align: center;
}

footer {
  border-top: 1px solid var(--border);
  padding: var(--space-6) 0;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.footer-links {
  display: flex;
  gap: var(--space-4);
}

.footer-links a {
  color: var(--muted);
}

/* ---------- hero mockup (08-03, D-01) ----------
   Pill/bars/dot values are copied VERBATIM from src/overlay/overlay.css — the
   mockup is a screenshot of the product, so the pill stays dark in both color
   schemes and never re-themes. Markup ships the loop's final frame; hero.js
   resets it and drives the ~9.5s timeline. */
.hero-demo {
  max-width: 560px;
  margin: var(--space-6) auto 0;
}

.demo-window {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--card-shadow);
  overflow: hidden;
  text-align: left;
}

.demo-titlebar {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}

.demo-titlebar span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
}

.demo-text {
  min-height: 96px;
  padding: var(--space-4);
}

.demo-typed {
  transition: opacity 600ms ease; /* 8.2–9.5s: text fades before the loop restarts */
}

.demo-caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  vertical-align: text-bottom;
  background: var(--text);
  animation: caret-blink 1.06s step-end infinite;
}

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

/* The pill floats over the window's bottom edge (negative margin, 36px pill). */
.demo-stage {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: -18px;
  min-height: 72px;
}

/* --- overlay.css verbatim: pill construction --- */
.pill {
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 88px;
  max-width: 284px;
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(20, 20, 26, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  animation: pill-in 160ms ease-out;
}

@keyframes pill-in {
  from {
    transform: translateY(6px);
    opacity: 0;
  }
}

/* --- overlay.css verbatim: bars + dot --- */
.bars {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 28px;
}

.bar {
  width: 3px;
  min-height: 4px;
  border-radius: 2px;
  background: var(--brand);
  transition: height 45ms linear;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  animation: breathe 1.6s ease-in-out infinite;
}

.pill[data-phase="success"] .dot,
.pill[data-phase="exit"] .dot {
  background: #4ade80;
  animation: pulse-out 0.5s ease-out forwards;
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.7);
    opacity: 0.5;
  }

  50% {
    transform: scale(1.15);
    opacity: 1;
  }
}

@keyframes pulse-out {
  0% {
    transform: scale(0.8);
  }

  60% {
    transform: scale(1.5);
  }

  100% {
    transform: scale(1);
  }
}

/* Phase plumbing driven by hero.js (mirrors the app's recording → processing
   → success states): bars only while recording, dot otherwise. */
.pill[data-phase="hidden"] {
  display: none;
}

.pill[data-phase="recording"] .dot {
  display: none;
}

.pill:not([data-phase="recording"]) .bars {
  display: none;
}

/* Exit is the reverse of entry (5.2s in the timeline). */
.pill[data-phase="exit"] {
  animation: pill-out 160ms ease-out forwards;
}

@keyframes pill-out {
  to {
    transform: translateY(6px);
    opacity: 0;
  }
}

/* Raw-speech caption under the pill (0.4–3.4s), muted 14px, fades in/out. */
.demo-caption {
  margin: var(--space-2) 0 0;
  font-size: 14px;
  color: var(--muted);
  min-height: 21px;
  opacity: 0;
  transition: opacity 300ms ease;
}

.demo-caption.show {
  opacity: 1;
}

/* ---------- reduced motion (08-UI-SPEC: kill smooth-scroll + all hero motion;
   the markup ships the final frame — polished sentence + green-dot pill — so
   stillness IS the static render; hero.js early-returns and adds .hero-static) ---------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .hero-demo,
  .hero-demo * {
    animation: none !important;
    transition: none !important;
  }
}

/* Belt-and-braces for the JS path: hero.js tags the demo when it detects
   reduced motion, freezing the shipped final frame without relying on the
   media query alone. */
.hero-demo.hero-static * {
  animation: none !important;
  transition: none !important;
}

/* ---------- subpage shell (08-04; policy/thanks/404 pages) ----------
   08-UI-SPEC typography rule: policy pages are a 680px Body-size text
   column with a single h1 rendered at the h2 size — no Display use off
   the landing page. */
.policy {
  max-width: 680px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-5);
}
.policy h1 {
  font-size: clamp(26px, 4vw, 32px);
  line-height: 1.2;
}
.policy h2 {
  font-size: 16px;
  margin-top: var(--space-6);
}
.policy li {
  margin-bottom: var(--space-3);
}
