:root {
    --primary-text-color: #222;
    --secondary-text-color: white;
    --background-dark: #222;
    --background-light: #f4f4f4;
    --transition-speed: 0.3s ease;
}

body {
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
    /* Ensure MediaFon.jpg exists or change to a supported format */
    background: url('../images/MediaFon.CR2') no-repeat center center fixed; /* Перевірте розширення файлу */
    background-size: cover;
    color: white;
    overflow-x: hidden;
}

/* --- Navigation Styles --- */
nav {
    background-color: var(--background-dark);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between; /* Розносимо елементи по краях */
    flex-wrap: nowrap; /* Запобігаємо перенесенню елементів на великих екранах */
    position: sticky; /* Фіксована навігація */
    top: 0;
    width: 100%;
    box-sizing: border-box;
    z-index: 990;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* Кнопка-бургер */
.hamburger-menu {
    display: none; /* Приховуємо за замовчуванням на великих екранах */
    background: none;
    border: none;
    font-size: 24px;
    color: white;
    cursor: pointer;
    padding: 10px;
    order: -1; /* Розміщуємо зліва на мобільних */
}

/* Група посилань навігації */
.nav-links-group { /* Змінено клас */
    display: flex; /* За замовчуванням завжди flex для десктопу */
    gap: 15px;
    flex-wrap: wrap; /* Дозволяємо перенесення на новий рядок, якщо не влазять */
    justify-content: center;
    flex-grow: 1; /* Дозволяє займати доступний простір */
}

nav a {
    color: var(--secondary-text-color);
    text-decoration: none;
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 5px;
    transition: color var(--transition-speed), text-shadow var(--transition-speed), background-color var(--transition-speed), box-shadow var(--transition-speed);
    white-space: nowrap; /* Запобігаємо перенесенню тексту посилання */
}

nav a:hover {
    text-decoration: none;
    color: #ccc;
    text-shadow: 0 0 8px #ccc;
}

nav a.active-link { /* Змінено на active-link для уніфікації */
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px 8px rgba(255, 255, 255, 0.4);
    border-radius: 20px;
}

/* --- Language Switcher Styles --- */
.language-switcher {
    display: flex;
    gap: 10px;
}

.language-button {
    background: transparent;
    border: none;
    color: white;
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 5px;
    font-weight: bold;
    text-shadow: none;
    transition: color var(--transition-speed), text-shadow var(--transition-speed), background-color var(--transition-speed), box-shadow var(--transition-speed);
}

.language-button:hover {
    color: #ccc;
    text-shadow: 0 0 8px #ccc;
}

.language-button.active {
    background-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 0 20px 8px rgba(255, 255, 255, 0.4);
    border-radius: 20px;
}

/* --- Main Content Styles --- */
main {
    background-color: rgba(0, 0, 0, 0.6);
    padding: 30px 20px;
    max-width: 900px;
    margin: 80px auto 20px auto; /* Залишаємо відступ згори */
    border-radius: 10px;
    text-align: center;
}

h1 {
    color: white;
    margin-bottom: 30px;
}

/* --- Video Block Styles --- */
.video-block {
    margin-bottom: 40px;
    position: relative;
    background-color: rgba(0, 0, 0, 0.4);
    padding: 15px;
    border-radius: 8px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.video-block.left {
    margin-right: auto;
    margin-left: 0;
    padding-right: 20%;
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.5);
    text-align: left;
}

.video-block.right {
    margin-left: auto;
    margin-right: 0;
    padding-left: 20%;
    box-shadow: 5px 0 20px rgba(0, 0, 0, 0.5);
    text-align: right;
}

.video-block h2,
.video-block h3,
.video-block h4 {
    font-family: 'Roboto Slab', serif !important;
    font-weight: 700 !important;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    color: white;
    text-align: center;
    width: 100%;
}

.video-block h2 {
    margin-top: 10px;
    margin-bottom: 15px;
    font-size: 1.8em;
}

.video-block h3 {
    font-size: 1.4em;
    margin-bottom: 10px;
}

.video-block h4 {
    font-size: 1.1em;
    margin-bottom: 20px;
}

/* --- Video Thumbnail Styles --- */
.video-thumbnail {
    display: block;
    width: 80%;
    max-width: 400px;
    height: 225px;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.video-thumbnail:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.video-thumbnail .play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3em;
    color: white;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    text-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

.video-thumbnail:hover .play-button {
    opacity: 1;
}

/* --- Background Gradients for Video Blocks --- */
.video-block::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 30%;
    z-index: 1;
    pointer-events: none;
}

.video-block.left::before {
    left: 0;
    background: linear-gradient(to right, rgba(0, 0, 0, 0.8), transparent);
}

.video-block.right::before {
    right: 0;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.8), transparent);
}

