/* Mobile product-page layout.
 * The production product template uses a desktop thumbnail column. On phones,
 * keep the main image full-width and move the thumbnails below it. */

/* A module placeholder containing only a hidden attribute input has no visual
 * content, but still occupies a grid slot and doubles the gap before the CTA. */
body#product .product-info .sticky .card > .product-container:has(
  > .product-additional-info > input[type="hidden"]:only-child
) {
  display: none !important;
}

/* The short-description jump link is intentionally omitted on this PDP. */
body#product .featured-features > div:has(> .js-product-description-scroll) {
  display: none !important;
}

/* Keep manufacturer branding compact and left-aligned at every viewport size. */
body#product .product-specification .brand.grid {
  justify-items: start;
  text-align: left;
}

body#product .product-specification .brand.grid > section {
  width: 100%;
  justify-items: start;
}

body#product .product-specification .brand.grid .short h2 {
  width: min(180px, 50vw);
  margin: 0 0 0.75rem;
}

body#product .product-specification .brand.grid .short h2 img {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto;
  margin-inline: 0;
}

body#product .product-specification .brand.grid .long {
  display: flex;
  justify-content: flex-start;
}

body#product .product-specification .brand.grid .long a {
  text-align: left;
}

/* Keep benefits, description and manufacturer branding in the left product
 * column. The right product-info cell spans the complete product section so
 * its sticky child stays in view until the recommendation blocks begin. */
body#product .product.grid > .usper {
  margin: 0;
}

@media (min-width: 1200px) {
  body#product .product.grid > .product-images {
    grid-column: 1;
    grid-row: 1;
  }

  body#product .product.grid > .product-info {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: stretch;
  }

  body#product .product.grid > .usper {
    grid-column: 1;
    grid-row: 2;
  }

  body#product .product.grid > .product-specification {
    grid-column: 1;
    grid-row: 3;
    width: 100%;
    min-width: 0;
  }

  body#product .product-specification > .grid {
    grid-template-columns: minmax(0, 1fr);
  }

  body#product .product-info .sticky .card {
    gap: 0.625rem;
  }

  body#product .product-info .sticky .title h1 {
    font-size: 26.75px;
    font-weight: 600;
    line-height: 1.1;
  }

  body#product .product.grid > .usper > .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 681px) and (max-width: 1199.98px) {
  body#product .product.grid {
    grid-template-columns: minmax(0, 1fr);
  }

  body#product .product.grid > .product-images,
  body#product .product.grid > .product-info,
  body#product .product.grid > .usper,
  body#product .product.grid > .product-specification {
    grid-column: 1;
    grid-row: auto;
    width: 100%;
  }

  body#product .product-info .sticky {
    position: static;
  }

  body#product .product.grid > .usper > .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* The single-column PDP starts at 1200px, not 680px. Keep gallery order
 * and sizing in the same breakpoint so the cover never enters the 120px
 * desktop thumbnail track left behind by product.css. */
@media (max-width: 1199.98px) {
  body#product .product-images {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: auto;
    max-height: none;
    min-width: 0;
    gap: 0.625rem;
    overflow: visible;
    border-right: 0;
  }

  body#product .product-images .cover {
    order: 1;
    width: 100%;
    height: clamp(280px, 85vw, 480px);
    flex: none;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
  }

  body#product .product-images .cover > img {
    box-sizing: border-box;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
    max-height: none;
    padding: 1rem;
    object-fit: contain;
  }

  body#product .product-images .cover figcaption {
    padding: 0.75rem;
  }

  body#product .product-images .thumbnails {
    order: 2;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    height: auto;
    width: 100%;
    max-height: none;
    flex: none;
    min-height: 0;
    gap: 0.5rem;
    padding: 0.125rem 0.125rem 0.25rem;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  body#product .product-images .thumbnails::-webkit-scrollbar {
    display: none;
  }

  body#product .product-images .thumbnails:not(:has(img + img)):not(:has(.bme3d-gallery-thumb)) {
    display: none;
  }

  body#product .product-images .thumbnails > img,
  body#product .product-images .thumbnails > button.bme3d-gallery-thumb {
    flex: 0 0 60px;
    width: 60px;
    height: 60px;
    max-width: 60px;
    max-height: 60px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    scroll-snap-align: center;
  }

  body#product .product-images .thumbnails > button.bme3d-gallery-thumb > img {
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    border: 0;
  }
}

@media (max-width: 680px) {
  body#product .product.grid {
    gap: 0.875rem;
  }

  body#product .product-info .sticky .card {
    gap: 0.75rem;
    margin-bottom: 0.75rem;
  }

  body#product .product-info .product-prices {
    min-height: 0;
  }

  body#product .product-info .featured-features {
    margin-top: -0.35rem;
  }

  body#product .product-info .sticky .title h1 {
    margin-bottom: 0;
    font-size: 1.375rem;
    line-height: 1.08;
  }

  body#product .product-info .sticky .title small {
    margin-bottom: 0.2rem;
  }

  body#product .product-info .sticky .trustpilot,
  body#product .product-info .sticky .price .h2 {
    align-items: center;
  }

  body#product .tregutter {
    font-size: 0.5rem;
    gap: 0.35rem;
    padding: 0.55rem 0.5rem;
  }

  body#product .tregutter > span {
    flex: 1 1 0;
    justify-content: center;
    line-height: 1.15;
    text-align: left;
  }

  body#product .usper {
    margin-block: 1rem;
    padding-block: 0;
  }

  body#product .product-info .sticky .details .outline {
    margin-top: 1.25rem;
    padding: 1.5rem 1rem 1rem;
  }

  /* Manufacturer block: keep the logo compact and aligned with the copy. */
  body#product .product-specification .brand.grid {
    justify-items: start;
    text-align: left;
  }

  body#product .product-specification .brand.grid > section {
    width: 100%;
    justify-items: start;
  }

  body#product .product-specification .brand.grid .short h2 {
    width: 110px;
    margin: 0 0 0.75rem;
  }

  body#product .product-specification .brand.grid .short h2 img {
    width: 110px !important;
    max-width: 110px !important;
    height: auto;
    margin-inline: 0;
  }

  /* The module's mobile setting is one 345px card. Two compact cards should
     be visible instead, while the bleed-slider continues handling scrolling. */
  body#product .bm-ps--type-related .bm-ps__title {
    font-size: 1.25rem;
    line-height: 1.15;
  }

  body#product .bm-ps--type-related .bm-ps__item {
    flex: 0 0 150px !important;
    width: 150px !important;
  }

  body#product .bm-ps--type-related .product-miniature,
  body#product .bm-ps--type-related .mh-card {
    width: 150px !important;
  }

  body#product .bm-ps--type-related .mh-card__body {
    padding-inline: 0.125rem;
  }

  body#product .bm-ps--type-related .mh-card__brand,
  body#product .bm-ps--type-related .mh-card__name,
  body#product .bm-ps--type-related .mh-card__price,
  body#product .bm-ps--type-related .mh-card__was,
  body#product .bm-ps--type-related .inkl-text {
    font-size: 0.6875rem;
    line-height: 1.25;
  }
}
