/* Лендинг. Sticky-split layout: слева скроллится контент, справа всегда виден
   крутящийся киберпанк-ключ. Видео-фон под всем. */

/* ВАЖНО: НИКАКОГО overflow-x:hidden / overflow:auto на body или .page —
   это ломает position:sticky у .sticky-col. Если нужна защита от
   горизонтального скролла, использовать overflow-x: clip (не ломает sticky). */
body { background: #f0f0ee; overflow-x: clip; }

.page {
  position: relative;
  min-height: 100vh;
  background: #f0f0ee;
  overflow-x: clip;
}

/* ── Видео-фон ──────────────────────────────────────── */
.bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

/* Soft-подложка поверх видео (или вместо него): холодный градиент */
.page::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(900px 600px at 75% 30%, rgba(165, 200, 255, 0.35), transparent 60%),
    radial-gradient(700px 500px at 20% 80%, rgba(180, 220, 200, 0.30), transparent 60%);
  pointer-events: none;
}

.content {
  position: relative;
  z-index: 10;
}

/* ── Navbar — компактная, sticky к верху страницы ──── */
.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1rem;
  gap: 0.45rem;
  position: sticky;
  top: 0;
  z-index: 50;
  /* Полупрозрачный backdrop, чтобы при скролле под nav не просвечивал контент жёстко */
  background: rgba(240, 240, 238, 0.78);
  -webkit-backdrop-filter: saturate(150%) blur(14px);
          backdrop-filter: saturate(150%) blur(14px);
}
@media (min-width: 640px) { .nav { padding: 0.75rem 1.5rem; gap: 0.5rem; } }

.nav-logo {
  display: flex; align-items: center; justify-content: center;
  border-radius: 9999px;
  width: 2rem; height: 2rem;
  flex-shrink: 0;
  background-color: #EDEDED;
}
@media (min-width: 640px) { .nav-logo { width: 2.25rem; height: 2.25rem; } }

.nav-pill {
  display: flex; align-items: center;
  gap: 0.85rem;
  border-radius: 0.6rem;
  padding: 0.4rem 0.85rem;
  background-color: #EDEDED;
}
@media (min-width: 640px) { .nav-pill { gap: 1.6rem; padding: 0.45rem 1.4rem; } }

.nav-pill a {
  font-size: 12px;
  font-weight: 500;
  color: #374151;
  transition: color 0.2s;
  white-space: nowrap;
}
.nav-pill a:hover { color: #111827; }
@media (min-width: 640px) { .nav-pill a { font-size: 13px; } }

/* Высота nav зашита в CSS-переменной, sticky-col использует её */
:root { --nav-h: 60px; }
@media (min-width: 640px) { :root { --nav-h: 64px; } }

/* ── Split layout ───────────────────────────────────── */
.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  align-items: start;
}
@media (max-width: 980px) {
  .split { grid-template-columns: 1fr; gap: 0; padding: 0 1rem; }
}

/* Левая колонка — скроллится */
.scroll-col {
  padding: 4rem 0 8rem;
  min-width: 0;
}
@media (max-width: 980px) { .scroll-col { padding: 2rem 0 4rem; } }

/* Правая колонка — sticky, держит ключ в viewport.
   top = высота nav, height = что осталось от viewport ниже nav.
   Так ключ никогда не уходит под nav, и центр sticky-области приходится
   ровно на центр свободного пространства (не на центр всего viewport). */
