/* Forms carousel + materials — high specificity to beat Elementor.
   Mockup: materials column cards; forms image top radius + top inset. */

.dmk-fc{
  --dmk-fc-text: #2C2C2C;
  --dmk-fc-gap: 20px;
  --dmk-fc-per: 4;
  --dmk-fc-container: 1280px;
  width: 100%;
  max-width: var(--dmk-fc-container);
  margin: 0 auto;
  padding: 0 20px 50px;
  box-sizing: border-box;
  position: relative;
  z-index: 1;
}
.dmk-fc--with-heading{ padding-top: 20px; }
.dmk-fc__title{
  margin: 0;
  text-align: center;
  font-size: 40px;
  font-weight: 400;
  line-height: 40px;
  text-transform: uppercase;
  color: var(--dmk-fc-text);
}
.dmk-fc__subtitle{
  margin: 20px auto 25px;
  text-align: center;
  color: var(--dmk-fc-text);
  font-size: 20px;
  font-weight: 300;
  line-height: 1.3;
  max-width: 920px;
}
.dmk-fc__row{
  display: flex !important;
  flex-direction: row !important;
  align-items: stretch;
  gap: 8px;
  margin-top: 25px;
  width: 100%;
  box-sizing: border-box;
}
.dmk-fc__viewport{
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden !important;
  width: 100%;
}
.dmk-fc__track{
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch;
  gap: var(--dmk-fc-gap);
  transform: translate3d(0,0,0);
  transition: transform 0.4s ease;
  will-change: transform;
}

/* Forms card: top inset + top image radius (mockup look, visible gap) */
.dmk-fc__card,
.dmk-woo-forms .dmk-fc__card,
.elementor-shortcode .dmk-fc__card{
  flex: 0 0 auto !important;
  width: 280px;
  max-width: none !important;
  float: none !important;
  margin: 0 !important;
  background: #fff !important;
  padding: 12px 12px 50px !important;
  text-align: center;
  border-radius: 10px !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  box-sizing: border-box !important;
  box-shadow: 0 4px 16px rgba(31, 24, 15, 0.06);
}
.dmk-fc__media,
.dmk-fc__card > a.dmk-fc__media{
  display: block !important;
  width: 100% !important;
  height: 251px !important;
  margin: 0 0 14px !important;
  padding: 0 !important;
  text-decoration: none !important;
  overflow: hidden !important;
  border-radius: 10px 10px 0 0 !important;
  box-sizing: border-box !important;
  line-height: 0 !important;
  background: #f3f1ec !important;
}
.dmk-fc__card img,
.dmk-fc__media img,
.dmk-fc__media .attachment-large{
  width: 100% !important;
  height: 251px !important;
  max-height: 251px !important;
  object-fit: contain !important;
  object-position: top center !important;
  margin: 0 !important;
  padding: 0 !important;
  display: block !important;
  border-radius: 10px 10px 0 0 !important;
  float: none !important;
}
.dmk-fc__card h3{
  color: var(--dmk-fc-text);
  text-align: center;
  font-size: 20px;
  font-weight: 400;
  line-height: 20px;
  margin: 0 10px 6px !important;
  flex-grow: 1;
}
.dmk-fc__size{
  color: #5F5F5F;
  text-align: center;
  font-size: 14px;
  font-weight: 400;
  margin: 0 0 14px !important;
  display: block;
  min-height: 1.2em;
}
.dmk-fc__link{
  border-radius: 3px;
  border: 1px solid #5F5C53;
  background: rgba(249, 247, 243, 0.48);
  padding: 13px 30px 11px;
  color: var(--dmk-fc-text) !important;
  text-align: center;
  font-size: 12px;
  font-weight: 400;
  line-height: 12px;
  text-transform: uppercase;
  text-decoration: none !important;
  display: inline-flex;
  width: max-content;
  margin: 0 auto !important;
  justify-content: center;
  align-items: center;
}
.dmk-fc__btn{
  flex: 0 0 40px;
  align-self: center;
  width: 40px;
  height: 48px;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 0;
  margin: 0;
  cursor: pointer;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  line-height: 0;
  appearance: none;
  -webkit-appearance: none;
}
.dmk-fc__btn.is-disabled{ opacity: 0.3; pointer-events: none; }
.dmk-fc__btn svg{ display: block; pointer-events: none; }

