/* ===== CSS ПЕРЕМЕННЫЕ ===== */
:root {
  /* ЦВЕТА */
  --color-bg: #FDFBF7;
  --color-text: #0A2342;
  --color-accent: #C5A059;
  --color-secondary: #1C2E4A;
  --color-white: #FFFFFF;
  --color-gray: #6B7280;
  --color-gray-light: #E5E7EB;

  /* РАЗМЕРЫ */
  --container: 1200px;
  --header-height: 56px;
  --section-padding: 80px;

  /* ТЕНИ */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 20px rgba(10, 35, 66, 0.08);
  --shadow-lg: 0 8px 30px rgba(10, 35, 66, 0.12);

  /* АНИМАЦИИ */
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-height);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-top: var(--header-height);
}

main {
  display: block;
}

/* КОНТЕЙНЕР */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 20px;
}

/* СЕКЦИИ */
.section {
  padding: 60px 0;
}

#about,
#requisites {
  background-color: var(--color-secondary);
}

/* Секция "О компании": уменьшаем верхний внутренний отступ */
#about.section {
  padding-top: clamp(30px, 5vw, 50px);
}

.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 40px;
  color: var(--color-accent);
  line-height: 1.2;
  overflow-wrap: break-word;
}

.section-title.legal-title {
  line-height: 1.2;
}

.section-title.legal-title span {
  display: block;
  white-space: nowrap;
}

/* Секция О компании: уменьшаем верхний отступ вдвое и добавляем отступ снизу */
#about .section-title {
  margin-top: 0.415em; /* половина стандартного h2 margin-top (~0.83em) */
  margin-bottom: clamp(28px, 4vw, 48px);
}
#about .about-text { margin-top: 0; }

/* ЗАГОЛОВКИ */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 1rem;
  font-size: 1.5rem;
  color: var(--color-accent);
  overflow-wrap: break-word;
}

/* ТЕКСТ */
p {
  margin-bottom: 1.5rem;
  font-size: 1.125rem;
  line-height: 1.7;
  overflow-wrap: break-word;
}

/* ССЫЛКИ */
a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
  overflow-wrap: break-word;
}

a:hover {
  color: var(--color-secondary);
}

/* КНОПКИ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 32px;
  background-color: var(--color-accent);
  color: var(--color-white);
  border: 2px solid var(--color-accent);
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
  text-decoration: none;
}

.btn:hover {
  background-color: var(--color-secondary);
  color: var(--color-white);
  border-color: var(--color-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-glow {
  position: relative;
  overflow: hidden;
}

.btn-glow::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.12) 50%, transparent 70%);
  transform: rotate(45deg);
  transition: transform 0.6s;
}

.btn-glow:hover::after {
  transform: rotate(45deg) translate(20%, 20%);
}

/* АНИМАЦИИ */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  opacity: 0;
  transform: translateY(20px);
}

.visible {
  opacity: 1;
  transform: translateY(0);
  animation: fadeInUp 0.6s ease-out forwards;
}

.card-hover {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card-hover:hover {
  transform: translateY(-5px);
  box-shadow: 0 20px 40px rgba(10, 35, 66, 0.15);
}

/* ===== НАВИГАЦИЯ (MOBILE) ===== */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
  z-index: 1000;
  height: var(--header-height);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.logo {
  height: 56px;
  width: auto;
  display: block;
}

.nav-menu {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: 100%;
  background-color: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow-md);
  padding: 20px;
  display: none;
  flex-direction: column;
  gap: 15px;
  z-index: 999;
}

.nav-menu.active {
  display: flex;
}

.nav-menu a {
  color: var(--color-text);
  font-weight: 500;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-gray-light);
}

.nav-menu a:hover {
  color: var(--color-accent);
}

.btn-nav {
  background-color: var(--color-accent);
  color: var(--color-white) !important;
  border-radius: 6px;
  padding: 10px 20px !important;
  margin-top: 10px;
}

.menu-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-text);
  padding: 5px;
}

/* ===== БЛОКИ ТЕКСТ-ИЗОБРАЖЕНИЕ (MOBILE) ===== */
.text-image-block {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-bottom: 40px;
}

.text-content {
  flex: 1;
}

.image-content {
  flex: 1;
}

.image-content img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  display: block;
}

.text-image-block.reverse {
  flex-direction: column-reverse;
}

/* Mobile order override for services second block */
.mobile-text-first .text-content {
  order: 1;
}

