/*
 Theme Name:   Divi Child - Haderslev Vinfestival
 Theme URI:    https://haderslev.vinfestival.dk
 Description:  Divi child theme med hamburger sidebar-menu til Haderslev Vinfestival
 Author:       Haderslev Vinfestival
 Author URI:   https://haderslev.vinfestival.dk
 Template:     Divi
 Version:      1.0.0
 Text Domain:  divi-child-haderslev
*/

/* ==========================================================================
   Import Divi parent styles
   ========================================================================== */
/* Parent styles loaded via functions.php wp_enqueue_style */

/* ==========================================================================
   Skjul Divi standard header paa hamburger-sider
   ========================================================================== */
body.hamburger-page #main-header,
body.hamburger-page #top-header,
body.hamburger-page #et-secondary-nav {
    display: none !important;
}

body.hamburger-page #page-container {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

body.hamburger-page .et-l--header {
    display: none !important;
}

/* ==========================================================================
   Hamburger Toggle-knap
   ========================================================================== */
.hv-hamburger-toggle {
    display: none;
    position: fixed;
    top: 55px;
    right: 20px;
    z-index: 99999;
    width: 50px;
    height: 50px;
    padding: 0;
    margin: 0;
    background: transparent;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: none;
    transition: background 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                transform 0.2s ease;
    -webkit-tap-highlight-color: transparent;
}

body.hamburger-page .hv-hamburger-toggle,
.hv-hamburger-module .hv-hamburger-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hv-hamburger-toggle:hover {
    opacity: 0.8;
}

.hv-hamburger-toggle:focus-visible {
    outline: 2px solid #d4a574;
    outline-offset: 3px;
}

/* Hamburger icon - de 3 streger */
.hv-hamburger-icon {
    position: relative;
    width: 22px;
    height: 16px;
}

.hv-hamburger-icon span {
    display: block;
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: #ffffff;
    border-radius: 2px;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.hv-hamburger-icon span:nth-child(1) {
    top: 0;
}

.hv-hamburger-icon span:nth-child(2) {
    top: 7px;
}

.hv-hamburger-icon span:nth-child(3) {
    top: 14px;
}

/* Skjul burger-knap naar menu er aaben — luk via kryds i sidebar, overlay eller ESC */
.hv-hamburger-toggle.is-active {
    opacity: 0 !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* ==========================================================================
   Overlay baggrund
   ========================================================================== */
.hv-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99997;
    opacity: 0;
    transition: opacity 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

body.hamburger-page .hv-menu-overlay,
.hv-hamburger-module .hv-menu-overlay {
    display: block;
    pointer-events: none;
}

body.hamburger-page .hv-menu-overlay.is-visible,
.hv-hamburger-module .hv-menu-overlay.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ==========================================================================
   Sidebar Panel
   ========================================================================== */
.hv-sidebar-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    max-width: 85vw;
    height: 100%;
    z-index: 99998;
    background: #4e2a14;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
}

.hv-sidebar-menu.is-open {
    transform: translateX(0);
    box-shadow: -5px 0 30px rgba(0, 0, 0, 0.3);
}

/* Sidebar header med titel og luk-knap */
.hv-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 20px 30px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
    min-height: 60px;
}

.hv-sidebar-header .hv-sidebar-title {
    color: #ffffff;
    font-family: 'Playfair Display', serif;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
    line-height: 1.3;
    flex: 1;
}

/* Luk-knap (kryds) i sidebar header */
.hv-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    margin-left: 10px;
    flex-shrink: 0;
    border-radius: 50%;
    transition: color 0.25s ease, background 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

.hv-sidebar-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.hv-sidebar-close:focus-visible {
    outline: 2px solid #d4a574;
    outline-offset: 2px;
}

/* ==========================================================================
   Menu Items
   ========================================================================== */
.hv-sidebar-nav {
    padding: 15px 0;
    flex: 1;
}

