/*
 * Промо-лендинг «Rustdeep»: страница — это ствол.
 *
 * Прокрутка — спуск: шкала глубины идёт от 0 до 6000 м, а цвет акцента
 * и порода фона меняются по биомам игры (атрибут data-biome у body ставит
 * landing.js). Цвета взяты из самой игры: порода — фон забоя, янтарь —
 * кнопка «БУРИТЬ», ледяной голубой — строки HUD.
 */

:root {
  --rock: #1b110d;          /* фон забоя в игре */
  --rock-raised: #2a1b15;   /* панели поверх породы */
  --seam: #4a3326;          /* границы, швы плит */
  --bone: #ede3d3;          /* основной текст */
  --dust: #b3a492;          /* второстепенный текст */
  --amber: #e58a2b;         /* кнопка «БУРИТЬ», главное действие */
  --amber-deep: #b8641a;
  --ice: #b9d4f5;           /* строки HUD и эфира */

  /* Акцент биома — меняется при спуске */
  --accent: var(--amber);

  --font-display: "Alumni Sans", "Arial Narrow", sans-serif;
  --font-body: "Golos Text", "Segoe UI", sans-serif;

  --gutter: clamp(16px, 5vw, 48px);
  --bar-h: 56px;
  --measure: 38rem;
}

