/* =========================================================
   MKC HEADER – DYNAMISCHE SHOPNAVIGATION
   Version 0.6.8.39

   Die Struktur und Reihenfolge kommen vollständig aus dem
   WordPress-Menü. Es werden keine Produktkategorien fest im
   Plugin hinterlegt.
   ========================================================= */

/* ---------------------------------------------------------
   Home + Produkte: gleiche Designsprache wie Konto/Warenkorb
   --------------------------------------------------------- */
@media screen and (min-width: 981px) {
    /*
     * Divi und der MKC-Shortcode besitzen unterschiedliche Wrapper.
     * Deshalb werden die beiden Primary-Menu-Einträge hier bewusst auf
     * dieselbe sichtbare Geometrie wie die 88x88-px Headeraktionen gebracht.
     * Die kleine Kompensation gleicht Divis eigene Menübox aus.
     */
    .mkc-nav-home,
    .mkc-nav-products {
        box-sizing: border-box !important;
        display: flex !important;
        height: 92px !important;
        margin: 0 !important;
        padding: 0 !important;
        align-items: center !important;
        justify-content: center !important;
        line-height: 1 !important;
        vertical-align: middle !important;
    }

    .mkc-nav-home > a,
    .mkc-nav-products > a {
        box-sizing: border-box;
        display: flex !important;
        min-width: 96px;
        width: 92px;
        height: 92px;
        padding: 9px 12px 8px !important;
        align-items: center;
        justify-content: center;
        flex-direction: column;
        gap: 4px;
        border-radius: 14px;
        color: #000 !important;
        font-family: Verdana, Arial, sans-serif !important;
        font-size: 16px !important;
        font-style: normal !important;
        font-weight: 400 !important;
        letter-spacing: 0 !important;
        line-height: 1.2 !important;
        text-transform: none !important;
        text-align: center;
        text-decoration: none !important;
        transform: translateY(-2px);
        -webkit-font-smoothing: antialiased;
        transition: background-color .18s ease, color .18s ease;
    }

    .mkc-nav-products > a {
        min-width: 116px;
        width: 116px;
        padding-right: 23px !important;
    }

    /* Divi kann den Linktext in zusätzliche Inline-Elemente kapseln. */
    .mkc-nav-home > a *,
    .mkc-nav-products > a * {
        font-family: Verdana, Arial, sans-serif !important;
        font-size: 16px !important;
        font-style: normal !important;
        font-weight: 400 !important;
        letter-spacing: 0 !important;
        line-height: 1.2 !important;
        text-transform: none !important;
    }

    .mkc-nav-home > a:hover,
    .mkc-nav-home > a:focus-visible,
    .mkc-nav-products > a:hover,
    .mkc-nav-products > a:focus-visible,
    .mkc-nav-home.current-menu-item > a,
    .mkc-nav-products.current-menu-item > a,
    .mkc-nav-products.current-menu-ancestor > a {
        background-color: #e2e2e2;
        color: #c50000 !important;
    }

    .mkc-nav-home > a:focus-visible,
    .mkc-nav-products > a:focus-visible {
        outline: none;
        box-shadow: 0 0 0 2px rgba(197, 0, 0, .22);
    }

    .mkc-nav-home > a::before,
    .mkc-nav-products > a::before {
        position: static !important;
        display: block !important;
        width: 42px !important;
        height: 42px !important;
        margin: 0 !important;
        padding: 0 !important;
        flex: 0 0 42px;
        background-color: currentColor;
        content: "" !important;
        opacity: 1 !important;
        transform: none !important;
        -webkit-mask-position: center;
        mask-position: center;
        -webkit-mask-repeat: no-repeat;
        mask-repeat: no-repeat;
        -webkit-mask-size: 40px 40px;
        mask-size: 40px 40px;
    }

    /* Feines Haus-Line-Icon. */
    .mkc-nav-home > a::before {
        -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M4.5 14.5 16 5l11.5 9.5M7.5 12v14h17V12M12.5 26v-8h7v8' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32'%3E%3Cpath d='M4.5 14.5 16 5l11.5 9.5M7.5 12v14h17V12M12.5 26v-8h7v8' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    }

    /*
     * Produkte = Kategorieraster. Die originale MKC-Blume liegt als kleine
     * zweite Hintergrundebene im Raster und wandert bei Hover/Fokus im Kreis.
     */
    .mkc-nav-products > a::before {
        background-color: transparent;
        background-image:
            url("../images/mkc-flower-mark.png"),
            url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg fill='none' stroke='%23000' stroke-width='1.7' stroke-linejoin='round'%3E%3Crect x='3.5' y='3.5' width='14' height='14' rx='2'/%3E%3Crect x='22.5' y='3.5' width='14' height='14' rx='2'/%3E%3Crect x='22.5' y='22.5' width='14' height='14' rx='2'/%3E%3Crect x='3.5' y='22.5' width='14' height='14' rx='2'/%3E%3C/g%3E%3C/svg%3E");
        background-position: 6px 5px, center;
        background-repeat: no-repeat, no-repeat;
        background-size: 11px auto, 40px 40px;
        -webkit-mask-image: none;
        mask-image: none;
    }

    .mkc-nav-products > a:hover::before,
    .mkc-nav-products > a:focus-visible::before,
    .mkc-nav-products.current-menu-item > a::before,
    .mkc-nav-products.current-menu-ancestor > a::before {
        animation: mkc-product-flower-orbit 2.4s steps(1, end) infinite;
    }

    @keyframes mkc-product-flower-orbit {
        0%, 24.99%   { background-position: 6px 5px, center; }
        25%, 49.99%  { background-position: 25px 5px, center; }
        50%, 74.99%  { background-position: 25px 24px, center; }
        75%, 100%    { background-position: 6px 24px, center; }
    }

    @media (prefers-reduced-motion: reduce) {
        .mkc-nav-products > a:hover::before,
        .mkc-nav-products > a:focus-visible::before,
        .mkc-nav-products.current-menu-item > a::before,
        .mkc-nav-products.current-menu-ancestor > a::before {
            animation: none;
        }
    }

    /* Divis vorhandener Untermenü-Pfeil bleibt erhalten, wird aber ruhiger. */
    .mkc-nav-products > a::after {
        top: auto !important;
        right: 8px !important;
        bottom: 14px !important;
        margin: 0 !important;
        color: currentColor !important;
        font-size: 13px !important;
        line-height: 1 !important;
    }

    /* -----------------------------------------------------
       Dynamisches Mega-Menü unter „Produkte“
       Ebene 2 = Gruppen, Ebene 3 = Links innerhalb der Gruppe
       ----------------------------------------------------- */
    .mkc-nav-products {
        position: relative !important;
    }

    /* Gleiche feine Trennlinie wie zwischen Mein Konto und Warenkorb. */
    .mkc-nav-products::before {
        position: absolute;
        top: 14px;
        bottom: 14px;
        left: -4px;
        width: 1px;
        background: rgba(0, 0, 0, .14);
        content: "";
        pointer-events: none;
    }

    .mkc-nav-products > ul.sub-menu {
        box-sizing: border-box !important;
        width: min(980px, calc(100vw - 48px)) !important;
        max-width: calc(100vw - 48px) !important;
        min-width: 520px !important;
        padding: 22px !important;
        left: 50% !important;
        right: auto !important;
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
        gap: 12px 18px;
        border: 1px solid rgba(0, 0, 0, .10) !important;
        border-radius: 18px !important;
        background: #fff !important;
        box-shadow: 0 14px 34px rgba(0, 0, 0, .14) !important;
        transform: translateX(-50%) !important;
    }

    /*
     * Das Mega-Menü öffnet bewusst nur nach einem Klick auf „Produkte“.
     * Divis Hover-/Focus-Klassen dürfen das Menü nicht vorzeitig einblenden.
     */
    .mkc-nav-products > ul.sub-menu {
        display: none !important;
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }

    .mkc-nav-products.mkc-menu-open > ul.sub-menu {
        display: grid !important;
        visibility: visible !important;
        opacity: 1 !important;
        pointer-events: auto !important;
    }

    /* Jede Kategorie der zweiten Ebene wird zu einer eigenen Kachel/Spalte. */
    .mkc-nav-products > ul.sub-menu > li {
        box-sizing: border-box !important;
        position: relative !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
        background: #f5f5f5;
        border-radius: 13px;
        overflow: hidden;
    }

    .mkc-nav-products > ul.sub-menu > li > a {
        box-sizing: border-box !important;
        display: block !important;
        width: 100% !important;
        padding: 13px 15px !important;
        border: 0 !important;
        background: transparent !important;
        color: #111 !important;
        font-family: Verdana, Arial, sans-serif;
        font-size: 15px !important;
        font-weight: 700 !important;
        line-height: 1.3 !important;
        text-decoration: none !important;
        white-space: normal !important;
        transition: background-color .18s ease, color .18s ease;
    }

    .mkc-nav-products > ul.sub-menu > li > a:hover,
    .mkc-nav-products > ul.sub-menu > li > a:focus-visible {
        background: #e5e5e5 !important;
        color: #c50000 !important;
        outline: none;
    }

    /* Pfeile an den Gruppenüberschriften entfallen, da Ebene 3 sichtbar ist. */
    .mkc-nav-products > ul.sub-menu > li.menu-item-has-children > a::after {
        display: none !important;
    }

    /* Dritte Ebene: immer innerhalb der Kategorie sichtbar statt Flyout. */
    .mkc-nav-products > ul.sub-menu > li > ul.sub-menu {
        display: block !important;
        position: static !important;
        visibility: visible !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 3px 7px 9px !important;
        opacity: 1 !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        transform: none !important;
    }

    .mkc-nav-products > ul.sub-menu > li > ul.sub-menu > li {
        position: static !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: 0 !important;
    }

    .mkc-nav-products > ul.sub-menu > li > ul.sub-menu > li > a {
        box-sizing: border-box !important;
        display: block !important;
        width: 100% !important;
        padding: 9px 10px !important;
        border-radius: 9px;
        background: transparent !important;
        color: #333 !important;
        font-family: Verdana, Arial, sans-serif;
        font-size: 14px !important;
        font-weight: 400 !important;
        line-height: 1.35 !important;
        text-decoration: none !important;
        white-space: normal !important;
        transition: background-color .18s ease, color .18s ease, padding-left .18s ease;
    }

    .mkc-nav-products > ul.sub-menu > li > ul.sub-menu > li > a:hover,
    .mkc-nav-products > ul.sub-menu > li > ul.sub-menu > li > a:focus-visible,
    .mkc-nav-products > ul.sub-menu > li > ul.sub-menu > li.current-menu-item > a {
        padding-left: 14px !important;
        background: #e8e8e8 !important;
        color: #c50000 !important;
        outline: none;
    }

    /* Auch tiefere Ebenen bleiben in der Kachel und erzeugen kein seitliches Flyout. */
    .mkc-nav-products > ul.sub-menu ul.sub-menu ul.sub-menu {
        display: block !important;
        position: static !important;
        visibility: visible !important;
        width: auto !important;
        margin: 0 !important;
        padding: 0 7px 7px 17px !important;
        opacity: 1 !important;
        border: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        transform: none !important;
    }
}

/* ---------------------------------------------------------
   Tablet / Smartphone
   Divis mobile Navigation bleibt funktional; nur leichte
   optische Aufwertung, kein erzwungenes Mega-Menü.
   --------------------------------------------------------- */
@media screen and (max-width: 980px) {
    .mkc-nav-home > a,
    .mkc-nav-products > a {
        font-weight: 600 !important;
    }

    .mkc-nav-products ul.sub-menu {
        border-radius: 10px;
    }

    .mkc-nav-products ul.sub-menu a {
        white-space: normal !important;
    }
}