.mobile-text-first .image-content {
  order: 2;
}

.subtitle {
  font-size: 1.75rem;
  text-align: center;
  margin: 60px 0 40px;
  color: var(--color-secondary);
  font-weight: 600;
  overflow-wrap: break-word;
}

.top-subtitle {
  margin-top: 10px;
  margin-bottom: 50px;
}

.services-title {
  display: block;
  width: 100%;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
  background-color: var(--color-secondary);
  color: var(--color-accent);
  padding: 12px 18px;
  border-radius: 12px;
  box-sizing: border-box;
}

/* ===== СТАТИСТИКА (MOBILE) ===== */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  margin: 40px 0;
}

.stat-block {
  background-color: var(--color-white);
  padding: 30px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  text-align: center;
  transition: transform var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.stat-block:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.stat-block h4 {
  font-size: 2rem;
  color: var(--color-accent);
  margin-bottom: 0;
}

.stat-block p {
  color: var(--color-gray);
  font-size: 1rem;
  margin-bottom: 0;
}

.stat-image {
  height: 120px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  margin-top: auto;
}

.stat-image img {
  max-height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
}

.image-placeholder {
  width: 80px;
  height: 80px;
  background-color: var(--color-gray-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  color: var(--color-accent);
}

/* ===== СПИСОК ОПРЕДЕЛЕНИЙ ===== */
.definition-title {
  text-align: center;
  margin: 60px 0 30px;
  color: var(--color-secondary);
}

.definition-list {
  list-style: none;
  max-width: 800px;
  margin: 0 auto 60px;
  color: var(--color-white);
}

.definition-list li {
  margin-bottom: 20px;
  padding-left: 30px;
  position: relative;
  font-size: 1.125rem;
  line-height: 1.7;
  color: var(--color-white);
}

.definition-list li::before {
  content: "•";
  color: var(--color-accent);
  font-size: 1.5rem;
  position: absolute;
  left: 0;
  top: -2px;
}

/* Заголовок блока преимуществ */
.advantage-title {
  text-align: center;
  margin: 60px 0 10px;
  padding-top: 30px;
  color: var(--color-accent);
}

.advantage-subtitle {
  color: var(--color-white);
}

/* ===== ФОРМУЛА УСПЕХА (MOBILE) ===== */
.formula-title {
  text-align: center;
}

.formula-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 30px;
  margin-top: 40px;
}

.formula-block {
  text-align: center;
  padding: 30px;
  background-color: var(--color-white);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  transition: all var(--transition);
}

.formula-block:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-lg);
}

.formula-block h4 {
  font-size: 1.5rem;
  color: var(--color-secondary);
  margin-bottom: 20px;
}

