/* ============================================
   ОСНОВНЫЕ СТИЛИ ФУТЕРА - Premium & Trust
   ============================================ */

.site-footer {
  background: var(--gradient-primary);
  color: var(--text-white);
  margin-top: 5rem;
  position: relative;
  overflow: hidden;
  width: 100vw !important;
  margin-left: calc(-50vw + 50%) !important;
  margin-right: calc(-50vw + 50%) !important;
}

.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.02)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.02)"/><circle cx="50" cy="10" r="0.5" fill="rgba(255,255,255,0.01)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
  pointer-events: none;
}

.footer-content {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  padding: 60px 0 40px;
  position: relative;
  z-index: 1;
}

/* ============================================
   СЕКЦИИ ФУТЕРА
   ============================================ */

.footer-section {
  display: flex;
  flex-direction: column;
}

.footer-about {
  max-width: 300px;
}

.footer-logo {
  display: inline-flex;
  align-items: center;
  margin-bottom: 20px;
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

.footer-logo:hover {
  opacity: 0.9;
}

.footer-logo-img {
  height: 40px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
}

.footer-description {
  line-height: var(--leading-relaxed);
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 25px;
  font-size: var(--text-sm);
}

.footer-description-wrap {
  position: relative;
}

.footer-description-toggle {
  display: none;
}

/* Mobile: keep footer short by default, expand on tap */
@media (max-width: 768px) {
  .footer-description-wrap .footer-description {
    margin-bottom: 10px;
    overflow: hidden;
    max-height: 3.9em; /* ~3 lines */
    transition: max-height var(--transition-normal);
  }

  .footer-description-wrap.is-expanded .footer-description {
    max-height: min(75vh, 560px);
  }

  .footer-description-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    position: relative;
    z-index: 2;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.10);
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.85rem;
    padding: 8px 12px;
    border-radius: var(--radius-full);
    cursor: pointer;
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    transition: transform var(--transition-fast), background var(--transition-fast), border-color var(--transition-fast);
    margin: 0 auto 14px; /* center by default */
  }

  .footer-description-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
  }

  .footer-description-toggle__icon {
    transition: transform var(--transition-fast);
  }

  .footer-description-wrap.is-expanded .footer-description-toggle__icon {
    transform: rotate(180deg);
  }

  /* If you prefer right-aligned toggle on mobile, uncomment:
  .footer-description-toggle { margin-left: auto; margin-right: 0; }
  */
}

/* ============================================
   СОЦИАЛЬНЫЕ ССЫЛКИ
   ============================================ */

.social-links {
  display: flex;
  gap: 15px;
}

.social-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-full);
  color: var(--text-white);
  text-decoration: none;
  transition: all var(--transition-normal);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.social-link:hover {
  background: var(--accent-color);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(212, 175, 55, 0.35);
  color: var(--primary-dark);
}

.social-link i {
  font-size: 16px;
}

/* ============================================
   ЗАГОЛОВКИ СЕКЦИЙ
   ============================================ */

.footer-title {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--accent-color);
  position: relative;
  padding-bottom: 10px;
  font-family: var(--font-accent);
}

.footer-title::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  width: 30px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-color), transparent);
  border-radius: 1px;
}

/* ============================================
   НАВИГАЦИОННЫЕ СПИСКИ
   ============================================ */

.footer-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-nav li {
  margin-bottom: 12px;
}

.footer-nav a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: all var(--transition-normal);
  position: relative;
  padding-left: 15px;
  font-family: var(--font-secondary);
}

.footer-nav a::before {
  content: "→";
  position: absolute;
  left: 0;
  opacity: 0;
  transform: translateX(-10px);
  transition: all var(--transition-normal);
  color: var(--accent-color);
}

.footer-nav a:hover {
  color: var(--accent-color);
  padding-left: 20px;
}

.footer-nav a:hover::before {
  opacity: 1;
  transform: translateX(0);
}

/* ============================================
   КОНТАКТНАЯ ИНФОРМАЦИЯ
   ============================================ */

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.8);
  font-family: var(--font-secondary);
}

.contact-item i {
  width: 20px;
  color: var(--accent-color);
  font-size: 16px;
}

.contact-item a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  transition: color var(--transition-normal);
}

.contact-item a:hover {
  color: var(--accent-color);
}

/* ============================================
   НИЖНЯЯ ЧАСТЬ ФУТЕРА
   ============================================ */

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding: 25px 0;
  position: relative;
  z-index: 1;
}

.footer-bottom-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
}

.copyright {
  margin: 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: var(--text-xs);
  font-family: var(--font-secondary);
}

.footer-bottom-links {
  display: flex;
  gap: 25px;
  flex-wrap: wrap;
}

.footer-bottom-links a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: var(--text-xs);
  transition: color var(--transition-normal);
  font-family: var(--font-secondary);
}

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

/* ============================================
   КНОПКА "НАВЕРХ"
   ============================================ */

.back-to-top {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 50px;
  height: 50px;
  background: var(--gradient-warm);
  color: var(--primary-dark);
  border: none;
  border-radius: var(--radius-full);
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  transition: all var(--transition-normal);
  box-shadow: var(--shadow-lg);
  z-index: var(--z-sticky);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.back-to-top:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 30px rgba(212, 175, 55, 0.4);
}

.back-to-top.show {
  display: flex;
  animation: fadeInUp 0.3s ease;
}

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

/* ============================================
   АДАПТИВНОСТЬ
   ============================================ */

@media (max-width: 1024px) {
  .footer-content {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px;
    padding: 50px 0 30px;
  }

  .footer-about {
    max-width: none;
  }
}

