/* ==========================================================================
   Product Card — компонентные стили карточки товара
   Геометрия: thumb -> body(vendor/title) -> bottom(article + country/price) -> actions(qty+buy)
   ========================================================================== */

.mkf-card{
  --pc-pad: 12px;
  --pc-gap: 8px;

  --pc-text: 14px;
  --pc-meta: 12px;
  --pc-vendor: 12px;

  --pc-title-lines: 3;
  --pc-title-lh: 1.35;

  /* цена крупнее */
  --pc-price: 32px;

  position: relative;
  display: grid;

  /* 4 строки: картинка / текст / bottom / кнопки */
  grid-template-rows: 210px 1fr auto 56px;

  background: var(--mkf-surface);
  border: 1px solid var(--mkf-border);
  border-radius: var(--mkf-radius);
  box-shadow: var(--mkf-shadow);
  overflow: hidden;
  height: 100%;
}


.mkf-product__vendor{
  opacity: .8;
  margin-bottom: 6px;
}

.mkf-product__article{
  opacity: .7;
  margin-bottom: 12px;
}

/* ==========================================================================
   Thumb
   ========================================================================== */
.mkf-card .card__thumb{
  grid-row: 1;
  display: block;
  height: 210px;
  padding: 8px;
  background: var(--mkf-thumb);
  position: relative;
}

.mkf-card .card__thumb img{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  object-position: center;
}

.mkf-card .card__placeholder{
  width: 100%;
  height: 100%;
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--mkf-muted);
  font-size: var(--pc-text);
}

/* ID badge (копирование) */
.card__code{
  position: absolute;
  top: 8px;
  right: 10px;
  z-index: 2;

  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;

  color: var(--mkf-muted);
  background: rgba(255,255,255,0.9);

  padding: 2px 6px;
  border-radius: 6px;

  cursor: pointer;
  user-select: none;

  transition:
    color .15s ease,
    background .15s ease,
    box-shadow .15s ease,
    transform .1s ease;
}

.card__code:hover{
  color: var(--mkf-accent);
  background: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,.12);
  transform: translateY(-1px);
}

/* Tooltip */
.card__code::after{
  content: attr(data-tooltip);
  position: absolute;
  top: calc(100% + 6px);
  right: 0;

  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;

  color: #fff;
  background: rgba(0,0,0,0.8);

  padding: 4px 8px;
  border-radius: 6px;

  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;

  transition: opacity .15s ease, transform .15s ease;
}

.card__code:hover::after{
  opacity: 1;
  transform: translateY(0);
}

.card__code.is-copied{
  color: #16a34a;
  background: #ecfdf5;
  box-shadow: 0 0 0 1px #bbf7d0 inset;
}

/* ==========================================================================
   Body: vendor -> title
   ========================================================================== */
.mkf-card .card__body{
  grid-row: 2;
  padding: var(--pc-pad) var(--pc-pad) 8px;
  min-width: 0;

  display: flex;
  flex-direction: column;
  gap: var(--pc-gap);
}

