/* ============================================================
   Latency — site design system
   Dark theme, neon cyan→purple accent (matches the app icon)
   ============================================================ */

:root {
  /* Palette */
  --bg:            #07070c;
  --bg-soft:       #0d0d16;
  --bg-card:       #12121d;
  --bg-card-2:     #171724;
  --border:        #23233a;
  --border-soft:   #1a1a2b;

  --text:          #eef0fb;
  --text-dim:      #a9adc9;
  --text-faint:    #6c7193;

  /* Neon accent */
  --cyan:          #36d6ff;
  --violet:        #9b6bff;
  --magenta:       #d56bff;
  --accent:        #8a7bff;
  --grad:          linear-gradient(120deg, #36d6ff 0%, #7b6bff 48%, #d56bff 100%);
  --grad-soft:     linear-gradient(120deg, rgba(54,214,255,.18), rgba(213,107,255,.18));

  --glow-cyan:     0 0 32px rgba(54, 214, 255, .35);
  --glow-violet:   0 0 40px rgba(123, 107, 255, .35);

  /* Geometry */
  --radius:        16px;
  --radius-sm:     10px;
  --radius-lg:     24px;
  --maxw:          1160px;
  --nav-h:         64px;

  --shadow:        0 18px 50px -20px rgba(0,0,0,.8);
  --shadow-card:   0 12px 40px -22px rgba(0,0,0,.9);

  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, "Cascadia Code", Consolas, monospace;

  --ease: cubic-bezier(.22, 1, .36, 1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--nav-h) + 16px); }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* Ambient background glow */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(50% 40% at 80% -8%, rgba(123,107,255,.30), transparent 68%),
    radial-gradient(45% 38% at 8% -4%, rgba(54,214,255,.22), transparent 70%),
    radial-gradient(40% 35% at 95% 35%, rgba(213,107,255,.16), transparent 70%),
    radial-gradient(60% 50% at 50% 116%, rgba(123,107,255,.14), transparent 72%),
    linear-gradient(180deg, #0a0b18 0%, #07070f 40%, var(--bg) 100%);
  pointer-events: none;
}
/* Faint grid texture for depth */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(124,130,200,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124,130,200,.045) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 30%, transparent 78%);
  mask-image: radial-gradient(120% 90% at 50% 0%, #000 30%, transparent 78%);
  pointer-events: none;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.7rem, 1rem + 2.6vw, 2.7rem); }
h3 { font-size: 1.25rem; }

p { color: var(--text-dim); }

