/* 
 * ARCHITECTURE:
 * 1. Variables & Reset
 * 2. Typography & Base
 * 3. Layout & Header
 * 4. Components (Cards, Buttons)
 * 5. Utilities & Animations
 * 6. Media Queries
 */

:root {
    /* Цветовая палитра */
    --remox-red: #e63946;
    --remox-red-dark: #c1121f;
    --remox-black: #1d1d1d;
    --remox-light: #f8f9fa;
    --remox-gray: #6c757d;

    /* Размеры */
    --header-height: 76px; /* Точная высота шапки */
    --border-radius-lg: 12px;
    --border-radius-sm: 6px;

    /* Анимации */
    --transition-fast: 0.2s ease;
    --transition-base: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* ==========================================================================
   1. BASE & OPTIMIZATION
   ========================================================================== */
html {
    /* Самое важное для JS-оптимизации: отступ скролла равен высоте шапки + 20px */
    scroll-padding-top: calc(var(--header-height) + 20px);
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', sans-serif;
    color: #333;
    line-height: 1.6;
    text-rendering: optimizeLegibility; /* Улучшает кернинг текста */
    -webkit-font-smoothing: antialiased; /* Сглаживание шрифтов на Mac */
    background-color: var(--remox-light);
}

/* Применяем Montserrat ко всем заголовкам и важным элементам */
h1, h2, h3, h4, h5, h6, .navbar-brand, .btn, .modal-title {
    font-family: 'Montserrat', sans-serif;
}

/* Оптимизация изображений */
img {
    max-width: 100%;
    height: auto;
    display: block;
    /* Предотвращает сдвиг контента при загрузке (CLS метрика) */
    font-style: italic;
    shape-margin: 0.75rem;
}

/* ==========================================================================
   2. HEADER & NAV
   ========================================================================== */
header {
    position: sticky;
    top: 0;
    z-index: 1020;
    background-color: var(--remox-black);
    /* backdrop-filter создает эффект размытого стекла (дорогой вид) */
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.navbar-brand span {
    letter-spacing: 0.5px;
}

/* ==========================================================================
   2.5 HERO SECTION (Карусель и фиксированная высота)
   ========================================================================== */
.hero-section {
    min-height: 80vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.hero-carousel {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-carousel .carousel-inner, 
.hero-carousel .carousel-item {
    height: 100%;
}

.hero-carousel img {
    height: 100%;
    width: 100%;
    object-fit: cover;
    object-position: center;
}

/* ==========================================================================
   3. CARDS & SERVICES (GPU Optimized)
   ========================================================================== */
.service-card, 
.equipment-card {
    background: #fff;
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    /* Хак для активации GPU рендеринга (убирает микро-лаги) */
    transform: translateZ(0); 
    will-change: transform, box-shadow;
}

.service-card:hover, 
.equipment-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

/* Контейнеры изображений с фиксированным соотношением сторон */
.equipment-img-container {
    height: 220px;
    width: 100%;
    overflow: hidden;
    position: relative;
    background-color: #eee;
}

.equipment-card img {
    transition: transform 0.5s ease;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.equipment-card:hover img {
    transform: scale(1.05);
}

/* ==========================================================================
   4. BUTTONS & INTERACTIVE
   ========================================================================== */
.btn {
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    letter-spacing: 0.3px;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn-danger {
    background-color: var(--remox-red);
    border-color: var(--remox-red);
    box-shadow: 0 4px 6px rgba(230, 57, 70, 0.2);
    transition: all var(--transition-base);
}

.btn-danger:hover, 
.btn-danger:active {
    background-color: var(--remox-red-dark);
    border-color: var(--remox-red-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(230, 57, 70, 0.3);
}

/* Кнопка "Подробнее" */
.btn-remox-details {
    background: transparent;
    border: 2px solid var(--remox-red);
    color: var(--remox-red);
    border-radius: 50px;
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
    transition: all var(--transition-base);
}

.btn-remox-details:hover {
    background: var(--remox-red);
    color: white;
    box-shadow: 0 5px 15px rgba(230, 57, 70, 0.25);
}

/* ==========================================================================
   5. GALLERY GRID
   ========================================================================== */
.gallery-grid {
    /* Используем CSS Grid вместо Flexbox для идеальной сетки */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.gallery-img-container {
    border-radius: var(--border-radius-lg);
    overflow: hidden;
    aspect-ratio: 4/3; /* Современное свойство пропорций */
    position: relative;
    background-color: #e9ecef;
    cursor: zoom-in;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform var(--transition-base);
}

.gallery-img-container:hover {
    transform: scale(1.02);
    z-index: 2;
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
}

.gallery-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

/* ==========================================================================
   6. UTILITIES & ANIMATIONS
   ========================================================================== */
.object-cover { object-fit: cover; }
.min-vh-400 { min-height: 400px; }
.py-24 { padding-top: 8rem; padding-bottom: 8rem; }

/* Ленивая загрузка (эффект пульсации) */
@keyframes skeleton-pulse { 0% { background-color: #f5f5f5; } 100% { background-color: #e9ecef; } }
.lazyload {
    animation: skeleton-pulse 1s linear infinite alternate; 
    display: block; 
    min-height: 100px;
}
.lazyloaded {
    animation: none; 
    background-color: transparent; 
    transition: opacity 0.4s ease-in;
}

/* Плавное появление при скролле */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-on-scroll {
    /* Если JS IntersectionObserver не сработает, элемент все равно будет виден */
    animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.cursor-pointer { cursor: pointer; }

/* ==========================================================================
   7. MOBILE & RESPONSIVE
   ========================================================================== */
/* Плавающая кнопка звонка */
.mobile-call-wrapper {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999;
    display: block;
}

.mobile-call-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: var(--remox-red);
    color: white;
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.mobile-call-btn i { font-size: 24px; }

.mobile-call-btn::after {
    content: ''; 
    position: absolute; 
    width: 100%; 
    height: 100%;
    background-color: var(--remox-red); 
    border-radius: 50%;
    z-index: -1; 
    animation: pulse-ring 2s infinite;
}

@keyframes pulse-ring { 
    0% { transform: scale(1); opacity: 0.7; } 
    100% { transform: scale(1.6); opacity: 0; } 
}

.dropdown-menu-call {
    border-radius: 12px; 
    border: none; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    margin-bottom: 10px; 
    padding: 8px;
}

.dropdown-menu-call .dropdown-item {
    padding: 12px 15px; 
    font-weight: bold; 
    display: flex; 
    align-items: center;
}

.dropdown-menu-call .dropdown-item i { 
    color: var(--remox-red); 
    margin-right: 10px; 
}

/* Медиа-запросы */
@media (min-width: 992px) {
    /* Если нужно скрыть на ПК, раскомментируй строку ниже */
    /* .mobile-call-wrapper { display: none; } */
}

@media (max-width: 768px) {
    .py-24 { padding-top: 4rem; padding-bottom: 4rem; }
    
    h1.display-4 { font-size: 2.2rem; }
    
    .gallery-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 колонки на планшете */
        gap: 0.8rem;
    }
}

@media (max-width: 576px) {
    .gallery-grid {
        grid-template-columns: 1fr; /* 1 колонка на телефоне */
    }
    
    .navbar-brand small { display: none !important; }
}

/* ==========================================================================
   8. ACCESSIBILITY (Для людей, чувствительных к движению)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}