/* Reset WordPress menu styling */
.hv-sidebar-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hv-sidebar-nav li {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.hv-sidebar-nav li:last-child {
    border-bottom: none;
}

.hv-sidebar-nav li a {
    display: block;
    padding: 14px 30px;
    color: rgba(255, 255, 255, 0.85);
    font-family: 'Playfair Display', serif;
    font-size: 16px;
    font-weight: 400;
    text-decoration: none;
    letter-spacing: 0.5px;
    transition: all 0.25s ease;
    position: relative;
}

.hv-sidebar-nav li a:hover,
.hv-sidebar-nav li a:focus {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

.hv-sidebar-nav li.current-menu-item > a,
.hv-sidebar-nav li.current_page_item > a {
    color: #d4a574;
    background: rgba(255, 255, 255, 0.05);
}

.hv-sidebar-nav li.current-menu-item > a::before,
.hv-sidebar-nav li.current_page_item > a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #d4a574;
}

/* ==========================================================================
   Submenuer (Accordion)
   ========================================================================== */
.hv-sidebar-nav li.menu-item-has-children > a {
    padding-right: 50px;
}

.hv-submenu-toggle {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

.hv-submenu-toggle::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-right: 2px solid rgba(255, 255, 255, 0.5);
    border-bottom: 2px solid rgba(255, 255, 255, 0.5);
    transform: rotate(45deg);
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.hv-submenu-toggle.is-expanded::after {
    transform: rotate(-135deg);
    border-color: #d4a574;
}

/* Submenu items */
.hv-sidebar-nav .sub-menu {
    display: none;
    background: rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.hv-sidebar-nav .sub-menu.is-open {
    display: block;
}

.hv-sidebar-nav .sub-menu li {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.hv-sidebar-nav .sub-menu li a {
    padding: 12px 30px 12px 45px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
}

.hv-sidebar-nav .sub-menu li a:hover {
    color: #ffffff;
}

/* Nested submenus (3. niveau) */
.hv-sidebar-nav .sub-menu .sub-menu li a {
    padding-left: 60px;
    font-size: 13px;
}

.hv-sidebar-nav .sub-menu .sub-menu li a:hover {
    color: #ffffff;
}

/* ==========================================================================
   Sidebar footer (kontakt info)
   ========================================================================== */
.hv-sidebar-footer {
    padding: 20px 30px 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.hv-sidebar-footer a {
    color: #d4a574;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.25s ease;
}

.hv-sidebar-footer a:hover {
    color: #ffffff;
}

/* ==========================================================================
   Body scroll lock
   ========================================================================== */
body.hv-menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* ==========================================================================
   Social Media ikoner i sidebar (valgfrit)
   ========================================================================== */
.hv-sidebar-social {
    display: flex;
    gap: 15px;
    padding: 15px 30px 0;
}

.hv-sidebar-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    text-decoration: none;
    transition: all 0.25s ease;
}

.hv-sidebar-social a:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: #d4a574;
    color: #d4a574;
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 980px) {
    .hv-hamburger-toggle {
        top: 15px;
        right: 15px;
        width: 44px;
        height: 44px;
    }

    .hv-hamburger-icon {
        width: 20px;
        height: 14px;
    }

    .hv-hamburger-icon span:nth-child(2) {
        top: 6px;
    }

    .hv-hamburger-icon span:nth-child(3) {
        top: 12px;
    }

    .hv-sidebar-menu {
        width: 300px;
    }

    .hv-sidebar-nav li a {
        padding: 13px 25px;
        font-size: 15px;
    }

    .hv-sidebar-nav .sub-menu li a {
        padding: 11px 25px 11px 40px;
    }

    .hv-sidebar-header {
        padding: 15px 15px 15px 25px;
    }

    .hv-sidebar-close {
        width: 36px;
        height: 36px;
        font-size: 24px;
    }

    .hv-sidebar-footer {
        padding: 15px 25px 25px;
    }
}

@media (max-width: 479px) {
    .hv-sidebar-menu {
        width: 280px;
    }

    .hv-sidebar-header .hv-sidebar-title {
        font-size: 18px;
    }

    .hv-sidebar-nav li a {
        padding: 12px 20px;
        font-size: 14px;
    }
}

/* ==========================================================================
   Print - skjul hamburger menu
   ========================================================================== */
@media print {
    .hv-hamburger-toggle,
    .hv-sidebar-menu,
    .hv-menu-overlay {
        display: none !important;
    }
}