::selection { background: rgba(123,107,255,.4); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #20203a; border-radius: 10px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #2c2c4d; }

/* ---------- Layout helpers ---------- */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.section { padding: clamp(64px, 9vw, 120px) 0; }
.center { text-align: center; }

.gradient-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.eyebrow {
  display: inline-block;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 14px;
}

.section-head { max-width: 660px; margin: 0 auto 56px; }
.section-head.center { text-align: center; }
.section-head p { font-size: 1.05rem; margin-top: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-family: inherit;
  font-size: .96rem;
  font-weight: 600;
  padding: 13px 24px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s var(--ease),
              background .25s var(--ease), border-color .25s var(--ease);
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn-primary {
  background: var(--grad);
  color: #0a0a12;
  box-shadow: 0 10px 30px -10px rgba(123,107,255,.6);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -12px rgba(123,107,255,.8); }
.btn-ghost {
  background: rgba(255,255,255,.03);
  border-color: var(--border);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--accent); background: rgba(138,123,255,.08); transform: translateY(-2px); }
.btn-block { width: 100%; }
.btn-lg { padding: 16px 30px; font-size: 1.02rem; }

/* ---------- Navbar ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(7,7,12,.72);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid var(--border-soft);
}
.nav .container { display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }
.brand img { width: 30px; height: 30px; border-radius: 22%; filter: drop-shadow(0 2px 9px rgba(123,107,255,.5)); }
.nav-links { display: flex; align-items: center; gap: 4px; margin-left: 18px; }
.nav-links a {
  padding: 8px 14px;
  border-radius: 8px;
  font-size: .92rem;
  font-weight: 500;
  color: var(--text-dim);
  transition: color .2s, background .2s;
}
.nav-links a:hover, .nav-links a.active { color: var(--text); background: rgba(255,255,255,.05); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.02);
}
.lang-toggle button {
  font-family: inherit;
  font-size: .8rem;
  font-weight: 600;
  padding: 6px 12px;
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  transition: color .2s, background .2s;
}
.lang-toggle button.active { color: #0a0a12; background: var(--grad); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 40px; height: 40px;
  color: var(--text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.nav-toggle svg { width: 22px; height: 22px; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: clamp(70px, 11vw, 140px) 0 clamp(50px, 7vw, 90px); overflow: hidden; }
.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  gap: 56px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.5rem, 1.2rem + 5vw, 4.4rem);
  letter-spacing: -0.035em;
  margin-bottom: 22px;
}
.hero-lead { font-size: clamp(1.05rem, .95rem + .5vw, 1.28rem); max-width: 540px; margin-bottom: 32px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; }
.hero-meta { display: flex; flex-wrap: wrap; gap: 22px; margin-top: 30px; color: var(--text-faint); font-size: .88rem; }
.hero-meta span { display: inline-flex; align-items: center; gap: 7px; }
.hero-meta b { color: var(--text); font-weight: 600; }

/* Hero visual — faux player window mockup */
.hero-visual { position: relative; display: flex; align-items: center; justify-content: center; }
.hero-visual .glow-orb {
  position: absolute;
  width: 90%;
  aspect-ratio: 1;
  background: var(--grad);
  filter: blur(90px);
  opacity: .38;
  border-radius: 50%;
  animation: float 8s var(--ease) infinite;
}
/* uses `translate` (not transform) so it composes with the shot's
   base perspective/rotate transform instead of overriding it */
@keyframes float { 0%,100% { translate: 0 -8px; } 50% { translate: 0 8px; } }

/* ---- Hero polished logo ---- */
.hero-logo {
  position: relative;
  z-index: 1;
  width: min(330px, 72%);
  aspect-ratio: 1;
  border-radius: 23%;
  overflow: hidden;
  background: #0a0a14;
  filter: drop-shadow(0 22px 46px rgba(123,107,255,.55));
  animation: float 8s var(--ease) infinite;
}
.hero-logo img {
  width: 112%;
  height: 112%;
  margin: -6%;
  display: block;
  object-fit: cover;
}

/* ---------- Feature grid ---------- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 26px;
  transition: transform .3s var(--ease), border-color .3s var(--ease), background .3s var(--ease);
  position: relative;
  overflow: hidden;
}
.card:hover { transform: translateY(-4px); border-color: var(--border); background: var(--bg-card-2); }
.card .icon {
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  background: var(--grad-soft);
  border: 1px solid var(--border);
  margin-bottom: 16px;
  color: #8fd6ff;
}
.card .icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.card h3 { margin-bottom: 8px; }
.card p { font-size: .94rem; }

/* ---------- Screenshots gallery ---------- */
.gallery { display: flex; flex-direction: column; gap: 26px; }
.gmasonry { columns: 2; column-gap: 22px; }
.gmasonry .gshot { break-inside: avoid; margin-bottom: 22px; }

.gshot { display: flex; flex-direction: column; margin: 0; }
.win {
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 24px 60px -30px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.025) inset;
  cursor: pointer;
  transition: transform .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease);
}
.win:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: 0 30px 70px -28px rgba(91,86,200,.55); }
.win img { display: block; width: 100%; height: auto; background-color: #0a0a12; }
.gshot .cap {
  text-align: center;
  margin-top: 13px;
  font-size: .9rem;
  color: var(--text-dim);
  line-height: 1.45;
}

/* ---------- Mobile showcase ---------- */
.phones {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 3vw, 34px);
  flex-wrap: wrap;
}
.phone {
  width: clamp(150px, 20vw, 208px);
  border-radius: 30px;
  padding: 8px;
  background: linear-gradient(160deg, #1c1d30, #0c0c16);
  border: 1px solid var(--border);
  box-shadow: 0 30px 70px -28px rgba(91,86,200,.65);
  transition: transform .35s var(--ease);
}
.phone:nth-child(odd) { transform: translateY(14px); }
.phone:hover { transform: translateY(0) scale(1.02); }
.phone img {
  width: 100%; border-radius: 23px; display: block;
  border: 1px solid rgba(255,255,255,.04);
}
.phone-cap { text-align: center; margin-top: 12px; font-size: .82rem; color: var(--text-faint); line-height: 1.4; }

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(4,4,9,.92);
  backdrop-filter: blur(8px);
  padding: 30px;
}
.lightbox.open { display: flex; }
.lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 14px; box-shadow: var(--shadow); }
.lightbox-close {
  position: absolute; top: 22px; right: 26px;
  background: none; border: none; color: #fff; font-size: 2.4rem; line-height: 1; cursor: pointer;
}

