/* ==========================================================================
   NexusAI — design tokens
   Concept: an old analog monitoring station — amber phosphor displays,
   on-screen camera chrome (REC dot, timestamps, corner reticles),
   monospace overlay text. Not the generic acid-green "hacker" look —
   amber reads as instrumentation, not cliché terminal.
   ========================================================================== */

:root {
  /* color */
  --bg: #0d0c0a;
  --bg-raised: #17150f;
  --panel: #1c1911;
  --border: #322c1e;
  --border-soft: #241f15;

  --text: #f1ede0;
  --text-muted: #948c72;
  --text-faint: #5c5642;

  --amber: #ffb020;
  --amber-dim: #7a5a1e;
  --amber-wash: rgba(255, 176, 32, 0.08);

  --rec: #ff3b30;

  /* type */
  --font-display: "Space Grotesk", sans-serif;
  --font-body: "Inter", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  /* layout */
  --maxw: 1120px;
  --radius: 3px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

p {
  margin: 0;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 32px;
}

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

/* --------------------------------------------------------------------------
   Monospace "OSD" chrome — badges, REC indicator, timestamps
   -------------------------------------------------------------------------- */

.osd {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.rec-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--rec);
  margin-right: 8px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

@media (prefers-reduced-motion: reduce) {
  .rec-dot { animation: none; }
}

/* --------------------------------------------------------------------------
   Nav
   -------------------------------------------------------------------------- */

.nav {
  border-bottom: 1px solid var(--border-soft);
  background: var(--bg);
}

.nav .wrap {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.logo span {
  color: var(--amber);
}

.nav-status {
  display: flex;
  align-items: center;
}

.back-link {
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius);
  transition: border-color 0.15s ease, color 0.15s ease;
}

.back-link:hover {
  border-color: var(--amber-dim);
  color: var(--amber);
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  border-radius: var(--radius);
  padding: 15px 26px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--amber);
  color: #1a1305;
  font-weight: 600;
}

.btn-primary:hover {
  background: #ffc04d;
}

.btn-primary:disabled {
  background: var(--amber-dim);
  color: #cbb98a;
  cursor: default;
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  border-color: var(--amber-dim);
  color: var(--amber);
}

/* --------------------------------------------------------------------------
   Hero — viewfinder frame with corner reticles
   -------------------------------------------------------------------------- */

.hero {
  padding: 64px 0 96px;
}

.hero-frame {
  position: relative;
  border: 1px solid var(--border);
  background:
    linear-gradient(180deg, var(--amber-wash), transparent 40%),
    var(--bg-raised);
  padding: 72px 56px;
  overflow: hidden;
}

.hero-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.015) 0px,
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-frame::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    height: 120px;
    background: linear-gradient(180deg, transparent, rgba(255, 176, 32, 0.06), transparent);
    animation: scan 7s linear infinite;
    pointer-events: none;
  }
}

@keyframes scan {
  0% { top: -120px; }
  100% { top: 100%; }
}

.corner {
  position: absolute;
  width: 22px;
  height: 22px;
  border: 2px solid var(--amber-dim);
}

.corner.tl { top: 14px; left: 14px; border-right: none; border-bottom: none; }
.corner.tr { top: 14px; right: 14px; border-left: none; border-bottom: none; }
.corner.bl { bottom: 14px; left: 14px; border-right: none; border-top: none; }
.corner.br { bottom: 14px; right: 14px; border-left: none; border-top: none; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  margin-bottom: 24px;
}

.hero h1 {
  font-size: clamp(34px, 5vw, 54px);
  max-width: 15ch;
  margin-bottom: 20px;
}

.hero-sub {
  color: var(--text-muted);
  font-size: 17px;
  max-width: 52ch;
  margin-bottom: 36px;
}

/* --------------------------------------------------------------------------
   Detection grid
   -------------------------------------------------------------------------- */

.section {
  padding: 88px 0;
  border-top: 1px solid var(--border-soft);
}

.section-head {
  margin-bottom: 48px;
  max-width: 60ch;
}

.section-eyebrow {
  color: var(--amber);
  margin-bottom: 14px;
  display: block;
}

.section-head h2 {
  font-size: clamp(24px, 3vw, 32px);
  margin-bottom: 12px;
}

.section-head p {
  color: var(--text-muted);
}

.detect-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
}

.detect-card {
  position: relative;
  background: var(--bg);
  padding: 28px 24px;
}

.detect-card .osd {
  color: var(--amber-dim);
  display: block;
  margin-bottom: 14px;
}

.detect-card h3 {
  font-size: 16px;
  margin-bottom: 10px;
}

.detect-card p {
  color: var(--text-muted);
  font-size: 14px;
}

/* --------------------------------------------------------------------------
   Timeline ("how it works" — order carries real meaning here)
   -------------------------------------------------------------------------- */

.timeline {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 11px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
}

.timeline-step {
  position: relative;
}

.timeline-marker {
  width: 11px;
  height: 11px;
  border: 2px solid var(--amber);
  background: var(--bg);
  border-radius: 50%;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.timeline-step .osd {
  display: block;
  margin-bottom: 8px;
}

.timeline-step h3 {
  font-size: 17px;
  margin-bottom: 8px;
}

.timeline-step p {
  color: var(--text-muted);
  font-size: 14px;
}

@media (max-width: 720px) {
  .timeline {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .timeline::before {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   CTA band
   -------------------------------------------------------------------------- */

.cta-band {
  border-top: 1px solid var(--border-soft);
  padding: 80px 0;
  text-align: center;
}

.cta-band h2 {
  font-size: clamp(22px, 3vw, 30px);
  margin-bottom: 28px;
  max-width: 26ch;
  margin-left: auto;
  margin-right: auto;
}

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

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

footer .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* ==========================================================================
   Form page
   ========================================================================== */

.form-shell {
  min-height: calc(100vh - 73px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 64px 24px;
}

.form-card {
  width: 100%;
  max-width: 480px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  padding: 40px;
}

.form-card h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.form-sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 32px;
}

.field {
  margin-bottom: 22px;
}

.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.field label .req {
  color: var(--amber);
}

.field input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 12px 14px;
  border-radius: var(--radius);
}

.field input::placeholder {
  color: var(--text-faint);
}

.field input:focus {
  outline: none;
  border-color: var(--amber-dim);
}

.field-row {
  display: flex;
  gap: 16px;
}

.field-row .field {
  flex: 1;
}

.form-card .btn {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.form-status {
  margin-top: 18px;
  font-family: var(--font-mono);
  font-size: 13px;
  display: none;
}

.form-status.visible {
  display: block;
}

.form-status.error {
  color: var(--rec);
}

.qr-result {
  margin-top: 28px;
  padding-top: 28px;
  border-top: 1px dashed var(--border);
  text-align: center;
  display: none;
}

.qr-result.visible {
  display: block;
}

.qr-result img {
  width: 180px;
  height: 180px;
  background: #fff;
  padding: 10px;
  border-radius: var(--radius);
}

.qr-result p {
  margin-top: 16px;
  color: var(--text-muted);
  font-size: 13px;
}

.qr-result .token {
  font-family: var(--font-mono);
  color: var(--text);
  font-size: 12px;
  word-break: break-all;
  margin-top: 8px;
}