/* ==========================================================================
   Header & Navigation - Ralph Ammer Theme
   ========================================================================== */

/* Header */
.header {
    height: 72px;
    min-width: 300px;
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 0 0px;  /* top-bottom left-right */
    padding-top: 24px;
    width: 100%;
    flex-wrap: wrap;
    /* max-width: 100vw; */
    /* overflow: hidden; */
    margin-bottom: 2.5rem;
}

.header__logo-hamburger-container {
    display: flex;
    min-width: 140px;
    flex-direction: row;
}

/* Logo */
.header__logo {
    font-weight: bold;
    width: 120px;
    line-height: 1;
}

.header__logo svg {
    display: block;
    width: 100%;
    height: auto;
}

.header__logo .line {
    stroke: #111; /* Von #111 zu red ändern */
    fill: none;
    stroke-width: 1.4px;
}

/* Hamburger-Button Styling */
.header__hamburger {
    width: 34px;
    height: 40px;
    position: relative;
    cursor: pointer;
    display: inline-block;
    /* Optional: Positionierung im Header anpassen */
    margin: 0 1rem;
    display: none;
}

.header__hamburger span {
    position: absolute;
    height: 4px;
    width: 100%;
    background: #333;
    border-radius: 2px;
    transition: 0.4s;
    left: 0;
}

/* Positionierung der drei Linien */
.header__hamburger span:nth-child(1) {
    top: 0;
}
.header__hamburger span:nth-child(2) {
    top: 10px;
}
.header__hamburger span:nth-child(3) {
    top: 20px;
}

/* Aktiv-Zustand: Hamburger verwandelt sich in ein Kreuz */
.header__hamburger.active span:nth-child(1) {
    transform: rotate(45deg);
    top: 10px;
}
.header__hamburger.active span:nth-child(2) {
    opacity: 0;
}
.header__hamburger.active span:nth-child(3) {
    transform: rotate(-45deg);
    top: 10px;
}

/* Navigation */
.main-menu {
    display: flex;
    justify-content: space-between;
    min-width: 680px;
    gap: 20px;
    border-bottom: 1.2px dashed rgba(0, 0, 0, 0.8);
    /* backdrop-filter: blur(3px); */
}

.main-menu__left-container {
    display: flex;
    justify-content: flex-start;
}

.main-menu__right-container {
    display: flex;
    justify-content: flex-end;
}

.main-menu .main-menu__link {
    color: #111 !important;
    text-decoration: none;
    font-family: "Crimson Pro", serif;
    font-optical-sizing: auto;
    font-weight: 400;
    font-style: normal;
    font-size: 1.25rem;
    letter-spacing: 0.01rem;
    padding: 10px 15px;
    display: inline-block; /* Stellt sicher, dass padding funktioniert */
}

.main-menu .main-menu__link:hover {
    /* background-color: rgba(0, 0, 0, 0.1);
    border-radius: 5px; */
    color: #111 !important;
    letter-spacing: -0.01rem;
    font-weight: 550;
}

.main-menu .main-menu__link--selected {
    color: rgba(255, 255, 255, 1.0) !important;
    text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
}

/* WordPress current menu item classes */
.main-menu .current-menu-item a,
.main-menu .current_page_item a {
    color: rgba(255, 255, 255, 1.0) !important;
    text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
}

/* Hover states for active/selected menu items - keep them unchanged */
.main-menu .main-menu__link--selected:hover,
.main-menu .current-menu-item a:hover,
.main-menu .current_page_item a:hover {
    color: rgba(255, 255, 255, 1.0) !important;
    letter-spacing: 0.01rem; /* Keep original letter spacing */
    font-weight: 400; /* Keep original font weight */
    text-shadow: 0px 0px 5px rgba(0, 0, 0, 0.2);
}

/* Social Icons */
.social-menu {
    display: flex;
    display: row;
    min-width: 140px;
    gap: 0.8rem;
    justify-content: center;
    align-items: center;
    line-height: 0;
}

.social-menu__link {
    color: rgba(0, 0, 0, 0.8);
    text-decoration: none;
    font-size: 16px;
}

.social-menu__link:hover {
    color: #000;
}

.social-menu__icon {
    height:  1.25rem; 
}

/* WordPress Menu Reset */
#primary-menu {
    margin: 0;
    padding: 0;
}

