/* ==========================================================================
   Hero «Живой граф систем» — Alian Systems
   3D-сцена (Three.js) + текст + карточка решения + лента событий.
   Логика: js/hero-graph.js
   ========================================================================== */

.gx-hero {
  --gx-bg: #030712;
  --gx-accent: #07beff;
  --gx-accent-2: #4f7fff;
  --gx-violet: #a78bfa;
  --gx-text: #e6edf7;
  --gx-muted: #8a97ab;
  --gx-line: rgba(130, 170, 255, 0.14);
  --gx-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  width: 100%;
  overflow: hidden;
  background: var(--gx-bg);
  color: var(--gx-text);
  isolation: isolate;
}

/* ---- ambient light behind the graph (also the no-WebGL fallback) ---- */
.gx-ambient {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(42% 52% at 64% 48%, rgba(7, 190, 255, 0.10), transparent 70%),
    radial-gradient(30% 40% at 80% 20%, rgba(167, 139, 250, 0.07), transparent 70%),
    radial-gradient(35% 45% at 20% 85%, rgba(79, 127, 255, 0.06), transparent 70%);
}
.gx-grid {
  position: absolute;
  inset: -10% -10% 0 -10%;
  z-index: 0;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    linear-gradient(rgba(79, 127, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 127, 255, 0.07) 1px, transparent 1px);
  background-size: 64px 64px;
  transform: perspective(900px) rotateX(62deg) translateY(28%);
  transform-origin: 50% 100%;
  mask-image: radial-gradient(ellipse 70% 60% at 60% 60%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 60% 60%, #000 20%, transparent 75%);
}

/* ---- WebGL stage ---- */
.gx-stage {
  position: absolute;
  inset: 0;
  z-index: 1;
  cursor: grab;
  touch-action: pan-y;
}
.gx-stage.is-dragging { cursor: grabbing; }
.gx-stage canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.gx-stage.is-ready canvas { opacity: 1; }

/* ---- projected labels ---- */
.gx-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.gx-label {
  position: absolute;
  left: 0;
  top: 0;
  white-space: nowrap;
  font-family: var(--gx-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: rgba(170, 190, 220, 0.55);
  transform: translate3d(-9999px, -9999px, 0);
  transition: color 0.3s ease, opacity 0.3s ease;
  will-change: transform, opacity;
}
.gx-label--hub {
  pointer-events: auto;
  cursor: pointer;
  padding: 5px 9px 5px 8px;
  border: 1px solid rgba(7, 190, 255, 0.22);
  border-radius: 999px;
  background: rgba(5, 12, 26, 0.72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: #cfe9ff;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.gx-label--hub b {
  font-weight: 500;
  color: var(--gx-accent);
  font-size: 9px;
}
.gx-label--hub.is-active {
  border-color: rgba(7, 190, 255, 0.85);
  background: rgba(7, 190, 255, 0.16);
  color: #fff;
  box-shadow: 0 0 24px -4px rgba(7, 190, 255, 0.7);
}
.gx-label--core {
  font-family: "Space Grotesk", sans-serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.32em;
  color: #fff;
  text-shadow: 0 0 18px rgba(7, 190, 255, 0.9);
}
.gx-label--product {
  color: rgba(196, 181, 253, 0.85);
  font-size: 10px;
}
.gx-label--sat.is-lit { color: #e6f6ff; }
.gx-label--product.is-lit { color: #ede9fe; }

/* ---- readability veil between graph and copy ---- */
.gx-veil {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(3, 7, 18, 0.92) 0%, rgba(3, 7, 18, 0.72) 30%, rgba(3, 7, 18, 0) 52%),
    linear-gradient(180deg, rgba(3, 7, 18, 0.6) 0%, transparent 18%, transparent 80%, var(--gx-bg) 100%);
}

/* ---- copy ---- */
.gx-copy {
  position: absolute;
  z-index: 3;
  left: clamp(24px, 6vw, 96px);
  top: 50%;
  transform: translateY(-46%);
  width: min(640px, 46vw);
  pointer-events: none; /* let the graph under the text stay interactive */
}
.gx-copy a, .gx-copy button { pointer-events: auto; }
.gx-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 10px;
  border: 1px solid rgba(7, 190, 255, 0.25);
  border-radius: 999px;
  background: rgba(7, 190, 255, 0.06);
  font-family: var(--gx-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9fdcff;
}
.gx-pulse {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px #34d399;
}
.gx-pulse::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1px solid #34d399;
  animation: gx-ping 1.8s ease-out infinite;
}
@keyframes gx-ping {
  from { transform: scale(0.6); opacity: 0.9; }
  to { transform: scale(2.2); opacity: 0; }
}
.gx-title {
  margin-top: 26px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: clamp(1.9rem, 2.9vw, 3.1rem);
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: #fff;
  text-transform: none;
}
.gx-title span { color: var(--gx-accent); }
.gx-sub {
  margin-top: 22px;
  max-width: 500px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--gx-muted);
}
.gx-actions {
  margin-top: 34px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
}
.gx-ghost {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #dbe7f5;
  transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease;
}
.gx-ghost:hover {
  border-color: rgba(7, 190, 255, 0.6);
  background: rgba(7, 190, 255, 0.08);
  color: #fff;
}
.gx-meta {
  margin-top: 40px;
  display: flex;
  gap: 28px;
  font-family: var(--gx-mono);
  font-size: 11px;
  color: var(--gx-muted);
  letter-spacing: 0.06em;
}
.gx-meta strong {
  display: block;
  font-family: "Space Grotesk", sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0;
  margin-bottom: 2px;
}

/* ---- solution card ---- */
.gx-card {
  position: absolute;
  z-index: 3;
  right: clamp(20px, 3.5vw, 56px);
  bottom: clamp(24px, 7vh, 72px);
  width: 330px;
  padding: 22px 22px 20px;
  border: 1px solid rgba(7, 190, 255, 0.22);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(10, 22, 44, 0.86), rgba(4, 9, 22, 0.9));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.gx-card.is-swapping { opacity: 0; transform: translateY(8px); }
.gx-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: var(--gx-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gx-muted);
}
.gx-card-num { color: var(--gx-accent); }
.gx-card-title {
  margin-top: 14px;
  font-family: "Space Grotesk", sans-serif;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.25;
  color: #fff;
}
.gx-card-desc {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.55;
  color: #9aa8bb;
}
.gx-chips {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.gx-chip {
  padding: 4px 8px;
  border: 1px solid var(--gx-line);
  border-radius: 6px;
  font-family: var(--gx-mono);
  font-size: 10px;
  color: #b9c8dc;
}
.gx-card-cta {
  margin-top: 18px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gx-accent);
}
.gx-card-cta:hover { color: #fff; }
.gx-progress {
  margin-top: 16px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
.gx-progress i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gx-accent-2), var(--gx-accent));
}

