/*
Theme Name: UNIMEGA Luxury Theme
Theme URI: https://unimegayachting.com
Author: UNIMEGA
Author URI: https://unimegayachting.com
Description: Bespoke luxury WordPress theme developed exclusively for UNIMEGA Superyacht Services.
Version: 1.0.12
Requires at least: 6.5
Requires PHP: 8.1
Text Domain: unimega
*/
body, html, #page, .site-content {
    background-color: #ffffff;
    background-image: none;
}

main.site-main {
    background-color: #ffffff;
}

#hero.hero-section {
    background-color: transparent;
}

/* Hero Ana Konteyner */
.hero-section {
    position: relative;
    width: 100%;
    min-height: 100vh; /* Ekranın tamamını kaplar */
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Arka Plan Videosu */
.hero-bg-video {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    min-width: 100%;
    min-height: 100%;
    object-fit: cover; /* Videoyu taşırıp boşluk bırakmadan ekrana yayar */
    transform: translate(-50%, -50%);
    z-index: 1;
}

/* Karartma Katmanı */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45); /* İsteğe göre 0.3 ile 0.6 arası koyuluk */
    z-index: 2;
}

/* İçerik Katmanı (Video ve Karartmanın Üstünde) */
.hero-content {
    position: relative;
    z-index: 3;
    text-align: center;
    color: #ffffff;
}

/* Logo Boyutlandırma */
.hero-logo-img {
    max-width: 500px;
    width: 100%;
    height: auto;
}

.hero-tagline {
    margin: 0 0 1.25rem;
    font-family: 'Playfair Display', Georgia, 'Times New Roman', serif;
    font-size: 13px;
    font-style: italic;
    letter-spacing: 0.35em;
    line-height: 1.6;
    opacity: 0.9;
    color: #ffffff;
}

.hero-section--video {
    background: transparent !important;
}
// Mobil Menü Kapatma Kökten Çözüm
add_action('wp_footer', function() {
    ?>
    <script>
    document.addEventListener('DOMContentLoaded', function() {
        // 1. Kapatma Butonunu Oluştur
        let closeBtn = document.getElementById('custom-mobile-close-btn');
        if (!closeBtn) {
            closeBtn = document.createElement('button');
            closeBtn.id = 'custom-mobile-close-btn';
            closeBtn.innerHTML = '&#10005;';
            closeBtn.setAttribute('style', `
                position: fixed !important;
                top: 50px !important;
                right: 20px !important;
                z-index: 99999999 !important;
                width: 48px !important;
                height: 48px !important;
                background: #ffffff !important;
                color: #000000 !important;
                border: 2px solid #000000 !important;
                border-radius: 50% !important;
                font-size: 26px !important;
                font-weight: bold !important;
                line-height: 44px !important;
                text-align: center !important;
                cursor: pointer !important;
                box-shadow: 0 4px 15px rgba(0,0,0,0.6) !important;
                display: none;
            `);
            document.body.appendChild(closeBtn);
        }

        // 2. Menünün Açık Olup Olmadığını Takip Et
        const checkMenuState = function() {
            const isOpen = document.body.classList.contains('menu-open') || 
                           document.documentElement.classList.contains('menu-open');
            closeBtn.style.display = isOpen ? 'block' : 'none';
        };

        const observer = new MutationObserver(checkMenuState);
        observer.observe(document.body, { attributes: true, attributeFilter: ['class'] });

        // 3. X Butonuna Tıklama (Click) Olayı
        closeBtn.addEventListener('click', function(e) {
            e.preventDefault();
            e.stopPropagation();

            // body ve html üzerinden menu-open sınıfını sök
            document.body.classList.remove('menu-open', 'nav-open', 'mobile-menu-active');
            document.documentElement.classList.remove('menu-open', 'nav-open', 'mobile-menu-active');

            // Temada menü paneli veya header'da 'open' / 'is-open' olan her şeyi temizle
            const allElements = document.querySelectorAll('*');
            allElements.forEach(function(el) {
                if (el.classList.contains('open') || el.classList.contains('is-open') || el.classList.contains('active')) {
                    el.classList.remove('open', 'is-open', 'active');
                }
            });

            // Temanın kendi toggle butonunu simüle et
            const originalToggle = document.querySelector('.menu-toggle, .mobile-menu-toggle, button.menu-toggle, .nav-toggle');
            if (originalToggle) {
                originalToggle.click();
            }

            closeBtn.style.display = 'none';
        });

        // 4. Link Tıklamalarında da Menüyü Kapat
        document.addEventListener('click', function(e) {
            const link = e.target.closest('a');
            if (link && (document.body.classList.contains('menu-open') || document.documentElement.classList.contains('menu-open'))) {
                closeBtn.click();
            }
        });
    });
    </script>
    <?php
});