/* ==========================================================
   JARVIS — design tokens
   ========================================================== */
:root {
  --void: #030609;
  --panel: #081019;
  --panel-soft: rgba(10, 20, 30, 0.55);
  --line: #12283a;
  --line-soft: rgba(76, 229, 255, 0.14);
  --cyan: #4ce5ff;
  --cyan-dim: #1f7a94;
  --signal: #35f2a0;
  --text: #d7ecf2;
  --text-dim: #7c97a3;
  --text-faint: #4c6570;

  --font-display: "Space Grotesk", sans-serif;
  --font-mono: "JetBrains Mono", monospace;

  --radius: 10px;
  --container: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font-family: var(--font-display);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; }

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

::selection { background: var(--cyan-dim); color: var(--void); }

/* faint background grid across the whole page */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.25;
  pointer-events: none;
  z-index: 0;
}

.scanline {
  position: fixed;
  left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(76,229,255,0.5), transparent);
  animation: scan 9s linear infinite;
  pointer-events: none;
  z-index: 3;
  opacity: 0.5;
}
@keyframes scan {
  0% { top: -2px; }
  100% { top: 100%; }
}

.tag {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--cyan);
  margin: 0 0 14px;
}

/* ==========================================================
   Buttons
   ========================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: 6px;
  font-size: 14.5px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--cyan);
  color: #04141a;
}
.btn-primary:hover { background: #6cecff; }
.btn-outline {
  border-color: var(--line);
  color: var(--text);
  background: transparent;
}
.btn-outline:hover { border-color: var(--cyan-dim); color: var(--cyan); }
.btn-ghost {
  border-color: var(--line);
  color: var(--text-dim);
  font-size: 13px;
  padding: 9px 16px;
}
.btn-ghost:hover { color: var(--cyan); border-color: var(--cyan-dim); }
.btn-lg { padding: 16px 30px; font-size: 15px; }

/* ==========================================================
   Nav
   ========================================================== */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(3, 6, 9, 0.7);
  backdrop-filter: blur(14px);
}
.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 16px 28px;
  display: flex;
  align-items: center;
  gap: 32px;
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.03em;
  margin-right: auto;
}
.nav-logo-mark {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
}
.nav-links { display: flex; gap: 26px; }
.nav-links a {
  font-size: 14px;
  color: var(--text-dim);
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--cyan); }
.nav-toggle { display: none; }

@media (max-width: 820px) {
  .nav-links, .nav-cta { display: none; }
  .nav-toggle {
    display: flex; flex-direction: column; gap: 4px;
    background: none; border: none; padding: 6px; cursor: pointer;
  }
  .nav-toggle span { width: 20px; height: 2px; background: var(--text); }
  .nav.open .nav-links {
    display: flex; flex-direction: column;
    position: absolute; top: 100%; left: 0; right: 0;
    background: var(--void); border-bottom: 1px solid var(--line);
    padding: 18px 28px; gap: 16px;
  }
  .nav.open .nav-cta { display: inline-flex; margin: 0 28px 18px; }
}

/* ==========================================================
   Hero
   ========================================================== */
.hero {
  position: relative;
  min-height: 100vh;
  padding: 150px 28px 90px;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.field-canvas {
  position: absolute;
  inset: 0;
  z-index: 0;
  opacity: 0.6;
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: var(--container);
  margin: 0 auto;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 40px;
  align-items: center;
}
.hero-copy h1 {
  font-size: clamp(52px, 8vw, 92px);
  line-height: 0.98;
  margin: 6px 0 10px;
}
.hero-sub {
  font-family: var(--font-mono);
  font-size: 15px;
  color: var(--cyan-dim);
  letter-spacing: 0.02em;
  margin-bottom: 22px;
}
.hero-desc {
  color: var(--text-dim);
  font-size: 16.5px;
  max-width: 480px;
  margin-bottom: 34px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 30px; }
.hero-flags {
  display: flex; gap: 22px; flex-wrap: wrap;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-faint);
}
.hero-flags li::before { content: "✓ "; color: var(--signal); }

.hero-core {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 420px;
}
#coreCanvas {
  width: 100%;
  max-width: 500px;
  height: auto;
  aspect-ratio: 1 / 1;
}
.core-panel {
  position: absolute;
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  width: min(340px, 92%);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 20px;
  backdrop-filter: blur(10px);
}
.core-panel-head {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.core-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--signal);
  box-shadow: 0 0 8px var(--signal);
  animation: pulse 2.2s ease-in-out infinite;
}
.core-dot.small { width: 6px; height: 6px; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}
.core-row {
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--text-dim);
  padding: 5px 0;
}
.core-row b.ok { color: var(--signal); font-weight: 500; }

@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; text-align: left; }
  .hero-core { min-height: 340px; margin-top: 20px; }
}

/* ==========================================================
   Section shell
   ========================================================== */
