/* Keep Max Mega Menu's desktop markup and presentation intact. */
.artel-mobile-menu-panel,
.artel-mobile-menu-scroll {
    display: contents;
}

.artel-mobile-menu-header,
.artel-mobile-menu-extras,
.artel-mobile-menu-footer {
    display: none;
}

/* Match MobileHeader::BREAKPOINT and FiboSearch's responsive layout. */
@media (max-width: 1024px) {
    #site-header.artel-mobile-header-ready {
        --artel-header-gutter: clamp(12px, 5.682vw, 25px);
        --artel-header-gap: clamp(4px, 3.409vw, 15px);
    }

    /* Keep space in the document while the main row stays in the viewport. */
    #site-header.artel-mobile-header-ready.artel-mobile-fixed-header {
        display: block;
        position: relative;
        top: auto;
        height: var(--artel-mobile-header-height, 120px);
        z-index: 9999;
        transform: none !important;
        transition: none !important;
    }

    #site-header.artel-mobile-header-ready.artel-mobile-fixed-header > .site-header__row {
        position: static;
    }

    #site-header.artel-mobile-header-ready.artel-mobile-fixed-header:has(.artel-mobile-menu-panel.is-open) {
        z-index: 10000000;
    }

    #site-header.artel-mobile-header-ready.artel-mobile-fixed-header > .main-row {
        position: fixed !important;
        top: var(--artel-mobile-main-top, 0px) !important;
        right: 0;
        left: 0;
        width: auto;
        margin: 0;
        transform: none !important;
        transition: none !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    #site-header.artel-mobile-header-ready.artel-mobile-fixed-header > .top-row[data-artel-sticky="true"] {
        position: fixed;
        top: var(--artel-mobile-admin-top, 0px);
        right: 0;
        left: 0;
    }

    #site-header.artel-mobile-header-ready .main-row__content {
        position: relative;
        min-height: 80px;
        background: #000;
    }

    #site-header.artel-mobile-header-ready .main-row__content > .wp-block-group {
        position: static;
        min-height: 80px;
        padding: 0;
    }

    #site-header.artel-mobile-header-ready .main-row__content > .wp-block-group > .wp-block-group {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 44px 44px;
        align-items: center;
        gap: var(--artel-header-gap);
        min-height: 80px;
        margin: 0 0 0 calc(var(--artel-header-gutter) + 44px + var(--artel-header-gap)) !important;
        padding: 0 var(--artel-header-gutter) 0 0;
    }

    #site-header.artel-mobile-header-ready .main-row__content figure.wp-block-image {
        justify-self: center;
        width: clamp(100px, 30.3vw, 133.306px);
        max-width: 100%;
        margin: 0 !important;
    }

    #site-header.artel-mobile-header-ready .main-row__content figure.wp-block-image a {
        display: flex;
        align-items: center;
        min-height: 60px;
    }

    #site-header.artel-mobile-header-ready .main-row__content figure.wp-block-image img {
        display: block;
        width: 100%;
        height: 60px;
        object-fit: contain;
    }

    #site-header.artel-mobile-header-ready .main-row__content .wishlist-link,
    #site-header.artel-mobile-header-ready .main-row__content .account-link {
        display: none;
    }

    #site-header.artel-mobile-header-ready .main-row__content .wp-block-group:has(> .artel-mini-cart-trigger) {
        gap: 0;
        margin: 0;
        padding: 0 !important;
    }

    #site-header.artel-mobile-header-ready .artel-mini-cart-trigger,
    #site-header.artel-mobile-header-ready .dgwt-wcas-search-icon {
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        padding: 7px;
        color: #fff;
    }

    #site-header.artel-mobile-header-ready .artel-mini-cart-trigger svg,
    #site-header.artel-mobile-header-ready .dgwt-wcas-search-icon svg {
        width: 30px;
        height: 30px;
    }

    #site-header.artel-mobile-header-ready .dgwt-wcas-search-icon svg {
        fill: currentColor;
    }

    #site-header.artel-mobile-header-ready .artel-cart-count {
        position: absolute;
        top: 0;
        right: 0;
        min-width: 16px;
        border-radius: 50%;
        color: #000;
        background: #fff;
        text-align: center;
        line-height: 16px;
    }

    #site-header.artel-mobile-header-ready .main-row__content .dgwt-wcas-search-wrapp {
        width: 44px;
        min-width: 0;
        max-width: 44px;
        margin: 0;
    }

    #site-header.artel-mobile-header-ready .top-row__content > .wp-block-group {
        flex-wrap: nowrap;
        gap: 8px;
        min-height: 40px;
        padding-right: 12px;
        padding-left: 12px;
    }

    #site-header.artel-mobile-header-ready .top-row__content figure {
        flex: 0 0 24px;
        margin: 0;
    }

    #site-header.artel-mobile-header-ready .top-row__content img {
        width: 24px;
        height: 24px;
    }

    #site-header.artel-mobile-header-ready .top-row__content p {
        margin: 0 !important;
        font-size: clamp(11px, 3.2vw, 14px);
        line-height: 18px;
        text-align: center;
    }

    #site-header.artel-mobile-header-ready .bottom-row {
        display: none;
    }

    #site-header.artel-mobile-header-ready .artel-mobile-navigation {
        position: absolute;
        top: 18px;
        left: var(--artel-header-gutter);
        z-index: 2;
        width: 44px;
        min-width: 0;
        background: transparent;
    }

    #site-header .artel-mobile-navigation .mega-menu-toggle {
        display: flex;
        width: 44px;
        height: 44px;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    #site-header .artel-mobile-navigation .mega-menu-toggle::after {
        display: none;
    }

    #site-header .artel-mobile-navigation .mega-toggle-blocks-left,
    #site-header .artel-mobile-navigation .mega-toggle-blocks-center {
        display: none;
    }

    #site-header .artel-mobile-navigation .mega-toggle-blocks-right,
    #site-header .artel-mobile-navigation .mega-toggle-block {
        justify-content: center;
        width: 44px;
        height: 44px;
        margin: 0;
    }

    #site-header .artel-mobile-navigation button.mega-toggle-animated {
        width: 44px;
        height: 44px;
        margin: 0;
        padding: 2px;
        background: transparent;
    }

    #site-header .artel-mobile-navigation .mega-toggle-animated-box {
        width: 40px;
    }

    #site-header .artel-mobile-navigation .mega-toggle-animated-inner,
    #site-header .artel-mobile-navigation .mega-toggle-animated-inner::before,
    #site-header .artel-mobile-navigation .mega-toggle-animated-inner::after {
        width: 40px;
        height: 3px;
        border-radius: 0;
        background: #fff;
    }

    #site-header.artel-mobile-header-ready .artel-mobile-menu-panel {
        position: fixed;
        inset: var(--artel-mobile-menu-viewport-top, 0px) 0 auto;
        z-index: 999999;
        display: flex;
        flex-direction: column;
        box-sizing: border-box;
        width: 100%;
        height: 100vh;
        height: 100dvh;
        height: var(--artel-mobile-menu-viewport-height, 100dvh);
        padding-top: env(safe-area-inset-top, 0px);
        padding-bottom: 0;
        color: #212121;
        background: #f0f0f0;
        font-family: "Noto Sans", sans-serif;
        visibility: hidden;
        transform: translateX(-100%);
        transition: transform 200ms ease, visibility 200ms ease;
    }

    #site-header.artel-mobile-header-ready .artel-mobile-menu-panel.is-open {
        visibility: visible;
        transform: translateX(0);
    }

    #site-header #artel-mobile-menu .artel-mobile-menu-header {
        display: flex;
        flex: 0 0 90px;
        align-items: center;
        box-sizing: border-box;
        padding: 0 30px;
    }

    #site-header #artel-mobile-menu .artel-mobile-menu-header .mega-close {
        position: static;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        margin: 0;
        padding: 6px;
        border: 0;
        border-radius: 0;
        color: #212121;
        background: transparent;
        opacity: 1;
        visibility: inherit;
    }

    #site-header #artel-mobile-menu .artel-mobile-menu-header .mega-close::before {
        display: block;
        content: "×";
        color: inherit;
        font-family: sans-serif;
        font-size: 32px;
        font-weight: 400;
        line-height: 1;
    }

    #site-header.artel-mobile-header-ready .artel-mobile-menu-scroll {
        display: block;
        flex: 1 1 auto;
        min-height: 0;
        padding: 20px 30px;
        overflow: auto;
        overscroll-behavior: contain;
    }

    #site-header #artel-mobile-menu .artel-mobile-menu-scroll > ul.max-mega-menu {
        position: static;
        display: block;
        width: 100% !important;
        max-width: none;
        height: auto;
        max-height: none;
        margin: 0;
        padding: 0;
        overflow: visible;
        background: transparent;
        visibility: inherit;
        transform: none;
        transition: none;
    }

    #site-header #artel-mobile-menu ul.max-mega-menu > li.mega-menu-item {
        width: 100%;
        margin: 0;
    }

    #site-header #artel-mobile-menu ul.max-mega-menu > li.mega-menu-item > a.mega-menu-link {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        min-height: 57px;
        height: auto;
        padding: 0;
        border: 0;
        color: #6b6b6b;
        background: transparent;
        font-family: inherit;
        font-size: 20px;
        font-weight: 400;
        line-height: 27px;
        white-space: normal;
    }

    #site-header #artel-mobile-menu ul.max-mega-menu > li.mega-menu-item:last-child > a.mega-menu-link {
        min-height: 27px;
    }

    #site-header #artel-mobile-menu ul.max-mega-menu > li.mega-current-menu-item > a.mega-menu-link,
    #site-header #artel-mobile-menu ul.max-mega-menu > li.mega-menu-item > a.mega-menu-link:hover {
        color: #212121;
        text-decoration: underline;
    }

    #site-header .artel-mobile-menu-extras {
        display: block;
        margin-top: 20px;
        border-top: 1px solid #6b6b6b;
    }

    #site-header .artel-mobile-menu-extras a {
        color: #000;
        font-family: inherit;
        font-size: 20px;
        font-weight: 500;
        line-height: 27px;
        text-decoration: none;
    }

    #site-header .artel-mobile-menu-extras a:hover,
    #site-header .artel-mobile-menu-extras a[aria-current] {
        text-decoration: underline;
    }

    #site-header .artel-mobile-menu-account,
    #site-header .artel-mobile-menu-wishlist {
        padding: 20px 0;
        border-bottom: 1px solid #6b6b6b;
    }

    #site-header .artel-mobile-menu-account-link,
    #site-header .artel-mobile-menu-wishlist a {
        display: flex;
        align-items: center;
        gap: 21px;
        min-height: 27px;
    }

    #site-header .artel-mobile-menu-wishlist a {
        gap: 31px;
    }

    .artel-mobile-account-icon,
    .artel-mobile-wishlist-icon {
        display: inline-flex;
        flex: 0 0 24px;
        width: 24px;
        height: 24px;
    }

    .artel-mobile-menu-extras svg [stroke] {
        stroke: currentColor;
    }

    #site-header .artel-mobile-menu-auth {
        display: flex;
        gap: 20px;
        margin-top: 15px;
    }

    #site-header .artel-mobile-menu-auth a {
        display: inline-flex;
        align-items: center;
        min-width: 120px;
        min-height: 24px;
        color: #6b6b6b;
        font-size: 16px;
        font-weight: 400;
        line-height: 22px;
    }

    #site-header .artel-mobile-menu-languages {
        display: flex;
        flex-direction: column;
        gap: 6px;
        padding-top: 12px;
    }

    #site-header .artel-mobile-menu-languages a {
        display: flex;
        align-items: center;
        min-height: 44px;
    }

    #site-header #artel-mobile-menu .artel-mobile-menu-footer {
        display: flex;
        flex: 0 0 auto;
        align-items: center;
        justify-content: center;
        box-sizing: content-box;
        height: 32px;
        min-height: 0;
        margin: 0;
        padding: 0 0 min(env(safe-area-inset-bottom, 0px), 12px);
        color: #000;
        font-size: 14px;
        line-height: 20px;
    }

    #site-header .artel-mobile-navigation :focus-visible {
        outline: 2px solid currentColor;
        outline-offset: 3px;
    }

    /* Navigation remains readable if the enhancement cannot initialize. */
    #site-header:not(.artel-mobile-header-ready) .artel-mobile-navigation .max-mega-menu {
        position: static;
        display: block;
        width: 100%;
        visibility: visible;
    }
}

@media (prefers-reduced-motion: reduce) {
    #site-header .artel-mobile-menu-panel {
        transition: none;
    }
}
