/* Динамические фоны для Hero секции */

:root {
    --hero-bg-image: none;
}

/* Перехватываем фон hero секции */
.hero-section .hero-background {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

/* Контент поверх фона и затемнения */
.hero-section>.container,
.hero-section>.max-w-7xl,
.hero-section>.relative,
.hero-section .container,
.hero-section .relative {
    position: relative;
    z-index: 4;
}

/* Гарантируем что весь контент hero поверх затемнения */
.hero-section .search-container,
.hero-section .text-center,
.hero-section .flex,
.hero-section .grid,
.hero-section form,
.hero-section h1,
.hero-section p,
.hero-section .search-tabs,
.hero-section .search-form {
    position: relative;
    z-index: 5;
}

/* Градиент скрывается когда есть изображение */
.hero-section .hero-gradient {
    opacity: 1;
    transition: opacity 1s ease-in-out;
}

/* Когда загружено изображение */
.hero-section.has-custom-bg .hero-gradient {
    opacity: 0;
}

/* Новый слой для изображения */
.hero-section .hero-background::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: var(--hero-bg-image);
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity 1.5s ease-in-out;
    z-index: 2;
}

/* Показываем изображение когда оно загружено */
.hero-section.has-custom-bg .hero-background::before {
    opacity: 1;
}

/* Затемнение для лучшей читаемости текста */
.hero-section .hero-background::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    z-index: 3;
    pointer-events: none;
}

/* Когда есть кастомный фон - усиливаем затемнение */
.hero-section.has-custom-bg .hero-background::after {
    background: rgba(0, 0, 0, 0.5);
}

/* Адаптивность */
@media (max-width: 768px) {
    .hero-section .hero-background::before {
        background-attachment: scroll;
    }
}