/* moonqr landing page — dark/technical aesthetic (committed, not a light/dark toggle).
   Self-contained: no external fonts, no CDN. System sans stack + a monospace stack for
   code/technical accents (mirrors the "bun/vite/drizzle" OSS look requested for this page). */

:root {
  color-scheme: dark;
  --bg: #08090b;
  --bg-raised: #0e1013;
  --panel: #131519;
  --panel-2: #1a1d22;
  --border: #24272e;
  --border-strong: #34383f;
  --text: #eef0f4;
  --muted: #9aa0ad;
  --muted-2: #6b7280;
  --accent: #f2c744;
  --accent-ink: #14120a;
  --ok: #3ddc84;
  --err: #ff6b6b;
  --font-sans:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif;
  --font-mono:
    ui-monospace,
    "SFMono-Regular",
    "Cascadia Code",
    "Consolas",
    "Liberation Mono",
    Menlo,
    monospace;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
  overflow-x: hidden;
}

/* QR-module-derived background motif: a small, deterministic tile of dark/light squares at
   very low opacity, reminiscent of a QR fragment without competing with content. Static (no
   animation) so it doesn't need a prefers-reduced-motion guard, and cheap (single inline SVG,
   no per-frame cost). */
.hero {
  background-image:
    linear-gradient(180deg, rgba(8, 9, 11, 0.4) 0%, var(--bg) 85%),
    url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2264%22%20height%3D%2264%22%20viewBox%3D%220%200%2064%2064%22%3E%3Crect%20width%3D%2264%22%20height%3D%2264%22%20fill%3D%22none%22%2F%3E%3Cg%20fill%3D%22%23f2c744%22%20fill-opacity%3D%220.05%22%3E%3Crect%20x%3D%220%22%20y%3D%220%22%20width%3D%228%22%20height%3D%228%22%2F%3E%3Crect%20x%3D%2216%22%20y%3D%220%22%20width%3D%228%22%20height%3D%228%22%2F%3E%3Crect%20x%3D%220%22%20y%3D%2216%22%20width%3D%228%22%20height%3D%228%22%2F%3E%3Crect%20x%3D%228%22%20y%3D%228%22%20width%3D%228%22%20height%3D%228%22%2F%3E%3Crect%20x%3D%2240%22%20y%3D%220%22%20width%3D%228%22%20height%3D%228%22%2F%3E%3Crect%20x%3D%2256%22%20y%3D%220%22%20width%3D%228%22%20height%3D%228%22%2F%3E%3Crect%20x%3D%2248%22%20y%3D%228%22%20width%3D%228%22%20height%3D%228%22%2F%3E%3Crect%20x%3D%220%22%20y%3D%2240%22%20width%3D%228%22%20height%3D%228%22%2F%3E%3Crect%20x%3D%228%22%20y%3D%2248%22%20width%3D%228%22%20height%3D%228%22%2F%3E%3Crect%20x%3D%2224%22%20y%3D%2240%22%20width%3D%228%22%20height%3D%228%22%2F%3E%3Crect%20x%3D%2240%22%20y%3D%2248%22%20width%3D%228%22%20height%3D%228%22%2F%3E%3Crect%20x%3D%2256%22%20y%3D%2240%22%20width%3D%228%22%20height%3D%228%22%2F%3E%3Crect%20x%3D%2240%22%20y%3D%2256%22%20width%3D%228%22%20height%3D%228%22%2F%3E%3Crect%20x%3D%2224%22%20y%3D%2224%22%20width%3D%228%22%20height%3D%228%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E");
  background-repeat: repeat;
  background-position: top center;
  border-bottom: 1px solid var(--border);
}

@media (prefers-contrast: more) {
  .hero {
    background-image: linear-gradient(180deg, rgba(8, 9, 11, 0.4) 0%, var(--bg) 85%);
  }
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

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

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

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

/* ---------------------------------------------------------------------------
   Top bar
   --------------------------------------------------------------------------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(8, 9, 11, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand:hover {
  color: var(--accent);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 0.9rem;
}

.topbar-nav a {
  color: var(--muted);
  text-decoration: none;
}

.topbar-nav a:hover {
  color: var(--text);
}

.lang-toggle {
  cursor: pointer;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.lang-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ---------------------------------------------------------------------------
   Hero
   --------------------------------------------------------------------------- */

.hero-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 72px 20px 56px;
  text-align: center;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin: 0 0 16px;
  text-transform: uppercase;
}

.hero h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.75rem);
  line-height: 1.2;
  margin: 0 0 18px;
  letter-spacing: -0.01em;
}

.hero-subtitle {
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 600px;
  margin: 0 auto 32px;
}

