/* ============================================================================
   🎨 БУРСОЮЗ — ОБЩИЕ СТИЛИ (главная / контакты / внутренние страницы)
   Версия: 1.0 | Домен: bursoyuz.ru
   ============================================================================ */

/* ============================================================================
   1. ПЕРЕМЕННЫЕ И ТЕМЫ
   ============================================================================ */
:root {
  /* Бренд-цвета */
  --primary: #2E9CCA;
  --primary-rgb: 46, 156, 202;
  --primary-dark: #1E7A9E;
  
  /* Светлая тема (по умолчанию) */
  --bg: #F8FAFC;
  --surface: #FFFFFF;
  --text: #0F172A;
  --text-muted: #64748B;
  --border: rgba(226, 232, 240, 0.6);
  --glass: rgba(255, 255, 255, 0.75);
  
  /* Тени и эффекты */
  --shadow: 0 8px 32px rgba(var(--primary-rgb), 0.08);
  --shadow-hover: 0 12px 40px rgba(var(--primary-rgb), 0.14);
  --shadow-glow: 0 0 40px rgba(var(--primary-rgb), 0.15);
  
  /* Сеть и геология (для главной) */
  --network-node: rgba(var(--primary-rgb), 0.4);
  --network-line: rgba(var(--primary-rgb), 0.12);
  --geo-stroke: rgba(var(--primary-rgb), 0.2);
  
  /* Шрифты */
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Размеры и отступы */
  --radius: 16px;
  --radius-sm: 12px;
  --radius-lg: 24px;
}

/* Тёмная тема — переключение через [data-theme="dark"] на <html> */
[data-theme="dark"] {
  --bg: #0B1120;
  --surface: #111827;
  --text: #F1F5F9;
  --text-muted: #94A3B8;
  --border: rgba(51, 65, 85, 0.6);
  --glass: rgba(17, 24, 39, 0.8);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.5);
  --network-node: rgba(var(--primary-rgb), 0.65);
  --network-line: rgba(var(--primary-rgb), 0.18);
  --geo-stroke: rgba(var(--primary-rgb), 0.35);
}

/* ============================================================================
   2. БАЗОВЫЕ СТИЛИ (сброс, типографика, утилиты)
   ============================================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Заголовки */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  letter-spacing: -0.02em;
  line-height: 1.15;
  font-weight: 600;
  margin-bottom: 0.75em;
}

h1 { font-size: clamp(2.5rem, 6vw, 4.5rem); }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h3 { font-size: clamp(1.4rem, 3vw, 1.75rem); }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.1rem; }

/* Текст */
p { margin-bottom: 1rem; }
.text-muted-custom { color: var(--text-muted) !important; }
.text-primary { color: var(--primary) !important; }
.fw-bold { font-weight: 700 !important; }

/* Ссылки */
a { color: var(--primary); text-decoration: none; transition: 0.2s ease; }
a:hover { color: var(--primary-dark); }

/* Изображения */
img { max-width: 100%; height: auto; display: block; }

/* ============================================================================
   3. КОМПОНЕНТЫ ИНТЕРФЕЙСА (общие для всех страниц)
   ============================================================================ */

/* --- Прогресс скролла --- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--primary);
  width: 0%;
  z-index: 1000;
  transition: width 0.1s linear;
}

/* --- Навбар --- */
.navbar {
  background: rgba(248, 250, 252, 0.85) !important;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: 0.4s ease;
  padding: 0.75rem 0;
}
[data-theme="dark"] .navbar { background: rgba(11, 17, 32, 0.85) !important; }

.navbar-brand { font-weight: 700; font-size: 1.35rem; display: flex; align-items: center; }
.navbar-brand span { color: var(--primary); }
.navbar-brand img { max-height: 40px; }

.nav-link {
  font-weight: 500;
  color: var(--text-muted);
  transition: 0.3s ease;
  font-size: 0.95rem;
}
.nav-link:hover, .nav-link.active { color: var(--primary); }

/* Переключатель темы */
.theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.3s ease;
  font-size: 1.1rem;
  color: var(--text);
}
.theme-toggle:hover {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.05);
}

/* --- Магнитные кнопки --- */
.btn-magnetic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 14px 28px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  will-change: transform;
  text-decoration: none;
  font-size: 0.95rem;
}
.btn-magnetic:hover {
  box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.35);
  filter: brightness(0.95);
}
.btn-magnetic:active { transform: scale(0.98); }

.btn-magnetic-outline {
  background: transparent;
  color: var(--primary);
  border: 1.5px solid rgba(var(--primary-rgb), 0.3);
}
.btn-magnetic-outline:hover {
  border-color: var(--primary);
  background: rgba(var(--primary-rgb), 0.05);
}

.btn-magnetic.btn-sm { padding: 10px 20px; font-size: 0.875rem; }
.btn-magnetic.btn-lg { padding: 16px 32px; font-size: 1.05rem; }

/* --- Анимация появления (GSAP + класс .reveal) --- */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: none; /* Управляется через GSAP */
}

