/*!
 * MiningHelp — карточка товара и сетка: плитка (по умолчанию) и список (data-mh-layout="list").
 */

.mh-product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 262px), 1fr)); gap: var(--mh-gap); }

.mh-product-card { position: relative; min-width: 0; container: mh-card / inline-size; display: flex; flex-direction: column; gap: 14px; padding: 10px 10px 12px; border-radius: var(--mh-r-lg); background: var(--mh-surface); }

/* Фото без фона на тёмном градиенте */
.mh-product-card__media { position: relative; height: 220px; border-radius: var(--mh-r-img); overflow: hidden; background: var(--mh-photo-bg); }
.mh-product-card__photo { position: absolute; inset: 0; display: block; }
.mh-product-card__photo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.mh-product-card__noimg { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.22); }
.mh-product-card__overlay { position: absolute; left: 10px; right: 10px; top: 10px; display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; pointer-events: none; }
.mh-product-card__badges { display: flex; flex-wrap: wrap; gap: 6px; }
.mh-product-card__stock { display: inline-flex; align-items: center; gap: 7px; }
.mh-product-card__stock-dot { width: 7px; height: 7px; flex: none; border-radius: 50%; background: currentColor; }
.mh-product-card__stock--in { color: var(--mh-success); }
.mh-product-card__stock--order { color: var(--mh-accent-pale); }
.mh-product-card__stock--out { color: var(--mh-on-dark-2); }
.mh-product-card__fav { pointer-events: auto; width: var(--mh-btn-icon); height: var(--mh-btn-icon); flex: none; border-radius: 50%; border: 1px solid rgba(255,255,255,.16); background: var(--mh-glass-chip); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); color: var(--mh-on-dark); display: flex; align-items: center; justify-content: center; cursor: pointer; transition: background .15s, color .15s; }
.mh-product-card__fav:hover { background: var(--mh-on-dark); color: var(--mh-ink); }
.mh-product-card__fav[aria-pressed="true"] { color: var(--mh-accent-soft); }
.mh-product-card__fav[aria-pressed="true"] svg { fill: currentColor; }

