:root {
  color-scheme: dark;
  --bg: #07090c;
  --bg-2: #0b0d10;
  --card: #16191e;
  --line: #2a2f36;
  --gold: #c9a227;
  --gold-soft: rgba(201, 162, 39, 0.14);
  --text: #e6e8ea;
  --muted: #9aa3ad;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, "Segoe UI", Tahoma, sans-serif;
}

.site-bg,
.site-bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.site-bg {
  overflow: hidden;
  background: var(--bg);
}

.site-bg-canvas {
  display: block;
}

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap,
.doc {
  position: relative;
  z-index: 2;
}

.wrap {
  width: min(1080px, calc(100% - 40px));
  margin: 0 auto;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 8px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand img {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 14px;
}

.lang-picker {
  position: relative;
  z-index: 40;
}

.lang-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 6px 12px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), transparent 40%),
    var(--card);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  transition: border-color .2s ease, transform .18s ease, box-shadow .2s ease;
}

html[dir="rtl"] .lang-trigger { padding: 6px 8px 6px 12px; }

.lang-trigger:hover {
  border-color: rgba(201, 162, 39, 0.55);
  text-decoration: none;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
}

.lang-trigger:focus-visible,
.lang-option:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.lang-picker.is-open .lang-trigger {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.lang-picker.is-open .lang-chevron { transform: rotate(180deg); }

.lang-flag {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
  background: #1c222b;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.12);
}

.lang-flag img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lang-flag-lg {
  width: 32px;
  height: 32px;
}

.lang-flag-fallback {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.lang-trigger-copy {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.15;
}

html[dir="rtl"] .lang-trigger-copy { align-items: flex-end; }

.lang-trigger-sub {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.lang-trigger-name {
  font-size: 14px;
  font-weight: 700;
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang-chevron {
  color: var(--gold);
  flex: 0 0 auto;
  transition: transform .2s ease;
}

.lang-backdrop {
  display: none;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 10px);
  inset-inline-end: 0;
  width: min(320px, calc(100vw - 32px));
  padding: 10px;
  border: 1px solid rgba(201, 162, 39, 0.22);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(201,162,39,0.08), transparent 28%),
    #12151b;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255,255,255,0.03);
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.98);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

html[dir="rtl"] .lang-menu { transform-origin: top left; }

.lang-picker.is-open .lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.lang-menu-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px 12px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
}

.lang-menu-icon { display: grid; place-items: center; }

.lang-options {
  display: grid;
  gap: 4px;
  max-height: min(420px, 70vh);
  overflow: auto;
  padding-inline-end: 2px;
}

.lang-options::-webkit-scrollbar { width: 8px; }
.lang-options::-webkit-scrollbar-thumb {
  background: rgba(201, 162, 39, 0.28);
  border-radius: 99px;
}

.lang-option {
  display: grid;
  grid-template-columns: 28px 1fr 18px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 8px 10px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: start;
  cursor: pointer;
  transition: background .15s ease;
}

.lang-option:hover,
.lang-option.is-active {
  background: rgba(255,255,255,0.05);
}

.lang-option.is-selected {
  background: var(--gold-soft);
}

.lang-option-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
}

.lang-option-native {
  font-size: 14px;
  font-weight: 700;
}

.lang-option-en {
  font-size: 12px;
  color: var(--muted);
}

.lang-check {
  color: var(--gold);
  opacity: 0;
}

.lang-option.is-selected .lang-check { opacity: 1; }

@media (prefers-reduced-motion: reduce) {
  .lang-trigger, .lang-menu, .lang-chevron, .lang-option { transition: none; }
}

@media (max-width: 720px) {
  .lang-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
    z-index: 30;
  }

  .lang-picker.is-open .lang-backdrop {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .lang-menu {
    position: fixed;
    inset: auto 12px 12px 12px;
    top: auto;
    width: auto;
    max-width: none;
    border-radius: 24px 24px 20px 20px;
    padding: 8px 10px 16px;
    transform: translateY(18px);
    z-index: 50;
  }

  .lang-picker.is-open .lang-menu {
    transform: translateY(0);
  }

  .lang-options { max-height: min(58vh, 460px); }

  body.lang-picker-open { overflow: hidden; }
}

.hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 48px;
  align-items: center;
  padding: 48px 0 36px;
}

.icon-hero {
  width: 112px;
  height: 112px;
  border-radius: 28px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

h1 {
  margin: 18px 0 10px;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.1;
}

.gold { color: var(--gold); }

.lede {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
  max-width: 540px;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 700;
}

.btn-gold {
  background: var(--gold);
  color: #111;
}
.btn-gold:hover { text-decoration: none; filter: brightness(1.05); }

.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn-ghost:hover { text-decoration: none; border-color: var(--gold); }

.mosaic {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
}

.mosaic img {
  width: 100%;
  aspect-ratio: 9 / 16;
  object-fit: cover;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card);
}

.mosaic img:nth-child(2),
.mosaic img:nth-child(5) { transform: translateY(18px); }

.stats, .features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 12px 0 40px;
}

.card {
  background: rgba(22, 25, 30, 0.86);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}

.card strong { display: block; color: var(--gold); font-size: 22px; margin-bottom: 6px; }
.card p { margin: 0; color: var(--muted); line-height: 1.6; }

footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 48px;
  color: var(--muted);
  font-size: 14px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.doc {
  width: min(760px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 80px;
  line-height: 1.9;
}

.doc h1 { font-size: 32px; margin-bottom: 4px; }
.doc h2 { font-size: 18px; margin-top: 36px; color: var(--gold); }
.doc .meta { color: var(--muted); margin-bottom: 28px; }
.doc code { background: var(--card); padding: 2px 6px; border-radius: 4px; font-size: 13px; }

@media (max-width: 860px) {
  .hero, .stats, .features { grid-template-columns: 1fr; }
  .mosaic { max-width: 420px; }
  .mosaic img:nth-child(2),
  .mosaic img:nth-child(5) { transform: none; }
  .nav { align-items: flex-start; }
}