@media (max-width: 768px) {
  .footer-content {
    grid-template-columns: 1fr;
    gap: 40px;
    padding: 40px 0 30px;
    text-align: center;
  }

  .footer-title::after {
    left: 50%;
    transform: translateX(-50%);
  }

  .footer-nav a::before {
    display: none;
  }

  .footer-nav a:hover {
    padding-left: 15px;
  }

  .footer-bottom-content {
    flex-direction: column;
    text-align: center;
    gap: 15px;
  }

  .footer-bottom-links {
    justify-content: center;
  }

  .contact-info {
    align-items: center;
  }

  .social-links {
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .footer-content {
    padding: 30px 0 20px;
    gap: 30px;
  }

  .footer-logo {
    justify-content: center;
  }

  .footer-logo-img {
    height: 32px;
    max-width: 160px;
  }

  .social-link {
    width: 35px;
    height: 35px;
  }

  .social-link i {
    font-size: 14px;
  }

  .back-to-top {
    bottom: 20px;
    right: 20px;
    width: 45px;
    height: 45px;
    font-size: 16px;
  }

  .footer-bottom-links {
    flex-direction: column;
    gap: 10px;
  }

  .site-footer .container {
    padding: 0 15px;
  }
}

/* ============================================
   ТЕМНАЯ ТЕМА
   ============================================ */

@media (prefers-color-scheme: dark) {
  .site-footer {
    background: linear-gradient(
      135deg,
      var(--primary-dark) 0%,
      var(--primary-color) 100%
    );
  }

  .footer-description,
  .footer-nav a,
  .contact-item {
    color: rgba(255, 255, 255, 0.75);
  }

  .copyright,
  .footer-bottom-links a {
    color: rgba(255, 255, 255, 0.6);
  }

  .social-link {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.1);
  }

  .social-link:hover {
    background: var(--accent-color);
  }
}

/* ============================================
   АНИМАЦИИ ПРИ ЗАГРУЗКЕ
   ============================================ */

.footer-section {
  animation: fadeInUp 0.6s ease forwards;
  opacity: 0;
}

.footer-section:nth-child(1) {
  animation-delay: 0.1s;
}

.footer-section:nth-child(2) {
  animation-delay: 0.2s;
}

.footer-section:nth-child(3) {
  animation-delay: 0.3s;
}

.footer-section:nth-child(4) {
  animation-delay: 0.4s;
}

/* ============================================
   УЛУЧШЕННАЯ ДОСТУПНОСТЬ
   ============================================ */

@media (prefers-reduced-motion: reduce) {
  .footer-section,
  .social-link,
  .footer-nav a,
  .back-to-top {
    animation: none;
    transition: none;
  }
}

/* ============================================
   ВЫСОКИЙ КОНТРАСТ
   ============================================ */

@media (prefers-contrast: high) {
  .site-footer {
    background: var(--bg-dark);
    border-top: 3px solid var(--accent-color);
  }

  .footer-description,
  .footer-nav a,
  .contact-item,
  .copyright,
  .footer-bottom-links a {
    color: var(--text-white);
  }

  .footer-title,
  .footer-logo,
  .contact-item i {
    color: var(--accent-color);
  }

  .social-link {
    background: var(--text-white);
    color: var(--bg-dark);
    border: 2px solid var(--accent-color);
  }

  .social-link:hover {
    background: var(--accent-color);
    color: var(--bg-dark);
  }

  .back-to-top {
    background: var(--accent-color);
    color: var(--bg-dark);
    border: 2px solid var(--accent-color);
  }

  .back-to-top:hover {
    background: var(--bg-dark);
    color: var(--accent-color);
  }
}

/* ============================================
   ПЕЧАТЬ
   ============================================ */

@media print {
  .site-footer {
    background: none !important;
    color: var(--text-primary) !important;
    box-shadow: none !important;
  }

  .social-links,
  .back-to-top {
    display: none !important;
  }

  .footer-nav a,
  .contact-item a {
    color: var(--text-primary) !important;
    text-decoration: underline !important;
  }

  .footer-content {
    padding: 20px 0 !important;
  }

  .footer-title {
    color: var(--text-primary) !important;
  }

  .footer-title::after {
    background: var(--text-primary) !important;
  }
}

/* ============================================
   ФОКУС ДЛЯ КЛАВИАТУРНОЙ НАВИГАЦИИ
   ============================================ */

.footer-nav a:focus,
.social-link:focus,
.footer-bottom-links a:focus,
.contact-item a:focus,
.back-to-top:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

/* ============================================
   ДОПОЛНИТЕЛЬНЫЕ УТИЛИТЫ
   ============================================ */

.footer-section.fade-in {
  opacity: 1;
}

.footer-section.slide-up {
  transform: translateY(0);
}

/* ============================================
   СКРЫТИЕ ЭЛЕМЕНТОВ ДЛЯ SCREEN READERS
   ============================================ */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ============================================
   ОПТИМИЗАЦИЯ ПРОИЗВОДИТЕЛЬНОСТИ
   ============================================ */

.social-link,
.footer-nav a,
.footer-bottom-links a,
.contact-item a,
.back-to-top {
  will-change: transform, color, background;
}

/* ============================================
   ПОДДЕРЖКА LIGHT/DARK РЕЖИМОВ
   ============================================ */

@media (prefers-color-scheme: light) {
  .site-footer {
    background: var(--gradient-primary);
  }

  .footer-description,
  .footer-nav a,
  .contact-item {
    color: rgba(255, 255, 255, 0.85);
  }

  .copyright,
  .footer-bottom-links a {
    color: rgba(255, 255, 255, 0.7);
  }
}