.hero-cta {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.btn {
  display: inline-block;
  padding: 11px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
}

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

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

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.hero-badges {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  gap: 20px;
  justify-content: center;
  flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.hero-badges li {
  display: flex;
  align-items: center;
  gap: 7px;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dot-ok {
  background: var(--ok);
}

.dot-accent {
  background: var(--accent);
}

/* ---------------------------------------------------------------------------
   Sections (shared)
   --------------------------------------------------------------------------- */

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

.section {
  padding: 56px 0;
  border-bottom: 1px solid var(--border);
}

.section:last-of-type {
  border-bottom: none;
}

.section h2 {
  font-size: 1.5rem;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.section-intro {
  color: var(--muted);
  max-width: 640px;
  margin: 0 0 28px;
}

.section p {
  color: var(--muted);
  max-width: 720px;
}

.section-evidence {
  display: inline-block;
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  text-decoration: none;
}

.section-evidence:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------------------------------
   Demo panels (the embedded live demo)
   --------------------------------------------------------------------------- */

.demo-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 22px;
  margin-bottom: 20px;
}

.demo-panel h3 {
  margin: 0 0 14px;
  font-size: 1.05rem;
}

.demo-panel label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.demo-panel textarea,
.demo-panel select,
.demo-panel input[type="text"] {
  width: 100%;
  background: var(--bg-raised);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: 0.95rem;
  font-family: var(--font-mono);
}

.demo-panel textarea {
  min-height: 72px;
  resize: vertical;
}

.demo-panel .row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.demo-panel .row > div {
  flex: 1;
  min-width: 160px;
}

button {
  cursor: pointer;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: 8px;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.generate-output {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  margin-top: 18px;
  flex-wrap: wrap;
}

.qr-preview {
  background: #fff;
  border-radius: 8px;
  padding: 8px;
  width: 220px;
  height: 220px;
  flex-shrink: 0;
}

.qr-preview svg {
  width: 100%;
  height: 100%;
  display: block;
}

.actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

#drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: 10px;
  padding: 28px 16px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
  transition:
    background 0.15s,
    border-color 0.15s;
}

#drop-zone:focus-visible,
#drop-zone.dragover {
  background: rgba(242, 199, 68, 0.06);
  border-color: var(--accent);
}

.result-card {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--panel-2);
}

.result-card img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  background: #fff;
  border-radius: 6px;
  flex-shrink: 0;
}

.result-card dl {
  margin: 0;
  font-size: 0.88rem;
}

.result-card dt {
  color: var(--muted);
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.result-card dd {
  margin: 0;
  word-break: break-all;
}

.status-ok {
  color: var(--ok);
  font-weight: 600;
}

.status-err {
  color: var(--err);
  font-weight: 600;
}

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

.note code {
  background: var(--bg-raised);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 0.85em;
}

.camera-stage {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.camera-stage video,
.camera-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.camera-stage video {
  object-fit: cover;
}

.camera-stage canvas {
  pointer-events: none;
}

/* ---------------------------------------------------------------------------
   Stat grid ("By the numbers")
   --------------------------------------------------------------------------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.stat-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s;
}

.stat-card:hover {
  border-color: var(--accent);
}

.stat-label {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 6px;
}

.stat-value {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 8px;
  font-family: var(--font-mono);
}

.stat-desc {
  color: var(--muted);
  font-size: 0.86rem;
  margin: 0 0 12px;
}

.stat-evidence {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text);
}

.stat-card:hover .stat-evidence {
  color: var(--accent);
}

/* ---------------------------------------------------------------------------
   Install / code blocks
   --------------------------------------------------------------------------- */

#install h3 {
  font-size: 1.02rem;
  margin: 28px 0 10px;
}

.code-block {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  overflow-x: auto;
  font-size: 0.85rem;
  line-height: 1.6;
  margin: 0 0 8px;
}

.code-block code {
  color: #d7dae0;
  white-space: pre;
}

/* ---------------------------------------------------------------------------
   Limitations
   --------------------------------------------------------------------------- */

.limitations-list {
  padding-left: 20px;
  color: var(--muted);
  max-width: 760px;
}

.limitations-list li {
  margin-bottom: 12px;
}

/* ---------------------------------------------------------------------------
   Footer
   --------------------------------------------------------------------------- */

footer {
  max-width: 1040px;
  margin: 0 auto;
  padding: 32px 20px 48px;
  color: var(--muted-2);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-bottom: 14px;
}

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

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

.footer-attribution {
  max-width: 720px;
  margin: 0;
}

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

.footer-attribution a:hover {
  color: var(--accent);
}

/* ---------------------------------------------------------------------------
   Responsive
   --------------------------------------------------------------------------- */

@media (max-width: 640px) {
  .topbar-inner {
    padding: 12px 16px;
  }

  .hero-inner {
    padding: 48px 16px 40px;
  }

  main {
    padding: 0 16px 32px;
  }

  .section {
    padding: 40px 0;
  }

  .generate-output {
    flex-direction: column;
    align-items: stretch;
  }

  .qr-preview {
    width: 100%;
    max-width: 260px;
    margin: 0 auto;
  }
}

/* ---------------------------------------------------------------------------
   Reduced motion
   --------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.001ms !important;
  }
}
