/*
 * Карточки товаров (новое оформление) и мини-корзина.
 * Файл подключается, только когда в «Настройки → Карточки товаров» включён один из режимов.
 * Сетка списков остаётся штатной (.main-catalog__item, слайдеры), здесь — только содержимое карточки.
 * Цвета и шрифт — как на сайте: текст #414243, акция #d91638, шрифт Montserrat (наследуется).
 */

.alc-cards-mode,
.alc-product-mode {
	--alc-ink: #414243;
	--alc-muted: #6b706b;
	--alc-line: #e6e8e4;
	--alc-sale: #d91638;
	--alc-soft: #f3f7f3;
	--alc-green: #41b757;
	--alc-button-text: #fff;
	--alc-radius: 4px;
	--alc-label-radius: 4px;
	--alc-motion: 160ms;
}

/* ---------- Карточка ---------- */

.alc-card.product {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0;
	min-width: 0;
	height: auto;
	padding: 14px 16px 16px;
	background: #fff;
	color: var(--alc-ink);
	box-sizing: border-box;
	container-type: inline-size;
	transition: box-shadow var(--alc-motion), transform var(--alc-motion);
}

/* Штатная карточка показывает .product__actions по наведению — у новой действия всегда на месте. */
.alc-card.product:hover { z-index: 2; }
.alc-shadow-hover .alc-card.product:hover,
.alc-shadow-always .alc-card.product { box-shadow: 0 6px 24px rgba(33, 41, 35, .09); }

/* Метки над фото: строка всегда одной высоты, чтобы фото в ряду стояли ровно. */
.alc-card__labels {
	display: flex;
	justify-content: space-between;
	gap: 6px;
	min-height: 22px;
	padding-right: 34px;
	margin-bottom: 8px;
}
.alc-card__labels-start,
.alc-card__labels-end {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	min-width: 0;
}
.alc-card__labels-end { margin-left: auto; justify-content: flex-end; }

.alc-label {
	display: inline-flex;
	align-items: center;
	max-width: 100%;
	min-height: 22px;
	padding: 2px 7px;
	border: 1px solid var(--alc-label-border);
	border-radius: var(--alc-label-radius);
	background: var(--alc-label-bg);
	color: var(--alc-label-ink);
	font-size: 11px;
	font-weight: 600;
	line-height: 1.2;
	letter-spacing: .01em;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	box-sizing: border-box;
}