/* Responsives Design (mid) */
@media (max-width: 1024px) {
    .header {
        /* Ermöglicht den Umbruch in mehrere Zeilen und zentriert den Inhalt */
        flex-wrap: wrap;
        height: auto;
        justify-content: flex-start;  /* Links ausrichten statt center */
        align-items: center;
        padding: 10px;
        max-width: 600px;  /* Gleiche max-width wie Primary Menu */
        width: 100%;
        margin: 1rem auto 0 auto !important;  /* Oben 1rem, unten 0, horizontal zentriert */
        display: flex;
        flex-direction: row;  /* Erste Zeile horizontal */
    }
    
    /* Logo linksbündig positionieren */
    .header__logo-hamburger-container {
        order: 1;
        margin: 0;
        padding: 0;
        flex: 0 0 auto;  /* Logo nimmt nur benötigten Platz */
        align-self: flex-start;  /* Logo am linken Rand */
    }

    .social-menu {
        order: 2;
        margin: 0;
        padding: 0;
        margin-left: auto;  /* Social Menu nach rechts schieben */
        flex: 0 0 auto;
    }

    .header__logo {
        width: 120px;
    }
    
    /* Hauptmenü in der zweiten Zeile */
    .main-menu {
        order: 3;
        width: 100%;
        max-width: 600px;  /* Gleiche Breite wie Header */
        justify-content: space-between;
        margin: 10px auto 0 auto;
        min-width: 0;
        display: flex;
        flex-basis: 100%;  /* Nimmt die ganze Breite der neuen Zeile */
    }

    .main-menu__left-container,
    .main-menu__right-container {
        /* Ursprüngliche Aufteilung beibehalten */
        display: flex;
    }

    .menu-container-left {
        flex-direction: row;
    }
    .menu-container-right {
        flex-direction: row;
    }

    .menu-container a {
        text-align: center;
        min-width: 10%;
    }
}

/* Mobile-Version: Social-Menu unter dem Logo */
@media (max-width: 768px) {  /* 768px - angepasst an writing.css Breakpoint */
    .header__logo-hamburger-container {
        width: 100%;
        padding-left: 14px;
        padding-right: 14px;
        position: relative;
        display: flex;
        justify-content: flex-end; /* Ändert das Layout, um den Hamburger rechts zu positionieren */
        align-items: center;
    }

    .header__logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%); /* Perfekte horizontale Zentrierung */
        width: 140px;
        text-align: center;
        padding: 10px 0;
        padding-bottom: 0;
        z-index: 0; /* Damit das Logo hinter dem Hamburger-Menü liegt, wenn sie überlappen */
    }

    .header__hamburger {
        display: block;
        order: 1;
        position: relative; /* Sicherstellt, dass der Hamburger nicht von der absoluten Positionierung beeinflusst wird */
        top: 0.75rem;
        right: 0; /* Positioniert den Hamburger explizit rechts */
        margin-right: 0; /* Entfernt mögliche Margins */
        z-index: 1; /* Stellt sicher, dass der Hamburger über dem Logo liegt */
    }

    .social-menu {
        order: 2;
        width: 100%;
        text-align: center;
        justify-content: center;
        padding: 0.5rem 0;
        padding-top: 1.5rem;
        display: none;
    }

    .social-menu.visible {
        display: flex;
        gap: 0.8rem; /* Gleicher Abstand wie Desktop */
    }
    
    .main-menu {
        order: 3; 
        gap: 4px;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-width: 0;
        padding-bottom: 20px;
        display: block; /* Wichtig: block display für mobile */
    }

    .main-menu__left-container, .main-menu__right-container {
        align-items: center;
        justify-content: center;
        display: none;
        flex-direction: column;
    }

    .main-menu__link {
        text-align: center;
        margin-top: 8px;
        width: 90vw;
        background-color: rgba(0, 0, 0, 0.1);
        border: solid 1px rgba(0, 0, 0, 0.2); 
        border-radius: 5px;
        min-width: 10%;
    } 

    .social-menu {
        display: none;
    } 

    .hidden {
        opacity: 0;
        visibility: hidden; 
        transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    }
    
    .visible {
        opacity: 1;
        visibility: visible; 
        transition: opacity 0.2s ease-in-out, visibility 0.2s ease-in-out;
    } 

    .header {
        margin-bottom: 0px;
        flex-direction: row;
        justify-content: center;
        align-items: center;
        backdrop-filter: blur(4px);
    }
    
    .header-logo .line {
        stroke-width: 1.2px;
    }
}