.dmk-fc ~ .post-edit-link,
.catalog-forms .post-edit-link,
body.tax-product_cat .post-edit-link,
body.tax-product_cat .edit-link{
  display: none !important;
}

/* ===== Materials grid: IMAGE ABOVE TITLE (never side-by-side) =====
   Beat Elementor/Woo floats and flex-row on the LoopProduct link. */
body.tax-product_cat.term-materialy ul.products,
body.tax-product_cat.term-pechatnyy-beton ul.products,
body.term-materialy .elementor ul.products,
body.term-pechatnyy-beton .elementor ul.products,
body.term-materialy .elementor-widget-woocommerce-products ul.products,
body.term-pechatnyy-beton .elementor-widget-woocommerce-products ul.products{
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  gap: 40px !important;
  max-width: 1280px;
  margin-left: auto !important;
  margin-right: auto !important;
  padding: 50px 20px 0 !important;
  list-style: none !important;
  width: 100%;
  box-sizing: border-box;
}
body.tax-product_cat.term-materialy ul.products::before,
body.tax-product_cat.term-materialy ul.products::after,
body.tax-product_cat.term-pechatnyy-beton ul.products::before,
body.tax-product_cat.term-pechatnyy-beton ul.products::after,
body.term-materialy ul.products::before,
body.term-materialy ul.products::after,
body.term-pechatnyy-beton ul.products::before,
body.term-pechatnyy-beton ul.products::after{
  display: none !important;
  content: none !important;
}

/* Woo wraps img+title in one <a> — FORCE column (materials + any pechatnyy archive) */
.dmk-woo-materials ul.products li.product a.woocommerce-LoopProduct-link,
.dmk-woo-materials ul.products li.product a.woocommerce-loop-product__link,
.dmk-woo-materials .woocommerce ul.products li.product > a:first-child,
body.tax-product_cat.term-materialy ul.products li.product a.woocommerce-LoopProduct-link,
body.tax-product_cat.term-pechatnyy-beton ul.products li.product a.woocommerce-LoopProduct-link,
body.tax-product_cat.term-materialy ul.products li.product a.woocommerce-loop-product__link,
body.tax-product_cat.term-pechatnyy-beton ul.products li.product a.woocommerce-loop-product__link,
body.term-materialy ul.products li.product > a:first-child,
body.term-pechatnyy-beton ul.products li.product > a:first-child,
body.term-materialy .elementor ul.products li.product a.woocommerce-LoopProduct-link,
body.term-pechatnyy-beton .elementor ul.products li.product a.woocommerce-LoopProduct-link,
.elementor-shortcode .dmk-woo-materials ul.products li.product a.woocommerce-LoopProduct-link,
.elementor-shortcode .dmk-woo-materials ul.products li.product a.woocommerce-loop-product__link{
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0 !important;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  float: none !important;
  text-decoration: none !important;
  color: inherit !important;
  box-sizing: border-box !important;
}

.dmk-woo-materials ul.products li.product,
body.tax-product_cat.term-materialy ul.products li.product,
body.tax-product_cat.term-pechatnyy-beton ul.products li.product,
body.term-materialy ul.products li.product,
body.term-pechatnyy-beton ul.products li.product{
  width: 100% !important;
  max-width: none !important;
  float: none !important;
  clear: none !important;
  margin: 0 !important;
  background: #fff !important;
  border-radius: 10px !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 8px 8px 40px !important;
  text-align: center !important;
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  box-sizing: border-box !important;
  overflow: hidden !important;
}

.dmk-woo-materials ul.products li.product img,
.dmk-woo-materials ul.products li.product a img,
body.tax-product_cat.term-materialy ul.products li.product img,
body.tax-product_cat.term-pechatnyy-beton ul.products li.product img,
body.term-materialy ul.products li.product img,
body.term-pechatnyy-beton ul.products li.product img,
body.term-materialy ul.products li.product a img,
body.term-pechatnyy-beton ul.products li.product a img{
  float: none !important;
  clear: both !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 280px !important;
  max-height: 280px !important;
  object-fit: contain !important;
  object-position: center center !important;
  margin: 0 0 24px !important;
  padding: 0 !important;
  display: block !important;
  border-radius: 8px 8px 0 0 !important;
}

