/* Главная страница - Профессиональные исправления */

/* Mobile First Reset */
* {
  box-sizing: border-box;
}

body {
  overflow-x: hidden;
  font-family: 'Inter', sans-serif;
}

/* Hero Section - Исправление */
body.theme-leaf .hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--leaf-radius-xl);
  padding: 0;
  margin: var(--space-8) 0 var(--space-6);
  box-shadow: var(--leaf-shadow);
  background: var(--leaf-surface-2);
  max-width: 1600px;
  margin-left: auto;
  margin-right: auto;
}

body.theme-leaf .hero-inner {
  position: relative;
}

body.theme-leaf .hero-bg {
  display: none;
}

body.theme-leaf .hero-leaf-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.05);
  transition: transform 10s ease-out;
  background-color: var(--leaf-bg-1);
}

body.theme-leaf .hero:hover .hero-leaf-bg {
  transform: scale(1.08);
}

body.theme-leaf .hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, 
    rgba(15, 23, 42, 0.98) 0%, 
    rgba(30, 58, 138, 0.85) 40%,
    rgba(234, 88, 12, 0.6) 80%,
    rgba(245, 158, 11, 0.4) 100%);
}

body.theme-leaf .hero-copy {
  position: relative;
  min-height: 520px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  padding: var(--space-18) var(--space-12);
  z-index: 2;
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

body.theme-leaf .hero-copy h1 {
  margin: 0;
  font-weight: var(--font-extrabold);
  font-size: var(--text-4xl);
  letter-spacing: -0.01em;
  text-align: left;
  max-width: 750px;
  line-height: 1.1;
  color: var(--leaf-text);
  text-shadow: 0 6px 25px rgba(0, 0, 0, 0.6);
  margin-bottom: var(--space-6);
}

body.theme-leaf .hero-copy p {
  margin: 0;
  max-width: 650px;
  text-align: left;
  color: var(--leaf-muted);
  font-size: var(--text-lg);
  font-weight: var(--font-medium);
  line-height: 1.6;
  margin-bottom: var(--space-8);
}

body.theme-leaf .hero-tag {
  display: inline-flex;
  gap: var(--space-3);
  align-items: center;
  color: var(--leaf-text);
  font-weight: var(--font-bold);
  font-size: var(--text-base);
  letter-spacing: 0.01em;
  margin-bottom: var(--space-6);
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--energy-cyan), var(--energy-secondary));
  padding: var(--space-3) var(--space-6);
  border-radius: var(--leaf-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.3);
  backdrop-filter: blur(15px);
  box-shadow: 0 10px 30px rgba(6, 182, 212, 0.5);
}

/* Services Section - Исправление структуры */
body.theme-leaf .services-section {
  margin: var(--space-8) 0 var(--space-12);
}

body.theme-leaf .services-section h2.section-title {
  text-align: center;
  font-weight: var(--font-extrabold);
  font-size: var(--text-3xl);
  color: var(--leaf-text);
  margin-bottom: var(--space-8);
  background: var(--energy-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--leaf-radius-lg);
  display: inline-block;
}

body.theme-leaf .tile-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

body.theme-leaf .tile {
  border-radius: var(--leaf-radius-lg);
  background: var(--leaf-surface);
  border: 1px solid var(--leaf-border);
  box-shadow: var(--leaf-soft-shadow);
  min-height: 180px;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: var(--leaf-text);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
}

body.theme-leaf .tile::before {
  content: '';
  position: absolute;
  inset: -20% -20%;
  background: var(--energy-glow);
  opacity: 0;
  transition: opacity 0.4s ease;
  border-radius: 50%;
}

body.theme-leaf .tile:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--leaf-glow-shadow);
  border-color: var(--leaf-border-accent);
}

body.theme-leaf .tile:hover::before {
  opacity: 0.1;
}

body.theme-leaf .tile-badge {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  background: var(--energy-gradient);
  border-radius: var(--leaf-radius);
  margin-bottom: var(--space-4);
  box-shadow: 0 8px 20px rgba(234, 88, 12, 0.3);
  transition: all 0.4s ease;
}

body.theme-leaf .tile-badge .tile-icon {
  width: 32px;
  height: 32px;
  stroke: rgba(255, 255, 255, 0.95);
  filter: drop-shadow(0 0 8px rgba(255,255,255, 0.3));
}

body.theme-leaf .tile:hover .tile-badge {
  transform: rotate(-5deg) scale(1.1);
  box-shadow: 0 12px 30px rgba(234, 88, 12, 0.5);
}

body.theme-leaf .tile-title {
  font-weight: var(--font-bold);
  font-size: var(--text-lg);
  color: var(--leaf-text);
  margin-bottom: var(--space-3);
  line-height: 1.3;
  transition: all 0.3s ease;
}

