/* Базовые настройки */
:root {
    --color-bg: #1a1510; /* Темно-коричневый фон */
    --color-text: #e0d8c3; /* Старая бумага */
    --color-accent: #d48c28; /* Янтарный/Лисий */
    --font-heading: 'Cormorant Garamond', serif;
    --font-body: 'Montserrat', sans-serif;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--color-bg);
    color: var(--color-text);
    font-family: var(--font-body);
}

h1, h2, h3 {
    font-family: var(--font-heading);
    color: var(--color-accent);
}

/* Навигация */
.top-nav {
    display: flex;
    justify-content: space-between;
    padding: 20px 40px;
    background: rgba(0,0,0,0.5);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-sizing: border-box;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--color-accent);
    letter-spacing: 2px;
}

.menu a {
    color: var(--color-text);
    text-decoration: none;
    margin-left: 20px;
    font-size: 14px;
    text-transform: uppercase;
    transition: color 0.3s;
}

.menu a:hover {
    color: var(--color-accent);
}

main {
    padding-top: 80px; /* Отступ под фиксированное меню */
    min-height: 100vh;
}

footer {
    text-align: center;
    padding: 20px;
    opacity: 0.5;
}

/* --- ПАРАЛЛАКС (ВЕРСИЯ "БЕЗ ДЫРОК", КОТОРУЮ МЫ УТВЕРДИЛИ) --- */
#parallax-world {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background-color: #0f0c08;
}

.parallax-layer {
    position: absolute; /* Важно: absolute, чтобы JS двигал их внутри fixed контейнера */
    top: 0;
    left: 0;
    width: 100%;
    background-repeat: no-repeat;
    background-position: center top; 
    will-change: transform;
}

/* 1. ФОН (Земля) */
.layer-bg {
    background-image: url('../img/backgrounds/bg_forest.jpg');
    background-size: 100% auto; 
    /* Возвращаем calc, чтобы был запас хода для JS */
    height: calc(100% + 600px); 
    z-index: -3;
}

/* 2. СРЕДНИЙ ПЛАН (Если он будет) */
.layer-mid {
    /* background-image: url('../img/backgrounds/middle_fog.png'); */
    background-size: cover;
    height: 100%;
    z-index: -2;
    opacity: 0.5;
}

.layer-fore {
    background-image: url('../img/backgrounds/fore_branches.png');
    background-size: 100% auto;
    
    /* ВАЖНО: Делаем высоту с запасом! 
       100% экрана + 1000px запаса на прокрутку */
    height: calc(100% + 1000px); 
    
    z-index: -1;
    pointer-events: none;
    
    /* Привязываем картинку к верху */
    background-position: center top; 
}


/* --- 1. АГРЕССИВНОЕ ЗАТЕМНЕНИЕ --- */
.darkness-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 10; /* Лежит поверх фона, но ПОД светлячками */
    
    background: linear-gradient(
        to bottom, 
        rgba(0,0,0,0) 0%,        /* Верх прозрачный */
        rgba(0,0,0,0) 20%,       /* Чуть дольше прозрачный */
        rgba(10, 5, 0, 0.6) 50%, /* Середина уже темная */
        #000000 100%             /* Низ АБСОЛЮТНО черный */
    );
    transition: opacity 0.1s linear;
}

/* --- 2. КОНТЕЙНЕР СВЕТЛЯЧКОВ --- */
#fireflies-container {
    position: absolute;
    top: 0; 
    left: 0;
    width: 100%;
    /* height: 100%; <--- ЭТО МЫ УБРАЛИ, ТЕПЕРЬ JS ЗАДАЕТ ВЫСОТУ */
    
    pointer-events: none;
    overflow: hidden;
    
    /* Поднимаем ОЧЕНЬ высоко (выше фона, выше секций, выше темноты) */
    z-index: 900; 
}

/* --- 3. САМИ СВЕТЛЯЧКИ --- */
.firefly {
    position: absolute;
    border-radius: 50%;
    
    /* 1. ЦВЕТ: Ядро теперь тепло-желтое, а не белое */
    background-color: #ffcc00; 
    
    /* 2. СВЕЧЕНИЕ: Добавили красноты для "жара" */
    box-shadow: 
        0 0 5px #ffd700,   /* Золото */
        0 0 10px #ff8c00,  /* Оранжевый */
        0 0 20px #ff4500;  /* Красноватый ореол */
        
    opacity: 0;
    animation: floatingFirefly linear infinite;
    
    /* Должны быть выше затемнения */
    z-index: 900; 
}

@keyframes floatingFirefly {
    0% {
        transform: translate(0, 0) scale(0.2);
        opacity: 0;
    }
    10% { opacity: 1; } /* Быстро разгораются */
    50% { opacity: 0.8; transform: translate(var(--move-x), -50px) scale(1); } 
    90% { opacity: 1; }
    100% {
        /* Улетают вверх */
        transform: translate(calc(var(--move-x) * 1.5), -150px) scale(0.2);
        opacity: 0;
    }
}

/* --- СТИЛИ ДЛЯ ВИДЕО-МОДАЛКИ --- */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    z-index: 5000; /* Самый высокий слой */
    
    display: none; /* Скрыто по умолчанию (JS включает flex) */
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.video-modal video {
    max-width: 90%;
    max-height: 80vh;
    border: 2px solid #d48c28;
    box-shadow: 0 0 50px rgba(212, 140, 40, 0.2);
    border-radius: 10px;
}

.video-modal .close-modal {
    margin-top: 20px;
    padding: 10px 30px;
    background: transparent;
    border: 1px solid #d48c28;
    color: #d48c28;
    font-size: 18px;
    cursor: pointer;
    border-radius: 30px;
    transition: all 0.3s;
    position: static; /* Сбрасываем абсолютное позиционирование крестика */
}

.video-modal .close-modal:hover {
    background: #d48c28;
    color: #000;
}

/* КНОПКА-МОРДОЧКА В ШАПКЕ */
.header-radio-btn {
    /* 1. Жесткие размеры */
    width: 45px !important; 
    height: 45px !important;
    
    /* 2. Запрещаем сплющивание в Flex-блоке */
    flex-shrink: 0; 
    
    background: transparent;
    border: 2px solid #d48c28;
    border-radius: 50%;
    cursor: pointer;
    overflow: hidden; /* Обрезаем всё, что вылезает */
    margin-left: 15px;
    
    display: none; /* Скрыта по умолчанию */
    align-items: center; 
    justify-content: center;
    padding: 0;
}

/* 3. Картинка внутри кнопки */
.header-radio-btn img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover; /* Заполняет круг красиво */
    display: block;
    max-width: 100%; /* Страховка */
}

/* 4. Показываем, когда плеер свернут */
body.player-minimized .header-radio-btn {
    display: flex !important; /* Используем flex для центровки */
    animation: fadeIn 0.5s;
}

/* --- АДАПТАЦИЯ ПАРАЛЛАКСА ПОД МОБИЛЬНЫЕ --- */
@media (max-width: 768px) {
    
    /* Для всех слоев параллакса */
    .parallax-layer {
        /* COVER растягивает картинку так, чтобы не было пустых мест.
           Бока обрежутся, но зато по вертикали дыр не будет. */
        background-size: cover !important;
        
        /* Центруем, чтобы обрезка шла равномерно с боков */
        background-position: center top !important;
    }

    /* Для веток (передний план) можно сдвинуть чуть ниже, если лезут в лицо */
    .layer-fore {
        background-position: center bottom !important; /* Прижимаем к низу или верху по вкусу */
    }
}