/* Уважение к prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

/* --- Футер --- */
footer {
  border-top: 1px solid var(--border);
  padding: 40px 0;
  margin-top: 60px;
  color: var(--text-muted);
  font-size: 0.9rem;
}
footer a { color: var(--text-muted); }
footer a:hover { color: var(--primary); }

/* ============================================================================
   4. ГЛАВНАЯ СТРАНИЦА (index.html)
   ============================================================================ */

/* --- Hero секция --- */
.hero {
  position: relative;
  padding: 140px 0 120px;
  overflow: hidden;
  min-height: 100vh;
  display: flex;
  align-items: center;
}
.hero h1 { margin-bottom: 1.5rem; }
.hero-lead {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 580px;
  margin-bottom: 2.5rem;
}

/* Data-flow Canvas (фон-сеть) */
#data-network {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Геологические слои (анимированные волны) */
.geo-layers {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 240px;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
  opacity: 0.6;
}
.geo-layers svg { width: 100%; height: 100%; }
.geo-path {
  fill: var(--surface);
  stroke: var(--geo-stroke);
  stroke-width: 2;
  transition: stroke 0.4s ease, fill 0.4s ease;
}
.geo-1 { animation: geoBreath 9s ease-in-out infinite alternate; }
.geo-2 { animation: geoBreath 11s ease-in-out infinite alternate-reverse; }
.geo-3 { animation: geoBreath 13s ease-in-out infinite alternate; }
@keyframes geoBreath {
  0% { transform: translateY(0); }
  100% { transform: translateY(-18px); }
}

/* --- Интерактивная карта (превью) --- */
.map-preview {
  position: relative;
  background: var(--glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  height: 460px;
  transform-style: preserve-3d;
  perspective: 1000px;
  z-index: 2;
}
.map-canvas {
  width: 100%;
  height: 100%;
  background: var(--surface);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.04);
}
[data-theme="dark"] .map-canvas { background: #151C2C; }

.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 40px 40px;
  opacity: 0.5;
}

/* Маркеры скважин */
.well-marker {
  position: absolute;
  width: 18px;
  height: 18px;
  background: var(--primary);
  border: 3px solid var(--surface);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.4);
  cursor: pointer;
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 2;
}
.well-marker::after {
  content: '';
  position: absolute;
  inset: -10px;
  border: 2px solid var(--primary);
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.7);
  transition: 0.4s ease;
}
.well-marker:hover { transform: scale(1.4); z-index: 3; }
.well-marker:hover::after { opacity: 1; transform: scale(1.1); }

/* Панель с данными скважины (появляется при hover) */
.well-panel {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 240px;
  background: var(--surface);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
  box-shadow: var(--shadow);
  transform: translateY(12px) rotateX(8deg);
  opacity: 0;
  pointer-events: none;
  transition: 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  z-index: 4;
}
.well-marker:hover ~ .well-panel {
  transform: translateY(0) rotateX(0);
  opacity: 1;
  pointer-events: all;
}
.spec-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  margin: 5px 0;
}
.spec-row span:last-child { font-weight: 600; color: var(--text); }

/* --- Карточки возможностей (с 3D-наклоном) --- */
.tilt-card {
  background: var(--surface);
  padding: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  transition: transform 0.4s ease, box-shadow 0.3s ease, border-color 0.4s ease;
  transform-style: preserve-3d;
  will-change: transform;
  height: 100%;
}
.tilt-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: rgba(var(--primary-rgb), 0.3);
}
.icon-box {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.15), transparent);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  font-size: 1.6rem;
  border: 1px solid var(--border);
}

/* --- Счётчики (статистика) --- */
.stats {
  background: linear-gradient(180deg, var(--bg) 0%, rgba(var(--primary-rgb), 0.05) 100%);
}
.stat-number {
  font-size: 3rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.stat-label {
  font-size: 0.95rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* --- CTA секция --- */
.cta-section {
  background: radial-gradient(ellipse at center, rgba(var(--primary-rgb), 0.08), transparent 70%);
  border-radius: var(--radius-lg);
  padding: 80px 40px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
}
.cta-section::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -20%;
  width: 140%;
  height: 200%;
  background: conic-gradient(from 180deg, transparent, rgba(var(--primary-rgb), 0.04), transparent 40%);
  animation: rotate 25s linear infinite;
  pointer-events: none;
}
@keyframes rotate { 100% { transform: rotate(360deg); } }

/* ============================================================================
   5. СТРАНИЦА КОНТАКТОВ (contacts.html)
   ============================================================================ */

/* Заголовок страницы */
.page-hero {
  padding: 120px 0 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.page-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 40% at 50% 0%, rgba(var(--primary-rgb), 0.1), transparent 70%);
  pointer-events: none;
}
.page-hero h1 { font-size: clamp(2rem, 4vw, 3rem); margin-bottom: 0.5rem; }