body.theme-leaf .tile:hover .tile-title {
  color: var(--energy-accent);
  transform: translateX(4px);
}

body.theme-leaf .tile-desc {
  color: var(--leaf-muted);
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  line-height: 1.5;
  margin: 0;
}

body.theme-leaf .tile-photo {
  background-size: cover;
  background-position: center;
  padding: 0;
  position: relative;
  overflow: hidden;
}

body.theme-leaf .tile-photo-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0.08), rgba(0, 0, 0, 0.6));
}

body.theme-leaf .tile-photo-badge {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  z-index: 2;
}

body.theme-leaf .tile-photo-meta {
  position: absolute;
  left: var(--space-4);
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 2;
}

body.theme-leaf .tile-photo-meta h3.tile-title,
body.theme-leaf .tile-photo-meta .tile-title {
  color: var(--leaf-text);
  font-weight: var(--font-bold);
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.8);
}

body.theme-leaf .tile-photo-meta p.tile-desc {
  color: rgba(241, 245, 249, 0.9);
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
}

/* Stats Section - Улучшение */
body.theme-leaf .stats-section {
  margin: var(--space-8) 0 var(--space-12);
}

body.theme-leaf .stats-section h2 {
  text-align: center;
  font-weight: var(--font-extrabold);
  font-size: var(--text-3xl);
  color: var(--leaf-text);
  margin-bottom: var(--space-8);
}

body.theme-leaf .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: var(--space-6);
}

body.theme-leaf .stat-card {
  background: var(--leaf-surface);
  border: 1px solid var(--leaf-border);
  border-radius: var(--leaf-radius-lg);
  padding: var(--space-8);
  text-align: center;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
  position: relative;
  overflow: hidden;
}

body.theme-leaf .stat-card::before {
  content: '';
  position: absolute;
  inset: -10% -10%;
  background: var(--energy-glow);
  opacity: 0;
  transition: opacity 0.4s ease;
  border-radius: 50%;
}

body.theme-leaf .stat-card:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: var(--leaf-glow-shadow);
  border-color: var(--leaf-border-accent);
}

body.theme-leaf .stat-card:hover::before {
  opacity: 0.15;
}

body.theme-leaf .stat-icon-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: var(--energy-gradient);
  border-radius: var(--leaf-radius);
  margin-bottom: var(--space-4);
  box-shadow: 0 8px 20px rgba(234, 88, 12, 0.3);
  transition: all 0.4s ease;
}

body.theme-leaf .stat-icon {
  width: 40px;
  height: 40px;
  stroke: rgba(255, 255, 255, 0.95);
  filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3);
}

body.theme-leaf .stat-value {
  font-weight: var(--font-extrabold);
  font-size: var(--text-3xl);
  color: var(--energy-accent);
  margin-bottom: var(--space-2);
  text-shadow: 0 0 15px rgba(245, 158, 11, 0.6);
  animation: valuePulse 2s ease-in-out infinite;
}

@keyframes valuePulse {
  0%, 100% { transform: scale(1); }
 50% { transform: scale(1.1); }
}

body.theme-leaf .stat-label {
  font-weight: var(--font-semibold);
  font-size: var(--text-lg);
  color: var(--leaf-text);
  margin-bottom: var(--space-1);
}

body.theme-leaf .stat-desc {
  color: var(--leaf-muted);
  font-weight: var(--font-medium);
  font-size: var(--text-sm);
  line-height: 1.4;
  margin: 0;
}

/* News Section - Улучшение */
body.theme-leaf .news-section {
  margin: var(--space-8) 0 var(--space-12);
}

body.theme-leaf .news-section .section-title {
  text-align: center;
  font-weight: var(--font-extrabold);
  font-size: var(--text-3xl);
  color: var(--leaf-text);
  margin-bottom: var(--space-8);
  background: var(--energy-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-leaf-clip: text;
  text-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--leaf-radius-lg);
  display: inline-block;
}

body.theme-leaf .news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: var(--space-6);
}

body.theme-leaf .news-card {
  background: var(--leaf-surface);
  border: 1px solid var(--leaf-border);
  border-radius: var(--leaf-radius-lg);
  padding: var(--space-6);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
}

body.theme-leaf .news-card::before {
  content: '';
  position: absolute;
  inset: -10% -10%;
  background: var(--energy-glow);
  opacity: 0;
  transition: opacity 0.4s ease;
  border-radius: 50%;
}

body.theme-leaf .news-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--leaf-soft-shadow);
  border-color: var(--leaf-border-accent);
}

body.theme-leaf .news-card:hover::before {
  opacity: 0.1;
}

body.theme-leaf .news-date {
  display: inline-block;
  background: rgba(245, 158, 11, 0.15);
  color: var(--energy-accent);
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  letter-spacing: 0.01em;
  margin-bottom: var(--space-3);
  border-radius: var(--leaf-radius);
  padding: var(--space-1) var(--space-2);
  text-transform: uppercase;
}