body[data-biome="surface"] { --accent: #d9c7a8; }
body[data-biome="rusty"]   { --accent: #d07a3c; }
body[data-biome="belly"]   { --accent: #9fb4c4; }
body[data-biome="rift"]    { --accent: #ff7a33; }
body[data-biome="bio"]     { --accent: #6fe0c2; }
body[data-biome="voids"]   { --accent: #a893ff; }
body[data-biome="beyond"]  { --accent: #e58a2b; }

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

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

body {
  margin: 0;
  background: var(--rock);
  color: var(--bone);
  font: 400 1.0625rem/1.6 var(--font-body);
}

img { max-width: 100%; height: auto; display: block; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--ice);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -100px;
  z-index: 50;
  background: var(--ice);
  color: var(--rock);
  padding: 8px 14px;
  border-radius: 4px;
  text-decoration: none;
}
.skip:focus { top: 8px; }

/* ---------- Верхняя строка ---------- */

.bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 30;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top);
  background: linear-gradient(var(--rock) 55%, rgba(27, 17, 13, 0));
}

.bar-brand {
  font: 800 1.75rem/1 var(--font-display);
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--bone);
}

.bar-depth {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

.bar-depth-num {
  font: 800 1.9rem/1 var(--font-display);
  color: var(--accent);
  min-width: 3.2ch;
  text-align: right;
}

.bar-depth-unit {
  font: 600 1.1rem/1 var(--font-display);
  color: var(--accent);
}

.bar-depth-biome {
  margin-left: 10px;
  font-size: 0.8rem;
  color: var(--dust);
  max-width: 11rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.95rem;
}

.bar-nav a { text-decoration: none; color: var(--dust); }

/* На узком телефоне имя биома уступает место: глубина и язык важнее */
@media (max-width: 560px) {
  .bar { gap: 12px; }
  .bar-depth-biome { display: none; }
  /* Архивы есть в подвале; в шапке остаются глубина и язык */
  .bar-nav a { display: none; }
  .bar-lang { max-width: 7.5rem; }
}
.bar-nav a:hover { color: var(--bone); }

.bar-lang {
  font: 600 0.85rem/1 var(--font-body);
  color: var(--bone);
  background: var(--rock-raised);
  border: 1px solid var(--seam);
  border-radius: 4px;
  padding: 7px 8px;
  cursor: pointer;
  max-width: 9.5rem;
}

/* Звук бурения: тот же вид, что у переключателя языка; по умолчанию выключен */
.bar-sound {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 0.85rem/1 var(--font-body);
  color: var(--dust);
  background: var(--rock-raised);
  border: 1px solid var(--seam);
  border-radius: 4px;
  padding: 6px 9px;
  cursor: pointer;
  white-space: nowrap;
}
.bar-sound:hover { color: var(--bone); }
.bar-sound[aria-pressed="true"] { color: var(--bone); border-color: var(--accent); }
.bar-sound-icon { font-size: 1rem; line-height: 1; }

/* Узкий телефон: от кнопки звука остаётся значок */
@media (max-width: 560px) {
  .bar-sound-label { display: none; }
  .bar-sound { padding: 6px 7px; }
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- Шкала глубины (широкий экран) ---------- */

.gauge { display: none; }

@media (min-width: 1000px) {
  .bar-depth { display: none; }

  .gauge {
    display: block;
    position: fixed;
    z-index: 20;
    left: var(--gutter);
    top: calc(var(--bar-h) + 24px);
    bottom: 32px;
    width: 120px;
  }

  .gauge-scale {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 120px;
    width: 2px;
    background: var(--seam);
  }

  .gauge-mark {
    position: absolute;
    left: 10px;
    top: calc(var(--at) * 100%);
    transform: translateY(-50%);
    font: 600 1rem/1 var(--font-display);
    color: var(--dust);
    font-variant-numeric: tabular-nums;
  }

  .gauge-mark::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    width: 7px;
    height: 2px;
    background: var(--seam);
  }

  .gauge-pin {
    position: absolute;
    left: -5px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px rgba(27, 17, 13, 0.9);
    transform: translateY(-50%);
  }

  .gauge-read {
    position: absolute;
    left: 0;
    bottom: 0;
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-variant-numeric: tabular-nums;
  }

  .gauge-num {
    font: 900 4.5rem/0.85 var(--font-display);
    color: var(--accent);
  }

  .gauge-unit {
    font: 600 1.5rem/1 var(--font-display);
    color: var(--accent);
  }
}

/* ---------- Страты ---------- */

/* Живой ствол — холст под всей страницей (shaft.js) */
.shaft {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: block;
}

main, .foot { position: relative; z-index: 1; }

/* Страта — прозрачный пролёт ствола: текст идёт панелью, а между панелями
   виден бур. Высокие поля — это и есть «метры», которые бур проходит */
.stratum {
  position: relative;
  padding: 38vh var(--gutter) 38vh;
}

.stratum-inner {
  max-width: var(--measure);
  padding: clamp(22px, 4vw, 36px);
  background: rgba(20, 13, 10, 0.8);
  border: 1px solid rgba(90, 64, 48, 0.55);
  border-radius: 14px;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

/* Цвет биома — тонкой кромкой сверху панели */
.stratum-inner { border-top: 3px solid var(--accent); }

@media (min-width: 1000px) {
  .stratum { padding-left: calc(var(--gutter) + 200px); }
}

.stratum-depth {
  margin: 0 0 12px;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: 0.005em;
  margin: 0 0 20px;
  text-wrap: balance;
}

h2 { font-size: clamp(2.6rem, 8vw, 4.2rem); }

p { margin: 0 0 16px; max-width: 65ch; }

/* ---------- Первый экран: поверхность ---------- */

.hero {
  min-height: 100svh;
  display: block;
  padding: calc(var(--bar-h) + 6vh) var(--gutter) 0;
}

.hero-inner {
  position: relative;
  max-width: 42rem;
}

.hero-kicker {
  color: var(--dust);
  font-size: 0.95rem;
  max-width: 30rem;
  margin-bottom: 14px;
}

.hero-title {
  font-size: clamp(3.6rem, 14vw, 9rem);
  font-weight: 900;
  line-height: 0.86;
  margin-bottom: 20px;
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.55);
}

.hero-lead {
  font-size: 1.1rem;
  max-width: 34rem;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7);
}

.hero-note {
  font-size: 0.9rem;
  color: var(--dust);
  margin-top: 14px;
}

@media (min-width: 1000px) {
  .hero { padding-left: calc(var(--gutter) + 200px); padding-top: calc(var(--bar-h) + 12vh); }
}

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

.cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 8px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 24px;
  border-radius: 8px;
  font: 600 1.05rem/1 var(--font-body);
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform 0.08s, background-color 0.15s;
}

.btn:active { transform: translateY(1px); }

/* Главная кнопка — та же, что «БУРИТЬ» в игре */
.btn-play {
  background: var(--amber);
  color: #2a1406;
  border-color: #f2a95c;
}
.btn-play:hover { background: #f09a3e; }

.btn-discord {
  background: transparent;
  color: var(--bone);
  border-color: var(--seam);
}
.btn-discord:hover { border-color: var(--ice); }

.btn-soon {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 3px 7px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.22);
}

.btn-discord .btn-soon { background: var(--rock-raised); color: var(--dust); }

.btn[data-live] .btn-soon { display: none; }

/* ---------- Эфир ---------- */

.radio {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin: 32px 0 0;
  padding: 18px;
  background: rgba(20, 26, 36, 0.72);
  border: 1px solid #2b3a4d;
  border-radius: 10px;
  color: var(--ice);
}

.radio img {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  flex: none;
  object-fit: cover;
}

.radio p { margin: 0; }

.radio-who {
  display: block;
  font-size: 0.85rem;
  color: #8fa9c9;
  margin-bottom: 4px;
}

/* ---------- Бур-песочница ---------- */

.rig {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 20px;
  align-items: center;
  margin-top: 28px;
  padding: 20px;
  background: rgba(42, 27, 21, 0.78);
  border: 1px solid var(--seam);
  border-radius: 12px;
}

.rig-drill {
  width: 96px;
  transform-origin: 50% 20%;
}

.rig[data-overdrive] .rig-drill { animation: shake 0.12s linear infinite; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(1.5px); }
}

.rig-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.95rem;
  color: var(--dust);
}

.rig-row strong {
  font: 800 2rem/1 var(--font-display);
  color: var(--bone);
  font-variant-numeric: tabular-nums;
}

