*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Arial', sans-serif;
  color: #333;
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;

  background-color: #f5f5f5;

  background-image: url('/static/img/background.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

a { text-decoration: none; color: inherit; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

:root {
  --primary: #0077cc;
  --primary-light: #66aaff;
  --accent: #ff6b6b;
  --bg: #fff;
  --text: #333;
  --muted: #777;
  --radius: 5px;
  --shadow: 0 4px 12px rgba(0,0,0,0.1);
  --spacing: 1rem;
  --header-h: 55px;
  --text-color: #222;
  --logo: #4CAF50;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1c;
    --text: #f5f5f5;
    --muted: #aaa;
  }
  body { background: var(--bg); color: var(--text); }
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing);
}

.main-content {
  padding-top: calc(var(--header-h) + var(--spacing));
  padding-bottom: var(--spacing);
}

.site-header {
  position: fixed;
  top: 0;
  width: 100%;
  height: var(--header-h);
  background: rgba(255,255,255,0.9);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  z-index: 100;
  transition: background 0.3s, box-shadow 0.3s;
}

body.scrolled .site-header {
  background: rgba(255,255,255,0.95);
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);
  transition: color 0.3s;
}

.logo:hover {
  color: var(--primary-light);
}

.nav-toggle {
  display: none;
  font-size: 1.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--primary);
  transition: transform 0.2s;
}

.nav-toggle:active {
  transform: scale(0.9);
}

nav.main-nav { position: relative; }

.nav-list {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  z-index: 99;
  transition: all 0.3s ease;
}

.nav-list a {
  padding: .5rem .5rem;
  text-align: center;
  border-radius: var(--radius);
  transition: background .3s, color .3s;
  color: var(--text);
  font-weight: 500;
}

.nav-list a:hover {
  background: var(--primary-light);
  color: #fff;
}

.cta-button {
  background: var(--accent);
  color: #fff !important;
  padding: .5rem 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .2s, background .3s;
}

.cta-button:hover {
  transform: translateY(-2px);
  background: #ff5252;
}

.messages {
  margin: var(--spacing) auto;
  padding: var(--spacing);
  background: #ffeeba;
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}

.site-footer {
  background: var(--bg);
  border-top: 1px solid #eaeaea;
  padding: var(--spacing) 0;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
}

.footer-nav ul {
  display: flex;
  justify-content: center;
  gap: var(--spacing);
  margin-bottom: .5rem;
}

.footer-nav a:hover {
  color: var(--primary);
}

.logo-block {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-right: 1.5rem;
  margin-left: -0.5rem;
}

.logo-img {
  height: 60px;
  width: auto;
}

.logo-text {
  font-size: 1.2rem;
  font-weight: 400;
  color: #3a7bdb;
  white-space: nowrap;
}

/* --- Мобильная версия --- */
@media (max-width: 768px) {
  nav.main-nav {
    position: absolute;
    top: var(--header-h);
    left: 0;
    width: 100%;
  }

  .nav-list {
    display: none;
    flex-direction: column;
    width: 100%;
    background: var(--bg);
    padding: var(--spacing) 0;
    box-shadow: var(--shadow);
  }

  .nav-list.active {
    display: flex;
    animation: slideDown 0.3s ease forwards;
  }

  @keyframes slideDown {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
  }

  .nav-toggle { display: block; }
}

@media (max-width: 600px) {
  .logo-img {
    height: 32px;
  }

  .logo-text {
    font-size: 1rem;
  }

  .nav-list a {
    font-size: 0.9rem;
  }
}

@media (max-width: 600px) {
  .footer-nav ul {
    flex-direction: column;
    gap: 0.5rem;
  }
}

@media (max-width: 480px) {
  .container { padding: 0 0.5rem; }
}

/* --- Фикс шапки в одну линию на десктопе --- */
.header-content {
  flex-wrap: nowrap; /* запрет переноса */
  gap: 1rem; /* расстояние между логотипом и меню */
}

.nav-list {
  flex-wrap: nowrap; /* ссылки не переносятся */
}

.nav-list a,
.nav-list .cta-button {
  white-space: nowrap; /* запрет переноса текста */
}

/* Пусть кнопки прижимаются вправо */
.main-nav {
  flex-grow: 1;
}

.nav-list {
  justify-content: flex-end;
}

/* --- Мобильная версия остаётся прежней --- */
@media (max-width: 992px) {
  .header-content {
    flex-wrap: wrap;
  }
}
