/* Mobile UX fixes + Gutenberg/editor content layout support. */

html {
  scrollbar-gutter: stable;
}

/* --- Header search (mobile): show category, query field and button --- */
@media (max-width: 900px) {
  .ho-header-main {
    grid-template-columns: minmax(0, 1fr) !important;
    min-height: 0 !important;
    gap: 12px !important;
  }

  .ho-search {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-areas:
      "category"
      "query"
      "submit" !important;
    gap: 8px !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    flex-wrap: nowrap !important;
    padding: 10px !important;
    border-radius: 22px !important;
    box-sizing: border-box !important;
  }

  .ho-search select {
    grid-area: category !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 48px !important;
    line-height: 1.3 !important;
    border: 1px solid rgba(122, 139, 90, .18) !important;
    border-radius: 14px !important;
    background: #fff !important;
    padding: 10px 14px !important;
  }

  .ho-search input[type="search"],
  .ho-search #ho-search-field {
    grid-area: query !important;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 48px !important;
    line-height: 1.3 !important;
    border: 1px solid rgba(122, 139, 90, .18) !important;
    border-radius: 14px !important;
    background: #fff !important;
    padding: 10px 14px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }

  .ho-search button {
    grid-area: submit !important;
    width: 100% !important;
    min-width: 0 !important;
    height: auto !important;
    min-height: 48px !important;
    line-height: 1.2 !important;
    border: 0 !important;
    border-radius: 999px !important;
    padding: 12px 18px !important;
  }
}

/* --- Single product: quantity label always visible --- */
body.single-product div.product form.cart .ho-qty-visible-label {
  display: block !important;
  margin: 0 0 8px !important;
  color: var(--ho-text) !important;
  font-size: 14px !important;
  font-weight: 900 !important;
  line-height: 1.2 !important;
}

