/* mk-pdp-fold-v1.css (20261120b) - MOJEKAFE CZ + SK, audit 20 Nov 2026, batch 1b (C02 + C17 + C18).
   PHONES ONLY (max-width: 767px); above that width this file changes nothing (review 20 Nov: desktop stays as is).
   Product detail: price and "add to cart" in the first viewport. Only the order of existing blocks changes,
   nothing is removed, no colours or fonts change. Source of truth: ~/MOJEKAFE-AI/eshop-kod/moduly/opravy-audit/.
   Loaded render-blocking from the header HTML code so the first paint already has the final order.
   Rollback: remove the header lines.

   Order on phones: photo (168 px high) -> title + rating -> buy box (stock, price, quantity, button, shipping line)
     -> 1 kg / 10 kg switch -> thumbnails -> quantity discounts -> Black Weeks strip -> gift box -> taste card + video
   Old order: photo -> thumbnails -> title -> taste card + video -> link -> switch -> Black Weeks -> gift -> buy box. */

@media (max-width: 767px) {
  /* the gallery and the info column become one flex column so their blocks can interleave */
  html body.type-product #product-detail-form .row.product-top { display: flex; flex-direction: column; }
  html body.type-product #product-detail-form .row.product-top > .p-image-wrapper,
  html body.type-product #product-detail-form .row.product-top > .p-info-wrapper { display: contents; }
  /* the two columns had 10 px side padding */
  html body.type-product #product-detail-form .row.product-top > .p-image-wrapper > *,
  html body.type-product #product-detail-form .row.product-top > .p-info-wrapper > * {
    margin-left: 10px !important;
    margin-right: 10px !important;
    width: auto !important;
    max-width: none !important;
    flex: 0 0 auto !important;
    box-sizing: border-box;
  }

  html body.type-product #product-detail-form .row.product-top > .col-xs-12:first-child { order: -3; }
  html body.type-product #product-detail-form .p-image-wrapper > .p-image { order: -2; margin-bottom: 6px !important; height: auto !important; text-align: center; }
  html body.type-product #product-detail-form .p-info-wrapper > .p-detail-inner-header { order: 1 !important; margin-bottom: 10px !important; row-gap: 6px !important; }
  /* native stock / price / button before mk-buybox or mk-akce31 wraps them into the buy box (first paint): same
     sequence as inside the finished box */
  html body.type-product #product-detail-form .p-info-wrapper > .availability-value,
  html body.type-product #product-detail-form .p-info-wrapper > table.detail-parameters { order: 3 !important; }
  html body.type-product #product-detail-form .p-info-wrapper > .p-final-price-wrapper { order: 4 !important; }
  html body.type-product #product-detail-form .p-info-wrapper > .add-to-cart,
  html body.type-product #product-detail-form .p-info-wrapper > .mk-buy,
  html body.type-product #product-detail-form .p-info-wrapper > .mk31-buy { order: 5 !important; }
  html body.type-product #product-detail-form .p-info-wrapper > #mk-gsw { order: 7 !important; }
  html body.type-product #product-detail-form .p-image-wrapper > .p-thumbnails-wrapper { order: 8; margin-top: 4px !important; margin-bottom: 14px !important; }
  html body.type-product #product-detail-form .p-info-wrapper > .discout-table { order: 9 !important; }
  html body.type-product #product-detail-form .p-info-wrapper > .mkbfw-strip { order: 10 !important; }
  html body.type-product #product-detail-form .p-info-wrapper > .xyDiscount__banner { order: 11 !important; }
  html body.type-product #product-detail-form .p-info-wrapper > .p-short-description { order: 12 !important; }
  html body.type-product #product-detail-form .p-info-wrapper > p { order: 13 !important; }

  /* main photo: same picture, lower box (168 px instead of 278 px) */
  html body.type-product #product-detail-form .p-image-wrapper > .p-image .p-main-image { display: block; }
  html body.type-product #product-detail-form .p-image-wrapper > .p-image .p-main-image img {
    display: block; width: auto !important; max-width: 100% !important; height: 168px !important; margin: 0 auto; object-fit: contain;
  }

  /* the gift box is built by mk-akce31 at DOMContentLoaded (24 px -> about 289 px); it now sits above the taste
     card, so its final height is reserved from the first paint */
  html body.type-product #product-detail-form .p-info-wrapper > .xyDiscount__banner:not(.mk31-done) { min-height: 289px; box-sizing: border-box; }

  /* a little less air so the button fits into 664 px */
  html body.type-product #product-detail-form .p-detail-inner-header > h1 { margin-top: 4px !important; }
  html body.type-product #product-detail-form .p-info-wrapper > .mk-buy,
  html body.type-product #product-detail-form .p-info-wrapper > .mk31-buy { padding: 10px 14px 12px !important; margin-bottom: 12px !important; }
  html body.type-product #product-detail-form .mk-buy .p-final-price-wrapper,
  html body.type-product #product-detail-form .mk31-buy .p-final-price-wrapper,
  html body.type-product #product-detail-form .mk-buy .mk-gsw-pw,
  html body.type-product #product-detail-form .mk31-buy .mk-gsw-pw { margin-top: 6px !important; }
  html body.type-product #product-detail-form .mk-buy .add-to-cart,
  html body.type-product #product-detail-form .mk31-buy .add-to-cart { margin-top: 10px !important; }

  /* C17: one shipping line under the button, inside the buy box (inserted by mk-pdp-fold-v1.js) */
  .mk-buy > .mk-shipline,
  .mk31-buy > .mk-shipline {
    order: 5 !important;
    flex: 0 0 100%;
    width: 100%;
    min-height: 36px;              /* two lines of 13 px text (CZ) */
    margin: 10px 0 0;
    padding: 0;
    font-size: 13px;
    line-height: 18px;
    color: #4d4d4d;
    text-align: left;
    box-sizing: border-box;
  }
  html[lang="sk"] .mk-buy > .mk-shipline,
  html[lang="sk"] .mk31-buy > .mk-shipline { min-height: 18px; }   /* the SK sentence is one line */
  .mk-shipline a { color: inherit; text-decoration: underline; }
  /* the same height is reserved before the script inserts the line (only where a buy button exists), so nothing
     below the box moves. The script marks the box .mk-ship-set once it has decided (line added or not needed). */
  .mk-buy:not(.mk-ship-set):has(> .add-to-cart)::after,
  .mk31-buy:not(.mk-ship-set):has(> .add-to-cart)::after { content: ""; order: 5; flex: 0 0 100%; height: 46px; }
  html[lang="sk"] .mk-buy:not(.mk-ship-set):has(> .add-to-cart)::after,
  html[lang="sk"] .mk31-buy:not(.mk-ship-set):has(> .add-to-cart)::after { height: 28px; }

  /* C18: a unit price label without a value takes no space */
  .price-measure.mk-measure-empty { display: none !important; }
}
