:root {
  --bg: #070b12;
  --bg-2: #0a1220;
  --fg: #e8eef7;
  --muted: #8b9bb4;
  --cyan: #3de0ff;
  --amber: #e8a838;
  --surface: #0e1624;
  --line: #1e2a3c;
  --radius: 2px;
  --font-display: "Syne", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --max: 1120px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .edge.on {
    animation: none !important;
  }
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: var(--font-body);
  color: var(--fg);
  background:
    radial-gradient(1200px 600px at 70% -10%, rgba(61, 224, 255, 0.08), transparent 60%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 40%, #060910 100%);
  min-height: 100vh;
  line-height: 1.55;
}

a {
  color: var(--cyan);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: #9af0ff;
}

.nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(10px);
  background: rgba(7, 11, 18, 0.55);
  transition: border-color 0.2s, background 0.2s;
}

.nav.scrolled {
  border-bottom-color: var(--line);
  background: rgba(7, 11, 18, 0.88);
}

.nav-brand {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--fg);
  text-decoration: none;
  margin-right: 8px;
}

.nav-brand span {
  color: var(--cyan);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  flex: 1;
  min-width: 0;
}

.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: var(--radius);
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--fg);
  background: rgba(61, 224, 255, 0.08);
  outline: none;
}

.nav-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lang-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 6px 8px;
  cursor: pointer;
  border-radius: var(--radius);
}

.lang-btn[aria-pressed="true"] {
  color: var(--bg);
  background: var(--cyan);
  border-color: var(--cyan);
}

.hero {
  position: relative;
  min-height: min(88vh, 820px);
  display: grid;
  align-items: end;
  padding: 48px 20px 64px;
  overflow: hidden;
}

#asciiBg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 1;
  pointer-events: none; /* hit-test идёт через .hero */
  z-index: 0;
}

.hero {
  cursor: crosshair;
}

.hero-inner {
  pointer-events: none;
  position: relative;
  z-index: 1;
  max-width: min(640px, var(--max));
  margin: 0;
  width: 100%;
  padding: 28px 28px 32px;
  border-radius: 4px;
  background: rgba(7, 11, 18, 0.28);
  border: 1px solid rgba(61, 224, 255, 0.12);
  box-shadow: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.hero-inner a,
.hero-inner button {
  pointer-events: auto;
  cursor: pointer;
}

.kicker {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  letter-spacing: 0.08em;
  margin: 0 0 14px;
  text-shadow: 0 0 16px rgba(7, 11, 18, 0.9);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.08;
  margin: 0 0 18px;
  max-width: 18ch;
  letter-spacing: -0.02em;
  color: var(--fg);
  text-shadow:
    0 1px 2px rgba(7, 11, 18, 0.95),
    0 0 24px rgba(7, 11, 18, 0.85),
    0 0 48px rgba(7, 11, 18, 0.65);
}

.hero-lead {
  max-width: 52ch;
  color: #d7e0ee;
  font-size: 1.05rem;
  line-height: 1.55;
  margin: 0 0 28px;
  text-shadow:
    0 1px 2px rgba(7, 11, 18, 0.95),
    0 0 18px rgba(7, 11, 18, 0.8);
}

.hero-lead p {
  margin: 0 0 12px;
}

.hero-lead p:last-child {
  margin-bottom: 0;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
}

.btn:hover,
.btn:focus-visible {
  border-color: var(--cyan);
  outline: none;
}

.btn.primary {
  background: var(--cyan);
  color: #041018;
  border-color: var(--cyan);
}

.btn.primary:hover {
  background: #9af0ff;
}

/* «Открыть демо» — заметный CTA в toolbar сцены */
.btn[data-demo-toggle] {
  background: linear-gradient(180deg, #6aefff 0%, var(--cyan) 100%);
  color: #041018;
  border-color: #9af0ff;
  font-weight: 700;
  letter-spacing: 0.03em;
  min-height: 44px;
  padding: 12px 22px;
  box-shadow:
    0 0 0 1px rgba(61, 224, 255, 0.28),
    0 10px 28px rgba(61, 224, 255, 0.22);
  animation: demo-cta-pulse 2.6s ease-in-out infinite;
}

.btn[data-demo-toggle]:hover,
.btn[data-demo-toggle]:focus-visible {
  background: #b8f6ff;
  border-color: #e8eef7;
  color: #041018;
  outline: none;
}

.btn[data-demo-toggle][data-open="1"] {
  animation: none;
  background: var(--surface);
  color: var(--fg);
  border-color: var(--amber);
  box-shadow: none;
  font-weight: 600;
}

@keyframes demo-cta-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 1px rgba(61, 224, 255, 0.28),
      0 10px 28px rgba(61, 224, 255, 0.18);
  }
  50% {
    box-shadow:
      0 0 0 4px rgba(61, 224, 255, 0.22),
      0 12px 32px rgba(61, 224, 255, 0.32);
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn[data-demo-toggle] {
    animation: none;
  }
}

.section {
  max-width: var(--max);
  margin: 0 auto;
  padding: 72px 20px;
}

.section-h {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 8px;
}

.section-sub {
  color: var(--muted);
  margin: 0 0 28px;
  max-width: 60ch;
}

.graph-wrap {
  position: relative;
  border: 1px solid var(--line);
  background: rgba(14, 22, 36, 0.65);
  min-height: 420px;
}

.graph-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px 14px 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.leg-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.leg-item.muted {
  opacity: 0.7;
}

.leg-arrow {
  display: inline-block;
  width: 28px;
  height: 2px;
  background: var(--cyan);
  position: relative;
}

.leg-arrow::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -3px;
  border: 4px solid transparent;
  border-left-color: var(--cyan);
}