.dmk-woo-materials ul.products li.product .woocommerce-loop-product__title,
.dmk-woo-materials ul.products li.product h2,
body.tax-product_cat.term-materialy ul.products li.product .woocommerce-loop-product__title,
body.tax-product_cat.term-pechatnyy-beton ul.products li.product .woocommerce-loop-product__title,
body.term-materialy ul.products li.product .woocommerce-loop-product__title,
body.term-pechatnyy-beton ul.products li.product .woocommerce-loop-product__title,
body.term-materialy ul.products li.product h2,
body.term-pechatnyy-beton ul.products li.product h2,
body.term-materialy ul.products li.product h2.woocommerce-loop-product__title,
body.term-pechatnyy-beton ul.products li.product h2.woocommerce-loop-product__title{
  float: none !important;
  clear: both !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  color: #2C2C2C !important;
  text-align: center !important;
  font-size: 20px !important;
  font-weight: 400 !important;
  line-height: 20px !important;
  margin: 0 10px 0 !important;
  padding: 0 !important;
  text-transform: none !important;
  min-height: 40px !important;
}

body.term-materialy ul.products li.product .price,
body.term-pechatnyy-beton ul.products li.product .price{
  display: none !important;
}
body.term-materialy ul.products li.product .button,
body.term-pechatnyy-beton ul.products li.product .button,
body.term-materialy ul.products li.product a.button,
body.term-pechatnyy-beton ul.products li.product a.button{
  border-radius: 3px !important;
  border: 1px solid #5F5C53 !important;
  background: rgba(249, 247, 243, 0.48) !important;
  color: #2C2C2C !important;
  text-transform: uppercase !important;
  font-size: 12px !important;
  font-weight: 400 !important;
  line-height: 12px !important;
  padding: 13px 30px 11px !important;
  margin: 24px auto 0 !important;
  width: max-content !important;
  min-width: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-shadow: none !important;
  float: none !important;
}

@media (max-width: 992px){
  .dmk-fc{ --dmk-fc-per: 1; }
  .dmk-fc__btn{ display: none !important; }
  .dmk-fc__track{
    flex-direction: column !important;
    transform: none !important;
  }
  .dmk-fc__card{ width: 100% !important; }
  /* Same specificity as desktop 3-col rules — otherwise repeat(3) wins on mobile */
  body.tax-product_cat.term-materialy ul.products,
  body.tax-product_cat.term-pechatnyy-beton ul.products,
  body.term-materialy ul.products,
  body.term-pechatnyy-beton ul.products,
  body.term-materialy .elementor ul.products,
  body.term-pechatnyy-beton .elementor ul.products,
  body.term-materialy .elementor-widget-woocommerce-products ul.products,
  body.term-pechatnyy-beton .elementor-widget-woocommerce-products ul.products,
  .dmk-woo-materials ul.products{
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  body.term-materialy ul.products li.product,
  body.term-pechatnyy-beton ul.products li.product,
  body.tax-product_cat.term-materialy ul.products li.product,
  body.tax-product_cat.term-pechatnyy-beton ul.products li.product{
    width: 100% !important;
    max-width: 100% !important;
  }
  body.term-materialy ul.products li.product img,
  body.term-pechatnyy-beton ul.products li.product img,
  body.term-materialy ul.products li.product a img,
  body.term-pechatnyy-beton ul.products li.product a img{
    height: 220px !important;
    max-height: 220px !important;
  }
  body.term-materialy ul.products li.product .button,
  body.term-pechatnyy-beton ul.products li.product .button,
  body.term-materialy ul.products li.product a.button,
  body.term-pechatnyy-beton ul.products li.product a.button{
    width: calc(100% - 16px) !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}
@media (max-width: 767px){
  .dmk-fc__title{ font-size: 22px; line-height: 22px; }
  .dmk-fc__subtitle{ font-size: 16px; }
  body.term-materialy ul.products,
  body.term-pechatnyy-beton ul.products,
  body.term-materialy .elementor-widget-woocommerce-products ul.products,
  body.term-pechatnyy-beton .elementor-widget-woocommerce-products ul.products{
    padding: 24px 12px 0 !important;
    gap: 16px !important;
  }
}
