/* Mini ficha de producto: popover de escritorio y detalle ampliado de la fila (EVO002 fase 12). */

.cn-mf {
	display: grid;
	grid-template-areas:
		"img head"
		"img side"
		"desc desc";
	grid-template-columns: 130px minmax(0, 1fr);
	gap: 8px 16px;
	color: var(--cn-ink);
}

.cn-mf__img {
	grid-area: img;
}

.cn-mf__head {
	grid-area: head;
}

.cn-mf__desc {
	grid-area: desc;
	min-width: 0;
	padding-top: 8px;
	border-top: 1px solid var(--cn-line);
}

.cn-mf__side {
	grid-area: side;
}

.cn-mf__img img {
	display: block;
	width: 130px;
	height: 130px;
	margin: 0;
	border: 1px solid var(--cn-line);
	border-radius: 10px;
	background: #fff;
	object-fit: contain;
}

.cn-mf__img:empty {
	display: none;
}

.cn-mf__head,
.cn-mf__side {
	min-width: 0;
}

.cn-mf__tit {
	margin: 0 0 6px;
	font-weight: 700;
	line-height: 1.3;
}

.cn-mf p {
	margin: 0 0 8px;
}

.cn-mf__vol {
	display: flex;
	gap: 8px;
	align-items: flex-start;
	padding: 6px 10px;
	border: 1px solid #f1c89b;
	border-radius: 8px;
	background: #fff3dc;
	color: #7a4a00;
}

.cn-mf__desc > :last-child {
	margin-bottom: 0;
}

.cn-mf__desc ul,
.cn-mf__desc ol {
	margin: 0 0 8px;
	padding-inline-start: 1.2em;
}

.cn-mf__desc li {
	list-style: inherit;
}

.cn-mf__desc h4,
.cn-mf__desc h5,
.cn-mf__desc h6 {
	margin: 8px 0 4px;
	font-size: .86rem;
}

.cn-mf__desc table {
	display: block;
	width: 100%;
	margin: 0 0 8px;
	overflow-x: auto;
	font-size: .78rem;
	border-collapse: collapse;
}

.cn-mf__desc td,
.cn-mf__desc th {
	padding: 2px 6px;
	border: 1px solid var(--cn-line);
}

.cn-mf__datos {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 6px 18px;
	margin: 0 0 8px;
}

.cn-mf__datos div {
	min-width: 0;
}

.cn-mf__datos dt {
	color: var(--cn-muted);
	font-size: .72rem;
	font-weight: 600;
	letter-spacing: .02em;
	text-transform: uppercase;
}

.cn-mf__datos dd {
	margin: 0;
	overflow-wrap: anywhere;
}

.cn-mf__sub {
	margin: 0 0 4px;
	font-weight: 700;
}

.cn-mf__var ul {
	margin: 0 0 6px;
	padding: 0;
	list-style: none;
}

.cn-mf__var li {
	padding: 2px 0;
	border-top: 1px solid var(--cn-line);
}

.cn-mf__enlaces {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	margin: 0;
}

.cn-mf a {
	font-weight: 700;
	text-decoration: underline;
}

