/* --------------------------------------------------------------
   FWGPress – Navigation (Desktop + Mobile)
   Struktur:
   1) Desktop Navigation
   2) Mobile Navigation
-------------------------------------------------------------- */


/* ==============================================================
   1) DESKTOP NAVIGATION
   -------------------------------------------------------------- */
@media (min-width: 769px) {

    /* ---------------------------------------------
       1.1 Hauptnavigation im Header
    --------------------------------------------- */
    .fwg-nav {
        margin-left: auto;
        padding-right: 80px;
    }

    .fwg-header-inner {
        padding-left: 80px;
    }

    .fwg-nav .fwg-menu {
        list-style: none;
        margin: 0;
        padding: 0;

        display: flex;
        gap: 24px;
        flex-wrap: nowrap;
        white-space: nowrap;
    }

    .fwg-nav .fwg-menu li {
        position: relative; /* wichtig für Submenü */
    }

    .fwg-nav .fwg-menu a {
        text-decoration: none;
        color: var(--fwg-blue);
        font-size: 15px;
        font-weight: 500;
        padding: 12px 0;
        transition: color .25s ease;
    }

    /* Hover-Effekt für Haupt- und Submenü-Einträge */
    .fwg-nav .fwg-menu > li > a:hover,
    .fwg-nav .fwg-menu .sub-menu a:hover {
        color: var(--fwg-orange-dark);
    }


    /* ---------------------------------------------
       1.2 Submenü – smooth fade + slide down
    --------------------------------------------- */

    /* Ausgangszustand: unsichtbar, leicht nach unten versetzt */
    .fwg-nav .fwg-menu li .sub-menu {
        list-style: none;
        position: absolute;
        left: 0;
        top: 100%;

        min-width: 200px;
        margin: 0;
        padding: 8px 0;

        background: var(--fwg-orange);
        border: 1px solid var(--fwg-orange-dark);
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);

        opacity: 0;
        visibility: hidden;
        transform: translateY(18px);

        transition:
            opacity .65s cubic-bezier(0.22, 0.61, 0.36, 1),
            transform .65s cubic-bezier(0.22, 0.61, 0.36, 1),
            visibility 0s linear .65s;

        pointer-events: none; /* verhindert Hover-Löcher */
        z-index: 2000;
    }

    /* Hover-Zustand: weich einblenden + nach oben gleiten */
    .fwg-nav .fwg-menu li:hover > .sub-menu {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);

        transition:
            opacity .65s cubic-bezier(0.22, 0.61, 0.36, 1),
            transform .65s cubic-bezier(0.22, 0.61, 0.36, 1),
            visibility 0s;

        pointer-events: auto;
    }

    /* Submenü-Links */
    .fwg-nav .fwg-menu .sub-menu a {
        display: block;
        padding: 8px 16px;
        color: var(--fwg-blue);
        transition: color .25s ease;
    }


    /* ---------------------------------------------
       1.3 Pfeile für Submenüs (Desktop)
    --------------------------------------------- */
    .fwg-nav .fwg-menu > li.menu-item-has-children > a {
        position: relative;
        padding-right: 18px;
    }

    .fwg-nav .fwg-menu > li.menu-item-has-children > a::after {
        content: "›";
        position: absolute;
        right: 0;
        top: 50%;
        transform: translateY(-50%) rotate(90deg);

        font-size: 18px;
        color: var(--fwg-blue);
        transition: color .25s ease;
    }

    .fwg-nav .fwg-menu > li.menu-item-has-children > a:hover::after {
        color: var(--fwg-orange-dark);
    }
}



/* ==============================================================
   2) MOBILE NAVIGATION
   -------------------------------------------------------------- */
@media (max-width: 768px) {

    /* ---------------------------------------------
       2.1 Header als Bezugspunkt
    --------------------------------------------- */
    header.site-header {
        position: relative;
        z-index: 1000;
    }


    /* ---------------------------------------------
       2.2 Hamburger-Button
    --------------------------------------------- */
    #fwg-menu-button {
        width: 32px;
        height: 32px;
        padding: 4px;

        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;

        border: 2px solid var(--fwg-blue);
        border-radius: 8px;
        background: transparent;
        cursor: pointer;

        position: relative;
        z-index: 2000;
    }

    #fwg-menu-button .fwg-line {
        width: 100%;
        height: 3px;
        background-color: var(--fwg-blue);
        border-radius: 2px;
        transition: all .3s ease;
    }

    /* Hamburger Animation */
    #fwg-menu-button.active .fwg-line:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }
    #fwg-menu-button.active .fwg-line:nth-child(2) {
        opacity: 0;
    }
    #fwg-menu-button.active .fwg-line:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }


    /* ---------------------------------------------
       2.3 Hauptmenü (Akkordeon)
    --------------------------------------------- */
    .fwg-nav .fwg-menu {
        display: none;

        position: absolute;
        top: calc(100% - 5px);
        left: 0;
        right: 0;

        margin: 0 20px;
        padding: 16px;
        box-sizing: border-box;

        background: var(--fwg-orange);
        border-radius: 8px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);

        max-height: 0;
        overflow: hidden;
        transition: max-height .35s ease;
    }

    .fwg-nav .fwg-menu.open {
        display: block;
        max-height: 1000px;
    }


    /* ---------------------------------------------
       2.4 Menüeinträge & Links
    --------------------------------------------- */
    .fwg-nav .fwg-menu li {
        list-style: none;
        position: relative;
        padding: 4px 0;
    }

    .fwg-nav .fwg-menu a {
        display: flex;
        align-items: center;
        width: 100%;
        line-height: 1;
        padding: 4px 0;
        color: var(--fwg-blue);
        text-decoration: none;
        transition: color .25s ease;
    }

    .fwg-nav .fwg-menu a:hover {
        color: var(--fwg-orange-dark);
    }


    /* ---------------------------------------------
       2.5 Submenüs – smooth height animation
    --------------------------------------------- */
    .fwg-nav .fwg-menu .sub-menu {
        margin-top: 0;
        border: 0;

        height: 0;
        overflow: hidden;
        opacity: 0;

        transition:
            height .35s cubic-bezier(0.25, 0.1, 0.25, 1),
            opacity .25s ease;
    }

    .fwg-nav .fwg-menu .sub-menu.open {
        padding: 6px 10px;
        border: 1px solid var(--fwg-orange-dark);
        border-radius: 8px;
        background: rgba(255, 255, 255, 0.15);

        height: var(--fwg-submenu-height);
        opacity: 1;
    }


    /* ---------------------------------------------
       2.6 Pfeile für Mobile
    --------------------------------------------- */
    .fwg-nav .fwg-menu > li.menu-item-has-children > a {
        padding-right: 8px;
    }

    .fwg-nav .fwg-menu > li.menu-item-has-children > a::after {
        content: "›";

        font-size: 22px;
        line-height: 1;

        margin-left: auto;
        padding-left: 8px;

        color: var(--fwg-blue);

        transform: rotate(90deg);
        transition: transform .25s ease;
    }

    .fwg-nav .fwg-menu > li.menu-item-has-children.open > a::after {
        transform: rotate(270deg);
    }
}