body.theme-leaf .news-title {
  font-weight: var(--font-bold);
  font-size: var(--text-xl);
  color: var(--leaf-text);
  margin-bottom: var(--space-3);
  transition: all 0.3s ease;
}

body.theme-leaf .news-card:hover .news-title {
  color: var(--energy-accent);
  transform: translateX(4px);
}

body.theme-leaf .news-excerpt {
  color: var(--leaf-muted);
  font-weight: var(--font-medium);
  font-size: var(--text-base);
  line-height: 1.6;
  margin: 0;
}

/* Docs Section - Улучшение */
body.theme-leaf .docs-section {
  margin: var(--space-8) 0 var(--space-12);
}

body.theme-leaf .docs-title {
  text-align: center;
  font-weight: var(--font-extrabold);
  font-size: var(--text-3xl);
  color: var(--leaf-text);
  margin-bottom: var(--space-8);
  background: var(--energy-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
  padding: var(--space-4) var(--space-6);
  border-radius: var(--leaf-radius-lg);
  display: inline-block;
}

body.theme-leaf .docs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: var(--space-4);
}

body.theme-leaf .doc-card {
  background: var(--leaf-surface);
  border: 1px solid var(--leaf-border);
  border-radius: var(--leaf-radius);
  padding: var(--space-4);
  text-decoration: none;
  color: var(--leaf-text);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  backdrop-filter: blur(12px);
}

body.theme-leaf .doc-card::before {
  content: '';
  position: absolute;
  inset: -10% -10%;
  background: var(--energy-glow);
  opacity: 0;
  transition: opacity 0.4s ease;
  border-radius: 50%;
}

body.theme-leaf .doc-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--leaf-soft-shadow);
  border-color: var(--leaf-border-accent);
}

body.theme-leaf .doc-card:hover::before {
  opacity: 0.1;
}

body.theme-leaf .doc-icon {
  width: 32px;
  height: 32px;
  stroke: var(--energy-cyan);
  filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.4);
}

body.theme-leaf .doc-svg-icon {
  width: 28px;
  height: 28px;
  stroke: var(--energy-cyan);
  filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.4);
  transition: all 0.3s ease;
}

body.theme-leaf .doc-card:hover .doc-svg-icon {
  stroke: var(--energy-accent);
  transform: scale(1.2);
}

body.theme-leaf .doc-caption {
  font-weight: var(--font-semibold);
  font-size: var(--text-sm);
  color: var(--leaf-text);
  text-align: center;
  transition: all 0.3s ease;
}

body.theme-leaf .doc-card:hover .doc-caption {
  color: var(--energy-accent);
  text-shadow: 0 0 10px rgba(245, 158, 11, 0.6);
}

/* Mobile Responsive - Главная страница */
@media (max-width: 1400px) {
  body.theme-leaf .hero {
    max-width: 100%;
  }
  
  body.theme-leaf .hero-copy {
    padding: var(--space-12) var(--space-8);
    max-width: 700px;
  }
  body.theme-leaf .hero-copy h1 {
    font-size: var(--text-3xl);
    max-width: 550px;
  }
  body.theme-leaf .hero-copy p {
    max-width: 500px;
    font-size: var(--text-base);
  }
  
  body.theme-leaf .tile-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }
}

@media (max-width: 768px) {
  body.theme-leaf .hero {
    margin: var(--space-6) 0 var(--space-4);
  }
  
  body.theme-leaf .hero-copy {
    padding: var(--space-8) var(--space-6);
    align-items: center;
    text-align: center;
  }
  
  body.theme-leaf .hero-copy h1 {
    font-size: var(--text-2xl);
    text-align: center;
    max-width: 500px;
    }
  body.theme-leaf .hero-copy p {
    text-align: center;
    max-width: 100%;
    font-size: var(--text-base);
    }
  
  body.theme-leaf .tile-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
  
  body.theme-leaf .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  body.theme-leaf .news-grid {
    grid-template-columns: 1fr;
  }
  
  body.theme-leaf .docs-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  body.theme-leaf .hero {
    margin: var(--space-4) 0 var(--space-3);
  }
  
  body.theme-leaf .hero-copy {
    padding: var(--space-6) var(--space-4);
  }
  
  body.theme-leaf .hero-copy h1 {
    font-size: var(--text-xl);
    line-height: 1.2;
  }
  
  body.theme-leaf .hero-copy p {
    font-size: var(--text-sm);
    line-height: 1.5;
  }
  
  body.theme-leaf .hero-tag {
    font-size: var(--text-xs);
    padding: var(--space-2) var(--space-4);
  }
  
  body.theme-leaf .tile {
    min-height: 140px;
  }
  
  body.theme-leaf .stat-card {
    padding: var(--space-6);
  }
  
  body.theme-leaf .stat-value {
    font-size: var(--text-2xl);
  }
  
  body.theme-leaf .news-card {
    padding: var(--space-4);
  }
  
  body.theme-leaf .doc-card {
    padding: var(--space-3);
  }
}