/* ---------- Downloads ---------- */
.dl-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.dl-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 30px 26px;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: border-color .3s var(--ease), transform .3s var(--ease);
}
.dl-card:hover { border-color: var(--border); transform: translateY(-3px); }
.dl-card.recommended { border-color: rgba(138,123,255,.55); box-shadow: 0 0 0 1px rgba(138,123,255,.2), var(--shadow-card); }
.dl-card .plat-icon { margin-bottom: 16px; color: var(--text); }
.dl-card .plat-icon svg { width: 30px; height: 30px; fill: currentColor; }
.dl-card h3 { font-size: 1.3rem; margin-bottom: 4px; }
.dl-card .plat-sub { font-size: .85rem; color: var(--text-faint); margin-bottom: 18px; }
.dl-card ul { list-style: none; padding: 0; margin: 0 0 22px; font-size: .9rem; color: var(--text-dim); display: grid; gap: 9px; }
.dl-card li { display: flex; gap: 9px; align-items: flex-start; }
.dl-card li::before { content: "›"; color: var(--cyan); font-weight: 700; }
.dl-card .btn { margin-top: auto; }
.dl-badge {
  position: absolute; top: -11px; left: 50%; transform: translateX(-50%);
  background: var(--grad); color: #0a0a12;
  font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  padding: 4px 14px; border-radius: 999px;
}
.dl-note {
  margin-top: 28px;
  padding: 16px 20px;
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--cyan);
  border-radius: var(--radius-sm);
  background: rgba(54,214,255,.04);
  font-size: .9rem;
  color: var(--text-dim);
}

/* ---------- Callout / note boxes ---------- */
.note {
  margin: 22px 0;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-left: 3px solid var(--accent);
  font-size: .94rem;
  color: var(--text-dim);
}
.note.warn { border-left-color: #ffb454; background: rgba(255,180,84,.05); }
.note strong { color: var(--text); }

/* ---------- Code ---------- */
code {
  font-family: var(--mono);
  font-size: .86em;
  background: rgba(255,255,255,.06);
  padding: 2px 7px;
  border-radius: 6px;
  color: #c9d2ff;
}
pre {
  background: #0a0a13;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 18px 0;
}
pre code { background: none; padding: 0; font-size: .85rem; color: #c9d2ff; line-height: 1.7; }

/* ---------- Docs layout ---------- */
.docs-wrap { display: grid; grid-template-columns: 248px 1fr; gap: 48px; align-items: start; }
.docs-side {
  position: sticky;
  top: calc(var(--nav-h) + 28px);
  align-self: start;
}
.docs-side h4 {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--text-faint); margin: 22px 0 10px;
}
.docs-side h4:first-child { margin-top: 0; }
.docs-side a {
  display: block;
  padding: 6px 12px;
  font-size: .9rem;
  color: var(--text-dim);
  border-left: 2px solid var(--border-soft);
  transition: color .2s, border-color .2s;
}
.docs-side a:hover { color: var(--text); }
.docs-side a.active { color: var(--cyan); border-left-color: var(--cyan); }

.docs-body { min-width: 0; }
.docs-body h2 { margin: 48px 0 18px; scroll-margin-top: calc(var(--nav-h) + 20px); }
.docs-body h2:first-child { margin-top: 0; }
.docs-body h3 { margin: 30px 0 12px; }
.docs-body p { margin-bottom: 14px; }
.docs-body ul, .docs-body ol { color: var(--text-dim); margin: 0 0 16px; padding-left: 22px; }
.docs-body li { margin-bottom: 7px; }
.docs-body .lead { font-size: 1.1rem; color: var(--text-dim); }

.steps { list-style: none; counter-reset: step; padding: 0 !important; }
.steps li {
  position: relative;
  padding-left: 44px;
  margin-bottom: 18px;
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: -2px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--grad-soft);
  border: 1px solid var(--border);
  font-size: .85rem; font-weight: 700; color: var(--text);
}

