/* Цвета и шрифты из айдентики «Гаража 12»: гудрон, сигнал, кость и сталь.
   Подача мягче, чем в фирменном стиле: скругления, стекло, глубокие тени.
   Знак остаётся плоским и наклонённым на 11° влево. */
:root {
  --tar: #17130F;
  --tar-deep: #0E0B09;
  --night: #110E0B;
  --signal: #CE3122;
  --signal-hi: #E0473A;
  --bone: #F2EEE7;
  --paper: #FBF9F6;
  --sand: #CFC8BE;
  --ash: #918A80;
  --steel: #6B6862;
  --ink: #17130F;
  --ink-2: #3A332C;

  --glass: rgba(27, 22, 18, 0.72);
  --glass-hi: rgba(38, 32, 27, 0.8);
  --glass-line: rgba(242, 238, 231, 0.1);

  --head: 'Geologica', 'Golos Text', system-ui, sans-serif;
  --text: 'Golos Text', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

  --skew: -11deg;
  --unskew: 11deg;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.7, 0, 0.2, 1);
  --spring: cubic-bezier(0.22, 1.2, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--night);
  color: var(--bone);
  font-family: var(--text);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

/* Когда демо перестраивается при шаге назад, анимации не нужны */
body.is-fast *,
body.is-fast *::before,
body.is-fast *::after {
  transition: none !important;
  animation: none !important;
}

.app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.app.is-ready {
  opacity: 1;
}

/* ---------- Фон: тёплое свечение и точки, которые плывут вслед за камерой ---------- */
.bg {
  position: absolute;
  inset: 0;
  background: var(--night);
  overflow: hidden;
}

.bg__glow,
.bg__night {
  position: absolute;
  inset: 0;
  transition: opacity 1.4s ease;
}

.bg__glow {
  background:
    radial-gradient(900px 620px at 18% 12%, rgba(206, 49, 34, 0.16), transparent 62%),
    radial-gradient(760px 560px at 88% 92%, rgba(242, 238, 231, 0.06), transparent 60%),
    radial-gradient(1200px 800px at 55% 60%, rgba(40, 32, 26, 0.9), transparent 70%);
}

.bg__night {
  opacity: 0;
  background:
    radial-gradient(900px 620px at 50% 0%, rgba(145, 138, 128, 0.08), transparent 60%),
    #0A0807;
}

.app.is-night .bg__glow {
  opacity: 0.25;
}

.app.is-night .bg__night {
  opacity: 1;
}

.bg__dots {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(242, 238, 231, 0.075) 1px, transparent 1.4px);
  background-size: 30px 30px;
}

/* ---------- Знак ---------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.logo__word {
  font: 900 18px/0.8 var(--head);
  letter-spacing: -0.03em;
  color: #fff;
}

.logo__box {
  display: inline-flex;
  padding: 3px 7px;
  background: var(--signal);
  transform: skewX(var(--skew));
}

.logo__box > span {
  display: inline-block;
  transform: skewX(var(--unskew));
  font: 900 15px/0.85 var(--head);
  color: #fff;
}

.logo__trace {
  display: inline-flex;
  gap: 3px;
}

.logo__trace i {
  display: block;
  width: 3px;
  height: 16px;
  background: var(--signal);
  transform: skewX(var(--skew));
}

.logo__trace i + i {
  opacity: 0.55;
}

/* Монограмма Г12: аватар робота */
.mono {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 7px 10px;
  background: var(--signal);
  transform: skewX(var(--skew));
}

.mono > span {
  display: inline-block;
  transform: skewX(var(--unskew));
  font: 900 17px/0.85 var(--head);
  color: #fff;
}

.mono--xs {
  padding: 3px 5px;
}

.mono--xs > span {
  font-size: 9.5px;
}

/* ---------- Верхняя полоса ---------- */
.hud {
  position: absolute;
  top: 18px;
  left: 20px;
  right: 20px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.hud > * {
  pointer-events: auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  backdrop-filter: blur(16px) saturate(1.2);
  white-space: nowrap;
}

.pill--back {
  padding: 0 16px;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--bone);
  text-decoration: none;
  transition: background 0.2s;
}

.pill--back:hover {
  background: var(--glass-hi);
}

.pill--back > span {
  color: var(--signal-hi);
}

.hud__title {
  padding-left: 12px;
  border-left: 1px solid var(--glass-line);
  font: 600 13px/1 var(--text);
  color: var(--sand);
}

.chapters {
  display: flex;
  gap: 6px;
  margin-left: auto;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.chapter {
  position: relative;
  height: 34px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ash);
  font: 600 12.5px/1 var(--text);
  white-space: nowrap;
  transition: background 0.3s, color 0.3s;
}

.chapter:hover,
.chapter:focus-visible {
  color: var(--bone);
  outline: none;
}

.chapter.is-active {
  background: var(--bone);
  color: var(--ink);
}

.chapter.is-seen:not(.is-active)::after {
  content: '';
  position: absolute;
  top: 7px;
  right: 7px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--signal);
}

