/* ==========================================================================
   APEX — telemetry demo site
   Tokens
   ========================================================================== */

:root {
  --bg: #101214;
  --bg-alt: #0c0e10;
  --panel: #1a1d21;
  --panel-2: #20242a;
  --line: #2a2f36;

  --text: #eceff2;
  --text-dim: #9aa2af;
  --text-faint: #5c6470;

  --amber: #ffb800;
  --amber-dim: #7a5c0f;
  --red: #ff4757;
  --blue: #4cc9f0;
  --green: #3ddc97;

  --font-display: "Rajdhani", "Arial Narrow", sans-serif;
  --font-body: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, monospace;

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

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

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

img, svg { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.01em;
  margin: 0;
}

p { margin: 0; }

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

/* faint grain overlay for texture */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ==========================================================================
   Reveal-on-scroll
   ========================================================================== */

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.7s cubic-bezier(.2,.7,.2,1), transform 0.7s cubic-bezier(.2,.7,.2,1);
}
.reveal.in {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ==========================================================================
   Nav
   ========================================================================== */

.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 200;
  background: rgba(16, 18, 20, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background 0.3s ease;
}
.nav.scrolled {
  border-bottom-color: var(--line);
  background: rgba(16, 18, 20, 0.92);
}

.nav-inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 10px;
  height: 10px;
  background: var(--amber);
  transform: rotate(45deg);
  flex: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  font-size: 0.92rem;
  color: var(--text-dim);
}

.nav-links a { position: relative; transition: color 0.2s ease; }
.nav-links a:not(.nav-cta)::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 1px;
  background: var(--amber);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.nav-links a:not(.nav-cta):hover { color: var(--text); }
.nav-links a:not(.nav-cta):hover::after { transform: scaleX(1); }

.nav-cta {
  color: var(--bg);
  background: var(--amber);
  padding: 9px 18px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.nav-cta:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(255,184,0,0.25); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}
.nav-toggle span {
  width: 22px;
  height: 2px;
  background: var(--text);
  transition: transform 0.25s ease, opacity 0.25s ease;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 26px;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.btn-primary {
  background: var(--amber);
  color: #171300;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(255,184,0,0.28); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--text-dim); transform: translateY(-2px); }

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 140px 24px 80px;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255,184,0,0.08), transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-alt) 100%);
}

.hero-track {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.9;
}

.track-ghost {
  fill: none;
  stroke: var(--line);
  stroke-width: 1.5;
}

.track-line {
  fill: none;
  stroke: var(--amber);
  stroke-width: 1.5;
  stroke-linecap: round;
  filter: drop-shadow(0 0 6px rgba(255,184,0,0.35));
}

.track-dot {
  fill: var(--amber);
}
.track-dot-glow {
  fill: var(--amber);
  opacity: 0.18;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 720px;
  text-align: center;
}

.hero-title {
  font-size: clamp(2.6rem, 7.5vw, 5.2rem);
  line-height: 0.98;
}
.hero-title .line {
  display: block;
}
.hero-title .accent { color: var(--amber); }

.hero-sub {
  margin: 26px auto 0;
  max-width: 540px;
  color: var(--text-dim);
  font-size: 1.05rem;
}

.hero-actions {
  margin-top: 38px;
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.hud {
  position: absolute;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  background: rgba(26, 29, 33, 0.6);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  padding: 14px 8px;
}

.hud-row {
  display: flex;
  gap: 30px;
  padding: 0 20px;
}

.hud-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 64px;
}
.hud-label {
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-bottom: 4px;
}
.hud-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}
.hud-unit {
  font-size: 0.65rem;
  color: var(--text-faint);
}

.scroll-cue {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  width: 22px;
  height: 36px;
  border: 1px solid var(--text-faint);
  border-radius: 12px;
}
.scroll-cue span {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 4px;
  height: 4px;
  margin-left: -2px;
  background: var(--amber);
  border-radius: 50%;
  animation: scrollDown 1.8s ease-in-out infinite;
}
@keyframes scrollDown {
  0% { top: 6px; opacity: 1; }
  70% { opacity: 1; }
  100% { top: 20px; opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-cue span { animation: none; }
}

/* ==========================================================================
   Section shared
   ========================================================================== */

section {
  padding: 120px 24px;
  max-width: var(--container);
  margin: 0 auto;
}

.section-head {
  max-width: 640px;
  margin: 0 auto 56px;
  text-align: center;
}
.section-head h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1.08;
  margin-top: 6px;
}
.section-sub {
  margin-top: 18px;
  color: var(--text-dim);
  font-size: 1rem;
}

/* ==========================================================================
   Telemetry / scope
   ========================================================================== */

.scope-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  position: relative;
}

.scope {
  width: 100%;
  height: 280px;
  display: block;
  border-radius: 8px;
}

