/**
 * Brunon — header menu restyle (cream panels, gold column headings).
 *
 * Overrides the menu rules in style.min.css (assets/scss/_header.scss), so
 * every selector is prefixed with `header .header_block` to out-rank them.
 * Top-level items with children get `_mega` (functions.php,
 * wp_nav_menu_objects): on desktop and tablet their sub-menu is a row of
 * columns, on phones a bordered box of accordions.
 *
 * Not compiled from SCSS — edit this file directly.
 */

/* ------------------------------------------------------------------ */
/* Desktop                                                             */
/* ------------------------------------------------------------------ */
@media screen and (min-width: 1025px) {

    /* --- mega panel (Cabinet, Traitements, Conseils) --- */
    /* The li goes static so the panel is positioned against header .wrapper. */
    header .header_block .header_menu ul li._mega {
        position: static;
        display: flex;
        align-items: center;
    }
    header .header_block .header_menu ul li._mega > a {
        position: relative;
    }
    /* Hover bridge across the gap between the link and the panel. */
    header .header_block .header_menu ul li._mega > a::after {
        content: '';
        position: absolute;
        left: 0;
        right: -24px;
        top: 100%;
        height: 22px;
    }
    header .header_block .header_menu ul li._mega > .menu_arrow {
        position: relative;
        top: auto;
        right: auto;
        margin: 0 0 0 -22px;
        flex-shrink: 0;
    }

    header .header_block .header_menu ul li._mega > .sub-menu {
        top: calc(100% + 1px);
        left: 0;
        right: 0;
        margin-left: 0;
        min-width: 0;
        flex-direction: row;
        align-items: flex-start;
        gap: 40px;
        padding: 28px 50px 36px;
        background: transparent;
        border-radius: 0;
        transform: translate(0, -10px);
    }
    /* Full-bleed cream background + bottom hairline. */
    header .header_block .header_menu ul li._mega > .sub-menu::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        left: 50%;
        width: 100vw;
        transform: translateX(-50%);
        background: #F6F3E4;
        border-bottom: 1px solid #C1944D;
        box-shadow: 0 20px 30px rgba(0, 0, 0, .05);
        z-index: -1;
    }
    header .header_block .header_menu ul li._mega:hover > .sub-menu {
        transform: translate(0, 0);
    }

    /* Column */
    header .header_block .header_menu ul li._mega > .sub-menu > li {
        width: auto;
        flex: 0 1 auto;
        max-width: 200px;
    }
    header .header_block .header_menu ul li._mega > .sub-menu > li > .menu_arrow {
        display: none;
    }
    /* Column heading */
    header .header_block .header_menu ul li._mega > .sub-menu > li > a,
    header .header_block .header_menu ul li._mega > .sub-menu > li:hover > a {
        display: block;
        height: auto;
        padding: 0;
        text-align: left;
        text-transform: uppercase;
        font-size: 13px;
        line-height: 20px;
        font-weight: 500;
        letter-spacing: .05em;
        color: #C1944D;
        background: transparent;
        border-radius: 0;
    }
    header .header_block .header_menu ul li._mega > .sub-menu > li > a:hover {
        color: #9C7535;
    }

    /* Column links — always visible inside the panel. */
    header .header_block .header_menu ul li._mega > .sub-menu .sub-menu {
        position: static;
        display: flex;
        flex-direction: column;
        gap: 14px;
        min-width: 0;
        margin: 18px 0 0;
        padding: 0;
        background: transparent;
        border-radius: 0;
        opacity: 1;
        visibility: inherit;
        transform: none;
        transition: none;
    }
    header .header_block .header_menu ul li._mega > .sub-menu .sub-menu > li > a,
    header .header_block .header_menu ul li._mega > .sub-menu .sub-menu > li:hover > a {
        display: block;
        height: auto;
        padding: 0;
        text-align: left;
        text-transform: none;
        font-size: 14px;
        line-height: 22px;
        font-weight: 400;
        letter-spacing: .02em;
        color: #444;
        background: transparent;
        border-radius: 0;
    }
    header .header_block .header_menu ul li._mega > .sub-menu .sub-menu > li > a:hover {
        color: #C1944D;
    }
}

