/* ==========================================================================
   collection-grid.css
   Replaces every Globo Smart Filters scoped collection rule.
   Scoped to both the collection page (.custom-collectionpage) and the
   search results page (.custom-searchpage), which share the same card markup.
   Built and checked against the native markup of the collection page:

   .product-list.product-list--collection
     > .column.thumbnail                 (card)
         > div.product-NNN > .product-wrap   (image area)
             > .product_image > a > .image__container > .image-element__wrap
             > .price-ui-badges > .price-ui-badge > .price-ui-badge__sticker
         > a.product-info__caption       (title, price, add to cart form)
   ========================================================================== */

:is(.custom-collectionpage, .custom-searchpage) {
  --cg-gap: 32px;
  --cg-cols: 3;
  --cg-image-h: 306px;
  --cg-tag-h: 35px;
}

@media only screen and (max-width: 1200px) {
  :is(.custom-collectionpage, .custom-searchpage) { --cg-cols: 2; }
}

@media only screen and (max-width: 991px) {
  :is(.custom-collectionpage, .custom-searchpage) { --cg-cols: 1; }
}

@media only screen and (max-width: 767px) {
  :is(.custom-collectionpage, .custom-searchpage) {
    --cg-cols: 2;
    --cg-gap: 10px;
    --cg-image-h: 250px;
    --cg-tag-h: 27px;
  }
}

@media only screen and (max-width: 480px) {
  :is(.custom-collectionpage, .custom-searchpage) { --cg-image-h: 174px; }
}

@media only screen and (max-width: 340px) {
  :is(.custom-collectionpage, .custom-searchpage) { --cg-cols: 1; }
}

/* ---------- Page layout (container width the Globo page had) ---------- */

:is(.custom-collectionpage, .custom-searchpage) .product-app--container > .container {
  max-width: 1350px;
  padding-left: 15px;
  padding-right: 15px;
}

:is(.custom-collectionpage, .custom-searchpage) .product-app--container > .container > .one-whole.column {
  margin-left: 0 !important;
  margin-right: 0 !important;
  width: 100% !important;
}

:is(.custom-collectionpage, .custom-searchpage) .pf-shell__main .container.content {
  padding-left: 0 !important;
  padding-right: 0 !important;
}

.description-bottom .collection_description.rte {
  max-width: 100% !important;
}

/* ---------- Grid ---------- */

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection {
  display: flex;
  flex-flow: wrap;
  gap: var(--cg-gap);
  margin: 0;
}