/* Текст */
.mh-product-card__info { padding: 0 6px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.mh-product-card__meta { font-size: var(--mh-fs-12); text-transform: uppercase; letter-spacing: .04em; color: var(--mh-text-2); }
.mh-product-card__meta-stock { display: none; }
.mh-product-card__meta-stock--in { color: var(--mh-success-ink); }
.mh-product-card__meta-stock--order { color: var(--mh-accent-ink); }
.mh-product-card__name { margin: 0; font-size: var(--mh-fs-15); line-height: 1.3; font-weight: 400; }
.mh-product-card__name a { color: var(--mh-ink); }
.mh-product-card__name a:hover { color: var(--mh-accent-ink); }

/* Характеристики: 3 белые плашки (короткие значения, как в макете) */
.mh-product-card__specs { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; }
.mh-product-card__spec { min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: var(--mh-r-sm); background: var(--mh-white); }
.mh-product-card__spec dt { font-size: var(--mh-fs-11); color: var(--mh-text-3); text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mh-product-card__spec dd { margin: 0; font-size: var(--mh-fs-13); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Характеристики строками — длинные названия и значения (лидары, платы и т.п.) */
.mh-product-card__specs--rows { display: flex; flex-direction: column; gap: 0; padding: 2px 14px; border-radius: var(--mh-r-sm); background: var(--mh-white); }
.mh-product-card__specs--rows .mh-product-card__spec { flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 9px 0; border-radius: 0; background: none; }
.mh-product-card__specs--rows .mh-product-card__spec + .mh-product-card__spec { border-top: 1px solid var(--mh-line); }
.mh-product-card__specs--rows dt, .mh-product-card__specs--rows dd { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; white-space: normal; overflow: hidden; font-size: var(--mh-fs-13); line-height: 1.3; overflow-wrap: anywhere; }
.mh-product-card__specs--rows dt { flex: 1 1 0; min-width: 0; text-transform: none; color: var(--mh-text-3); }
.mh-product-card__specs--rows dd { flex: 0 1 auto; max-width: 52%; font-weight: 500; text-align: right; }

/* Узкая карточка (4 в ряд рядом с фильтрами): плашки не вмещают «200 Th/s» — те же строки */
@container mh-card (max-width: 300px) {
	.mh-product-card__specs--tiles { display: flex; flex-direction: column; gap: 0; padding: 2px 14px; border-radius: var(--mh-r-sm); background: var(--mh-white); }
	.mh-product-card__specs--tiles .mh-product-card__spec { flex-direction: row; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; border-radius: 0; background: none; }
	.mh-product-card__specs--tiles .mh-product-card__spec + .mh-product-card__spec { border-top: 1px solid var(--mh-line); }
	.mh-product-card__specs--tiles dt { font-size: var(--mh-fs-13); text-transform: none; }
	.mh-product-card__specs--tiles dd { font-size: var(--mh-fs-13); font-weight: 500; overflow: visible; }
}

/* Цена и кнопка */
.mh-product-card__foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 2px 0 0 6px; }
.mh-product-card__price { font-size: var(--mh-fs-16); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mh-product-card__buy { flex: none; height: var(--mh-btn-h-sm); padding: 0 16px; border-radius: var(--mh-r-pill); border: 0; display: inline-flex; align-items: center; background: var(--mh-ink); color: #fff; font: inherit; font-size: var(--mh-fs-14); white-space: nowrap; cursor: pointer; transition: background .15s, color .15s; }
.mh-product-card__buy:hover, .mh-product-card__buy.is-added { background: var(--mh-accent); color: var(--mh-ink-900); }
.mh-product-card__buy.is-busy { opacity: .6; cursor: progress; }

/* ---------------------------------------------------------------- Список */
.mh-product-grid[data-mh-layout="list"] { display: flex; flex-direction: column; gap: 8px; }
[data-mh-layout="list"] .mh-product-card { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 16px 24px; padding: 8px 20px 8px 8px; border-radius: var(--mh-r-lg); }
[data-mh-layout="list"] .mh-product-card__media { flex: 0 0 150px; height: 110px; border-radius: var(--mh-r-sm); }
[data-mh-layout="list"] .mh-product-card__overlay { display: none; }
[data-mh-layout="list"] .mh-product-card__info { flex: 1 1 240px; padding: 0; }
[data-mh-layout="list"] .mh-product-card__meta-stock { display: inline; }
[data-mh-layout="list"] .mh-product-card__specs { flex: 1 1 300px; gap: 12px; }
[data-mh-layout="list"] .mh-product-card__specs--tiles .mh-product-card__spec { padding: 0; gap: 4px; background: none; }
[data-mh-layout="list"] .mh-product-card__specs--tiles .mh-product-card__spec dd { white-space: normal; }
[data-mh-layout="list"] .mh-product-card__specs--rows { flex: 1 1 320px; gap: 0; }
[data-mh-layout="list"] .mh-product-card__foot { flex: 0 1 auto; margin: 0 0 0 auto; padding: 0; gap: 16px; }

/* ---------------------------------------------------------------- Компактная («Похожие товары») */
.mh-product-grid--fit { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.mh-product-card--compact { gap: 12px; padding-bottom: 14px; }
.mh-product-card--compact .mh-product-card__media { height: 200px; }
.mh-product-card__rank { position: absolute; left: 12px; top: 10px; font-size: var(--mh-fs-13); color: rgba(255,255,255,.7); pointer-events: none; font-variant-numeric: tabular-nums; }
.mh-product-card--compact .mh-product-card__name { font-size: var(--mh-fs-15); line-height: 1.2; font-weight: 500; }
.mh-product-card--compact .mh-product-card__price { font-size: var(--mh-fs-18); letter-spacing: -0.01em; }

/* ---------------------------------------------------------------- Светлый фон фото (настройка «Фон фото товаров») */
.mh-photos-light .mh-product-card__media { background: var(--mh-white); }
.mh-photos-light .mh-product-card__photo img { padding: 12px; }
.mh-photos-light .mh-product-card__stock { background: rgba(244,245,246,.94); border-color: var(--mh-line); -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--mh-ink); }
.mh-photos-light .mh-product-card__stock--in .mh-product-card__stock-dot { background: var(--mh-success-ink); }
.mh-photos-light .mh-product-card__stock--order .mh-product-card__stock-dot { background: var(--mh-accent); }
.mh-photos-light .mh-product-card__stock--out .mh-product-card__stock-dot { background: var(--mh-text-3); }
.mh-photos-light .mh-product-card__fav { background: rgba(244,245,246,.94); border-color: var(--mh-line); -webkit-backdrop-filter: none; backdrop-filter: none; color: var(--mh-ink); }
.mh-photos-light .mh-product-card__fav:hover { background: var(--mh-ink); color: #fff; }
.mh-photos-light .mh-product-card__fav[aria-pressed="true"] { color: var(--mh-accent-hover); }
.mh-photos-light .mh-product-card__rank { color: var(--mh-text-3); }
.mh-photos-light .mh-product-card__noimg { color: var(--mh-line-strong); }