section { position: relative; z-index: 1; }
.section-head {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
  margin-bottom: 44px;
}
.section-head h2 { font-size: clamp(28px, 4vw, 38px); margin-bottom: 10px; }
.section-head p { color: var(--text-dim); font-size: 15.5px; max-width: 520px; }

.features { padding: 120px 0 100px; border-top: 1px solid var(--line); }
.feature-grid {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.feature-card {
  background: var(--void);
  padding: 30px 26px;
  transition: background 0.2s ease;
}
.feature-card:hover { background: #060c12; }
.feature-icon {
  display: inline-block;
  font-size: 18px;
  color: var(--cyan);
  margin-bottom: 16px;
}
.feature-card h3 { font-size: 16px; margin-bottom: 8px; }
.feature-card p { color: var(--text-dim); font-size: 14px; line-height: 1.55; }

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

/* ==========================================================
   Demo
   ========================================================== */
.demo { padding: 100px 0; border-top: 1px solid var(--line); }
.demo-shell {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 220px;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.demo-side, .demo-main, .demo-commands { background: var(--panel); }
.demo-side { padding: 18px 10px; display: flex; flex-direction: column; gap: 4px; }
.demo-tab {
  background: none; border: none; text-align: left;
  padding: 10px 12px; border-radius: 6px;
  color: var(--text-dim); font-size: 13.5px; cursor: pointer;
}
.demo-tab:hover { color: var(--text); }
.demo-tab.active { background: rgba(76,229,255,0.09); color: var(--cyan); }

.demo-main { display: flex; flex-direction: column; min-height: 420px; }
.demo-topbar {
  font-family: var(--font-mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px;
}
.demo-chat {
  flex: 1;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  max-height: 340px;
}
.msg {
  max-width: 80%;
  padding: 11px 14px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.5;
}
.msg-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.msg-jarvis { background: rgba(76,229,255,0.06); border: 1px solid var(--line-soft); align-self: flex-start; }
.msg-user { background: rgba(255,255,255,0.04); align-self: flex-end; text-align: right; }
.msg-user .msg-tag { text-align: right; }

.demo-input {
  display: flex; gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}
.demo-input input {
  flex: 1;
  background: var(--void);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 14px;
}
.demo-input input:focus { outline: none; border-color: var(--cyan-dim); }
.demo-input button {
  width: 40px; border: none; border-radius: 6px;
  background: var(--cyan); color: var(--void); cursor: pointer; font-size: 15px;
}

.demo-commands { padding: 18px; }
.demo-commands-label {
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 12px;
}
.cmd-btn {
  display: block; width: 100%;
  text-align: left;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.cmd-btn:hover { border-color: var(--cyan-dim); color: var(--cyan); }

@media (max-width: 900px) {
  .demo-shell { grid-template-columns: 1fr; }
  .demo-side { flex-direction: row; overflow-x: auto; }
}

/* ==========================================================
   Dashboard
   ========================================================== */
.dashboard { padding: 100px 0 110px; border-top: 1px solid var(--line); }
.dash-grid {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 28px;
  display: grid;
  grid-template-columns: repeat(3, auto) 1fr;
  gap: 40px;
  align-items: center;
}
.dash-ring { position: relative; width: 120px; }
.dash-ring svg { width: 120px; height: 120px; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--line); stroke-width: 6; }
.ring-fill {
  fill: none; stroke: var(--cyan); stroke-width: 6; stroke-linecap: round;
  stroke-dasharray: 327; stroke-dashoffset: 327;
  transition: stroke-dashoffset 1s ease;
}
.dash-value {
  position: absolute; inset: 0;
  display: flex; align-items: baseline; justify-content: center; gap: 2px;
  font-family: var(--font-mono);
}
.dash-value b { font-size: 22px; }
.dash-value span { font-size: 12px; color: var(--text-dim); }
.dash-label {
  text-align: center;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
}
.dash-graph { min-width: 260px; }
.dash-graph canvas { width: 100%; height: 140px; margin-top: 10px; }

@media (max-width: 900px) {
  .dash-grid { grid-template-columns: repeat(3, 1fr); }
  .dash-graph { grid-column: 1 / -1; }
}

/* ==========================================================
   Download
   ========================================================== */
.download { padding: 110px 28px 130px; border-top: 1px solid var(--line); }
.download-card {
  max-width: 640px;
  margin: 0 auto;
  text-align: center;
}
.download-card h2 { font-size: clamp(28px, 4vw, 38px); margin-bottom: 14px; }
.download-desc { color: var(--text-dim); margin-bottom: 26px; }
.download-meta {
  display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 34px;
}
.download-meta span {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-dim);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 5px 13px;
}
.download-note {
  margin-top: 16px;
  font-size: 12.5px;
  color: var(--text-faint);
}

/* ==========================================================
   Footer
   ========================================================== */
.footer {
  border-top: 1px solid var(--line);
  padding: 26px 28px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-faint);
  letter-spacing: 0.04em;
}

/* reveal-on-scroll: one quiet, orchestrated pass */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.in { opacity: 1; transform: none; }