.pill--clock {
  gap: 10px;
  padding: 0 16px;
}

.clock__date {
  font: 600 12px/1 var(--text);
  color: var(--ash);
}

.clock__time {
  min-width: 46px;
  font: 800 18px/1 var(--head);
  font-variant-numeric: tabular-nums;
  color: #fff;
  text-align: right;
  transition: color 0.3s;
}

.pill--clock.is-ff .clock__time {
  color: var(--signal-hi);
}

/* ---------- Панель с пояснением шага ---------- */
.panel {
  position: absolute;
  left: 20px;
  bottom: 20px;
  z-index: 20;
  width: 380px;
  padding: 20px 20px 18px 22px;
  border-radius: 28px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  backdrop-filter: blur(20px) saturate(1.2);
  box-shadow: 0 30px 60px -30px rgba(0, 0, 0, 0.7);
}

.panel__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font: 700 11px/1 var(--head);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ash);
  white-space: nowrap;
}

.panel__meta .dots {
  margin-left: auto;
}

.panel__meta b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 22px;
  padding: 0 7px;
  border-radius: 999px;
  background: rgba(206, 49, 34, 0.16);
  color: var(--signal-hi);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.panel__body {
  position: relative;
}

.panel__slide {
  animation: slide-in 0.55s var(--ease-out) both;
}

.panel__slide.is-out {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  animation: slide-out 0.3s ease-in both;
}

.panel__title {
  margin: 12px 0 7px;
  font: 800 23px/1.12 var(--head);
  letter-spacing: -0.015em;
  color: #fff;
}

.panel__text {
  margin: 0;
  font: 400 15px/1.5 var(--text);
  color: rgba(242, 238, 231, 0.76);
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes slide-out {
  to { opacity: 0; transform: translateY(-10px); }
}

.panel__choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.panel__choices:not(:empty) {
  margin-top: 16px;
}

.choice {
  height: 38px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--glass-line);
  background: rgba(242, 238, 231, 0.06);
  color: var(--bone);
  font: 600 13px/1 var(--text);
  transition: background 0.2s, border-color 0.2s;
  animation: slide-in 0.5s var(--ease-out) both;
}

.choice:hover,
.choice:focus-visible {
  background: rgba(242, 238, 231, 0.12);
  border-color: rgba(242, 238, 231, 0.2);
  outline: none;
}

.choice--main {
  background: var(--bone);
  border-color: var(--bone);
  color: var(--ink);
}

.choice--main:hover,
.choice--main:focus-visible {
  background: #fff;
}

/* ---------- Кнопки шагов: назад и большая стрелка дальше ---------- */
.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
}

.ctl-prev {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 50px;
  border: 1px solid var(--glass-line);
  border-radius: 50%;
  background: rgba(242, 238, 231, 0.05);
  color: var(--bone);
  transition: background 0.2s, opacity 0.2s;
}

.ctl-prev svg {
  width: 20px;
  height: 20px;
}

.ctl-prev:hover,
.ctl-prev:focus-visible {
  background: rgba(242, 238, 231, 0.12);
  outline: none;
}

.ctl-prev:disabled {
  opacity: 0.3;
  cursor: default;
}

.dots {
  display: flex;
  align-items: center;
  gap: 5px;
}

.dot {
  width: 7px;
  height: 7px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(242, 238, 231, 0.22);
  transition: width 0.45s var(--ease-out), background 0.3s;
}

.dot:hover {
  background: rgba(242, 238, 231, 0.45);
}

.dot.is-done {
  background: rgba(206, 49, 34, 0.75);
}

.dot.is-now {
  width: 26px;
  background: var(--signal);
}

.ctl-next {
  display: inline-flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: 52px;
  padding: 0 8px 0 24px;
  border: 0;
  border-radius: 999px;
  background: var(--signal);
  color: #fff;
  font: 800 15px/1 var(--head);
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 14px 30px -12px rgba(206, 49, 34, 0.8);
  transition: background 0.2s, transform 0.2s var(--ease-out), box-shadow 0.2s;
}

.ctl-next:hover,
.ctl-next:focus-visible {
  background: var(--signal-hi);
  transform: translateY(-1px);
  outline: none;
}

.ctl-next:active {
  transform: scale(0.97);
}

.ctl-next__arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
}

.ctl-next__arrow svg {
  width: 18px;
  height: 18px;
}

/* Шаг показан и ждёт посетителя: стрелка подталкивает дальше */
.ctl-next.is-ready .ctl-next__arrow {
  animation: nudge 1.5s ease-in-out infinite;
}

.ctl-next.is-busy {
  background: rgba(206, 49, 34, 0.55);
  box-shadow: none;
}

.ctl-next.is-shake {
  animation: shake 0.45s ease-in-out;
}

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-3px); }
}

/* В превью на лендинге показ идёт сам, кнопки не нужны */
body.is-preview .controls,
body.is-preview .chapters,
body.is-preview .panel__choices {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .ctl-next.is-ready .ctl-next__arrow {
    animation: none;
  }
}