/* --- Footer Styles --- */
footer {
    background-color: var(--background-dark);
    color: var(--secondary-text-color);
    text-align: center;
    padding: 20px;
    position: relative;
    bottom: 0;
    width: 100%;
}

.footer-small-text {
    font-size: 0.8em;
    margin-top: 10px;
    opacity: 0.8;
}

/* --- Стилі модального вікна для відео --- */
.modal-overlay {
    display: none; /* Завжди 'none' за замовчуванням, показуємо через JS */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
    justify-content: center;
    align-items: center;
}

.modal-content {
    position: relative;
    background-color: #000;
    margin: auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 800px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.modal-content video {
    width: 100%;
    height: auto;
    max-height: 80vh; /* Limit video height */
    display: block;
    border-radius: 8px;
}

.close-button {
    color: #fff;
    font-size: 2.5em;
    font-weight: bold;
    position: absolute;
    top: 10px;
    right: 20px;
    cursor: pointer;
    transition: color 0.3s ease;
    z-index: 1001; /* Ensure close button is above video */
}

.close-button:hover,
.close-button:focus {
    color: #999;
    text-decoration: none;
    cursor: pointer;
}

/* --- Responsive Styles --- */
@media (max-width: 768px) {
    nav {
        flex-direction: row; /* Залишаємо в рядок, щоб бургер і мови були поруч */
        justify-content: space-between;
        padding: 10px 15px; /* Зменшуємо внутрішній відступ */
        flex-wrap: nowrap; /* Запобігаємо перенесенню елементів навбару */
    }

    .hamburger-menu {
        display: block; /* Показуємо кнопку-бургер */
    }

    .nav-links-group { /* Змінено клас */
        display: none; /* Приховуємо посилання за замовчуванням */
        flex-direction: column; /* Елементи меню один під одним */
        width: 100%; /* Займає всю ширину */
        position: absolute;
        top: 60px; /* Висота навбару */
        left: 0;
        background-color: var(--background-dark);
        box-shadow: 0 5px 10px rgba(0,0,0,0.3);
        padding: 10px 0;
        overflow: hidden;
    }

    .nav-links-group.open {
        display: flex; /* Показуємо як flex-контейнер */
        animation: slideDown 0.3s ease-out forwards;
    }

    .nav-links-group.closing {
        animation: slideUp 0.3s ease-out forwards;
    }

    .nav-links-group a {
        text-align: center;
        padding: 12px 0;
        width: 100%;
        border-radius: 0; /* Прибираємо закруглення, якщо меню повне */
        background-color: transparent; /* Робимо фон прозорим у відкритому меню */
        box-shadow: none;
    }

    .language-switcher {
        position: static; /* Повертаємо в нормальний потік */
        display: flex;
        gap: 10px;
        margin-top: 0;
        order: 1; /* Розміщуємо мови праворуч від бургеру */
    }

    .language-button {
        padding: 6px 10px;
        font-size: 0.9em;
        border-radius: 15px;
        backdrop-filter: none; /* Прибираємо blur, якщо потрібно */
        -webkit-backdrop-filter: none;
    }

    main {
        padding: 20px 15px;
        margin-top: 70px;
    }
    .video-block.left, .video-block.right {
        margin-left: auto;
        margin-right: auto;
        padding-left: 15px;
        padding-right: 15px;
        text-align: center;
        box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    }
    .video-block::before {
        display: none; /* Приховуємо градієнти на мобільних */
    }
    .video-thumbnail {
        width: 90%;
        height: 180px;
    }
    .video-block h2 {
        font-size: 1.5em;
    }
    .modal-content {
        width: 95%;
        padding: 10px;
    }
}

/* Анімація появи меню */
@keyframes slideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Анімація зникнення меню */
@keyframes slideUp {
    from {
        transform: translateY(0);
        opacity: 1;
    }
    to {
        transform: translateY(-100%);
        opacity: 0;
    }
}

@media (max-width: 480px) {
    main {
        padding: 15px 10px;
        margin-top: 60px;
    }
    .video-thumbnail {
        width: 100%;
        height: 150px;
    }
    .video-block h2 {
        font-size: 1.3em;
    }
    nav a {
        font-size: 0.9em;
    }
    .close-button {
        font-size: 2em;
        top: 5px;
        right: 15px;
    }
}