.rig-heat {
  position: relative;
  height: 16px;
  margin: 12px 0 8px;
  border-radius: 8px;
  background: #140c09;
  overflow: hidden;
}

/* Оранжевая зона форсажа: 45–75 % шкалы, как в игре */
.rig-heat-zone {
  position: absolute;
  left: 45%;
  width: 30%;
  top: 0;
  bottom: 0;
  background: rgba(229, 138, 43, 0.25);
}

.rig-heat-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: #7a5a3a;
  transition: width 0.12s, background-color 0.2s;
}

.rig[data-zone="orange"] .rig-heat-fill { background: var(--amber); }
.rig[data-zone="red"] .rig-heat-fill { background: #d8412b; }

.rig-state {
  font-size: 0.95rem;
  min-height: 1.6em;
  margin-bottom: 12px;
}

.rig[data-zone="orange"] .rig-state { color: var(--amber); }
.rig[data-zone="red"] .rig-state { color: #ff7d66; }

.rig-buttons { display: flex; gap: 10px; flex-wrap: wrap; }

.btn-drill {
  flex: 1 1 140px;
  background: var(--amber);
  color: #2a1406;
  border-color: #f2a95c;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.6rem;
  touch-action: manipulation;
}

.btn-drill:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--bone);
  border-color: var(--seam);
}

/* ---------- Советники ---------- */

.cast {
  list-style: none;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  gap: 14px;
}

.cast li {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  align-items: center;
}

.cast img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
}

.cast strong { display: block; font-weight: 600; }
.cast span { color: var(--ice); }

/* ---------- Петля поколения ---------- */

.loop {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 28px 0 0;
  display: grid;
  gap: 10px;
}

.loop li {
  counter-increment: step;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 1px solid var(--seam);
  border-radius: 8px;
  background: rgba(42, 27, 21, 0.6);
}

.loop li::before {
  content: counter(step);
  font: 800 1.8rem/1 var(--font-display);
  color: var(--accent);
  min-width: 1ch;
}

/* Последний шаг возвращает к первому: это цикл, а не список */
.loop li:last-child::after {
  content: "↺";
  margin-left: auto;
  color: var(--accent);
  font-size: 1.3rem;
}

/* ---------- Пустоты: снимок игры ---------- */

.stratum-split {
  display: grid;
  gap: 32px;
  max-width: 60rem;
}

/* Снимок рядом с текстом — только на планшете: на широком экране справа
   стоит ствол, и панель на всю ширину закрывала бы бур (доклад Сергея 24.09) */
@media (min-width: 760px) and (max-width: 999px) {
  .stratum-split { grid-template-columns: 1fr 240px; align-items: center; }
}

@media (min-width: 1000px) {
  .stratum-split { max-width: var(--measure); }
}

.phone {
  margin: 0;
  justify-self: start;
  width: min(240px, 70vw);
}

.phone img {
  border-radius: 22px;
  border: 6px solid #0e0a08;
  box-shadow: 0 0 0 1px var(--seam), 0 24px 60px rgba(120, 90, 255, 0.18);
}

.phone figcaption {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--dust);
}

/* ---------- 6000 м ---------- */

.finale-title { font-size: clamp(3rem, 11vw, 6rem); }

.fair {
  list-style: none;
  padding: 0;
  margin: 24px 0 28px;
  display: grid;
  gap: 8px;
}

.fair li {
  padding-left: 22px;
  position: relative;
}

.fair li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.62em;
  width: 9px;
  height: 9px;
  background: var(--accent);
  transform: rotate(45deg);
}

/* ---------- Подвал и нижняя панель ---------- */

.foot {
  padding: 40px var(--gutter) calc(110px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--seam);
  color: var(--dust);
  font-size: 0.95rem;
}

@media (min-width: 1000px) {
  .foot { padding-left: calc(var(--gutter) + 200px); padding-bottom: 40px; }
}

.foot a { color: var(--bone); }

.dock {
  position: fixed;
  z-index: 40;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 12px var(--gutter) calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(27, 17, 13, 0), var(--rock) 35%);
}

/* Атрибут hidden ставит скрипт: display:flex выше его бы перебил */
.dock[hidden] { display: none; }

.dock .btn { flex: 1; min-height: 50px; padding: 0 12px; }
.dock .btn-discord { flex: 0 0 auto; }

@media (min-width: 1000px) {
  .dock { display: none !important; }
}

.toast {
  position: fixed;
  z-index: 45;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  margin: 0;
  padding: 10px 16px;
  max-width: calc(100vw - 32px);
  background: var(--rock-raised);
  border: 1px solid var(--seam);
  border-radius: 8px;
  color: var(--bone);
  font-size: 0.95rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast[data-show] { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .rig[data-overdrive] .rig-drill { animation: none; }
  .btn, .toast, .rig-heat-fill { transition: none; }
}
