/* Общие токены и базовые стили для всех страниц сайта */
:root {
  --bg:          #0c0c0a;
  --surface:     #141412;
  --surface2:    #1a1a16;
  --surface3:    #22221e;
  --border:      rgba(255,255,255,.06);
  --border2:     rgba(139,154,107,.18);
  --text:        #b8b5aa;
  --text-bright: #e8e4d9;
  --muted:       #8d8a7c;   /* ≈4.6:1 на --bg, проходит WCAG AA */
  --footer-text: rgba(255,255,255,.42);
  --accent:      #8b9a6b;
  --accent-dim:  #5a6b42;
  --accent-glow: rgba(139,154,107,.12);
  --content-width: 920px;
  --page-gutter: 24px;
  --header-height: 56px;
  --section-space: 64px;
  --block-space: 32px;
  --card-padding: 24px;
  --control-gap: 12px;
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 17px;
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.wrap {
  width: 100%;
  max-width: var(--content-width);
  margin-inline: auto;
  padding-inline: var(--page-gutter);
}
.mono { font-family: var(--font-mono); }

/* Skip-link */
.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 300;
  padding: 10px 16px;
  background: var(--accent);
  color: #000;
  font: 700 .75rem/1 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
}
.skip-link:focus-visible { top: 12px; }

/* Фокус */
a:focus-visible,
button:focus-visible,
summary:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Шапка */
header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 200;
  background: rgba(12,12,10,.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
nav {
  height: var(--header-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-bright);
}
.logo-mark {
  width: 28px; height: 28px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--accent-dim);
  color: var(--accent);
  font: 700 10px/1 var(--font-mono);
  letter-spacing: .05em;
}
.logo-text {
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.2;
}
.logo-text span {
  display: block;
  font-size: .72rem;
  font-weight: 400;
  letter-spacing: .1em;
  color: var(--muted);
}
.nav-btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 8px 16px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  font: 700 .7rem/1 var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s, background-color .15s, border-color .15s;
}
.nav-btn:hover {
  background: var(--accent-glow);
  border-color: var(--accent);
}
.nav-btn--solid {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
}
.nav-btn--solid:hover { background: #a3b582; border-color: #a3b582; }

/* Футер */
footer {
  background: #080806;
  border-top: 1px solid var(--border);
  padding: 24px var(--page-gutter);
  text-align: center;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--footer-text);
  letter-spacing: .08em;
  text-transform: uppercase;
}
footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}
footer a:hover { color: var(--text-bright); }
.footer-links {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
}
.footer-hits { margin-top: 14px; line-height: 0; }
.footer-hits img { height: 20px; opacity: .8; transition: opacity .15s; }
.footer-hits img:hover { opacity: 1; }
.footer-visits {
  margin-top: 12px;
  font-size: .68rem;
  color: rgba(255,255,255,.28);
  letter-spacing: .06em;
}
.footer-visits span { color: var(--footer-text); font-weight: 500; }

/* Анимация появления (работает только при включённом JS) */
.js .fi { opacity: 1; transform: none; }
.js .fi.on { opacity: 1; transform: none; }

/* Бегущий солдат: спрайт 8 кадров по 144×168 (пропорция 6:7).
   Размер задаётся одной переменной --runner-w, всё остальное считается от неё. */
.runner {
  --runner-w: 96px;
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 150;            /* под шапкой (200), над контентом */
  width: var(--runner-w);
  height: calc(var(--runner-w) * 7 / 6);
  background: url('images/soldier-run.png') 0 0 / calc(var(--runner-w) * 8) 100% no-repeat;
  pointer-events: none;
  will-change: transform;
  transform: translateX(var(--runner-x, 0px)) scaleX(var(--runner-dir, 1));
  transition: transform .12s linear;
}
.runner.is-running {
  animation: runner-frames .6s steps(8) infinite;
}
@keyframes runner-frames {
  to { background-position: calc(var(--runner-w) * -8) 0; }
}
@media (max-width: 640px) { .runner { --runner-w: 60px; } }
@media (prefers-reduced-motion: reduce) { .runner { display: none; } }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .fi { opacity: 1; transform: none; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (max-width: 640px) {
  :root {
    --page-gutter: 16px;
    --section-space: 48px;
    --block-space: 24px;
    --card-padding: 20px;
  }
}