/* ------------------------------------------------------------------ */
/* Tablet + phone: drop-down panel under the header                    */
/* ------------------------------------------------------------------ */
@media screen and (max-width: 1024px) {
    header .header_block {
        width: 100%;
        height: calc(100dvh - 99px);
        transform: translate(0, -12px);
        opacity: 0;
        visibility: hidden;
        transition: opacity .3s, transform .3s, visibility .3s;
        box-shadow: 0 20px 30px rgba(0, 0, 0, .08);
    }
    body.menu_opened header .header_block {
        transform: translate(0, 0);
        opacity: 1;
        visibility: visible;
    }

    /* Top level */
    header .header_block .header_menu ul li a {
        padding-top: 12px;
        padding-bottom: 12px;
        font-size: 13px;
    }
    header .header_block .header_menu ul li .menu_arrow {
        top: 7px;
        right: -8px;
        width: 36px;
        height: 36px;
        background-color: transparent;
        box-shadow: none;
        border-radius: 0;
        background-size: 20px;
        background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%23444444' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
        cursor: pointer;
    }

    /* Sub-menus: cream, dark text instead of the gold blocks */
    /* visibility: inherit — style.min.css sets `visible`, which would let an
       open sub-menu show through the hidden panel. */
    header .header_block .header_menu ul .sub-menu,
    header .header_block .header_menu ul .sub-menu .sub-menu {
        background: transparent;
        border-radius: 0;
        visibility: inherit;
    }
    header .header_block .header_menu ul .sub-menu li a {
        color: #444;
        background: transparent;
        border-radius: 0;
        text-transform: none;
        font-size: 14px;
        line-height: 22px;
        font-weight: 400;
        letter-spacing: .02em;
        padding: 8px 16px;
    }

    /* Mega column heading */
    header .header_block .header_menu ul li._mega > .sub-menu > li > a {
        color: #C1944D;
        text-transform: uppercase;
        font-size: 12px;
        line-height: 18px;
        font-weight: 500;
        letter-spacing: .05em;
    }
    header .header_block .header_menu ul li._mega > .sub-menu > li > .menu_arrow {
        background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 7.5L10 12.5L15 7.5' stroke='%23C1944D' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    }
}

/* Tablet: mega panel as a row of always-open columns */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    /* jQuery slideDown writes display:block inline; force the row while open
       (the class is removed before slideUp, so closing still animates). */
    header .header_block .header_menu ul li._mega._opened > .sub-menu {
        display: flex !important;
    }
    header .header_block .header_menu ul li._mega > .sub-menu {
        flex-direction: row;
        align-items: flex-start;
        gap: 24px;
        padding: 8px 0 20px;
        margin-bottom: 4px;
        border-bottom: 1px solid #C1944D;
    }
    header .header_block .header_menu ul li._mega > .sub-menu > li {
        flex: 1 1 0;
        min-width: 0;
    }
    header .header_block .header_menu ul li._mega > .sub-menu > li > a {
        padding: 0;
    }
    header .header_block .header_menu ul li._mega > .sub-menu > li > .menu_arrow {
        display: none;
    }
    header .header_block .header_menu ul li._mega > .sub-menu .sub-menu {
        display: block !important;
        height: auto !important;
        margin-top: 12px;
    }
    header .header_block .header_menu ul li._mega > .sub-menu .sub-menu li a {
        padding: 6px 0;
        font-size: 13px;
        line-height: 20px;
    }

    header .header_block .header_mob_contacts {
        flex-direction: row-reverse;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 16px;
        margin-top: 20px;
        padding-bottom: 24px;
    }
    header .header_block .header_mob_button {
        display: none;
    }
}

/* Phone: mega panel as a bordered box of accordions */
@media screen and (max-width: 768px) {
    header .header_block {
        height: calc(100dvh - 66px);
    }
    header .header_block .header_menu ul li._mega > .sub-menu {
        box-sizing: border-box;
        border: 1px solid #C1944D;
        border-radius: 10px;
        padding: 4px 0;
        margin-bottom: 8px;
    }
    header .header_block .header_menu ul li._mega > .sub-menu > li > a {
        padding: 9px 40px 9px 12px;
    }
    header .header_block .header_menu ul li._mega > .sub-menu > li > .menu_arrow {
        top: 0;
        right: 2px;
    }
    header .header_block .header_menu ul li._mega > .sub-menu .sub-menu {
        padding-bottom: 6px;
    }
    header .header_block .header_menu ul li._mega > .sub-menu .sub-menu li a {
        padding: 8px 12px 8px 20px;
    }

    header .header_block .header_mob_contacts {
        flex-direction: column-reverse;
        align-items: flex-start;
        gap: 16px;
        margin-top: 20px;
    }
    header .header_block .header_mob_button {
        margin-top: 20px;
    }
}

@media screen and (max-width: 1024px) {
    header .header_block .header_mob_contacts .contact_item {
        margin: 0;
        font-size: 14px;
    }
}
