/* ============================================================
   layout.css — контейнеры, шапка, подвал, сетки
   ============================================================ */

.container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

.container.narrow {
  max-width: 640px;
}

.site-main {
  flex: 1 0 auto;
  padding-bottom: 48px;
}

/* --- Секции --- */
.section {
  padding: var(--section-py) 0;
}

.section + .section {
  padding-top: 0;
}

.section:first-child {
  padding-top: 32px;
}

/* ============================================================
   Шапка
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  background: rgba(10, 10, 10, 0.85);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 50;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 14px 24px;
}

/* Логотип-знак */
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--fg);
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.logo:hover {
  color: var(--fg);
}

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: var(--accent);
  color: #000;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.logo-text {
  color: var(--fg);
}

/* Меню */
.nav {
  display: flex;
  gap: 4px;
  margin-left: 8px;
  flex-wrap: wrap;
}

.nav a {
  color: var(--fg-2);
  font-size: 14px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  transition: color 0.15s ease, background 0.15s ease;
}

.nav a:hover {
  color: var(--fg);
  background: var(--bg-2);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Бургер */
.burger {
  display: none;
  background: none;
  border: 0;
  cursor: pointer;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  margin-left: auto;
}

.burger span {
  width: 22px;
  height: 2px;
  background: var(--fg);
  display: block;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.burger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.burger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}
.burger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

/* ============================================================
   Подвал
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 56px 0 24px;
  margin-top: 80px;
  flex-shrink: 0;
  background: var(--bg);
}

.footer-inner {
  display: grid;
  grid-template-columns: 1.2fr 1.5fr;
  gap: 48px;
  align-items: start;
}

.footer-brand .logo {
  margin-bottom: 12px;
}

.footer-brand p {
  max-width: 320px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.footer-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.footer-inner ul {
  list-style: none;
  padding: 0;
}

.footer-inner li {
  margin: 8px 0;
  font-size: 14px;
}

.footer-inner li a {
  color: var(--fg-2);
}

.footer-inner li a:hover {
  color: var(--accent);
}

.footer-bottom {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding-top: 32px;
  margin-top: 32px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   Сетки
   ============================================================ */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

/* ============================================================
   Статистика (новая — в одну строку)
   ============================================================ */
.stats-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 16px;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}

.stat-inline {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
}

.stat-inline .stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.02em;
}

.stat-inline .stat-label {
  color: var(--muted);
  font-size: 14px;
}

.stat-sep {
  color: var(--border-2);
  font-size: 18px;
}

/* Старая сетка — оставляем для внутренних страниц */
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-top: 32px;
}

.stats-small {
  grid-template-columns: repeat(4, 1fr);
  margin: 24px 0;
}

/* ============================================================
   Медиа
   ============================================================ */
@media (max-width: 900px) {
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 32px;
  }
}

@media (max-width: 800px) {
  .container {
    padding: 0 16px;
  }

  .header-inner {
    padding: 12px 16px;
    gap: 12px;
  }

  .nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-2);
    flex-direction: column;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    margin-left: 0;
    gap: 4px;
    z-index: 40;
  }

  .nav.open {
    display: flex;
  }

  .nav a {
    padding: 12px 12px;
    font-size: 15px;
  }

  .burger {
    display: flex;
  }

  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }

  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-small {
    grid-template-columns: repeat(2, 1fr);
  }

  .footer-cols {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .header-actions .btn-ghost,
  .header-actions .btn-primary {
    padding: 8px 12px;
    font-size: 13px;
  }

  .logo-text {
    display: none;
  }

  .stats-row {
    gap: 12px;
    padding: 16px 0;
  }

  .stat-inline .stat-num {
    font-size: 18px;
  }

  .stat-inline .stat-label {
    font-size: 13px;
  }
}

@media (max-width: 480px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .header-actions {
    gap: 6px;
  }
}