/* ============================================
   БАЗОВЫЕ СТИЛИ И СБРОС
   ============================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ============================================
   ЦВЕТОВАЯ СХЕМА ECS
   ============================================ */
:root {
  --ecs-deep: #0a2a44;
  --ecs-mid: #1e4a76;
  --ecs-light: #eef2f8;
  --ecs-accent: #3b82f6;
  --ecs-text: #1e293b;
  --ecs-text-light: #475569;
  --ecs-border: #cbd5e1;
  --ecs-white: #ffffff;
}

/* ============================================
   ОСНОВНАЯ СТРУКТУРА СТРАНИЦЫ (Flex-схема)
   ============================================ */
html {
  height: 100%;
}

/* Объединённый body — убраны дублирование и лишний html/body блок */
body {
  font-family: 'Segoe UI', 'Arial', sans-serif;
  background: #f0f4f8;
  color: #1e2a3e;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  padding: 0;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.container {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
}

/* ============================================
   ШАПКА (HEADER) — ДЕСКТОП
   ============================================ */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--ecs-white);
  border-bottom: 1px solid var(--ecs-border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.02);
}

.logo {
  font-size: 26px;
  font-weight: 700;
  color: var(--ecs-deep);
  letter-spacing: -0.5px;
  font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
}

.logo .subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--ecs-text-light);
  letter-spacing: 1px;
  margin-top: 4px;
  font-family: 'Montserrat', 'Segoe UI', Arial, sans-serif;
}

/* ============================================
   НАВИГАЦИЯ
   ============================================ */
.nav-link {
  text-decoration: none;
  color: var(--ecs-text);
  font-weight: 600;
  font-size: 15px;
  padding: 6px 0;
  transition: color 0.2s, background 0.2s, padding 0.2s;
  border-bottom: 2px solid transparent;
  border-radius: 40px;
}

.nav-link:hover {
  color: var(--ecs-accent);
  border-bottom-color: var(--ecs-accent);
}

/* Активная кнопка — тёмно-синяя таблетка как у переключателя языков */
.nav-link.active {
  background: var(--ecs-deep);
  color: var(--ecs-white);
  border-bottom-color: transparent;
  border-radius: 40px;
  padding: 4px 14px;
}

/* ============================================
   ПЕРЕКЛЮЧАТЕЛЬ ЯЗЫКОВ
   ============================================ */
.lang-link {
  text-decoration: none;
  padding: 6px 16px;
  border-radius: 40px;
  color: var(--ecs-deep);
  font-weight: 700;
  font-size: 13px;
  transition: background 0.2s, color 0.2s;
}

.lang-link.active {
  background: var(--ecs-deep);
  color: var(--ecs-white);
}

/* ============================================
   ОКНА (WINDOWS)
   ============================================ */
.window-content {
  display: none;
  flex: 1;
  padding: 48px 0 64px;
  animation: fadeIn 0.25s ease;
}

.window-content.active {
  display: block;
}

/* Стартовая страница — особое поведение (flex + центрирование) */
#window-home.window-content.active {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
}

/* Убран избыточный блок перечисления окон — display:block уже задан выше */

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ============================================
   ЗАГОЛОВКИ И ТЕКСТ
   ============================================ */
h1 {
  font-size: 38px;
  font-weight: 700;
  color: var(--ecs-deep);
  margin-bottom: 24px;
  letter-spacing: -0.5px;
}

h2 {
  font-size: 26px;
  font-weight: 600;
  color: var(--ecs-mid);
  margin: 32px 0 16px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--ecs-light);
}

h3 {
  font-size: 20px;
  font-weight: 600;
  color: var(--ecs-accent);
  margin: 24px 0 12px;
}

/* ============================================
   КАРТОЧКИ И КОЛОНКИ
   ============================================ */
.card {
  background: var(--ecs-white);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--ecs-border);
  transition: box-shadow 0.2s;
}

.card:hover {
  box-shadow: 0 8px 20px rgba(0,0,0,0.05);
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
}

/* ============================================
   ФОРМЫ
   ============================================ */
form {
  background: var(--ecs-white);
  padding: 28px;
  border-radius: 20px;
  border: 1px solid var(--ecs-border);
  margin: 24px 0;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  margin-top: 14px;
  color: var(--ecs-text);
}

input, textarea, select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--ecs-border);
  font-size: 15px;
  font-family: inherit;
  transition: 0.2s;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--ecs-accent);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.2);
}

textarea {
  min-height: 100px;
  resize: vertical;
}

.submit {
  margin-top: 20px;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 40px;
  background: var(--ecs-accent);
  color: white;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.submit:hover {
  background: var(--ecs-mid);
}

.small-note {
  font-size: 12px;
  color: var(--ecs-text-light);
  margin-top: 12px;
  text-align: center;
}

/* ============================================
   КОНТАКТЫ (СТРАНИЦА)
   ============================================ */
.contact-info {
  background: var(--ecs-white);
  border-radius: 20px;
  padding: 24px;
  border: 1px solid var(--ecs-border);
}

#window-contacts .two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

/* ============================================
   СТАРТОВАЯ СТРАНИЦА — ЭМБЛЕМА
   ============================================ */
#window-home {
  flex: 1;
  min-height: 0;
}

