/* Mini-cart layout correction: keep shipping information below all products. */
@media (min-width: 992px) {
  .cart-widget.popup-widget {
    overflow: hidden;
  }

  .cart-widget.popup-widget .cart-widget-inner {
    display: block;
    max-height: min(480px, calc(100vh - 300px));
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #d9c1a8 transparent;
  }

  .cart-widget.popup-widget .cart-widget-product {
    position: relative;
    z-index: 1;
  }

  .cart-widget.popup-widget .cart-free-shipping,
  .cart-widget.popup-widget .free-shipping {
    position: static !important;
    inset: auto !important;
    z-index: auto !important;
    width: auto !important;
    min-height: 48px;
    display: flex !important;
    align-items: center;
    justify-content: center;
    clear: both;
  }

  .cart-widget.popup-widget .cart-widget-product:last-of-type {
    border-bottom: 0;
  }

  .cart-widget.popup-widget .cart-widget-button {
    position: relative;
    z-index: 2;
    flex: 0 0 auto;
  }
}

/* Only the wide desktop has room for a lowered popup below the full cart button. */
@media (min-width: 1200px) {
  #header .navigation-buttons {
    position: relative !important;
    z-index: 58;
  }

  #header .navigation-buttons .cart-count {
    position: relative;
    z-index: 59;
  }

  .cart-widget.popup-widget {
    margin-top: 26px !important;
  }
}

/* Keep the intermediate desktop header compact instead of showing an empty wide cart box. */
@media (min-width: 992px) and (max-width: 1199px) {
  #header .header-top {
    grid-template-columns: 140px minmax(0, 1fr) 72px !important;
    gap: 16px !important;
  }

  #header .navigation-buttons {
    width: 72px !important;
    min-width: 72px !important;
    justify-self: end !important;
  }

  #header .navigation-buttons .cart-count {
    width: 72px !important;
    min-width: 72px !important;
    padding-inline: 10px !important;
  }

  .cart-widget.popup-widget {
    margin-top: 12px !important;
  }
}

/* Mobile: stack the existing information strip above the untouched Shoptet header. */
@media (max-width: 991px) {
  :root {
    --ch-mobile-notice-height: 88px;
  }

  body .site-msg.information {
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    left: 0 !important;
    z-index: 57 !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
  }

  body .top-navigation-bar {
    top: var(--ch-mobile-notice-height) !important;
  }

  body #header {
    top: calc(var(--ch-mobile-notice-height) + 50px) !important;
  }

  body .overall-wrapper {
    padding-top: calc(var(--ch-mobile-notice-height) + 50px) !important;
  }

  body.navigation-window-visible #navigation {
    top: var(--ch-mobile-notice-height) !important;
    height: calc(100dvh - var(--ch-mobile-notice-height)) !important;
    max-height: calc(100dvh - var(--ch-mobile-notice-height)) !important;
  }

  body.navigation-window-visible #navigation .navigation-in {
    height: 100% !important;
    max-height: 100% !important;
    overflow-y: auto !important;
    overscroll-behavior: contain;
  }
}