.sticky-col {
  position: sticky;
  top: var(--nav-h);
  height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
@media (max-width: 980px) {
  .sticky-col {
    position: relative;
    height: 55vh;
    margin: 1rem 0;
    top: 0;
  }
}

/* ── Sections в левой колонке ───────────────────────── */
.section { margin-bottom: 6rem; }
.section:last-child { margin-bottom: 0; }
@media (max-width: 980px) { .section { margin-bottom: 4rem; } }

.section-eyebrow {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #3b82f6;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.8rem;
}

.section h2 {
  font-size: 2rem;
  font-weight: 500;
  letter-spacing: -0.025em;
  color: #111827;
  line-height: 1.2;
  margin-bottom: 1rem;
}
@media (max-width: 640px) { .section h2 { font-size: 1.5rem; } }

.section p.lead {
  font-size: 15px;
  color: #6b7280;
  line-height: 1.65;
  max-width: 28rem;
}

/* ── Hero (первая секция) ───────────────────────────── */
.hero-section { padding-top: 6rem; }
@media (max-width: 980px) { .hero-section { padding-top: 2rem; } }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  font-size: 11.5px;
  font-weight: 500;
  color: #3b82f6;
  margin-bottom: 1rem;
  transition: color 0.2s;
}
.hero-badge:hover { color: #2563eb; }
.hero-badge .arrow { display: inline-block; transition: transform 0.2s; }
.hero-badge:hover .arrow { transform: translateX(2px); }

.hero-title {
  font-size: 2.5rem;
  line-height: 1.1;
  font-weight: 500;
  color: #111827;
  letter-spacing: -0.03em;
  margin-bottom: 1.2rem;
  max-width: 24rem;
}
@media (max-width: 640px) { .hero-title { font-size: 1.85rem; } }

.hero-sub {
  font-size: 14px;
  color: #9ca3af;
  margin-bottom: 1.6rem;
  max-width: 24rem;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 13px;
  font-weight: 500;
  color: #3b82f6;
  border: 1px solid #60a5fa;
  border-radius: 9999px;
  padding: 0.7rem 1.4rem;
  transition: all 0.2s;
}
.hero-cta:hover { background-color: #3b82f6; color: #ffffff; border-color: #3b82f6; }
.hero-cta .arrow { display: inline-block; transition: transform 0.2s; }
.hero-cta:hover .arrow { transform: translateX(2px); }

/* ── Feature-list ───────────────────────────────────── */
.feature-list { display: flex; flex-direction: column; gap: 1.5rem; }
.feature-row {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 1rem;
  align-items: flex-start;
}
.feature-row .num {
  width: 28px; height: 28px;
  border-radius: 9999px;
  background: #EDEDED;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  font-variant-numeric: tabular-nums;
  margin-top: 0.1rem;
}
.feature-row h3 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin-bottom: 0.3rem;
  letter-spacing: -0.01em;
}
.feature-row p {
  font-size: 13.5px;
  color: #6b7280;
  line-height: 1.6;
}
.feature-row code {
  background: #ededed;
  border-radius: 4px;
  padding: 0.05em 0.35em;
  font-size: 0.88em;
}

/* ── Code block ─────────────────────────────────────── */
.code-block {
  background: #0d1117;
  border-radius: 12px;
  padding: 1.2rem 1.4rem;
  overflow-x: auto;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  color: #c9d1d9;
  margin: 1.5rem 0;
  box-shadow: 0 8px 30px -10px rgba(0, 0, 0, 0.25);
}
.code-block .tok-kw   { color: #ff7b72; }
.code-block .tok-str  { color: #a5d6ff; }
.code-block .tok-num  { color: #79c0ff; }
.code-block .tok-fn   { color: #d2a8ff; }
.code-block .tok-prop { color: #7ee787; }
.code-block .tok-com  { color: #8b949e; font-style: italic; }

.code-tabs {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.8rem;
}
.code-tab {
  background: transparent;
  border: 1px solid transparent;
  padding: 0.35rem 0.85rem;
  font-size: 12px;
  font-weight: 500;
  color: #6b7280;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.code-tab:hover { color: #111827; background: #EDEDED; }
.code-tab.active { background: #111827; color: #ffffff; }

.code-pane { display: none; }
.code-pane.active { display: block; }

/* ── FAQ ────────────────────────────────────────────── */
.faq-list { display: flex; flex-direction: column; gap: 0.5rem; }
.faq-item {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s;
}
.faq-item:hover { border-color: #d1d5db; }
.faq-q {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 1rem 1.2rem;
  font-size: 14px;
  font-weight: 500;
  color: #111827;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 0;
  transition: none;
}
.faq-q:hover { background: rgba(0,0,0,0.02); color: #111827; }
.faq-q .chev { color: #9ca3af; transition: transform 0.2s; font-size: 14px; }
.faq-item.open .faq-q .chev { transform: rotate(180deg); color: #3b82f6; }
.faq-a {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  padding: 0 1.2rem;
}
.faq-a p { font-size: 13px; color: #6b7280; line-height: 1.7; margin: 0; }
.faq-item.open .faq-a { max-height: 400px; padding: 0 1.2rem 1.2rem; }

/* ── CTA finale ─────────────────────────────────────── */
.cta-finale {
  background: linear-gradient(135deg, #0d1117 0%, #1a1f2e 100%);
  color: #ffffff;
  border-radius: 20px;
  padding: 2.5rem 2rem;
  text-align: center;
  box-shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.3);
}
.cta-finale h2 { color: #ffffff; font-size: 1.6rem; margin-bottom: 0.6rem; }
.cta-finale p { color: rgba(255,255,255,0.7); font-size: 14px; margin-bottom: 1.5rem; }
.cta-finale .hero-cta {
  background: #00f0ff;
  color: #0d1117;
  border-color: #00f0ff;
  font-weight: 600;
}
.cta-finale .hero-cta:hover { background: #ffffff; color: #0d1117; border-color: #ffffff; }

/* ── Reveal-анимации при скролле ────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.reveal.visible { opacity: 1; transform: translateY(0); }

/* ════════════════════════════════════════════════════
   3D-КЛЮЧ — через Three.js (см. key-3d.js).
   Здесь только контейнер + мягкие тени под сценой.
   ════════════════════════════════════════════════════ */

.key-scene {
  position: relative;
  width: 440px;
  height: min(620px, calc(100vh - var(--nav-h) - 24px));
  animation: key-float 6s ease-in-out infinite;
}
@media (max-width: 1200px) {
  .key-scene { width: 360px; height: min(520px, calc(100vh - var(--nav-h) - 24px)); }
}
@media (max-width: 980px)  {
  .key-scene { width: 280px; height: 400px; }
}

@keyframes key-float {
  0%, 100% { transform: translateY(0px); }
  50%      { transform: translateY(-8px); }
}

#key-canvas {
  display: block;
  width: 100%;
  height: 100%;
  /* Three.js рисует на прозрачном фоне; тень — на ::after снизу */
}

/* Мягкое contact-shadow под ключом, чтобы он не «висел в воздухе» */
.key-scene::after {
  content: "";
  position: absolute;
  bottom: -2%;
  left: 50%;
  width: 60%;
  height: 36px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center,
    rgba(20, 20, 25, 0.22) 0%,
    rgba(20, 20, 25, 0.10) 40%,
    transparent 75%);
  filter: blur(10px);
  z-index: -1;
  pointer-events: none;
  animation: floor-shadow 6s ease-in-out infinite;
}
@keyframes floor-shadow {
  0%, 100% { opacity: 0.7;  width: 60%; }
  50%      { opacity: 0.45; width: 78%; }
}

/* Пока Three.js грузится — placeholder с лоадером, чтобы не было пустоты */
#key-canvas:empty::before {
  content: "";
  display: block;
  position: absolute;
  inset: 50% 50% auto auto;
  width: 24px; height: 24px;
  margin: -12px -12px 0 0;
  border: 2px solid #d1d5db;
  border-top-color: #6b7280;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