.scope-legend {
  display: flex;
  gap: 24px;
  margin-top: 20px;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  display: inline-block;
}
.dot-amber { background: var(--amber); }
.dot-red { background: var(--red); }
.dot-blue { background: var(--blue); }

.scope-readout {
  position: absolute;
  top: 28px;
  right: 28px;
  display: flex;
  gap: 24px;
}
.readout-item { display: flex; flex-direction: column; align-items: flex-end; }
.readout-label {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.readout-value { font-size: 1.05rem; font-weight: 600; color: var(--text); }

/* ==========================================================================
   Session flow
   ========================================================================== */

.flow-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.flow-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 32px 28px;
  transition: border-color 0.25s ease, transform 0.25s ease;
}
.flow-card:hover {
  border-color: var(--amber-dim);
  transform: translateY(-4px);
}
.flow-num {
  display: block;
  font-size: 0.85rem;
  color: var(--amber);
  margin-bottom: 16px;
}
.flow-card h3 {
  font-size: 1.4rem;
  margin-bottom: 12px;
}
.flow-card p {
  color: var(--text-dim);
  font-size: 0.95rem;
}

/* ==========================================================================
   Features
   ========================================================================== */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
}

.feature-card {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 22px;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}
.feature-card:hover {
  transform: translateY(-4px);
  border-color: var(--line);
  box-shadow: 0 16px 40px rgba(0,0,0,0.35);
}
.feature-icon {
  width: 32px; height: 32px;
  color: var(--amber);
  margin-bottom: 18px;
}
.feature-card h3 {
  font-size: 1.05rem;
  margin-bottom: 10px;
}
.feature-card p {
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.5;
}

/* ==========================================================================
   Stats
   ========================================================================== */

.stats {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  text-align: center;
}

.stat-num {
  display: block;
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  font-weight: 700;
  color: var(--amber);
}
.stat-label {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
}

/* ==========================================================================
   Quote
   ========================================================================== */

.quote-section {
  text-align: center;
}
.quote p {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.4rem, 3.4vw, 2.1rem);
  line-height: 1.35;
  max-width: 780px;
  margin: 0 auto;
  text-transform: none;
  letter-spacing: 0;
}
.quote footer {
  margin-top: 22px;
  color: var(--text-faint);
  font-size: 0.9rem;
  font-style: normal;
}

/* ==========================================================================
   CTA
   ========================================================================== */

.cta {
  text-align: center;
}
.cta-inner h2 {
  font-size: clamp(2.1rem, 5vw, 3.2rem);
}
.cta-inner p {
  margin-top: 16px;
  color: var(--text-dim);
}
.cta-form {
  margin-top: 32px;
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.cta-form input {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 14px 20px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.95rem;
  min-width: 260px;
  outline: none;
  transition: border-color 0.2s ease;
}
.cta-form input:focus {
  border-color: var(--amber);
}
.cta-form input::placeholder { color: var(--text-faint); }

.cta-note {
  margin-top: 16px;
  font-size: 0.85rem;
  color: var(--green);
  min-height: 1.2em;
}

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 40px 24px;
}
.footer-inner {
  max-width: var(--container);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.footer-brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.08em;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.05rem;
}
.footer-links {
  display: flex;
  gap: 24px;
  font-size: 0.85rem;
  color: var(--text-dim);
}
.footer-links a:hover { color: var(--text); }
.footer-copy {
  font-size: 0.78rem;
  color: var(--text-faint);
  width: 100%;
  text-align: center;
  margin-top: 8px;
}

/* ==========================================================================
   Focus visibility
   ========================================================================== */

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

/* ==========================================================================
   Keyboard focus for skip nav accessibility not needed (single page) — kept minimal
   ========================================================================== */

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
  .flow-grid { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 36px 24px; }
}

@media (max-width: 720px) {
  .nav-links {
    position: fixed;
    top: 60px;
    left: 0; right: 0;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    background: rgba(16,18,20,0.98);
    border-bottom: 1px solid var(--line);
    padding: 8px 24px 20px;
    transform: translateY(-120%);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
  }
  .nav-links.open {
    transform: translateY(0);
    opacity: 1;
  }
  .nav-links a {
    padding: 12px 0;
    width: 100%;
    border-bottom: 1px solid var(--line);
  }
  .nav-links a.nav-cta {
    margin-top: 12px;
    text-align: center;
    border-bottom: none;
  }
  .nav-toggle { display: flex; }

  .hero { padding: 120px 20px 70px; }
  .hud { bottom: 76px; padding: 10px 4px; }
  .hud-row { gap: 16px; padding: 0 10px; }
  .hud-value { font-size: 1.1rem; }

  section { padding: 80px 20px; }

  .scope-readout {
    position: static;
    margin-top: 18px;
    justify-content: space-between;
  }
  .readout-item { align-items: flex-start; }

  .feature-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; gap: 32px; }

  .cta-form { flex-direction: column; align-items: stretch; }
  .cta-form input { min-width: 0; }
}
