/* YPonton — блок «Вам может пригодиться» (сопутствующие товары) в карточке товара.
   Scoped .yp-related. Вторичный, свёрнут по умолчанию. Без теней на кнопках (правило бренда). */

.yp-related {
	--yp-r-accent: #f78e1f;
	--yp-r-ink:    #11233f;
	--yp-r-muted:  #8a93a2;
	--yp-r-line:   #e6eaf0;
	--yp-r-chip:   #eef2f7;
	margin: 14px 0 14px;
	font-family: 'Onest', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* --- Кнопка-заголовок (свёрнутое состояние) --- */
.yp-related__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	width: 100%;
	padding: 12px 14px;
	background: #fff;
	border: 1px solid var(--yp-r-line);
	border-radius: 12px;
	cursor: pointer;
	text-align: left;
	box-shadow: none;
	transition: border-color .15s, background .15s;
	font-family: inherit;
}
.yp-related__toggle:hover { border-color: #d6dde7; background: #fcfdfe; }
.yp-related__toggle:focus,
.yp-related__toggle:focus-visible,
.yp-related__toggle:active {
	outline: none;
	box-shadow: none;
	border-color: var(--yp-r-line);
}
.yp-related.is-open .yp-related__toggle {
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
	border-bottom-color: transparent;
}

.yp-related__lead { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.yp-related__title { font-size: 16px; font-weight: 800; color: var(--yp-r-ink); line-height: 1.2; }
.yp-related__sub { font-size: 12.5px; font-weight: 500; color: #9aa6b8; }

.yp-related__meta { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.yp-related__count {
	font-size: 12.5px; font-weight: 700; color: var(--yp-r-muted);
	background: var(--yp-r-chip); border-radius: 999px; padding: 3px 10px; white-space: nowrap;
}
.yp-related__chev { color: var(--yp-r-muted); transition: transform .3s ease; flex: none; }
.yp-related.is-open .yp-related__chev { transform: rotate(180deg); }

/* --- Раскрывающаяся панель --- */
.yp-related__panel {
	overflow: hidden;
	max-height: 0;
	border: 1px solid var(--yp-r-line);
	border-top: none;
	border-radius: 0 0 12px 12px;
	transition: max-height .3s ease;
}
/* Видимость — только через max-height (не через [hidden]: тема может иметь
   [hidden]{display:none!important}). Свёрнуто по умолчанию: max-height:0. */

.yp-related__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 14px 14px 4px;
}
.yp-related__chip {
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	color: var(--yp-r-ink);
	background: var(--yp-r-chip);
	border: 1px solid transparent;
	border-radius: 999px;
	padding: 7px 14px;
	cursor: pointer;
	box-shadow: none;
	white-space: nowrap;
	transition: background .15s, color .15s;
}
.yp-related__chip:hover { background: #e3e9f1; }
.yp-related__chip:focus,
.yp-related__chip:focus-visible,
.yp-related__chip:active { outline: none; box-shadow: none; }
.yp-related__chip.is-active { background: var(--yp-r-accent); color: #fff; }

/* --- Сетка мини-карточек --- */
.yp-related__grid {
	display: none;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 10px;
	padding: 14px;
}
.yp-related__grid.is-active { display: grid; }

.yp-rc {
	display: flex;
	flex-direction: column;
	min-width: 0;
	overflow: hidden;
	border: 1px solid var(--yp-r-line);
	border-radius: 10px;
	padding: 10px;
	background: #fff;
	text-decoration: none;
	transition: border-color .15s, transform .15s;
}
.yp-rc:hover { border-color: #cfd8e4; transform: translateY(-2px); }

.yp-rc__img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	background: #f7f9fc;
	border-radius: 8px;
	overflow: hidden;
	margin-bottom: 8px;
}
.yp-rc__img img { width: 100%; height: 100%; object-fit: contain; display: block; }
.yp-rc__ph { display: block; width: 100%; height: 100%;
	background: repeating-linear-gradient(45deg,#f0f3f8,#f0f3f8 8px,#f7f9fc 8px,#f7f9fc 16px); }

.yp-rc__name {
	font-size: 12.5px;
	font-weight: 500;
	line-height: 1.3;
	color: var(--yp-r-ink);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.6em;
	margin-bottom: 6px;
}
.yp-rc__price { font-size: 13.5px; font-weight: 700; color: var(--yp-r-ink); margin-top: auto; }
.yp-rc__price del { color: var(--yp-r-muted); font-weight: 500; font-size: 12px; margin-right: 4px; }
.yp-rc__price ins { text-decoration: none; }

/* --- Адаптив --- */
@media (max-width: 1024px) {
	.yp-related__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
	.yp-related__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.yp-related__chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
	.yp-related__chip { flex: none; }
	.yp-related__title { font-size: 15px; }
}
