/* Friends for Sale — промо-страница.
   Палитра взята из самой игры (src/gfx/theme.js): тёмно-фиолетовый зал,
   золото как единственный акцент, розовый — только для «тебя». Шрифты
   системные: внешние подключения запрещены строгим CSP. */

:root {
  --bg: #06070f;
  --bg-2: #0a0b18;
  --violet: #241650;
  --violet-2: #130f2c;
  --gold: #f5c542;
  --gold-light: #ffdd7a;
  --gold-deep: #b8862b;
  --rose: #ff5b6e;
  --text: #f4f5fa;
  --muted: #99a0b8;
  --muted-2: #6f7793;
  --line: rgba(255, 255, 255, 0.10);
  --line-soft: rgba(255, 255, 255, 0.06);
  --glass: rgba(18, 20, 36, 0.72);

  /* тени согласованы со светом сцены: ключевой свет сверху-справа */
  --shadow-card: -10px 26px 60px rgba(2, 3, 10, 0.62);
  --shadow-gold: 0 18px 46px rgba(245, 197, 66, 0.22);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --pad: clamp(20px, 5vw, 64px);
  --maxw: 1220px;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

::selection { background: rgba(245, 197, 66, 0.28); }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------------- сцена ---------------- */

/* Канвас лежит фоном на всю высоту окна; секции с непрозрачным фоном
   проезжают поверх него. Пока сцена не завелась (или WebGL нет вовсе) —
   виден постер, и страница всё равно выглядит собранной. */
#stage-wrap {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 62% 42%, rgba(36, 22, 80, 0.85) 0%, rgba(9, 10, 24, 0.2) 55%, transparent 78%),
    radial-gradient(80% 60% at 50% 110%, rgba(245, 197, 66, 0.10) 0%, transparent 70%),
    linear-gradient(180deg, #05060d 0%, #080a16 45%, #05060d 100%);
}

#stage-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.5;
  filter: saturate(0.85) brightness(0.8);
  transition: opacity 0.8s ease;
  mask-image: radial-gradient(75% 70% at 50% 45%, #000 30%, transparent 85%);
}

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 1.1s ease;
}

.stage-live #stage { opacity: 1; }
.stage-live #stage-poster { opacity: 0; }

/* ---------------- каркас ---------------- */

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px var(--pad);
  background: linear-gradient(180deg, rgba(5, 6, 13, 0.88) 0%, rgba(5, 6, 13, 0) 100%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.brand {
  font-weight: 800;
  letter-spacing: -0.015em;
  text-decoration: none;
  font-size: 17px;
  white-space: nowrap;
}
.brand span { color: var(--gold); }

.topbar nav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lang {
  display: flex;
  align-items: center;
  gap: 2px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px;
  margin-right: 4px;
}
.lang a, .lang span {
  padding: 3px 9px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
}
.lang a:hover { color: var(--text); }
.lang [aria-current] {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text);
}

main { position: relative; z-index: 1; }

section { padding-inline: var(--pad); }

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  width: 100%;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 18px;
}
.eyebrow.dim { color: var(--muted-2); }

h1, h2, h3 {
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0;
  font-weight: 800;
}

h1 {
  font-size: clamp(46px, 9vw, 108px);
  font-weight: 900;
  letter-spacing: -0.04em;
  background: linear-gradient(168deg, #ffffff 8%, #ffe9a8 48%, var(--gold) 96%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 22px;
}

h2 { font-size: clamp(30px, 4.6vw, 54px); }
h3 { font-size: 20px; letter-spacing: -0.01em; }

p { margin: 0 0 16px; }

.lead {
  font-size: clamp(20px, 2.6vw, 30px);
  line-height: 1.32;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text);
  margin-bottom: 18px;
}

.body { color: var(--muted); max-width: 58ch; }
.note { color: var(--muted-2); font-size: 14.5px; max-width: 46ch; }

/* ---------------- кнопки ---------------- */

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 30px 0 20px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 30px;
  border-radius: 15px;
  font: inherit;
  font-weight: 700;
  font-size: 17px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.16s ease, box-shadow 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  white-space: nowrap;
}

.btn-primary {
  background: linear-gradient(150deg, var(--gold-light) 0%, var(--gold) 42%, #e8a92e 100%);
  color: #21170a;
  box-shadow: var(--shadow-gold);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 54px rgba(245, 197, 66, 0.34);
}

.btn-ghost {
  border-color: var(--line);
  color: var(--text);
  background: rgba(255, 255, 255, 0.03);
}
.btn-ghost:hover {
  border-color: rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.07);
}

.btn-sm { min-height: 40px; padding: 0 16px; font-size: 14px; border-radius: 11px; }

.topbar .btn-primary { box-shadow: 0 10px 26px rgba(245, 197, 66, 0.2); }

/* ---------------- герой ---------------- */

.hero {
  min-height: 100svh;
  display: flex;
  align-items: center;
  padding-top: 96px;
  padding-bottom: 56px;
}

.hero .wrap { max-width: var(--maxw); }

.hero-col { max-width: 600px; }

.hero .lead { max-width: 17ch; }

/* ---------------- сюжет со скроллом ---------------- */

.story { padding-block: 4vh; }

.story-step {
  min-height: 100svh;
  display: flex;
  align-items: center;
}