/* Карточки контактов */
.contact-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  transition: transform 0.4s ease, box-shadow 0.3s ease, border-color 0.4s ease;
  transform-style: preserve-3d;
  height: 100%;
}
.contact-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: rgba(var(--primary-rgb), 0.3);
}
.icon-circle {
  width: 48px;
  height: 48px;
  background: rgba(var(--primary-rgb), 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  font-size: 1.4rem;
}
.contact-card h3 { font-size: 1.25rem; margin-bottom: 8px; }
.contact-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: 0.2s;
}
.contact-link:hover { color: var(--primary); }

/* Блок реквизитов */
.legal-block {
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-top: 48px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.legal-block h3 { margin-bottom: 20px; }
.legal-table { width: 100%; border-collapse: collapse; }
.legal-table td {
  padding: 8px 0;
  vertical-align: top;
  font-size: 0.95rem;
}
.legal-table td:first-child {
  color: var(--text-muted);
  width: 180px;
}
.legal-table td:last-child {
  font-weight: 500;
  word-break: break-word;
}

/* ============================================================================
   6. ВНУТРЕННИЕ СТРАНИЦЫ (template.html)
   ============================================================================ */

/* Хлебные крошки */
.breadcrumb-custom {
  padding: 120px 0 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.breadcrumb-custom a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  transition: 0.2s;
}
.breadcrumb-custom a:hover { color: var(--primary); }
.breadcrumb-custom span { color: var(--text-muted); font-size: 0.9rem; }
.breadcrumb-custom .current { color: var(--text); font-weight: 500; }

/* Заголовок страницы */
.page-header {
  padding: 20px 0 40px;
}
.page-header h1 { margin-bottom: 12px; }
.page-header p {
  font-size: 1.15rem;
  color: var(--text-muted);
  max-width: 700px;
}

/* Область контента */
.content-area {
  font-size: 1.05rem;
}
.content-area h2 { margin: 2.5rem 0 1rem; }
.content-area h3 { margin: 2rem 0 0.8rem; }
.content-area p {
  margin-bottom: 1.2rem;
  color: var(--text);
  line-height: 1.7;
}
.content-area ul,
.content-area ol {
  margin-bottom: 1.2rem;
  padding-left: 1.5rem;
}
.content-area li { margin-bottom: 0.5rem; color: var(--text); }
.content-area a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.content-area a:hover { color: var(--primary-dark); }

/* Цитаты и заметки */
.content-area blockquote {
  border-left: 3px solid var(--primary);
  padding: 16px 20px;
  background: rgba(var(--primary-rgb), 0.05);
  border-radius: 8px;
  margin: 1.5rem 0;
  font-style: italic;
}

/* Таблицы в контенте */
.content-area table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
}
.content-area th,
.content-area td {
  border: 1px solid var(--border);
  padding: 12px 16px;
  text-align: left;
}
.content-area th {
  background: rgba(var(--primary-rgb), 0.08);
  font-weight: 600;
}

/* Боковая панель (sticky sidebar) */
.sidebar-card {
  position: sticky;
  top: 100px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 24px;
  box-shadow: var(--shadow);
}
.sidebar-card h4 {
  font-size: 1.1rem;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.sidebar-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}
.sidebar-nav li { margin-bottom: 8px; }
.sidebar-nav a {
  display: block;
  padding: 8px 12px;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 8px;
  font-size: 0.95rem;
  transition: 0.2s;
}
.sidebar-nav a:hover,
.sidebar-nav a.active {
  background: rgba(var(--primary-rgb), 0.1);
  color: var(--primary);
}

/* ============================================================================
   7. АДАПТИВ (медиа-запросы)
   ============================================================================ */

/* Планшеты и меньше */
@media (max-width: 991.98px) {
  .hero { padding: 110px 0 80px; min-height: auto; }
  .map-preview { height: 360px; }
  .cta-section { padding: 60px 24px; }
  .geo-layers { height: 160px; }
  
  .sidebar-card { position: static; margin-top: 32px; }
  .page-header { padding-bottom: 20px; }
  
  .legal-table td:first-child { width: 140px; }
}

/* Мобильные */
@media (max-width: 767.98px) {
  h1 { font-size: 2.25rem; }
  h2 { font-size: 1.6rem; }
  
  .hero { padding: 100px 0 60px; }
  .hero-lead { font-size: 1.1rem; }
  
  .map-preview { height: 300px; padding: 16px; }
  .well-panel { width: 200px; top: 12px; right: 12px; padding: 14px; }
  
  .stat-number { font-size: 2.25rem; }
  
  .page-hero { padding: 100px 0 40px; }
  .legal-table td:first-child { width: 120px; font-size: 0.9rem; }
  .legal-table td:last-child { font-size: 0.95rem; }
  
  .btn-magnetic { width: 100%; justify-content: center; }
  .hero-actions { flex-direction: column; }
}

/* Очень маленькие экраны */
@media (max-width: 480px) {
  .navbar-brand { font-size: 1.2rem; }
  .theme-toggle { width: 32px; height: 32px; font-size: 1rem; }
  
  .spec-row { font-size: 0.8rem; }
  .icon-box { width: 44px; height: 44px; font-size: 1.3rem; }
}