.leg-dash {
  display: inline-block;
  width: 28px;
  height: 0;
  border-top: 2px dashed #34d399;
}

.leg-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--cyan);
}

.leg-dot.feeder {
  background: #a78bfa;
}

.leg-dot.camera {
  background: #e8eef7;
  box-shadow: inset 0 0 0 1px rgba(30, 42, 60, 0.8);
}

#constellation {
  width: 100%;
  height: 520px;
  display: block;
}

.band-label {
  fill: rgba(139, 155, 180, 0.55);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#graphTip {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  background: rgba(7, 11, 18, 0.9);
  border: 1px solid var(--line);
  padding: 8px 12px;
  max-width: calc(100% - 24px);
}

.edge {
  fill: none;
  stroke: rgba(61, 224, 255, 0.35);
  stroke-width: 1.5;
  pointer-events: none;
  transition: stroke 0.2s, stroke-width 0.2s, opacity 0.2s;
}

.edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14;
  pointer-events: stroke;
  cursor: help;
}

.edge.dim {
  stroke: rgba(61, 224, 255, 0.1);
  opacity: 0.45;
}

.edge.on {
  stroke: var(--amber);
  stroke-width: 2.25;
  stroke-dasharray: 5 7;
  animation: dash 1.1s linear infinite;
  opacity: 1;
}

@keyframes dash {
  to {
    stroke-dashoffset: -48;
  }
}

.node-ring {
  fill: rgba(61, 224, 255, 0.06);
  stroke: rgba(61, 224, 255, 0.45);
  stroke-width: 1;
}

.node.active .node-ring {
  stroke: var(--amber);
  fill: rgba(232, 168, 56, 0.1);
}

.node-core {
  fill: var(--cyan);
}

.node.lora .node-ring {
  stroke: rgba(232, 168, 56, 0.55);
  fill: rgba(232, 168, 56, 0.06);
}

.node.lora .node-core {
  fill: var(--amber);
}

.node.active .node-core {
  fill: var(--amber);
}

.node-label {
  fill: var(--fg);
  font-family: var(--font-mono);
  font-size: 12px;
}

.sku {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 28px;
  align-items: start;
  padding: 56px 0;
  border-top: 1px solid var(--line);
}

.edge.thick {
  stroke: rgba(61, 224, 255, 0.55);
  stroke-width: 3.25;
}

.edge.mqtt {
  stroke: rgba(52, 211, 153, 0.55);
  stroke-dasharray: 4 6;
  stroke-width: 1.5;
}

.edge.listen {
  stroke: rgba(232, 168, 56, 0.45);
  stroke-dasharray: 1 5;
  stroke-width: 1.25;
}

.node.mqtt-node .node-ring {
  stroke: rgba(52, 211, 153, 0.75);
  fill: rgba(52, 211, 153, 0.1);
  stroke-dasharray: 3 3;
}

.node.mqtt-node .node-core {
  fill: #34d399;
}

.node.feeder-node .node-ring {
  stroke: rgba(167, 139, 250, 0.75);
  fill: rgba(167, 139, 250, 0.1);
}