.story-card {
  max-width: 520px;
  padding: 34px 34px 30px;
  border-radius: 22px;
  border: 1px solid var(--line-soft);
  background: var(--glass);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: var(--shadow-card);
}
.story-card h2 { margin-bottom: 16px; font-size: clamp(28px, 3.6vw, 42px); }
.story-card p:last-child { margin-bottom: 0; }

.story-step:nth-child(even) .story-card { margin-left: auto; }

.figure {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.06em;
  color: var(--muted-2);
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
  margin-top: 20px;
  width: 100%;
}
.figure b {
  font-size: 22px;
  color: var(--gold);
  font-weight: 700;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* ---------------- непрозрачный блок поверх сцены ---------------- */

.solid {
  position: relative;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(6, 7, 15, 0) 0%, var(--bg) 90px, var(--bg) 100%);
}
.solid::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 140px;
  background: linear-gradient(180deg, var(--bg) 0%, rgba(6, 7, 15, 0) 100%);
  pointer-events: none;
}

.block { padding-block: clamp(64px, 8vh, 112px); }
.block > .wrap > h2 { margin-bottom: 18px; }
.block-intro { color: var(--muted); max-width: 56ch; margin-bottom: 46px; }

/* ---------------- механики ---------------- */

.grid-mech {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 18px;
}

.mech {
  padding: 26px 24px 24px;
  border-radius: 20px;
  border: 1px solid var(--line-soft);
  background: linear-gradient(168deg, rgba(255, 255, 255, 0.055) 0%, rgba(255, 255, 255, 0.015) 60%);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.mech::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(245, 197, 66, 0.5), transparent);
}
.mech h3 { margin-bottom: 10px; }
.mech p { color: var(--muted); font-size: 15.5px; margin: 0; }
.mech .num {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  color: var(--gold-deep);
  display: block;
  margin-bottom: 14px;
}

.aside {
  margin-top: 26px;
  color: var(--muted-2);
  font-size: 15px;
  max-width: 62ch;
}

/* ---------------- скриншоты ---------------- */

.shots-grid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: 18px;
  align-items: start;
}

figure { margin: 0; }

.shot {
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0a0b16;
  box-shadow: var(--shadow-card);
}
.shot img {
  width: 100%;
  height: auto;
  display: block;
}
figcaption {
  color: var(--muted-2);
  font-size: 14px;
  margin-top: 10px;
  line-height: 1.45;
}

.shot-stack {
  display: grid;
  gap: 18px;
}
.shot-phone .shot { max-width: 300px; border-radius: 26px; }

/* ---------------- из игры прямо сейчас ---------------- */

.live-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}
.live-item {
  position: relative;
  display: block;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0a0b16;
  aspect-ratio: 16 / 10;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.live-item:hover { transform: translateY(-3px); border-color: rgba(245, 197, 66, 0.5); }
.live-item img, .live-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.live-item .play {
  position: absolute;
  right: 10px;
  bottom: 10px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(6, 7, 15, 0.72);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.live-item .play::after {
  content: "";
  border-style: solid;
  border-width: 6px 0 6px 10px;
  border-color: transparent transparent transparent var(--text);
  margin-left: 2px;
}

/* ---------------- финал ---------------- */

/* Финал повторяет образ: объект поднят вверх кадра, текст живёт под ним.
   Затемнение снизу гарантирует читаемость, как бы ни легла сцена. */
.final {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  text-align: center;
  padding-bottom: clamp(56px, 9vh, 110px);
  padding-top: 48svh;
}
.final::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 66%;
  background: linear-gradient(180deg, rgba(6, 7, 15, 0) 0%, rgba(6, 7, 15, 0.82) 38%, var(--bg) 100%);
  z-index: -1;
  pointer-events: none;
}
.final .wrap { max-width: 720px; }
.final h2 { margin-bottom: 20px; }
.final .cta { justify-content: center; }
.final .body,
.final .note { margin-inline: auto; }

/* ---------------- адаптив ---------------- */

@media (max-width: 900px) {
  body { font-size: 16px; }
  .shots-grid { grid-template-columns: 1fr; }
  .shot-phone .shot { max-width: 260px; margin-inline: auto; }
  .story-card { max-width: 100%; padding: 26px 22px 24px; }
  .story-step:nth-child(even) .story-card { margin-left: 0; }
  /* На узком экране образ стоит в верхней половине, текст — снизу, и под
     текстом всегда лежит затемнение: читается при любом кадре сцены. */
  .hero, .story-step, .final { align-items: flex-end; position: relative; }
  .hero { min-height: 100svh; padding-bottom: 6vh; }
  .hero-col { max-width: 100%; }
  .hero .lead { max-width: 100%; }
  .story-step { padding-bottom: 7vh; }
  .final { padding-top: 44svh; }

  .hero::before,
  .story-step::before,
  .final::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 68%;
    background: linear-gradient(180deg, rgba(6, 7, 15, 0) 0%, rgba(6, 7, 15, 0.9) 34%, var(--bg) 72%);
    z-index: -1;
    pointer-events: none;
  }
  .topbar .btn-ghost { display: none; }
}

@media (max-width: 560px) {
  .btn { width: 100%; }
  .cta { gap: 10px; }
  .topbar { padding: 10px 16px; }
  .brand { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