/* Tables */
.table-wrap { overflow-x: auto; margin: 18px 0; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--border-soft); }
th { color: var(--text); font-weight: 600; background: var(--bg-soft); }
td { color: var(--text-dim); }
tr:last-child td { border-bottom: none; }

/* FAQ */
.faq details {
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  margin-bottom: 12px;
  overflow: hidden;
}
.faq summary {
  padding: 16px 20px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--cyan); font-size: 1.4rem; font-weight: 400; transition: transform .25s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details > p, .faq details > ul { padding: 0 20px 18px; margin: 0; color: var(--text-dim); font-size: .94rem; }

/* ---------- Changelog ---------- */
.timeline { position: relative; max-width: 800px; margin: 0 auto; padding-left: 28px; }
.timeline::before {
  content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px;
  width: 2px; background: linear-gradient(var(--cyan), var(--magenta), transparent);
}
.release { position: relative; margin-bottom: 48px; }
.release::before {
  content: ""; position: absolute; left: -27px; top: 6px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--grad); box-shadow: var(--glow-violet);
}
.release-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.release-head h3 { font-size: 1.5rem; }
.release-ver {
  font-family: var(--mono); font-size: .85rem;
  background: var(--grad-soft); border: 1px solid var(--border);
  padding: 2px 10px; border-radius: 999px; color: var(--text);
}
.release-date { color: var(--text-faint); font-size: .85rem; }
.release-group { margin: 18px 0; }
.release-group h4 { font-size: 1.02rem; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.release-group ul { color: var(--text-dim); font-size: .94rem; padding-left: 20px; }
.release-group li { margin-bottom: 6px; }

/* ---------- CTA band ---------- */
.cta-band {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: clamp(40px, 6vw, 72px);
  text-align: center;
  background:
    radial-gradient(80% 120% at 50% 0%, rgba(123,107,255,.18), transparent 70%),
    var(--bg-card);
  overflow: hidden;
}
.cta-band h2 { margin-bottom: 14px; }
.cta-band p { max-width: 520px; margin: 0 auto 28px; }
.cta-band .hero-cta { justify-content: center; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border-soft); padding: 48px 0 40px; margin-top: 40px; }
.footer-grid { display: flex; flex-wrap: wrap; gap: 40px; justify-content: space-between; }
.footer .brand { margin-bottom: 14px; }
.footer-col h5 { font-size: .8rem; text-transform: uppercase; letter-spacing: .12em; color: var(--text-faint); margin-bottom: 14px; }
.footer-col a { display: block; color: var(--text-dim); font-size: .92rem; padding: 4px 0; transition: color .2s; }
.footer-col a:hover { color: var(--text); }
.footer-about { max-width: 320px; }
.footer-about p { font-size: .9rem; }
.footer-bottom {
  margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--border-soft);
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  color: var(--text-faint); font-size: .85rem;
}

/* ---------- i18n visibility ----------
   !important so the active-language rule beats any inline display
   set in markup (some EN elements carry style="display:none" to
   avoid a flash before main.js sets <html lang>). revert restores
   the element's native display (block / inline / table-cell). */
[data-lang-en] { display: none !important; }
html[lang="en"] [data-lang-en] { display: revert !important; }
html[lang="en"] [data-lang-ru] { display: none !important; }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; gap: 36px; text-align: center; }
  .hero-lead { margin-left: auto; margin-right: auto; }
  .hero-cta, .hero-meta { justify-content: center; }
  .hero-visual { order: -1; }
  .hero-logo { width: min(240px, 56%); }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .dl-grid { grid-template-columns: 1fr; max-width: 460px; margin: 0 auto; }
  .docs-wrap { grid-template-columns: 1fr; }
  .docs-side { position: static; display: none; }
}
@media (max-width: 760px) {
  .nav-links { display: none; }
  .nav-toggle { display: inline-flex; }
  .nav.open .nav-links {
    display: flex; flex-direction: column; gap: 2px;
    position: absolute; top: var(--nav-h); left: 0; right: 0;
    background: var(--bg-soft); border-bottom: 1px solid var(--border);
    padding: 14px 24px; margin: 0;
  }
  .nav.open .nav-links a { padding: 12px 14px; }
  .gmasonry { columns: 1; }
}
@media (max-width: 540px) {
  .feature-grid { grid-template-columns: 1fr; }
  .hero-cta .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; }
}
