/* Сайт «Гелион и книга формул». Палитра повторяет главное меню игры:
   ночная синева, латунное золото, малахитовая кнопка. */
:root {
  --bg: #0b1322;
  --bg-alt: #0f1a2d;
  --surface: #14223a;
  --surface-2: #1a2c48;
  --line: rgba(232, 203, 137, 0.18);
  --line-strong: rgba(232, 203, 137, 0.42);

  --text: #e9e3d4;
  --muted: #a3acba;
  --gold: #e8cb89;
  --gold-deep: #c4ab75;
  --green: #2f6b55;
  --green-hi: #3c8468;
  --green-line: #8fc7a8;

  --font-head: 'Lora', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --radius: 14px;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 76px; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0; color: #f5ecd6; }
h2 { font-size: clamp(28px, 3.6vw, 42px); font-weight: 600; letter-spacing: -0.01em; }
h3 { font-size: 21px; font-weight: 600; }
p { margin: 0 0 1em; }

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

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--gold); color: #10182a; padding: 10px 16px; border-radius: 8px; font-weight: 600;
}
.skip:focus { top: 12px; }

.eyebrow {
  margin: 0 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 26px;
  border-radius: 10px;
  font: 600 16px/1 var(--font-body);
  letter-spacing: 0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}
.btn--play {
  background: var(--green);
  color: #f4f1e6;
  border: 1px solid var(--green-line);
  box-shadow: inset 0 0 0 3px rgba(0, 0, 0, .18), 0 8px 24px rgba(47, 107, 85, .35);
}
.btn--play:hover { background: var(--green-hi); transform: translateY(-1px); }
.btn--ghost {
  color: var(--gold);
  border: 1px solid var(--line-strong);
  background: rgba(11, 19, 34, .45);
}
.btn--ghost:hover { border-color: var(--gold); background: rgba(232, 203, 137, .08); }
.btn--sm { min-height: 40px; padding: 0 18px; font-size: 15px; }
.btn--lg { min-height: 56px; padding: 0 32px; font-size: 17px; }

/* ---------- Шапка ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(11, 19, 34, .82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.topbar__inner { display: flex; align-items: center; gap: 24px; min-height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; margin-right: auto; }
.brand__sprite { image-rendering: pixelated; width: 32px; height: auto; }
.brand__name { font: 700 22px/1 var(--font-head); color: #f5ecd6; letter-spacing: .04em; text-transform: uppercase; }
.nav { display: flex; gap: 26px; }
.nav a { color: var(--muted); text-decoration: none; font-size: 15px; font-weight: 500; transition: color .2s; }
.nav a:hover { color: var(--gold); }
@media (max-width: 820px) { .nav { display: none; } }

/* ---------- Первый экран ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(72px, 12vw, 150px) 0 40px; isolation: isolate; }
.hero__bg {
  position: absolute; inset: 0; z-index: -1;
  background: url('/img/hero-2x.webp') center 35% / cover no-repeat;
}
.hero__bg::after {
  content: ''; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(11, 19, 34, .94) 0%, rgba(11, 19, 34, .78) 40%, rgba(11, 19, 34, .15) 75%, rgba(11, 19, 34, .1) 100%),
    linear-gradient(180deg, rgba(11, 19, 34, 0) 55%, var(--bg) 100%);
}
@media (max-width: 720px) {
  .hero__bg { background-position: 70% 35%; }
  .hero__bg::after {
    background:
      linear-gradient(180deg, rgba(11, 19, 34, .55) 0%, rgba(11, 19, 34, .82) 45%, var(--bg) 100%);
  }
}
.hero__content { max-width: var(--wrap); }
.hero__title { display: flex; flex-direction: column; gap: 6px; margin-bottom: 22px; }
.hero__name {
  font-size: clamp(56px, 10vw, 112px); font-weight: 700; letter-spacing: .03em; line-height: 1;
  text-transform: uppercase; color: #f6eedb;
  text-shadow: 0 4px 30px rgba(0, 0, 0, .5);
}
.hero__sub {
  font-size: clamp(20px, 2.6vw, 30px); font-weight: 600; letter-spacing: .2em;
  text-transform: uppercase; color: var(--gold);
}
.hero__lead { max-width: 560px; font-size: clamp(17px, 1.6vw, 19px); color: #d6d6d2; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; margin: 30px 0 16px; }
.hero__note { font-size: 14px; color: var(--muted); }

.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  margin: clamp(48px, 8vw, 96px) 0 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(15, 26, 45, .72);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.stats > div { padding: 22px 16px; text-align: center; }
.stats > div + div { border-left: 1px solid var(--line); }
.stats dt { font: 700 clamp(28px, 3.4vw, 38px)/1.1 var(--font-head); color: var(--gold); }
.stats dd { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stats > div:nth-child(3) { border-left: 0; }
  .stats > div:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ---------- Секции ---------- */