#window-home img {
  max-width: 45%;
  max-height: 55%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* ============================================
   ПОДВАЛ (FOOTER) — ПРИЖАТ К НИЗУ
   ============================================ */
footer {
  background: var(--ecs-deep);
  color: #cbd5e1;
  padding: 10px 24px 8px;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
}

footer h3 {
  color: var(--ecs-white);
  margin-bottom: 4px;
  font-size: 15px;
}

.phone-link {
  color: #2dd4bf;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.email-link {
  color: #cbd5e1;
  font-size: 13px;
  text-decoration: none;
}

.footer-copyright {
  text-align: center;
  margin: 8px auto 0;
  font-size: 11px;
  border-top: 1px solid rgba(255,255,255,0.1);
  padding-top: 8px;
  max-width: 1200px;
}

/* ============================================
   АДАПТАЦИЯ: ПЛАНШЕТЫ (до 991px)
   ============================================ */
@media (max-width: 991px) {
  h1 { font-size: 32px; }
  h2 { font-size: 24px; }
  h3 { font-size: 18px; }
  .two-col { gap: 20px; }
  .window-content { padding: 32px 0 48px; }
  #window-home img { max-width: 50%; max-height: 50%; }
}

/* ============================================
   АДАПТАЦИЯ: МОБИЛЬНЫЕ (до 768px)
   ============================================ */
@media (max-width: 768px) {
  /* Шапка */
  header > div:first-child {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding: 10px 16px !important;
  }

  header > div:first-child > div:first-child {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 8px !important;
    cursor: pointer;
  }

  header img[alt="ECS logo"] {
    height: 32px !important;
    width: auto;
  }

  header .logo {
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    text-align: left !important;
  }

  header .logo .subtitle {
    font-size: 8px !important;
    font-weight: 400 !important;
    margin-top: 3px !important;
    text-align: left !important;
    display: block !important;
  }

  header > div:first-child > div:last-child {
    display: flex !important;
    flex-direction: row !important;
    gap: 6px !important;
    padding: 4px !important;
    flex-shrink: 0 !important;
  }

  header > div:first-child > div:last-child a {
    padding: 4px 10px !important;
    font-size: 11px !important;
  }

  /* Меню (перенос по строкам, плашка по размеру текста) */
  nav {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 6px 10px !important;
    justify-content: flex-start !important;
    padding: 8px 0 !important;
  }

  .nav-link {
    display: inline-block !important;
    padding: 4px 10px !important;
    font-size: 13px !important;
    text-align: left !important;
    border-bottom: none !important;
  }

  /* Контент */
  .window-content {
    padding: 24px 0 32px;
  }

  h1 { font-size: 28px; }
  h2 { font-size: 20px; }
  .two-col { grid-template-columns: 1fr !important; gap: 20px !important; }

  /* Стартовая страница */
  #window-home img {
    max-width: 60%;
    max-height: 45%;
  }

  /* Подвал */
  footer {
    padding: 8px 16px 6px;
    margin-top: 0;
  }

  .footer-grid {
    grid-template-columns: 1fr !important;
    gap: 2px !important;
    text-align: center !important;
  }

  .footer-grid .left-column,
  .footer-grid .right-column {
    display: flex;
    flex-direction: column;
    gap: 0;
  }

  .footer-grid .line-1,
  .footer-grid .line-2,
  .footer-grid .line-3 {
    margin: 0;
    padding: 0;
  }

  footer h3 {
    margin-bottom: 2px !important;
    font-size: 13px !important;
  }

  .footer-copyright {
    margin-top: 6px;
    padding-top: 6px;
    font-size: 10px;
  }

  .phone-link { font-size: 14px !important; }
  .email-link { font-size: 12px !important; }

  /* Контакты */
  #window-contacts .two-col { display: block !important; }
  #window-contacts .contact-info { margin-bottom: 20px; }
}

/* ============================================
   АДАПТАЦИЯ: МАЛЕНЬКИЕ ТЕЛЕФОНЫ (до 480px)
   ============================================ */
@media (max-width: 480px) {
  h1 { font-size: 24px; }
  h2 { font-size: 18px; }
  .nav-link { font-size: 12px !important; }
  #window-home img { max-width: 70%; max-height: 40%; }
  .phone-link { font-size: 14px !important; }
  .email-link { font-size: 11px !important; }
  footer p { font-size: 11px; }
  .footer-copyright { font-size: 9px; }
}

/* ============================================
   АДАПТАЦИЯ: САМЫЕ МАЛЕНЬКИЕ (до 375px)
   ============================================ */
@media (max-width: 375px) {
  header .logo { font-size: 12px !important; }
  header .logo .subtitle { font-size: 7px !important; }
  header img[alt="ECS logo"] { height: 28px !important; }
  .nav-link { font-size: 11px !important; }
  #window-home img { max-width: 80%; max-height: 35%; }
  .phone-link { font-size: 13px !important; }
  .email-link { font-size: 10px !important; }
  .contact-info p { font-size: 12px; }
}