/* Popover: compacto, sin enlaces, con su propio scroll. */
.cn-mfpop {
	position: fixed;
	z-index: 10000;
	box-sizing: border-box;
	width: 480px;
	max-width: calc(100vw - 16px);
	max-height: 60vh;
	padding: 14px;
	overflow: auto;
	border: 1px solid var(--cn-line);
	border-radius: 12px;
	background: var(--cn-surface, #fff);
	box-shadow: 0 14px 36px rgba(15, 40, 50, .22);
	font-size: .84rem;
	line-height: 1.45;
	opacity: 0;
	overscroll-behavior: contain;
}

.cn-mfpop[hidden] {
	display: none;
}

.cn-mfpop.is-on {
	opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
	.cn-mfpop {
		transition: opacity .12s ease;
	}
}

/* Solo con ratón y pantalla ancha. */
@media (hover: none), (pointer: coarse), (max-width: 1023px) {
	.cn-mfpop {
		display: none !important;
	}
}

/*
 * Detalle ampliado de la fila (tabla): alto mínimo común para todas las filas. Con un alto fijo, las fichas con
 * muchos datos aplastaban la fila de la descripción y la cortaban a media línea; ahora crecen lo necesario.
 */
.cn-row__detalle .cn-mf--full {
	grid-template-areas:
		"img head"
		"img desc"
		"img side";
	grid-template-columns: 200px minmax(0, 1fr);
	grid-template-rows: auto auto 1fr;
	gap: 6px 26px;
	min-height: 270px;
	font-size: .88rem;
}

.cn-row__detalle .cn-mf--full .cn-mf__img {
	display: flex;
	min-width: 0;
	flex-direction: column;
	gap: 8px;
	align-items: center;
	min-height: 0;
}

.cn-row__detalle .cn-mf--full .cn-mf__img img.cn-mf__main,
.cn-row__detalle .cn-mf--full .cn-mf__img > img {
	width: 200px;
	height: 200px;
}

.cn-mf__thumbs {
	display: flex;
	gap: 4px;
	justify-content: center;
	max-width: 100%;
}

/* Las miniaturas se encogen para caber en la columna de la imagen (4 de 48 px no caben en 200 px con huecos de 8). */
.cn-mf__thumb {
	flex: 0 1 48px;
	min-width: 0;
	width: 48px;
	height: auto;
	aspect-ratio: 1;
	box-sizing: border-box;
	padding: 2px;
	border: 2px solid var(--cn-line);
	border-radius: 8px;
	background: #fff;
	cursor: pointer;
}

.cn-mf__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.cn-mf__thumb.is-on,
.cn-mf__thumb:hover {
	border-color: var(--cn-ink);
}

.cn-mf__thumb:focus-visible {
	outline: 3px solid var(--cn-ink);
	outline-offset: 1px;
}

.cn-row__detalle .cn-mf--full .cn-mf__tit {
	display: none;
}

.cn-row__detalle .cn-mf--full .cn-mf__vol {
	margin: 0;
	padding: 4px 10px;
}

.cn-row__detalle .cn-mf--full .cn-mf__head:empty {
	display: none;
}

.cn-row__detalle .cn-mf--full .cn-mf__desc {
	display: -webkit-box;
	margin: 0;
	padding: 0;
	overflow: hidden;
	border: 0;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3;
}

.cn-row__detalle .cn-mf--full .cn-mf__datos {
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 6px 24px;
}

.cn-row__detalle .cn-mf--full .cn-mf__datos dd {
	display: -webkit-box;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.cn-shop[data-vista="tabla"] .cn-row__detalle[data-cn-mf] {
	padding: 20px 26px 22px 62px;
}

.cn-row__detalle[aria-busy="true"] {
	opacity: .6;
}

@media (max-width: 760px) {
	.cn-row__detalle .cn-mf--full {
		grid-template-areas:
			"img"
			"head"
			"desc"
			"side";
		grid-template-columns: 1fr;
		grid-template-rows: none;
		min-height: 0;
	}

	.cn-row__detalle .cn-mf--full .cn-mf__img img.cn-mf__main {
		width: 160px;
		height: 160px;
	}

	.cn-row__detalle .cn-mf--full .cn-mf__datos {
		grid-template-columns: 1fr 1fr;
		gap: 6px 14px;
	}

	.cn-shop[data-vista="tabla"] .cn-row__detalle[data-cn-mf] {
		padding: 14px;
	}
}

/* La regla de miniatura de la tabla (36 px) no debe aplicarse a las imágenes de la mini ficha. */
.cn-shop[data-vista="tabla"] ul.products li.product .cn-mf__img > img {
	grid-column: auto;
	grid-row: auto;
	width: 130px;
	height: 130px;
	border-radius: 10px;
}

.cn-shop[data-vista="tabla"] ul.products li.product .cn-mf--full .cn-mf__img > img.cn-mf__main {
	width: 200px;
	height: 200px;
	object-fit: contain;
}

.cn-shop[data-vista="tabla"] ul.products li.product .cn-mf__thumb img {
	grid-column: auto;
	grid-row: auto;
	width: 100%;
	height: 100%;
	border-radius: 4px;
}

@media (max-width: 760px) {
	.cn-shop[data-vista="tabla"] ul.products li.product .cn-mf--full .cn-mf__img > img.cn-mf__main {
		width: 160px;
		height: 160px;
	}
}

/* Aro de intención de hover: junto al cursor, se rellena justo antes de que salga la mini ficha (mini-ficha.js). */
.cn-mfaro {
	position: fixed;
	z-index: 10001;
	width: 18px;
	height: 18px;
	opacity: 0;
	pointer-events: none;
	transition: opacity .12s ease;
}

.cn-mfaro.is-on {
	opacity: 1;
}

.cn-mfaro svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
	transform: rotate(-90deg);
}

.cn-mfaro circle {
	stroke-width: 3;
}

.cn-mfaro__bg {
	/* Fondo blanco: el aro se lee aunque caiga sobre el texto del producto. */
	fill: rgba(255, 255, 255, .92);
	stroke: rgba(13, 38, 71, .14);
}

.cn-mfaro__fg {
	fill: none;
	stroke: var(--cn-accent);
	stroke-linecap: round;
	stroke-dasharray: 50.27;
	stroke-dashoffset: 50.27;
}

.cn-mfaro.is-on .cn-mfaro__fg {
	animation: cn-mfaro-llenar var(--cn-mfaro-t, 280ms) linear forwards;
}

@keyframes cn-mfaro-llenar {
	to {
		stroke-dashoffset: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cn-mfaro {
		display: none;
	}
}

/* EVO016: aviso encima de la ficha (equivalencia / referencia no encontrada). */
.cn-mf-aviso {
	margin: 0 0 10px;
	padding: 8px 12px;
	border-left: 4px solid #d6246e;
	border-radius: 6px;
	background: #fde2ec;
	color: #8a1148;
	font-weight: 700;
}
