/* Storefront purchase labels and capsule-category cards. Loaded before component layers. */
@layer molisan-storefront-refinements {
  @media (min-width: 768px) {
    #main :is(.mol-card-cart-add, .order-link[href*="cart.html?product="]),
    #main .mol-card-cart-add > .mol-card-add-label {
      font-size: 17px !important;
      line-height: 1.2 !important;
    }

    #main .mol-card-cart-add:has(.mol-card-count-compact) {
      flex-wrap: wrap;
      align-content: center;
      column-gap: 5px;
      row-gap: 2px;
    }
  }

  @media (min-width: 960px) {
    body.category-page #main > :is(.category-page-heading:not(.capsule-category-hero), .oyo-landing-heading),
    #main > .wrap.section:has(> .document-gallery),
    body[data-product-dossier] #main > .wrap.section:has(> h1),
    #main > .wrap > .product-detail[data-order-product="living-water"][data-canonical-indication] {
      padding-block-start: clamp(24px, 2.2vw, 32px) !important;
    }
  }

  #main :is(.capsule-category-products > .category-products, .capsule-collection > .product-collection):has(.capsule-card-photo) {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: clamp(12px, 1.5vw, 20px) !important;
    max-inline-size: 1220px;
    margin-inline: auto !important;
  }

  #main .capsule-category-products .product-card:has(.capsule-card-photo) {
    height: auto !important;
    align-self: stretch !important;
  }

  #main :is(.capsule-category-products .product-card > .card-link, .capsule-collection .product-tile):has(> .capsule-card-photo) {
    display: grid !important;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr) !important;
    grid-column: auto !important;
    align-items: center !important;
    align-self: stretch !important;
    gap: clamp(12px, 1.5vw, 20px) !important;
    padding: clamp(12px, 1.5vw, 20px) !important;
    box-sizing: border-box;
    height: 100%;
    min-height: 0 !important;
  }

  #main .capsule-card-photo {
    position: relative;
    overflow: hidden;
    display: block;
    width: 100%;
    min-width: 0;
    aspect-ratio: 3 / 2;
    border-radius: 9px;
    background: #f0ebe1;
  }

  #main .capsule-card-photo > img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    max-width: none !important;
    object-fit: cover;
  }

  /* Show just the existing photograph in the 1600px square localized artwork. */
  #main .capsule-card-photo[data-overview-photo] > img {
    position: absolute;
    inset: -37.5% auto auto -5.5556%;
    width: 111.1112% !important;
    height: auto !important;
    aspect-ratio: 1 !important;
  }

  #main .capsule-card-photo + :is(.card-info, .product-info) {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    justify-content: center !important;
    gap: 8px !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 328px;
    padding: 0 !important;
    margin: 0 !important;
    text-align: start !important;
  }

  #main .capsule-card-photo + :is(.card-info, .product-info) > :is(h3, .product-purpose, .product-card-price, .card-prices) {
    margin: 0 !important;
    min-width: 0 !important;
    min-height: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    text-align: start !important;
  }

  #main .capsule-card-photo + :is(.card-info, .product-info) > h3 {
    display: block !important;
    font-size: clamp(17px, 1.55vw, 22px) !important;
    line-height: 1.26 !important;
    overflow-wrap: break-word;
  }

  #main .capsule-card-photo + :is(.card-info, .product-info) > h3 > a {
    display: inline !important;
    font: inherit !important;
  }

  #main .capsule-card-photo + :is(.card-info, .product-info) > .product-purpose {
    font-size: 14px !important;
    line-height: 1.4 !important;
  }

  @media (max-width: 839px) {
    #main :is(.capsule-category-products > .category-products, .capsule-collection > .product-collection):has(.capsule-card-photo) {
      grid-template-columns: minmax(0, 1fr) !important;
    }

    #main :is(.capsule-category-products .product-card > .card-link, .capsule-collection .product-tile):has(> .capsule-card-photo) {
      grid-template-columns: minmax(0, min(28%, 160px)) minmax(0, 1fr) !important;
      gap: 12px !important;
    }
  }

  @media (max-width: 359px) {
    #main :is(.capsule-category-products .product-card > .card-link, .capsule-collection .product-tile):has(> .capsule-card-photo) {
      grid-template-columns: minmax(0, 24%) minmax(0, 1fr) !important;
      gap: 9px !important;
    }
  }
}