/* ---------- Card ---------- */

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail {
  flex: 0 0 calc((100% - (var(--cg-cols) - 1) * var(--cg-gap)) / var(--cg-cols)) !important;
  max-width: calc((100% - (var(--cg-cols) - 1) * var(--cg-gap)) / var(--cg-cols)) !important;
  width: auto !important;
  float: none !important;
  margin: 0 !important;
  padding: 0 !important;
  position: relative;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0px 3.16596px 12.6638px 0px rgba(0, 0, 0, 0.15);
  text-align: left;
  font-family: "Lexend", sans-serif;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .product-wrap {
  position: relative !important;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  padding: 0 !important;
  height: auto;
}

/* ---------- Image (the sale tag takes the first band, image sits under it) ---------- */

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .product_image {
  position: relative;
  padding-top: var(--cg-tag-h);
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .product_image .image-element__wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100% !important;
  max-width: 100% !important;
  height: var(--cg-image-h) !important;
  max-height: none !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .product_image .image-element__wrap img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
}

/* ---------- Sale tag (Price UI badge restyled to the old Globo tag) ---------- */

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-ui-badges {
  position: absolute !important;
  top: 18px !important;
  left: -10px !important;
  right: auto !important;
  bottom: auto !important;
  width: auto !important;
  display: block !important;
  margin: 0 !important;
  padding: 0 !important;
  z-index: auto !important;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-ui-badges .price-ui-badge {
  display: block;
  margin: 0;
  padding: 0;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-ui-badges .price-ui-badge__sticker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 114px;
  width: fit-content;
  height: var(--cg-tag-h);
  margin: 0;
  padding: 0 10px;
  border-radius: 8px;
  background: #E95757;
  color: #ffffff;
  font-family: "Lexend", sans-serif;
  font-size: 18px;
  font-weight: 700;
  line-height: 130%;
  letter-spacing: 0;
  text-transform: none;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-ui-badges .price-ui-badge__sticker * {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-ui-badges .price-ui-badge__sticker:before {
  content: "";
  background-color: #9c2f2f;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid #9C2F2F;
  position: absolute;
  bottom: -4px;
  left: 0px;
  transform: rotate(65deg);
  z-index: -1;
}

/* ---------- Caption: title ---------- */

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail > .product-info__caption {
  display: block;
  position: static;
  margin: 0 !important;
  padding: 14px 23px 0;
  text-align: left;
  text-decoration: none;
}

/* Products with a size guide link put an <a> inside the caption <a>. Browsers do not
   allow nested anchors, so the parser closes the caption early: the caption ends up
   empty and .product-details becomes a direct child of the card (plus empty anchor
   clones inside it). These rules make that markup look identical to the normal one. */
:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail > .product-info__caption:not(:has(*)) {
  display: none;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail > .product-details {
  padding: 14px 23px 0;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .product-details .product-info__caption {
  display: block;
  position: static;
  margin: 0 !important;
  padding: 0 !important;
  text-decoration: none;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .product-details {
  display: flow-root;
  margin: 0 0 50px !important;
  text-align: left;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail > .product-info__caption .product-details {
  padding: 0;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .product-details .title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  position: relative;
  margin: 0 0 5px;
  padding: 0;
  color: #2D2D2D;
  font-family: "Lexend", sans-serif;
  font-size: 20px;
  font-weight: 700;
  line-height: 130%;
  letter-spacing: 0;
  text-transform: initial;
  text-align: left;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .product-details .toy-type-section {
  display: block;
  margin: 10px 0 0;
  gap: 8px;
  overflow: visible;
}

/* ---------- Caption: price (pinned to the card bottom) ---------- */

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .product-price-addcart-block {
  position: absolute !important;
  left: 23px;
  right: 23px;
  bottom: 20px !important;
  margin: 0;
  padding: 0;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-collection-block {
  padding: 0;
  margin: 0;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-collection-block .price {
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  align-items: center;
  min-height: 29.3px;
  margin: 0 0 5px !important;
  padding: 0;
  font-family: "Lexend", sans-serif;
  line-height: 26px;
  text-align: left;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-collection-block .price small,
:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-collection-block .price .from {
  display: none;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-collection-block .price .current_price,
:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-collection-block .price .current_price .money {
  display: block;
  margin: 0;
  color: #2D2D2D;
  font-family: "Lexend", sans-serif;
  font-size: 20px;
  font-weight: 500;
  line-height: 130%;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-collection-block .price .was_price,
:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-collection-block .price .was_price .money {
  order: -1;
  display: block;
  margin: 0;
  color: #828282;
  font-family: "Lexend", sans-serif;
  font-size: 16px;
  font-weight: 500;
  line-height: 180%;
  text-decoration: line-through;
}

:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-collection-block .price .was_price {
  align-self: stretch;
}

/* Add to cart and gift bag are not shown on collection cards */
:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .add-to-cart-product-slider,
:is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .gift-bag-container {
  display: none !important;
}

/* Badge size on collection cards (was #gf-grid .custom-badge img) */
:is(.custom-collectionpage, .custom-searchpage) .product-list--collection .custom-badge img {
  max-width: 75px !important;
  max-height: 75px !important;
}

/* ---------- Mobile (max 768px) ---------- */

@media only screen and (max-width: 768px) {
  :is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail {
    border-radius: 10px;
    box-shadow: 0px 2.6969697475px 8.0909090042px 0px rgba(0, 0, 0, 0.15);
  }

  :is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-ui-badges {
    top: 8px !important;
    left: -5px !important;
  }

  :is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-ui-badges .price-ui-badge__sticker {
    min-width: 60px;
    font-size: 11px;
  }

  :is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-ui-badges .price-ui-badge__sticker:before {
    border-left: 6px solid transparent;
    border-right: 14px solid transparent;
    border-bottom: 12px solid #9C2F2F;
    bottom: -8px;
  }

  :is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail > .product-info__caption,
  :is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail > .product-details {
    padding: 8px 10px 0;
  }

  :is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .product-details {
    margin-bottom: 40px !important;
  }

  :is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .product-details .title {
    font-size: 13px;
    line-height: 130%;
  }

  :is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .product-price-addcart-block {
    left: 10px;
    right: 10px;
    bottom: 21.2px !important;
  }

  :is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-collection-block .price {
    min-height: 0;
  }

  :is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-collection-block .price .current_price,
  :is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-collection-block .price .current_price .money {
    font-size: 15px;
  }

  :is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-collection-block .price .was_price,
  :is(.custom-collectionpage, .custom-searchpage) .product-list--collection > .column.thumbnail .price-collection-block .price .was_price .money {
    font-size: 12px;
  }
}

/* ---------- Pagination spacing (native .pagination is styled in custom.css) ---------- */

:is(.custom-collectionpage, .custom-searchpage) .pagination {
  margin-top: 30px;
}