/* ---- live event log ---- */
.gx-log {
  position: absolute;
  z-index: 3;
  left: clamp(24px, 6vw, 96px);
  bottom: clamp(20px, 5vh, 48px);
  width: min(520px, 44vw);
  font-family: var(--gx-mono);
  font-size: 11px;
  line-height: 1.9;
  color: #6f7f96;
  pointer-events: none;
}
.gx-log-row {
  display: flex;
  gap: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: gx-row-in 0.5s ease both;
}
.gx-log-row time { color: #3f4c60; }
.gx-log-row em { font-style: normal; color: #9fdcff; }
.gx-log-row b { font-weight: 400; color: #34d399; }
.gx-log-row:not(:last-child) { opacity: 0.55; }
@keyframes gx-row-in {
  from { opacity: 0; transform: translateY(6px); }
  to { transform: none; }
}

.gx-hint {
  position: absolute;
  z-index: 3;
  right: clamp(20px, 3.5vw, 56px);
  top: 112px;
  font-family: var(--gx-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #4b5a70;
  pointer-events: none;
}

/* ---- tablet / mobile: graph on top, copy below ---- */
@media (max-width: 1023px) {
  .gx-veil {
    background: linear-gradient(180deg, rgba(3, 7, 18, 0.5) 0%, transparent 14%, transparent 38%, rgba(3, 7, 18, 0.88) 56%, var(--gx-bg) 72%);
  }
  .gx-copy {
    left: 24px;
    right: 24px;
    top: auto;
    bottom: 40px;
    transform: none;
    width: auto;
  }
  .gx-title { margin-top: 18px; font-size: clamp(1.8rem, 7.4vw, 2.6rem); }
  .gx-sub { margin-top: 14px; font-size: 15px; }
  .gx-actions { margin-top: 24px; }
  .gx-meta { margin-top: 24px; gap: 22px; }
  .gx-meta strong { font-size: 18px; }
  .gx-card, .gx-log, .gx-hint { display: none; }
  .gx-label { font-size: 9px; }
  .gx-label--sat, .gx-label--core { display: none; }
  .gx-label--hub { font-size: 10px; padding: 4px 8px; }
}
@media (max-width: 1023px) {
  .gx-meta { display: none; }
  .gx-actions { flex-wrap: nowrap; gap: 10px; }
  .gx-actions > * { flex: 1 1 0; justify-content: center; padding-left: 14px !important; padding-right: 14px !important; white-space: nowrap; }
}
@media (max-width: 1023px) and (max-height: 700px) {
  .gx-sub { display: none; }
}
/* short desktop screens (laptops 720–820px tall) */
@media (min-width: 1024px) and (max-height: 840px) {
  .gx-log { display: none; }
  .gx-chips { display: none; }
  .gx-card { width: 300px; padding: 18px; }
  .gx-title { font-size: clamp(1.8rem, 2.7vw, 2.6rem); }
  .gx-meta { margin-top: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  .gx-pulse::after, .gx-log-row { animation: none; }
  .gx-stage canvas { transition: none; }
}