.alc-card__like.product__like {
	position: absolute;
	top: 6px;
	right: 6px;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
}
.alc-card__like svg { width: 21px; height: 21px; fill: none; stroke: #8b8f8b; stroke-width: 1.6; transition: stroke var(--alc-motion); }
/* Штатный стиль сайта закрашивает path у .product__like — у новой карточки контурное сердце. */
.alc-card .alc-card__like svg path { fill: none; stroke: inherit; }
.alc-card__like:hover svg { stroke: var(--alc-sale); }
.alc-card._liked .alc-card__like svg { stroke: var(--alc-sale); }
.alc-card._liked .alc-card__like svg path { fill: var(--alc-sale); }

/* Фото целиком, в одинаковом квадрате. */
.alc-card__image {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	aspect-ratio: 1;
	margin-bottom: 12px;
	overflow: hidden;
}
.alc-card__image picture { display: contents; }
.alc-card__image img {
	position: static;
	display: block;
	width: 100%;
	height: 100%;
	max-width: 100%;
	object-fit: contain;
	transition: transform 300ms ease;
}
.alc-shadow-hover .alc-card:hover .alc-card__image img { transform: scale(1.03); }

/* Название — блок постоянной высоты: N строк у всех карточек (короткое название держит место, длинное — «…»),
   поэтому параметры, бренд, «В наличии» и цена в ряду стоят на одной линии.
   N по ширине карточки: шире 250 px (компьютер) — 2, уже (планшет, телефон) — 3. */
.alc-card__title {
	--alc-title-lines: 2;
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: var(--alc-title-lines);
	line-clamp: var(--alc-title-lines);
	overflow: hidden;
	min-width: 0;
	height: calc(var(--alc-title-lines) * 1.4em);
	margin: 0 0 6px;
	color: inherit;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.4;
	overflow-wrap: anywhere;
}
@container (max-width: 250px) {
	.alc-card__title { --alc-title-lines: 3; }
}
.alc-card__title:hover { color: var(--alc-green); }

/* Параметры (объём · крепость · страна) — первая строка, бренд — всегда отдельной строкой ниже.
   Бренд — в одну строку. Когда «Бренд» включён в настройках (--brand), его строка держит место и у товара
   без бренда: «В наличии» в ряду на одной линии. Выключен — строки бренда нет совсем. */
.alc-card__meta {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 2px;
	margin-bottom: 8px;
	color: var(--alc-muted);
	font-size: 12px;
	line-height: 1.45;
}
.alc-card__meta--brand { min-height: calc(2.9em + 2px); }
.alc-card__brand { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.alc-card__facts abbr { text-decoration: none; border: 0; cursor: help; }

.alc-card__stock { margin-bottom: 8px; }
.alc-card__stock .stock-badge { margin: 0; font-size: 12px; }

/* Низ карточки — сетка: строка «старая цена −%» (только у скидки) над строкой «цена | покупка».
   Цена и покупка всегда на одной линии и никогда не переносятся; низ карточек в ряду выровнен. */
.alc-card__bottom {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas: "old old" "price actions";
	align-items: center;
	column-gap: 10px;
	margin-top: auto;
	padding-top: 6px;
	min-height: 46px;
}
.alc-card__price-block { display: contents; }
.alc-card__price {
	grid-area: price;
	display: flex;
	align-items: baseline;
	flex-wrap: nowrap;
	min-width: 0;
	white-space: nowrap;
	gap: 4px;
	font-size: 19px;
	font-weight: 700;
	line-height: 1.2;
	font-variant-numeric: tabular-nums;
}
.alc-card__price strong { font-weight: 700; white-space: nowrap; }
.alc-card__price span { font-size: 12px; font-weight: 500; white-space: nowrap; }
.alc-card__price.is-sale { color: var(--alc-sale); }
.alc-card__old {
	grid-area: old;
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
	margin-bottom: 4px;
}
.alc-card__old s { color: var(--alc-muted); font-size: 12px; white-space: nowrap; }
.alc-card__actions { grid-area: actions; display: flex; justify-content: flex-end; min-width: 0; }

/* Карточка средней ширины (4 в ряд на широком экране, планшеты): кнопка с текстом рядом с ценой
   не помещается во всех языках → значок корзины 44×44 в той же строке. Название — в aria-label кнопки.
   Порог 310: самая длинная пара «49 999.00 MDL» + «Add to basket» = 301 px. */
@container (min-width: 251px) and (max-width: 309px) {
	.alc-card__bottom--wide .alc-buy:not(.alc-buy--disabled) { width: 44px; padding: 0; gap: 0; }
	.alc-card__bottom--wide .alc-qty { width: 104px; grid-template-columns: 32px minmax(30px, 1fr) 32px; }
	.alc-card__bottom--wide .alc-buy:not(.alc-buy--disabled) > span:not(.alc-buy__count) { display: none; }
	.alc-card__bottom--wide .alc-buy--disabled { max-width: 120px; white-space: normal; text-align: center; }
}

/* Вариант «значок» на телефоне: рядом со значком 44 px цена от 1 000 в одну строку не помещается
   (MDL переносился у одних карточек и не у других → значки на разной высоте). Здесь у ВСЕХ карточек
   число — крупно, «MDL» — мелко строкой ниже: блок цены одной высоты, значки ряда на одной линии. */
@container (max-width: 200px) {
	.alc-card__bottom--icon .alc-card__price { flex-direction: column; align-items: flex-start; gap: 0; line-height: 1.15; }
	.alc-card__bottom--icon .alc-card__price span { font-size: 11px; }
	.alc-card__bottom--icon .alc-buy--disabled { max-width: 96px; padding: 6px 8px; white-space: normal; text-align: center; font-size: 11px; }
}
/* Самые узкие телефоны (360 px): цена от 10 000 — чуть мельче, чтобы не упираться в значок. */
@container (max-width: 140px) {
	.alc-card__bottom--icon .alc-card__price { font-size: 15px; }
}
@container (max-width: 125px) {
	.alc-card__bottom--icon .alc-card__price { font-size: 13px; }
}

/* Узкая карточка (телефон, 5 в ряд): цена, под ней покупка во всю ширину — у всех карточек одинаково. */
@container (max-width: 250px) {
	.alc-card__bottom--wide { grid-template-columns: minmax(0, 1fr); grid-template-areas: "old" "price" "actions"; row-gap: 8px; }
	.alc-card__bottom--wide .alc-card__old { margin-bottom: -4px; }
	.alc-card__bottom--wide .alc-card__actions .alc-buy,
	.alc-card__bottom--wide .alc-card__actions .alc-qty { width: 100%; }
}

.alc-card__note { margin: 8px 0 0; color: #a81e3b; font-size: 11px; line-height: 1.4; }
.alc-card__message { margin: 6px 0 0; color: #8a4f12; font-size: 12px; line-height: 1.4; }
.alc-card__message:empty { display: none; }
.alc-hidden { display: none !important; }

/* ---------- Кнопка покупки ---------- */

.alc-buy {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	padding: 8px 16px;
	border: 1px solid var(--alc-green);
	border-radius: var(--alc-radius);
	background: var(--alc-green);
	color: var(--alc-button-text);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	box-sizing: border-box;
	transition: filter var(--alc-motion), background var(--alc-motion);
}
.alc-buy:hover { filter: brightness(.93); color: var(--alc-button-text); }
.alc-buy svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Значок без текста — квадрат 44×44 в строке цены. */
.alc-buy--icon { position: relative; width: 44px; padding: 0; }

.alc-buy--added { background: var(--alc-soft); border-color: #d6e3d6; color: var(--alc-green); }
.alc-buy--added:hover { filter: none; background: #e8f0e8; color: var(--alc-green); }
.alc-buy__count {
	position: absolute;
	top: -7px;
	right: -7px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 9px;
	background: var(--alc-green);
	color: var(--alc-button-text);
	font-size: 10px;
	font-weight: 700;
	line-height: 18px;
	box-sizing: border-box;
}
.alc-buy--disabled,
.alc-buy:disabled { background: #f1f3ef; border-color: #f1f3ef; color: #7a8078; cursor: default; filter: none; }

.alc-qty {
	display: inline-grid;
	grid-template-columns: 38px minmax(36px, 1fr) 38px;
	align-items: center;
	width: 120px;
	height: 44px;
	border: 1px solid #d6e3d6;
	border-radius: var(--alc-radius);
	background: var(--alc-soft);
	overflow: hidden;
	box-sizing: border-box;
}
.alc-qty button {
	height: 42px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--alc-green);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background var(--alc-motion);
}
.alc-qty button:hover { background: #e3ede3; }
.alc-qty input {
	width: 100%;
	min-width: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--alc-ink);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	font-variant-numeric: tabular-nums;
}

.alc-card a:focus-visible,
.alc-card button:focus-visible,
.alc-qty input:focus-visible,
.alc-drawer-shell a:focus-visible,
.alc-drawer-shell button:focus-visible { outline: 2px solid var(--alc-green); outline-offset: 2px; }
.alc-qty button:focus-visible,
.alc-qty input:focus-visible { outline-offset: -2px; }

.alc-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Слайдеры главной и «похожие»: карточки одной высоты. */
.alc-cards-mode .swiper-wrapper:has(> .alc-card) { align-items: stretch; }
.alc-cards-mode .swiper-slide.alc-card { height: auto; }

@media (max-width: 721.98px) {
	.alc-card.product { padding: 10px 10px 12px; }
	.alc-card__labels { min-height: 20px; margin-bottom: 6px; padding-right: 30px; }
	.alc-card__like.product__like { top: 2px; right: 2px; }
	.alc-label { min-height: 20px; padding: 1px 6px; font-size: 10px; }
	.alc-card__title { font-size: 13px; }
	.alc-card__meta { font-size: 11px; }
	.alc-card__price { font-size: 17px; }
	.alc-buy { font-size: 12px; padding: 8px 12px; }
}

@media (prefers-reduced-motion: reduce) {
	.alc-card.product,
	.alc-card__image img,
	.alc-buy,
	.alc-qty button { transition: none; }
	.alc-shadow-hover .alc-card:hover .alc-card__image img { transform: none; }
}

/* ---------- Мини-корзина (шторка) ---------- */

html.alc-cart-lock { overflow: hidden; }

.alc-drawer-shell {
	position: fixed;
	inset: 0 0 0 auto;
	width: 480px;
	max-width: 100vw;
	height: 100dvh;
	max-height: 100dvh;
	margin: 0;
	padding: 0;
	border: 0;
	border-left: 1px solid #dedede;
	background: #fff;
	color: var(--alc-ink, #414243);
	overflow: hidden;
	box-sizing: border-box;
	transform: none;
}
.alc-drawer-shell::backdrop { background: rgba(32, 48, 35, .4); }
.alc-drawer-shell[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }

.alc-cart__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px 22px; border-bottom: 1px solid #dedede; }
.alc-cart__head h2 { margin: 0; font-size: 20px; font-weight: 600; line-height: 1.3; }
.alc-cart__head h2 small { color: var(--alc-muted, #6b706b); font-size: 14px; font-weight: 500; }
.alc-cart__close,
.alc-cart__remove { min-width: 44px; min-height: 44px; border: 0; background: none; color: #747b73; font-size: 25px; cursor: pointer; }

.alc-cart__scroll { min-height: 0; padding: 0 22px; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; }
.alc-cart__row {
	display: grid;
	grid-template-columns: 56px minmax(0, 1fr) 32px;
	align-items: start;
	gap: 12px 13px;
	min-width: 0;
	padding: 20px 0;
	border-bottom: 1px solid #dedede;
}
.alc-cart__row > img { grid-row: 1 / span 2; width: 56px; height: 88px; object-fit: contain; }
.alc-cart__name { margin: 0 0 6px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.alc-cart__unit { font-size: 13px; font-weight: 600; }
.alc-cart__unit small,
.alc-cart__sum small { font-size: 10px; font-weight: 400; }
.alc-cart__remove { margin: -10px -10px 0 -3px; }
.alc-cart__controls { grid-column: 2 / span 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.alc-cart__sum { font-size: 14px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.alc-cart__row .alc-card__message { grid-column: 2 / span 2; }

.alc-cart__footer { display: grid; gap: 8px; padding: 18px 22px max(14px, env(safe-area-inset-bottom)); border-top: 1px solid #dedede; background: #fff; }
.alc-cart__footer .alc-buy { width: 100%; }
.alc-cart__total { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin-bottom: 4px; font-size: 13px; }
.alc-cart__total strong { font-size: 20px; font-weight: 600; white-space: nowrap; }
.alc-cart__continue { min-height: 36px; border: 0; background: none; color: var(--alc-green); font-size: 13px; text-decoration: underline; cursor: pointer; }
.alc-cart__empty { padding: 40px 10px; font-size: 15px; line-height: 1.6; text-align: center; }
.alc-cart__receiving { padding: 20px 0; font-size: 13px; line-height: 1.6; }
.alc-cart__receiving h3 { margin: 0 0 8px; font-size: 14px; font-weight: 600; }
.alc-cart__receiving button { display: block; min-height: 44px; padding: 6px 0; border: 0; background: none; color: var(--alc-green); text-decoration: underline; cursor: pointer; }
.alc-cart__receiving small { display: block; margin-top: 4px; color: #6d716d; font-size: 11px; }

@media (max-width: 767px) {
	.alc-drawer-shell { width: 100vw; border-left: 0; }
	.alc-cart__head { padding: 14px 16px; }
	.alc-cart__scroll { padding: 0 16px; }
	.alc-cart__footer { padding: 14px 16px max(12px, env(safe-area-inset-bottom)); }
}
@media (max-height: 500px) {
	.alc-cart__head { padding-top: 8px; padding-bottom: 8px; }
	.alc-cart__footer { gap: 3px; padding-top: 10px; padding-bottom: 10px; }
	.alc-cart__total strong { font-size: 17px; }
}

/* ---------- Страница товара (подпакет 2_СтраницаТовара, класс .alc-pp на <main>) ----------
 * Разметка страницы штатная: меняется порядок блоков и оформление. Покупка — штатная (количество, «В корзину», «В 1 клик»).
 * Порядок: метки → название → характеристики → цена и покупка → наличие и избранное → получение → описание.
 */
.alc-pp .image-card__mods { display: none; }
.alc-pp .info-card { row-gap: 16px; overflow: visible; }
.alc-pp .info-card > * { order: 10; }
.alc-pp .alc-pp__labels { order: 1; }
.alc-pp .info-card__title { order: 2; font-size: 28px; line-height: 1.25; }
.alc-pp .alc-pp__facts { order: 3; }
.alc-pp .info-card__brand { display: none; }
.alc-pp .alc-pp-buy { order: 4; }
.alc-pp .info-card__other,
.alc-pp .info-card > .stock-badge { order: 5; }
.alc-pp .info-card__text { order: 20; font-size: 15px; line-height: 1.6; }

.alc-pp__labels { display: flex; flex-wrap: wrap; gap: 6px; }
.alc-pp__labels .alc-label { min-height: 26px; padding: 3px 9px; font-size: 12px; }
.alc-pp__facts { margin: -6px 0 0; color: var(--alc-muted); font-size: 15px; line-height: 1.5; }
.alc-pp__facts abbr { text-decoration: none; border: 0; cursor: help; }

.alc-pp-buy {
	display: flex;
	flex-direction: column;
	gap: 16px;
	width: 100%;
	padding: 20px;
	border: 1px solid var(--alc-line);
	border-radius: 12px;
	background: #fafbf9;
	box-sizing: border-box;
}
.alc-pp-buy .info-card__price { flex-wrap: wrap; gap: 6px 14px; font-size: 30px; }
.alc-pp-buy .info-card__price ._old-container { display: flex; align-items: center; gap: 8px; }
.alc-pp-buy .info-card__price span._old { font-size: 18px; color: var(--alc-muted); }
.alc-pp-buy .info-card__price .alc-label { font-size: 13px; min-height: 26px; padding: 3px 8px; }
.alc-pp-buy .info-card__actions { width: 100%; gap: 12px; }
.alc-pp-buy .info-card__column { flex: 1 1 auto; border-radius: var(--alc-radius); }
.alc-pp-buy .info-card__column:last-child { flex: 0 1 auto; }
.alc-pp-buy .info-card__quantity { background: #fff; border-color: #d9ddd6; }
.alc-pp-buy .info-card__button { flex: 1 1 auto; min-height: 52px; }
/* Кнопки страницы товара — тот же цвет и форма, что у карточек (настройки «Покупка»). */
.alc-pp-buy .info-card__button.product__button { background: var(--alc-green); color: var(--alc-button-text); }
.alc-pp-buy .info-card__button.product__button:hover { filter: brightness(.93); }
.alc-pp-buy .info-card__button._stroke { border-color: var(--alc-green); color: var(--alc-green); background: #fff; }
.alc-pp-buy .info-card__button._stroke svg path { stroke: var(--alc-green); }
.alc-pp-buy .info-card__column:first-child { border-radius: var(--alc-radius); }
.alc-pp-buy .info-card__column:last-child .info-card__button { border-radius: var(--alc-radius); }

.alc-pp .info-card__other { gap: 10px; }
.alc-pp .info-card__status,
.alc-pp .info-card__like { min-height: 36px; padding: 4px 12px; border-radius: 999px; font-size: 14px; }

@media (max-width: 767px) {
	.alc-pp .info-card__title { font-size: 22px; }
	.alc-pp-buy { padding: 16px; }
	.alc-pp-buy .info-card__price { font-size: 26px; }
	.alc-pp-buy .info-card__column,
	.alc-pp-buy .info-card__column:last-child { flex: 1 1 100%; }
	.alc-pp-buy .info-card__column:last-child .info-card__button { width: 100%; }
}