.formula-image {
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.formula-image img {
  height: 100%;
  width: auto;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

/* ===== ИНФОРМАЦИЯ ===== */
.info-text {
  max-width: 900px;
  margin: 0 auto;
  background-color: var(--color-white);
  padding: 40px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.info-link {
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid var(--color-gray-light);
}

.info-link a {
  font-weight: 600;
  word-break: normal;
}

/* ===== О КОМПАНИИ ===== */
.about-text {
  background-color: var(--color-white);
  color: var(--color-text);
  padding: 30px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  margin-top: 0;
}

/* ===== РЕКВИЗИТЫ ===== */
.requisites-text {
  max-width: 820px;
  margin: 0 auto;
  background-color: var(--color-white);
  color: var(--color-text);
  padding: 40px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  font-size: 1.125rem;
  line-height: 1.8;
}

.requisites-text p {
  margin-bottom: 15px;
}

/* ===== КОНТАКТЫ ===== */
.contacts-content {
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.contacts-list {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.contact-item {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.contact-label {
  font-weight: 600;
  color: var(--color-secondary);
}

.contact-value {
  font-size: 1.125rem;
  color: var(--color-text);
}

.map-placeholder {
  background-color: var(--color-gray-light);
  border-radius: 12px;
  padding: 60px 20px;
  text-align: center;
  color: var(--color-gray);
  box-shadow: var(--shadow-md);
}

/* ===== ФОРМА ===== */
.form-container {
  max-width: 600px;
  margin: 0 auto;
  background-color: var(--color-white);
  padding: 40px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group label {
  font-weight: 600;
  color: var(--color-secondary);
}

.form-group input,
.form-group textarea {
  padding: 15px;
  border: 2px solid var(--color-gray-light);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color var(--transition);
  background-color: var(--color-white);
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.submit-btn {
  background-color: var(--color-accent);
  color: var(--color-white);
  border: none;
  padding: 16px 40px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 10px;
}

.submit-btn:hover {
  background-color: var(--color-secondary);
  transform: translateY(-2px);
}

.privacy-notice {
  text-align: center;
  font-size: 0.875rem;
  color: var(--color-gray);
  margin-top: 20px;
}

/* ===== МОДАЛЬНОЕ ОКНО ===== */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
}

.modal.active {
  display: flex;
}

.modal-content {
  background-color: var(--color-white);
  border-radius: 12px;
  max-width: 800px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 40px;
  position: relative;
  box-shadow: var(--shadow-lg);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-gray);
  padding: 5px;
}

.modal-close:hover {
  color: var(--color-text);
}

.modal-text {
  margin: 30px 0;
}

.modal-text p {
  margin-bottom: 15px;
}

.modal-text ul {
  margin-left: 20px;
  margin-bottom: 20px;
}

.modal-text li {
  margin-bottom: 10px;
}

.modal-date {
  text-align: center;
  font-style: italic;
  color: var(--color-gray);
  margin-top: 40px;
  padding-top: 20px;
  border-top: 1px solid var(--color-gray-light);
}

.accept-btn {
  background-color: var(--color-accent);
  color: var(--color-white);
  border: none;
  padding: 15px 40px;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: block;
  margin: 30px auto 0;
  transition: background-color var(--transition);
}

.accept-btn:hover {
  background-color: var(--color-secondary);
}

/* ===== ФУТЕР ===== */
.footer {
  background-color: var(--color-secondary);
  color: var(--color-white);
  padding: 60px 0 30px;
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-logo-img {
  height: 100px;
  width: auto;
  margin-bottom: 20px;
}

.footer-logo p {
  color: rgba(255, 255, 255, 0.8);
  max-width: 300px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.footer-links a {
  color: rgba(255, 255, 255, 0.8);
  transition: color var(--transition);
}

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

.footer-contacts p {
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 10px;
}

.footer-contacts strong {
  color: var(--color-white);
}

.footer-bottom {
  padding-top: 30px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 20px;
  align-items: center;
  text-align: center;
}

.footer-bottom p {
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

.footer-privacy {
  color: var(--color-accent);
  font-size: 0.875rem;
}

/* ===== TOAST УВЕДОМЛЕНИЯ ===== */
#toast-container {
  position: fixed;
  bottom: 20px;
  left: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
  z-index: 3000;
  pointer-events: none;
}

.toast {
  width: 100%;
  max-width: 340px;
  background: var(--color-secondary);
  color: var(--color-white);
  padding: 14px 16px;
  border-radius: 10px;
  box-shadow: var(--shadow-lg);
  font-size: 0.95rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  transform: translateY(30px);
  opacity: 0;
  animation: toast-in 0.35s ease-out forwards;
  pointer-events: auto;
}

.toast.success { background: var(--color-accent); color: var(--color-white); }
.toast.error { background: #c0392b; }
.toast.info { background: var(--color-secondary); }

.toast__icon {
  font-size: 1.2rem;
  line-height: 1;
}

.toast__message {
  flex: 1;
}

.toast__close {
  background: none;
  border: none;
  color: inherit;
  font-size: 1rem;
  cursor: pointer;
  padding: 4px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes toast-out {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(20px); }
}

/* Mobile text safety: no hard word splitting, slightly smaller type */
@media (max-width: 767px) {
  .section-title,
  h1, h2, h3, h4, h5, h6,
  .subtitle,
  p,
  li,
  a {
    word-break: normal;
    overflow-wrap: normal;
    hyphens: manual;
  }

  .section-title,
  h1, h2, h3, h4, h5, h6,
  .subtitle {
    font-size: 1.35rem;
    line-height: 1.25;
  }

  .section-title.legal-title {
    font-size: clamp(0.9rem, 4.2vw, 1.2rem);
    line-height: 1.25;
  }

  .footer-tagline {
    white-space: nowrap;
    font-size: clamp(0.82rem, 4vw, 0.95rem);
    line-height: 1.2;
    max-width: 100%;
  }

  p,
  .definition-list li,
  .advantage-subtitle,
  .requisites-text,
  .contact-value {
    font-size: 1rem;
  }

  .services-title {
    padding: 10px 12px;
  }

  /* Allow long URLs to wrap on mobile without horizontal overflow */
  .info-link a {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
}

/* ===== MEDIA QUERIES: TABLET (768px+) ===== */
@media (min-width: 768px) {
  .container {
    padding: 0 30px;
  }

  .section {
    padding: 80px 0;
  }

  .services-title {
    padding: 14px 24px;
    border-radius: 14px;
    color: var(--color-white);
  }

  .section-title {
    font-size: 1.7rem;
    color: var(--color-accent);
  }

  h1, h2, h3, h4, h5, h6 {
    font-size: 1.7rem;
    color: var(--color-accent);
  }

  .nav-menu {
    position: static;
    display: flex !important;
    flex-direction: row;
    align-items: center;
    gap: 30px;
    padding: 0;
    background: transparent;
    box-shadow: none;
    width: auto;
  }

  .nav-menu a {
    border: none;
    padding: 0;
    color: var(--color-text);
    font-size: 1rem;
  }

  .btn-nav {
    background-color: var(--color-accent);
    color: var(--color-white) !important;
    padding: 10px 25px !important;
    border-radius: 6px;
    margin-top: 0;
  }

  .menu-btn {
    display: none;
  }

  .text-image-block {
    flex-direction: row;
    align-items: center;
    gap: 50px;
  }

  .text-image-block.reverse {
    flex-direction: row-reverse;
  }

  .mobile-text-first .text-content,
  .mobile-text-first .image-content {
    order: 0;
  }

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

  .formula-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .contacts-content {
    flex-direction: row;
    align-items: flex-start;
  }

  .about-text {
    padding: 40px;
  }

  .contacts-list {
    flex: 1;
  }

  .map-placeholder {
    flex: 1;
  }

  .footer-content {
    flex-direction: row;
    justify-content: space-between;
  }

  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    text-align: left;
  }

  #toast-container {
    left: auto;
    right: 20px;
  }
}

/* Tablet nav safety: keep burger menu to avoid overflow on narrow tablets */
@media (min-width: 768px) and (max-width: 1023px) {
  .nav-menu {
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow-md);
    padding: 20px;
    display: none !important;
    flex-direction: column;
    gap: 15px;
    z-index: 999;
  }

  .nav-menu.active {
    display: flex !important;
  }

  .nav-menu a {
    border-bottom: 1px solid var(--color-gray-light);
    padding: 10px 0;
    color: var(--color-text);
  }

  .btn-nav {
    padding: 10px 20px !important;
    margin-top: 10px;
  }

  .menu-btn {
    display: block;
  }
}

/* ===== MEDIA QUERIES: DESKTOP (1024px+) ===== */
@media (min-width: 1024px) {
  :root {
    --header-height: 72px;
    --section-padding: 100px;
  }

  .container {
    padding: 0 40px;
  }

  .section {
    padding: var(--section-padding) 0;
  }

  .services-title {
    padding: 16px 28px;
    border-radius: 16px;
    color: var(--color-white);
  }

  .section-title {
    font-size: 1.9rem;
    color: var(--color-accent);
  }

  h1, h2, h3, h4, h5, h6 {
    font-size: 1.9rem;
    color: var(--color-accent);
  }

  .logo {
    height: 72px;
  }

  .nav-menu {
    gap: 40px;
  }

  h1 { font-size: 2.4rem; }
  h2 { font-size: 2rem; }
  h3 { font-size: 1.7rem; }

  .text-image-block {
    gap: 80px;
  }

  .stat-block h4 {
    font-size: 2.5rem;
  }

  .form-container {
    padding: 60px;
  }
}

/* ===== MEDIA QUERIES: WIDE (1440px+) ===== */
@media (min-width: 1440px) {
  :root {
    --container: 1400px;
  }

  html {
    font-size: 18px;
  }

  .container {
    padding: 0 60px;
  }

  .services-title {
    padding: 18px 32px;
    border-radius: 18px;
    color: var(--color-white);
  }

  .section-title {
    font-size: 2.1rem;
    color: var(--color-accent);
  }

  h1, h2, h3, h4, h5, h6 {
    font-size: 2.1rem;
    color: var(--color-accent);
  }

  .text-image-block {
    gap: 100px;
  }

  .image-content img {
    border-radius: 16px;
  }

  .about-text {
    padding: 50px;
  }
}