.node.feeder-node .node-core {
  fill: #a78bfa;
}

.node.camera-node .node-ring {
  stroke: rgba(232, 238, 247, 0.75);
  fill: rgba(232, 238, 247, 0.08);
}

.node.camera-node .node-core {
  fill: #e8eef7;
}

.nav-toggle {
  display: none;
  font-family: var(--font-mono);
  font-size: 12px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--fg);
  padding: 8px 10px;
  cursor: pointer;
  border-radius: var(--radius);
}

@media (max-width: 960px) {
  .hero-inner {
    padding: 22px 18px 26px;
  }
  .nav {
    flex-wrap: wrap;
  }
  .nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }
  .nav-tools {
    order: 2;
  }
  .nav-links {
    display: none;
    width: 100%;
    order: 3;
    flex-direction: column;
    gap: 0;
    padding: 8px 0 4px;
  }
  .nav.open .nav-links {
    display: flex;
  }
  .nav-links a {
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
  }
  .hero {
    min-height: min(78vh, 640px);
    padding: 32px 16px 40px;
    align-items: end;
  }
  .hero h1 {
    max-width: 100%;
    font-size: clamp(1.7rem, 8vw, 2.6rem);
  }
  .hero-lead {
    font-size: 0.98rem;
    max-width: 100%;
  }
  .section {
    padding: 48px 16px;
  }
  .sku {
    grid-template-columns: 1fr;
    gap: 20px;
    padding: 40px 0;
  }
  #constellation {
    height: 560px;
  }
  .graph-wrap {
    min-height: 560px;
  }
  .chip-row label {
    width: 100%;
  }
  .cta-row .btn {
    flex: 1 1 auto;
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .nav-brand {
    font-size: 14px;
  }
  #constellation {
    height: 620px;
  }
  .graph-wrap {
    min-height: 620px;
  }
  .kicker {
    font-size: 11px;
  }
}

.rail {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
  margin: 0 0 10px;
  letter-spacing: 0.06em;
}

.sku h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  margin: 0 0 10px;
}

.sku .for {
  color: var(--muted);
  margin: 0 0 14px;
}

.sku ul {
  margin: 0 0 18px;
  padding-left: 1.1em;
  color: var(--fg);
}

.sku li {
  margin: 0 0 6px;
}

.demo-stage {
  border: 1px solid var(--line);
  background: #070b12;
  width: 100%;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  align-self: start;
  overflow: hidden;
}

/* Демо на весь экран: Hub/FOG — полноценные пульты, в узкой колонке ломаются */
.demo-stage.demo-live {
  position: fixed;
  top: 10px;
  right: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 80;
  max-width: none;
  width: auto;
  /* flex+inset без явной высоты схлопывается до toolbar */
  height: calc(100vh - 20px);
  height: calc(100dvh - 20px);
  overflow: hidden;
  border-color: rgba(94, 234, 212, 0.4);
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.72);
  background: #05080f;
}

.demo-stage.demo-live .demo-body {
  aspect-ratio: unset;
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
}

body.demo-lightbox-open {
  overflow: hidden;
}

body.demo-lightbox-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(4, 8, 14, 0.78);
  backdrop-filter: blur(3px);
  pointer-events: none;
}

.demo-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 22, 36, 0.95);
  flex-shrink: 0;
}

.demo-toolbar .demo-hint {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.demo-body {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  flex: 0 0 auto;
  background: #070b12;
  overflow: hidden;
}

.demo-poster {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.poster-img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
}

.demo-stage iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.demo-err {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  font-size: 12px;
  color: var(--amber);
  background: rgba(7, 11, 18, 0.9);
  border: 1px solid var(--line);
  padding: 8px 10px;
  z-index: 2;
}

.lora-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.lora-grid label {
  display: flex;
  gap: 10px;
  align-items: center;
  font-size: 14px;
  cursor: pointer;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.chip-row label {
  border: 1px solid var(--line);
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  background: var(--surface);
}

.chip-row input {
  margin-right: 6px;
}

#loraOut {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--cyan);
  margin: 0 0 12px;
}

.pilot-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--amber);
  border: 1px solid rgba(232, 168, 56, 0.45);
  padding: 2px 8px;
  margin-left: 8px;
  vertical-align: middle;
}

.contact {
  text-align: left;
  border-top: 1px solid var(--line);
}

.foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 24px 20px 48px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
