/* Tischlerei-Priebe 1.0.6 – mobile-only repair of Jupiter 6's native header.
   The existing Jupiter responsive menu (.mk-responsive-wrap) and its JS remain
   intact. Desktop menu, theme options, cart state and footer are untouched. */
@media screen and (max-width: 1140px) {
  /* The chevron is the old responsive TOOLBAR toggle, not the menu burger. */
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-toolbar-resposnive-icon,
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-header-toolbar {
    display: none !important;
  }

  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-header-holder {
    min-height: 0 !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-header-inner,
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-header-bg,
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .header-grid.mk-grid {
    height: 78px !important;
    min-height: 78px !important;
    box-sizing: border-box !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-header-inner {
    padding: 0 !important;
    background: #fff !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .header-grid.mk-grid {
    position: relative !important;
    max-width: 100% !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
  }

  /* Retain the already-approved 2022 logo, but contain its clickable box. */
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .header-logo {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    right: auto !important;
    float: none !important;
    width: min(220px, calc(100% - 135px)) !important;
    height: 78px !important;
    margin: 0 !important;
    padding: 0 !important;
    z-index: 40 !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .header-logo > a {
    display: block !important;
    position: relative !important;
    width: calc(100% - 12px) !important;
    height: 78px !important;
    margin: 0 0 0 12px !important;
    padding: 0 !important;
    background-image: url("logo-priebe-2022.png") !important;
    background-repeat: no-repeat !important;
    background-position: left center !important;
    background-size: contain !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .header-logo > a > img {
    opacity: 0 !important;
  }

  /* The desktop UL must not remain visible on a 375/390px screen. The cart
     shares its parent container, so hide the UL, NOT the whole container. */
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-header-nav-container {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: absolute !important;
    top: 0 !important;
    right: 58px !important;
    left: auto !important;
    float: none !important;
    width: 50px !important;
    height: 78px !important;
    min-height: 78px !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: normal !important;
    text-align: center !important;
    z-index: 45 !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-header-nav-container .mk-main-navigation,
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-header-nav-container .main-navigation-ul,
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-header-nav-container .main-nav-side-search {
    display: none !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .shopping-cart-header {
    display: block !important;
    position: relative !important;
    float: none !important;
    width: 50px !important;
    height: 78px !important;
    line-height: 78px !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-shoping-cart-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 50px !important;
    height: 78px !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    gap: 3px;
    color: #003ca0 !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-shoping-cart-link svg {
    width: 19px !important;
    height: 19px !important;
    margin: 0 !important;
    transform: none !important;
    fill: #003ca0 !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-header-cart-count {
    color: #003ca0 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    padding: 0 !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-shopping-cart-box {
    right: -45px !important;
    left: auto !important;
    max-width: calc(100vw - 24px) !important;
    line-height: 1.45 !important;
  }

  /* Native Jupiter burger: its existing click handler opens the matching
     .mk-responsive-wrap. Do not add a second menu or duplicate its links. */
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-nav-responsive-link {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    position: absolute !important;
    top: 18px !important;
    right: 12px !important;
    left: auto !important;
    float: none !important;
    margin: 0 !important;
    padding: 9px !important;
    width: 42px !important;
    height: 42px !important;
    box-sizing: border-box !important;
    z-index: 55 !important;
    cursor: pointer;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-nav-responsive-link .mk-css-icon-menu {
    display: block !important;
    width: 24px !important;
    height: 20px !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-nav-responsive-link .mk-css-icon-menu > div {
    display: block !important;
    background-color: #003ca0 !important;
    height: 3px !important;
    margin-bottom: 4px !important;
    border-radius: 2px !important;
  }

  /* Jupiter's own responsive navigation, with native nested-menu arrows. */
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-responsive-wrap {
    position: relative !important;
    z-index: 58 !important;
    width: 100% !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    background: #fff !important;
    box-shadow: 0 8px 18px rgba(21, 34, 54, .11);
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-responsive-nav {
    background: #fff !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-responsive-nav li a {
    box-sizing: border-box;
    min-height: 44px;
    padding: 14px 20px !important;
    font-family: 'Open Sans', Arial, sans-serif;
    font-size: 14px !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    color: #003ca0 !important;
    background: #fff;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-responsive-nav li ul li a {
    color: #263c5c !important;
    font-weight: 400 !important;
    background: #f7f8fa;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-responsive-nav .mk-nav-arrow {
    z-index: 2;
    width: 48px !important;
    min-height: 44px;
    color: #003ca0 !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-responsive-nav .mk-nav-arrow svg {
    fill: #003ca0 !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .responsive-searchform {
    padding: 3px 10px 12px;
  }
}

@media screen and (max-width: 767px) {
  /* LayerSlider remains on desktop, but its tiny mobile rendition is omitted. */
  body.home #theme-page .ls-wp-fullwidth-container,
  body.home #theme-page .ls-wp-container,
  body.home #theme-page .ls-container,
  body.home #theme-page .layerslider,
  body.home #theme-page [id^="layerslider_"] {
    display: none !important;
  }

  /* Conservative rhythm/typography tuning, limited to the home page. */
  body.home.mk-boxed-enabled #theme-page .theme-content .mk-text-block p,
  body.home.mk-boxed-enabled #theme-page .theme-content .wpb_text_column p {
    font-size: 15px !important;
    line-height: 1.58 !important;
  }
  body.home.mk-boxed-enabled #theme-page .theme-content .mk-padding-divider {
    max-height: 48px !important;
  }
  body.home.mk-boxed-enabled #theme-page .mk-fancy-title.tp-home-products-title,
  body.home.mk-boxed-enabled #theme-page .mk-fancy-title.tp-home-products-title > span,
  body.home.mk-boxed-enabled #theme-page .mk-fancy-title.tp-home-products-title > span > p {
    font-size: clamp(25px, 7vw, 28px) !important;
    line-height: 1.25 !important;
  }
}

/* v1.0.7: On mobile, keep Jupiter's header in the document flow.
   WordPress already offsets the document for #wpadminbar (46px on phones).
   A second fixed/sticky header at top:0 otherwise hides the logo beneath it.
   Turning off mobile stickiness works for logged-in and public visitors. */
@media screen and (max-width: 1140px) {
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1,
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1.a-sticky,
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1:not(.a-sticky) {
    position: relative !important;
    top: auto !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    transform: none !important;
    margin-top: 0 !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-header-holder,
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-header-inner {
    position: relative !important;
    top: auto !important;
    transform: none !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-header-padding-wrapper {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
  }
  /* The mobile nav must remain below the logo row, never behind wpadminbar. */
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-responsive-wrap {
    clear: both !important;
    top: auto !important;
  }
}

@media screen and (max-width: 767px) {
  /* LayerSlider is embedded in the homepage's own VC row. Removing only the
     canvas leaves its WPBakery row background/min-height visible. :has() is
     supported by modern iOS Safari. The JS class is a fallback for wrappers
     that load after DOM-ready / differ between LayerSlider versions. */
  body.home .vc_row:has(.ls-wp-container),
  body.home .vc_row:has(.ls-wp-fullwidth-container),
  body.home .vc_row:has(.ls-container),
  body.home .vc_row:has([id^="layerslider_"]),
  body.home .vc_row.tp-mobile-slider-row,
  body.home .wpb_row.tp-mobile-slider-row,
  body.home .mk-fullwidth-true.tp-mobile-slider-row {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }
}


/* 1.0.8 – mobile flyout cart, visibly separated from header and menu.
   The Jupiter cart widget itself (and its Ajax behavior) is unchanged. */
@media screen and (max-width: 767px) {
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 {
    overflow: visible !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-header-nav-container {
    z-index: 100 !important;
    overflow: visible !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .shopping-cart-header {
    z-index: 110 !important;
    overflow: visible !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .shopping-cart-header > .mk-shopping-cart-box {
    position: fixed !important;
    top: 88px !important;
    right: 12px !important;
    left: auto !important;
    bottom: auto !important;
    width: min(350px, calc(100vw - 24px)) !important;
    max-width: calc(100vw - 24px) !important;
    max-height: min(70dvh, 570px) !important;
    height: auto !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    margin: 0 !important;
    padding: 16px !important;
    box-sizing: border-box !important;
    background: #fff !important;
    background-color: #fff !important;
    opacity: 1 !important;
    border: 1px solid #d9dfe8 !important;
    border-radius: 3px !important;
    box-shadow: 0 12px 32px rgba(0, 24, 60, .25) !important;
    color: #25303f !important;
    line-height: 1.45 !important;
    text-align: left !important;
    z-index: 200 !important;
  }
  body.admin-bar.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .shopping-cart-header > .mk-shopping-cart-box {
    top: 135px !important;
    max-height: calc(100dvh - 150px) !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-shopping-cart-box .widget_shopping_cart,
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-shopping-cart-box .widget_shopping_cart_content,
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-shopping-cart-box ul.woocommerce-mini-cart,
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-shopping-cart-box .woocommerce-mini-cart__total,
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-shopping-cart-box .woocommerce-mini-cart__buttons {
    position: relative !important;
    width: 100% !important;
    box-sizing: border-box !important;
    background-color: #fff !important;
    color: #25303f !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-shopping-cart-box .product_list_widget li {
    clear: both !important;
    min-height: 74px !important;
    overflow: hidden !important;
  }
  body.mk-boxed-enabled #mk-boxed-layout .mk-header.header-style-1 .mk-shopping-cart-box .product_list_widget li img {
    max-width: 66px !important;
    max-height: 66px !important;
    object-fit: contain;
  }

  /* OneTap: remove the backing square, retain the prominent blue trigger. */
  body .apop-container-toggle,
  body .onetap-container-toggle {
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    border: 0 !important;
  }
  body .apop-container-toggle .apop-toggle,
  body .onetap-container-toggle .onetap-toggle {
    opacity: 1 !important;
  }
}