/* vendor */
.mkf-card .card__vendor{
  display: block;
  min-width: 0;

  color: var(--mkf-muted);
  text-decoration: none;

  font-size: var(--pc-vendor);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mkf-card .card__vendor:hover{
  color: var(--mkf-on-surface);
}

/* title */
.mkf-card .card__title{
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: var(--pc-title-lines);
  overflow: hidden;

  width: 100%;
  min-width: 0;

  color: var(--mkf-on-surface);
  text-decoration: none;

  font-size: var(--pc-text);
  font-weight: 650;
  line-height: var(--pc-title-lh);
  margin: 0;

  min-height: calc(1em * var(--pc-title-lh) * var(--pc-title-lines));
}

.mkf-card .card__title:hover{
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ==========================================================================
   Bottom: article (full width) + country(1/3) + price(2/3)
   ========================================================================== */

.mkf-card .card__bottom{
  grid-row: 3;
  padding: 0 var(--pc-pad) 10px;
  min-width: 0;
}

.mkf-card .card__article-row{
  display: flex;
  align-items: center;
  gap: 6px;

  margin-bottom: 6px;
  min-width: 0;

  justify-content: flex-start; /* <-- липнем к началу */
}

.mkf-card .card__article{
  color: var(--mkf-muted);
  font-size: var(--pc-meta);

  display: inline-block;
  max-width: calc(100% - 22px); /* место под кнопку копирования */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* copy button */
.mkf-card .copy-article{
  position: relative;
  padding: 0;
  border: 0;
  background: transparent;

  font-size: 13px;
  line-height: 1;

  color: var(--mkf-muted);
  cursor: pointer;

  transition: color .15s ease, transform .1s ease;
  flex: 0 0 auto;
}

.mkf-card .copy-article:hover{
  color: var(--mkf-accent);
  transform: translateY(-1px);
}

.mkf-card .copy-article:active{
  transform: translateY(0);
}

/* tooltip */
.mkf-card .copy-article::after{
  content: attr(data-tooltip);
  position: absolute;
  top: -28px;
  left: 50%;
  transform: translateX(-50%) translateY(4px);

  padding: 4px 8px;
  border-radius: 6px;

  font-size: 11px;
  white-space: nowrap;

  background: rgba(0,0,0,.85);
  color: #fff;

  opacity: 0;
  pointer-events: none;
  transition: opacity .15s ease, transform .15s ease;
}

.mkf-card .copy-article:hover::after{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mkf-card .copy-article.is-copied{
  color: #16a34a;
}

/* Country + Price row (1/3 + 2/3) */
.mkf-card .card__country-price{
  display: grid;
  grid-template-columns: 1fr 2fr;
  column-gap: 10px;
  align-items: stretch;
}

/* левая колонка: страна сверху, наличие снизу */
.mkf-card .card__meta-left{
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
}

/* страна */
.mkf-card .card__country{
  font-size: 11px;
  font-weight: 350;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--mkf-muted);
  opacity: 0.85;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* наличие */
.mkf-card .card__availability{
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

/* статусы */
.mkf-card .card__availability.is-in-stock{
  color: #16a34a; /* зелёный */
}

.mkf-card .card__availability.is-backorder{
  color: #ca8a04; /* жёлтый */
}

/* price */
.mkf-card .card__price{
  position: relative;
  padding-left: 14px;
  margin-top: 0;

  justify-self: end;
  text-align: right;

  min-width: 0;
  max-width: 100%;

  display: inline-flex;
  align-items: baseline;
  align-self: center;
  justify-content: flex-end;
  gap: 4px;

  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  /* резерв под большие цены */
  font-size: clamp(24px, 3vw, var(--pc-price));
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--mkf-on-surface);

  font-family: var(--font-numeric, Inter, system-ui, sans-serif);
  line-height: 1;
}

.mkf-card .card__price::before{
  content: "";
  position: absolute;
  left: 0;
  top: 0.10em;

  width: 1px;
  height: 1.15em;

  background: var(--mkf-border);
  opacity: 0.85;
}

.mkf-card .price-on-request{
  color: var(--mkf-muted);
  font-weight: 650;
  font-size: var(--pc-text);
  font-family: var(--font-text, Inter, system-ui, sans-serif);
}

.mkf-card .price-value{
  font-variant-numeric: lining-nums tabular-nums;
}

.mkf-card .price-cents{
  font-size: 0.62em;
  vertical-align: super;
  line-height: 0;
  opacity: 0.85;
}

.mkf-card .price-currency{
  font-size: 0.75em;
  font-weight: 400;
  color: var(--mkf-muted);
  margin-left: 4px;
  letter-spacing: 0;
  font-family: var(--font-text, Inter, system-ui, sans-serif);
  line-height: 1;
}

/* ==========================================================================
   Actions
   ========================================================================== */
.mkf-card .card__actions{
  grid-row: 4;
  padding: 10px var(--pc-pad);
  border-top: 1px solid var(--mkf-border);

  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mkf-card .card__actions .mkf-cart-form{
  display: flex;
  align-items: center;
  gap: 10px;

  width: 100%;
  min-width: 0;
  margin: 0;
}

.mkf-card .card__actions .qty-wrap{
  position: relative;
  flex: 0 0 78px;
  width: 78px;
  height: 32px;
}

.mkf-card .card__actions .qty-wrap .qty{
  width: 100%;
  height: 100%;

  padding: 4px 22px 4px 6px;
  border-radius: 8px;

  font-size: 13px;
  font-weight: 500;
  text-align: center;

  background: var(--mkf-input);
  color: var(--mkf-muted);

  border: 1px solid var(--mkf-border);
}

.mkf-card .card__actions .qty-wrap .qty:focus{
  outline: 2px solid rgba(37, 99, 235, 0.25);
  outline-offset: 1px;
}

.mkf-card .card__actions .qty-unit{
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);

  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;

  color: var(--mkf-muted);
  pointer-events: none;
  user-select: none;
}

.mkf-card .card__actions .qty-wrap .qty:focus + .qty-unit{
  opacity: 0.7;
}

.mkf-card .card__actions .btn{
  flex: 1 1 auto;
  height: 36px;

  font-size: 14px;
  font-weight: 700;

  border-radius: 10px;
  letter-spacing: 0.01em;
}

.mkf-card .card__actions > .btn{
  width: 100%;
}
