/* ============================================
   BASE.CSS - Базовые стили, переменные, сброс
   Mobile-First подход
   ============================================ */

/* ===== CSS VARIABLES ===== */
:root {
    /* Z-Index Scale */
    --z-base: 1;
    --z-gallery: 2;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-sticker: 900;
    --z-navbar: 1000;
    --z-modal: 1000000;
    --z-toast: 3000;
    --z-preloader: 200000;
    
    /* Breakpoints (для использования в JS если нужно) */
    --bp-mobile: 0px;
    --bp-small-tablet: 480px;
    --bp-tablet: 768px;
    --bp-laptop: 1024px;
    --bp-desktop: 1280px;
    --bp-large-desktop: 1440px;
    
    /* Fluid Typography */
    --font-xs: clamp(0.75rem, 0.5vw + 0.6rem, 0.875rem);
    --font-sm: clamp(0.875rem, 0.5vw + 0.75rem, 1rem);
    --font-base: clamp(1rem, 0.5vw + 0.875rem, 1.125rem);
    --font-md: clamp(1.125rem, 1vw + 0.875rem, 1.5rem);
    --font-lg: clamp(1.5rem, 2vw + 1rem, 2.5rem);
    --font-xl: clamp(2rem, 4vw + 1rem, 4rem);
    --font-2xl: clamp(2.5rem, 5vw + 1.5rem, 5rem);
    
    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;
    --spacing-2xl: 4rem;
    
    /* Mobile-optimized spacing */
    --mobile-padding: 1rem;
    --mobile-gap: 1rem;
    --mobile-section-padding: 3rem 0;
    
    /* Touch-friendly sizes */
    --touch-target: 44px;
    --mobile-nav-height: 70px;
    
    /* Mobile typography */
    --mobile-h1: clamp(2rem, 8vw, 2.5rem);
    --mobile-h2: clamp(1.5rem, 6vw, 2rem);
    --mobile-h3: clamp(1.25rem, 5vw, 1.5rem);
    --mobile-body: clamp(0.9rem, 4vw, 1rem);
    
    /* Accessibility - Better contrast */
    --text-secondary-accessible: #475569;
    --text-muted-accessible: #64748b;
    
    /* Colors - Light Theme */
    --bg-primary: #F5F5F5;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --accent-color: #228B22; /* Forest Green */
    --accent-hover: #196b19;
    --border-color: #e2e8f0;
    
    /* Shadows */
    --shadow-light: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
    --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-large: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #228B22 0%, #196b19 100%);
    --gradient-secondary: linear-gradient(135deg, #2fbf2f 0%, #228B22 100%);
    
    /* Image Scale Factor */
    --image-scale-factor: 1;
    
    /* Safe Area Insets (для мобильных устройств) */
    --safe-area-inset-top: env(safe-area-inset-top, 0px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 0px);
    --safe-area-inset-left: env(safe-area-inset-left, 0px);
}

/* Dark Theme */
[data-theme="dark"] {
    --text-secondary-accessible: #cbd5e1;
    --text-muted-accessible: #a8b8cc;
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --accent-color: #FFD700; /* Gold */
    --accent-hover: #e6c200;
    --border-color: #334155;
    --shadow-light: 0 1px 3px 0 rgba(0, 0, 0, 0.3);
    --shadow-medium: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-large: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, #020617 0%, #000000 100%);
    --gradient-secondary: linear-gradient(135deg, #FFD700 0%, #e6c200 100%);
}

/* Адаптивное масштабирование для разных размеров экрана */
@media (max-width: 479px) {
    :root {
        --image-scale-factor: 0.4;
    }
}

@media (min-width: 480px) and (max-width: 767px) {
    :root {
        --image-scale-factor: 0.6;
    }
}

@media (min-width: 768px) and (max-width: 1023px) {
    :root {
        --image-scale-factor: 0.8;
    }
}

/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: #cbd5e1 transparent;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    background-color: var(--bg-primary);
    overflow-y: auto;
}

::-webkit-scrollbar {
    width: 12px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 999px;
    border: 2px solid transparent;
}

body {
    font-family: 'Inter', sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    position: relative;
    overflow-x: hidden;
    max-width: 100vw;
    overscroll-behavior-y: none;
}

/* Оптимизированные переходы для смены темы */
html,
body {
    transition: background-color 0.3s ease, color 0.3s ease;
    will-change: background-color, color;
}

/* Основные контейнеры и секции */
.navbar,
.footer,
.hero,
section,
.container {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

/* Карточки и интерактивные элементы */
.card,
.btn-primary,
.btn-secondary,
.social-card,
.link-card,
.timeline-item {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

/* Текст */
.nav-link,
.hero-title,
.hero-title .title-line,
.hero-subtitle,
h1, h2, h3, h4, h5, h6,
p, span, a, li {
    transition: color 0.3s ease;
}

/* Иконки и SVG */
i,
.fas,
.fab,
.far,
.icon,
svg {
    transition: color 0.3s ease, fill 0.3s ease, stroke 0.3s ease;
}

svg path,
svg rect,
svg circle {
    transition: fill 0.3s ease, stroke 0.3s ease;
}

/* Performance Optimization - Image loading */
img {
    max-width: 100%;
    height: auto;
    display: block;
    content-visibility: auto;
    user-select: none;
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
}

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

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    /* EXCEPTION: Keep ticker animation slow even with reduced motion */
    .ticker-track,
    .ticker-track * {
        animation-duration: 400s !important;
        animation-iteration-count: infinite !important;
    }
}

/* Font Loading */
body.fonts-loaded {
    font-family: 'Inter', sans-serif;
}

/* Preloader styles */
body:has(#preloader) {
    opacity: 0;
}

body.fade-in {
    animation: fadeInPage 0.8s ease-out forwards;
    opacity: 1;
}

@keyframes fadeInPage {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

body.preloader-active {
    overflow: hidden !important;
    height: 100vh;
    opacity: 1 !important;
}

html.preloader-active {
    overflow: hidden !important;
}