.section { padding: clamp(72px, 10vw, 120px) 0; }
.section--alt { background: var(--bg-alt); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section__head { max-width: 720px; margin-bottom: clamp(36px, 5vw, 56px); }
.section__head h2 { margin-bottom: 16px; }
.section__lead { color: var(--muted); font-size: 18px; }

.split { display: grid; grid-template-columns: 1fr 1.15fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
.split__text h2 { margin-bottom: 22px; }
.split__text p { color: #cfd3da; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }

/* Кадр игры в латунной рамке */
.shot { margin: 0; }
.shot__btn, .chapter__img {
  display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in;
}
/* Кадры показываем меньше 960 px — «pixelated» при уменьшении рвёт мелкий текст, поэтому сглаживаем.
   Чёткий пиксель включаем только в увеличенном просмотре (.lightbox). */
.shot__btn {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow), 0 0 0 6px rgba(232, 203, 137, .05);
  transition: transform .3s ease, box-shadow .3s ease;
}
.shot__btn:hover { transform: translateY(-3px); box-shadow: var(--shadow), 0 0 0 6px rgba(232, 203, 137, .1); }
.shot--tilt .shot__btn { transform: rotate(1.2deg); }
.shot--tilt .shot__btn:hover { transform: rotate(0deg) translateY(-3px); }
.shot figcaption { margin-top: 14px; font-size: 14px; color: var(--muted); text-align: center; }

/* ---------- Главы ---------- */
.chapters {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
}
@media (max-width: 1000px) { .chapters { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 620px) { .chapters { grid-template-columns: 1fr; } }
.chapter {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .25s ease, transform .25s ease;
}
.chapter:hover { border-color: var(--line-strong); transform: translateY(-3px); }
.chapter__img { aspect-ratio: 16 / 9; overflow: hidden; border-bottom: 1px solid var(--line); }
.chapter__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s ease; }
.chapter:hover .chapter__img img { transform: scale(1.04); }
.chapter__body { padding: 20px 22px 22px; }
.chapter__house {
  margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  color: var(--gold-deep);
}
.chapter h3 { margin-bottom: 8px; }
.chapter__topics { margin: 0 0 14px; color: #cfd3da; font-size: 15px; }
.chapter__boss {
  margin: 0; padding-top: 12px; border-top: 1px dashed var(--line);
  font-size: 14px; color: var(--muted);
}

/* ---------- Шаги ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: clamp(48px, 7vw, 88px); }
.step { display: grid; grid-template-columns: 1.15fr 1fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
.step:nth-child(even) .shot { order: 2; }
.step__text h3 { font-size: clamp(24px, 2.6vw, 30px); margin-bottom: 14px; }
.step__text p { color: #cfd3da; }
.step__num {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 18px;
  border: 1px solid var(--line-strong); border-radius: 50%;
  font: 700 20px/1 var(--font-head); color: var(--gold);
  background: rgba(232, 203, 137, .06);
}
@media (max-width: 860px) {
  .step { grid-template-columns: 1fr; }
  .step:nth-child(even) .shot { order: 0; }
}

/* ---------- Учителям ---------- */
.teachers__head { max-width: 720px; margin-bottom: 44px; }
.teachers__head h2 { margin-bottom: 16px; }
.features {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
}
@media (max-width: 960px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .features { grid-template-columns: 1fr; } }
.features li {
  padding: 24px 24px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  position: relative;
}
.features li::before {
  content: ''; position: absolute; left: 24px; top: 0; width: 36px; height: 3px;
  background: var(--gold-deep); border-radius: 0 0 3px 3px;
}
.features h3 { font-size: 19px; margin: 6px 0 10px; }
.features p { margin: 0; color: var(--muted); font-size: 15.5px; }

/* ---------- Старт ---------- */
.start { background: radial-gradient(1000px 500px at 20% 0%, rgba(47, 107, 85, .18), transparent 70%); }
.start__inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(32px, 6vw, 80px); align-items: center; }
@media (max-width: 900px) { .start__inner { grid-template-columns: 1fr; } }
.start__text h2 { margin-bottom: 18px; }
.start__text .btn { margin-top: 12px; }
.keys {
  padding: 26px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.keys h3 { font-size: 19px; margin-bottom: 16px; }
.keys dl { margin: 0; display: grid; gap: 12px; }
.keys dl > div { display: grid; grid-template-columns: minmax(150px, auto) 1fr; gap: 14px; align-items: center; }
.keys dt { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; color: var(--muted); font-size: 14px; }
.keys dd { margin: 0; color: #cfd3da; font-size: 15px; }
kbd {
  display: inline-grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px;
  font: 600 13px/1 var(--font-body); color: #f5ecd6;
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-bottom-width: 3px;
  border-radius: 7px;
}
@media (max-width: 480px) { .keys dl > div { grid-template-columns: 1fr; gap: 6px; } }

/* ---------- Подвал ---------- */
.footer { border-top: 1px solid var(--line); padding: 32px 0 40px; font-size: 14px; }
.footer__inner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; }
.footer p { margin: 0; }
.footer__muted { color: var(--muted); }
.footer__up { margin-left: auto; text-decoration: none; }

/* ---------- Просмотр кадра ---------- */
.lightbox {
  padding: 0; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: #000; max-width: min(1440px, 94vw); width: 100%;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .7);
}
.lightbox::backdrop { background: rgba(5, 9, 18, .86); }
.lightbox img { width: 100%; image-rendering: pixelated; }
.lightbox__close {
  position: absolute; top: 10px; right: 10px; z-index: 1;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line-strong); background: rgba(11, 19, 34, .85);
  color: var(--gold); font-size: 24px; line-height: 1; cursor: pointer;
}