/* Mobile Menu Styles */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  z-index: 1001;
}

.mobile-menu-btn span {
  width: 24px;
  height: 3px;
  background: var(--color-gray-100);
  margin: 3px 0;
  transition: 0.3s;
  border-radius: 2px;
}

.mobile-menu-overlay {
  position: fixed;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  backdrop-filter: blur(10px);
  z-index: 1000;
  transition: left 0.3s ease;
}

.mobile-menu-overlay.active {
  left: 0;
}

.mobile-menu-content {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: var(--space-8);
}

.mobile-menu-close {
  position: absolute;
  top: var(--space-6);
  right: var(--space-6);
  background: none;
  border: none;
  cursor: pointer;
  width: 30px;
  height: 30px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.mobile-menu-close span {
  width: 24px;
  height: 3px;
  background: var(--color-gray-100);
  margin: 2px 0;
  transition: 0.3s;
  border-radius: 2px;
}

.mobile-menu-close span:first-child {
  transform: rotate(45deg) translate(5px, 5px);
}

.mobile-menu-close span:last-child {
  transform: rotate(-45deg) translate(5px, -5px);
}

.mobile-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: center;
}

.mobile-nav li {
  margin: var(--space-4) 0;
}

.mobile-nav a {
  color: var(--color-gray-100);
  text-decoration: none;
  font-size: var(--text-xl);
  font-weight: 600;
  padding: var(--space-3) var(--space-6);
  border: 2px solid transparent;
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
  display: inline-block;
  background: rgba(255, 255, 255, 0.1);
}

.mobile-nav a:hover {
  color: var(--primary-500);
  border-color: var(--primary-500);
  background: rgba(6, 182, 212, 0.1);
  transform: translateY(-2px);
}

/* Mobile navigation visibility */
@media (max-width: 768px) {
  .mobile-menu-btn {
    display: flex;
  }
}

/* Fix mobile tile grid */
@media (max-width: 480px) {
  .tile-grid {
    grid-template-columns: 1fr !important;
    gap: var(--space-3) !important;
  }
  
  .tile {
    min-height: 120px !important;
    padding: var(--space-4) !important;
  }
  
  .tile-badge {
    width: 40px !important;
    height: 40px !important;
  }
  
  .tile-badge svg {
    width: 20px !important;
    height: 20px !important;
  }
  
  .tile h3 {
    font-size: var(--text-base) !important;
  }
}

/* Additional mobile fixes */
@media (max-width: 480px) {
  .site-header {
    padding: var(--space-3) 0 !important;
  }
  
  .site-header .container {
    padding: 0 var(--space-4) !important;
  }
  
  .site-logo img {
    width: 36px !important;
    height: 36px !important;
  }
  
  .site-logo span {
    font-size: var(--text-sm) !important;
  }
  
  .mobile-menu-btn {
    padding: var(--space-2) !important;
  }
  
  .mobile-menu-btn span {
    width: 20px !important;
    height: 2px !important;
    margin: 2px 0 !important;
  }
  
  .hero-tag {
    font-size: var(--text-xs) !important;
    padding: var(--space-1) var(--space-3) !important;
  }
  
  .hero-copy h1 {
    font-size: var(--text-xl) !important;
    line-height: 1.3 !important;
  }
  
  .hero-copy p {
    font-size: var(--text-sm) !important;
    line-height: 1.5 !important;
  }
  
  .section-title {
    font-size: var(--text-xl) !important;
  }
  
  .stat-card {
    padding: var(--space-4) !important;
    text-align: center !important;
  }
  
  .stat-value {
    font-size: var(--text-xl) !important;
  }
  
  .stat-label {
    font-size: var(--text-xs) !important;
  }
  
  .news-card {
    padding: var(--space-3) !important;
  }
  
  .news-card h3 {
    font-size: var(--text-sm) !important;
  }
  
  .news-card .news-date {
    font-size: var(--text-xs) !important;
  }
  
  .doc-card {
    padding: var(--space-3) !important;
    font-size: var(--text-xs) !important;
  }
}

/* Fix horizontal scrolling on mobile */
@media (max-width: 480px) {
  body {
    overflow-x: hidden !important;
  }
  
  .container {
    max-width: 100% !important;
    padding: 0 var(--space-4) !important;
    margin: 0 auto !important;
  }
  
  .site-main {
    padding: 0 !important;
  }
  
  .tile, .stat-card, .news-card, .doc-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
}