@media (max-width: 900px) {
  /* Single product: quantity above add-to-cart button (stacked) */
  body.single-product div.product form.cart,
  body.single-product div.product form.cart:not(.variations_form),
  body.single-product div.product form.cart .woocommerce-variation-add-to-cart {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: nowrap !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: 0 !important;
    box-sizing: border-box !important;
  }

  body.single-product div.product form.cart:not(.variations_form) {
    padding: 16px !important;
    min-height: 0 !important;
  }

  body.single-product div.product form.cart .variations,
  body.single-product div.product form.cart .single_variation_wrap,
  body.single-product div.product form.cart .single_variation_wrap .woocommerce-variation,
  body.single-product div.product form.cart .ho-single-paychips {
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 auto !important;
  }

  body.single-product div.product form.cart .quantity,
  body.single-product div.product form.cart .woocommerce-variation-add-to-cart .quantity {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    order: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    position: static !important;
    visibility: visible !important;
    opacity: 1 !important;
    flex: 0 0 auto !important;
    float: none !important;
  }

  body.single-product div.product form.cart .quantity .qty,
  body.single-product div.product form.cart .quantity input.qty {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    height: 52px !important;
    min-height: 52px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    text-align: center !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    border: 1px solid rgba(208, 147, 34, .28) !important;
    border-radius: 14px !important;
    background: #fff !important;
  }

  body.single-product div.product form.cart .single_add_to_cart_button,
  body.single-product div.product form.cart .woocommerce-variation-add-to-cart .single_add_to_cart_button {
    order: 2 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 0 !important;
    flex: 0 0 auto !important;
    align-self: stretch !important;
    white-space: normal !important;
    grid-column: auto !important;
    grid-row: auto !important;
  }

  /* Added-to-cart notice: keep "Warenkorb anzeigen" inside the box */
  body.single-product .woocommerce-message,
  body.single-product .woocommerce .woocommerce-message,
  body.single-product .woocommerce-info,
  body.single-product .woocommerce .woocommerce-info,
  body.single-product .woocommerce-notices-wrapper .woocommerce-message,
  body.single-product .woocommerce-notices-wrapper .woocommerce-info,
  .single-product .woocommerce-message,
  .single-product .woocommerce .woocommerce-message {
    display: block !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    padding: 16px 16px 16px 50px !important;
    min-height: 0 !important;
    line-height: 1.45 !important;
    word-break: normal !important;
    overflow-wrap: anywhere !important;
  }

  body.single-product .woocommerce-message::before,
  body.single-product .woocommerce .woocommerce-message::before,
  body.single-product .woocommerce-info::before,
  body.single-product .woocommerce .woocommerce-info::before,
  .single-product .woocommerce-message::before {
    left: 16px !important;
    top: 18px !important;
    transform: none !important;
  }

  body.single-product .woocommerce-message .button,
  body.single-product .woocommerce-message a.button,
  body.single-product .woocommerce-message a.wc-forward,
  body.single-product .woocommerce-message a.added_to_cart,
  body.single-product .woocommerce .woocommerce-message .button,
  body.single-product .woocommerce .woocommerce-message a.button,
  body.single-product .woocommerce .woocommerce-message a.wc-forward,
  body.single-product .woocommerce .woocommerce-message a.added_to_cart,
  .single-product .woocommerce-message .button,
  .single-product .woocommerce-message a.button,
  .single-product .woocommerce-message a.wc-forward,
  .single-product .woocommerce-message a.added_to_cart {
    display: flex !important;
    order: unset !important;
    float: none !important;
    clear: both !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin: 12px 0 0 !important;
    margin-left: 0 !important;
    box-sizing: border-box !important;
    white-space: normal !important;
    text-align: center !important;
    justify-content: center !important;
  }

  body.single-product div.product .summary {
    position: static !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  body.single-product div.product {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
  }

  body.single-product .woocommerce-notices-wrapper {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 14px !important;
  }
}

/* Prevent horizontal page jump when WooCommerce overlays the page */
body.blockUI,
body.blockOverlay {
  overflow: hidden !important;
  padding-right: 0 !important;
}

.ho-cart-badge,
.ho-cart-count {
  min-width: 28px !important;
  width: 28px !important;
  height: 28px !important;
  padding: 0 !important;
  font-variant-numeric: tabular-nums !important;
  justify-content: center !important;
}

/* --- Gutenberg / block editor content on frontend --- */
.ho-editor-page,
.ho-editor-content,
.entry-content.ho-editor-content,
.wp-site-blocks.ho-editor-content {
  width: min(920px, 100%) !important;
  margin: 0 auto !important;
  padding: clamp(18px, 3vw, 34px) clamp(16px, 3vw, 24px) !important;
}

.ho-editor-page > .alignwide,
.ho-editor-content > .alignwide,
.ho-editor-page .wp-block-group.alignwide,
.ho-editor-content .wp-block-group.alignwide {
  width: min(1180px, 100%) !important;
  max-width: 100% !important;
}

.ho-editor-page > .alignfull,
.ho-editor-content > .alignfull,
.ho-editor-page .wp-block-cover.alignfull,
.ho-editor-content .wp-block-cover.alignfull {
  width: 100vw !important;
  max-width: 100vw !important;
  margin-left: calc(50% - 50vw) !important;
  margin-right: calc(50% - 50vw) !important;
}

.ho-editor-page .wp-block-image img,
.ho-editor-content .wp-block-image img {
  height: auto !important;
  max-width: 100% !important;
}

.ho-editor-page .wp-block-columns,
.ho-editor-content .wp-block-columns {
  gap: 18px !important;
}

@media (max-width: 781px) {
  .ho-editor-page .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column,
  .ho-editor-content .wp-block-columns:not(.is-not-stacked-on-mobile) > .wp-block-column {
    flex-basis: 100% !important;
  }
}

.ho-editor-page .wp-block-button__link,
.ho-editor-content .wp-block-button__link {
  min-height: 48px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
}