/**
 * Ficha individual del caballo — Total Child Theme
 *
 * Estilos de la "pantalla 3" de la referencia del cliente
 * (ver single-caballo.php). Seleccionadores prefijados con "caballo-single-"
 * para no colisionar con otros componentes del tema. Reutiliza la paleta
 * (verdes) del archivo a través de las variables --caballo-*.
 */

/* Variables propias de la ficha. Los nombres de la paleta coinciden con :root
   de caballo-card.css, pero se fijan por valor literal: una variable que se
   referencia a sí misma (var( --caballo-green, … ) dentro de --caballo-green)
   queda "at-risk" y no resuelve en algunos navegadores, lo que dejaba
   transparente el botón primario y sin borde las pestañas. Los campos
   title/meta/text siguen enlazados a :root (nombres distintos, sin ciclo). */
.caballo-single {
	--caballo-green: #1d4d2f;
	--caballo-green-hover: #143721;
	--caballo-gold: #b8894a;
	--caballo-border: #e6e8e4;
	--caballo-bg: #f5f6f3;
	--caballo-title: var( --caballo-title-color, #1c3a26 );
	--caballo-meta: var( --caballo-meta-color, #7a807a );
	--caballo-text: var( --caballo-text-color, #333a33 );
	--caballo-serif: Georgia, "Times New Roman", serif;
	--caballo-radius: 12px;
	--caballo-shadow: 0 6px 18px rgba( 20, 40, 20, 0.06 );
	--caballo-soft: #eef3ee; /* verde muy claro para tarjetas/estado */
}

/* ---------- Contenedor ---------- */

.caballo-single {
	background: #ffffff;
	padding: 36px 0 64px;
}

.caballo-single__inner {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 24px;
}

/* ---------- Breadcrumb ---------- */

.caballo-single__breadcrumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	font-size: 13px;
	line-height: 1;
	color: var( --caballo-meta );
	margin: 0 0 26px;
}

.caballo-single__breadcrumb a {
	color: var( --caballo-meta );
	text-decoration: none;
	transition: color .2s ease;
}

.caballo-single__breadcrumb a:hover {
	color: var( --caballo-green );
}

.caballo-single__breadcrumb-sep {
	margin: 0 10px;
	opacity: .55;
}

.caballo-single__breadcrumb-current {
	color: var( --caballo-green );
	font-weight: 600;
}

/* ---------- Fila superior: galería + información ---------- */

.caballo-single__top {
	display: grid;
	grid-template-columns: minmax( 0, 1.55fr ) minmax( 0, 1fr );
	gap: 40px;
	align-items: start;
}

/* ---------- Galería ---------- */

.caballo-single__gallery {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.caballo-single__viewer {
	position: relative;
	background: var( --caballo-soft );
	border-radius: var( --caballo-radius );
	overflow: hidden;
	box-shadow: var( --caballo-shadow );
}

.caballo-single__slide {
	position: relative;
	margin: 0;
	display: none;
	aspect-ratio: 4 / 3;
}

.caballo-single__slide.is-active {
	display: block;
}

.caballo-single__slide-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Botón de reproducción (miniatura de vídeo en el visor). */
.caballo-single__play,
.caballo-single__thumb-play,
.caballo-single__video-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate( -50%, -50% );
	display: inline-flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
}

.caballo-single__play {
	width: 64px;
	height: 64px;
	border-radius: 50%;
	background: rgba( 0, 0, 0, .45 );
	color: #fff;
}

.caballo-single__play svg {
	width: 28px;
	height: 28px;
	margin-left: 3px;
}

/* Navegación del visor. */
.caballo-single__nav {
	position: absolute;
	top: 50%;
	transform: translateY( -50% );
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border: none;
	border-radius: 50%;
	background: rgba( 255, 255, 255, .9 );
	color: var( --caballo-title );
	cursor: pointer;
	transition: background .2s ease, color .2s ease, opacity .2s ease;
}

.caballo-single__nav svg {
	width: 22px;
	height: 22px;
}

.caballo-single__nav--prev {
	left: 16px;
}

.caballo-single__nav--next {
	right: 16px;
}

.caballo-single__nav:hover {
	background: var( --caballo-green );
	color: #fff;
}

.caballo-single__counter {
	position: absolute;
	right: 14px;
	bottom: 14px;
	z-index: 2;
	background: rgba( 0, 0, 0, .55 );
	color: #fff;
	font-size: 12px;
	letter-spacing: .5px;
	padding: 4px 10px;
	border-radius: 999px;
}

/* Miniaturas. */
.caballo-single__thumbs {
	display: grid;
	grid-template-columns: repeat( 4, 1fr );
	gap: 12px;
}

.caballo-single__thumb {
	position: relative;
	display: block;
	padding: 0;
	border: 2px solid transparent;
	border-radius: 10px;
	overflow: hidden;
	background: var( --caballo-soft );
	cursor: pointer;
	aspect-ratio: 1 / 1;
	transition: border-color .2s ease, opacity .2s ease;
}

.caballo-single__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.caballo-single__thumb.is-active {
	border-color: var( --caballo-green );
}

.caballo-single__thumb-play {
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: rgba( 0, 0, 0, .5 );
	color: #fff;
}

.caballo-single__thumb-play svg {
	width: 16px;
	height: 16px;
	margin-left: 2px;
}

/* Estado vacío de la galería. */
.caballo-single__viewer--empty {
	aspect-ratio: 4 / 3;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	color: var( --caballo-meta );
}

.caballo-single__placeholder {
	width: 56px;
	height: 56px;
	opacity: .6;
}

.caballo-single__placeholder svg {
	width: 100%;
	height: 100%;
}

.caballo-single__placeholder-text {
	margin: 12px 0 0;
	font-size: 14px;
}

/* ---------- Información (columna derecha) ---------- */

.caballo-single__info {
	display: flex;
	flex-direction: column;
}

.caballo-single__title {
	font-family: var( --caballo-serif );
	font-size: 38px;
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -.3px;
	color: var( --caballo-title );
	margin: 0 0 16px;
}

.caballo-single__meta {
	font-size: 15px;
	line-height: 1.5;
	color: var( --caballo-meta );
	margin: 0 0 8px;
}

/* Características destacadas: icono + etiqueta, 3 en fila. */
.caballo-single__features {
	display: flex;
	gap: 20px;
	list-style: none;
	margin: 26px 0 0;
	padding: 0;
}

.caballo-single__feature {
	flex: 1 1 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 10px;
}

.caballo-single__feature-icon {
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: var( --caballo-green );
}

.caballo-single__feature-icon svg {
	width: 34px;
	height: 34px;
}

.caballo-single__feature-label {
	font-size: 13px;
	line-height: 1.3;
	color: var( --caballo-text );
	font-weight: 500;
}

/* ---------- Rango de precio (ficha) ---------- */

.caballo-single__price {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	margin: 20px 0 0;
	padding: 14px 18px;
	background: var( --caballo-soft );
	border: 1px solid var( --caballo-border );
	border-radius: var( --caballo-radius );
}

.caballo-single__price-label {
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .5px;
	text-transform: uppercase;
	color: var( --caballo-meta );
}

.caballo-single__price-value {
	font-family: var( --caballo-serif );
	font-size: 20px;
	font-weight: 700;
	color: var( --caballo-green );
	text-align: right;
}

/* Estado sin rango: "Consultar" en gris, no en verde. */
.caballo-single__price-value--empty {
	font-family: var( --caballo-text, inherit );
	font-size: 15px;
	font-weight: 600;
	font-style: italic;
	color: var( --caballo-meta );
}

/* Botones (solo visuales). */
.caballo-single__actions {
	display: flex;
	flex-direction: column;
	gap: 14px;
	margin-top: 32px;
}

.caballo-single__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	padding: 15px 22px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 1px;
	text-transform: uppercase;
	cursor: pointer;
	transition: background .2s ease, color .2s ease, border-color .2s ease;
	border: 1px solid transparent;
}

.caballo-single__btn svg {
	width: 18px;
	height: 18px;
}

.caballo-single__btn--primary {
	background: var( --caballo-green );
	color: #fff;
}

.caballo-single__btn--primary:hover,
.caballo-single__btn--primary:focus-visible {
	background: var( --caballo-green-hover );
	color: #fff;
}

.caballo-single__btn--ghost {
	background: #fff;
	color: var( --caballo-green );
	border-color: var( --caballo-green );
}

.caballo-single__btn--ghost:hover,
.caballo-single__btn--ghost:focus-visible {
	background: var( --caballo-soft );
}

.caballo-single__btn--ghost.is-active {
	background: var( --caballo-green );
	color: #fff;
}

/* ---------- Pestañas ---------- */

.caballo-single__tabs {
	margin-top: 40px;
}

.caballo-single__tabnav {
	display: flex;
	flex-wrap: wrap;
	gap: 32px 36px;
	border-bottom: 1px solid var( --caballo-border );
	margin-bottom: 28px;
}

.caballo-single__tab {
	appearance: none;
	background: none;
	border: none;
	padding: 0 0 16px;
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 1.2px;
	text-transform: uppercase;
	color: var( --caballo-meta );
	cursor: pointer;
	position: relative;
	transition: color .2s ease;
}

.caballo-single__tab:hover {
	color: var( --caballo-green );
}

.caballo-single__tab.is-active {
	color: var( --caballo-title );
	font-weight: 700;
}

.caballo-single__tab.is-active::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -1px;
	height: 3px;
	background: var( --caballo-green );
	border-radius: 3px 3px 0 0;
}

.caballo-single__tabpanel {
	display: none;
}

.caballo-single__tabpanel.is-active {
	display: block;
}

.caballo-single__section-title {
	font-family: var( --caballo-serif );
	font-size: 18px;
	font-weight: 700;
	color: var( --caballo-title );
	margin: 0 0 14px;
}

.caballo-single__empty {
	color: var( --caballo-meta );
	font-size: 14px;
	font-style: italic;
	margin: 0;
}

.caballo-single__empty-block {
	padding: 28px 24px;
	background: var( --caballo-bg );
	border-radius: var( --caballo-radius );
	color: var( --caballo-meta );
	text-align: center;
}

/* ---------- Pestaña Información: grid 3 columnas ---------- */

.caballo-single__info-grid {
	display: grid;
	grid-template-columns: 1fr 1.1fr 1.1fr;
	gap: 40px;
	align-items: start;
}

.caballo-single__description {
	font-size: 14.5px;
	line-height: 1.7;
	color: var( --caballo-text );
}

.caballo-single__description p {
	margin: 0 0 12px;
}

/* Tabla de datos (Etiqueta / Valor). */
.caballo-single__data {
	margin: 0;
}

.caballo-single__data-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	padding: 13px 0;
	border-bottom: 1px solid var( --caballo-border );
}

.caballo-single__data-row:last-child {
	border-bottom: none;
}

.caballo-single__data-label {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	color: var( --caballo-meta );
	margin: 0;
}

.caballo-single__data-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var( --caballo-gold );
	flex: none;
}

.caballo-single__data-value {
	font-size: 14px;
	font-weight: 600;
	color: var( --caballo-title );
	margin: 0;
	text-align: right;
}

/* Tarjeta "Información adicional". */
.caballo-single__extra-card {
	background: var( --caballo-soft );
	border-radius: var( --caballo-radius );
	padding: 22px 24px;
}

.caballo-single__extra-card .caballo-single__section-title {
	font-family: var( --caballo-serif );
	font-size: 16px;
}

.caballo-single__extra-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.caballo-single__extra-list li {
	position: relative;
	padding: 0 0 12px 20px;
	font-size: 14px;
	line-height: 1.5;
	color: var( --caballo-text );
}

.caballo-single__extra-list li:last-child {
	padding-bottom: 0;
}

.caballo-single__extra-list li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 7px;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var( --caballo-green );
}

/* ---------- Pestaña: Vídeos ---------- */

.caballo-single__video-grid {
	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	gap: 20px;
}

.caballo-single__video-card {
	margin: 0;
}

.caballo-single__video-thumb {
	position: relative;
	display: block;
	border-radius: var( --caballo-radius );
	overflow: hidden;
	aspect-ratio: 16 / 9;
	background: var( --caballo-soft );
}

/* T23d — La miniatura reutiliza la estructura visual de la GALERÍA SUPERIOR, que
   ya funciona: contenedor position:relative + aspect-ratio 16/9 + <img> en flujo
   (width/height 100%, object-fit:cover, display:block). Se elimina el
   position:absolute/inset:0 de T23c, un desvío no presente en la galería. El botón
   de reproducción sigue superpuesto (z-index:1). */
.caballo-single__video-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .3s ease;
}

/* T23d — Fallback «Vídeo no disponible» cuando la miniatura no puede cargarse
   (p. ej. ID de YouTube inexistente → HTTP 404): el onerror del <img> añade la
   clase al CONTENEDOR; se oculta el <img> roto y se muestra el texto. No se
   inventa ninguna miniatura ni se modifica el enlace ACF. */
.caballo-single__video-thumb--missing .caballo-single__video-img {
	display: none;
}

.caballo-single__video-thumb--missing::after {
	content: 'Vídeo no disponible';
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8px;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	color: var( --caballo-meta );
	text-align: center;
}

.caballo-single__video-thumb:hover img {
	transform: scale( 1.04 );
}

.caballo-single__video-play {
	width: 54px;
	height: 54px;
	border-radius: 50%;
	background: rgba( 0, 0, 0, .5 );
	color: #fff;
}

.caballo-single__video-play svg {
	width: 24px;
	height: 24px;
	margin-left: 3px;
}

.caballo-single__video-title {
	display: block;
	margin-top: 10px;
	font-size: 14px;
	font-weight: 600;
	color: var( --caballo-title );
}

/* ---------- Vídeos: estado no disponible y reproductor en modal ---------- */

.caballo-single__video-card.is-unavailable {
	opacity: .75;
}

.caballo-single__video-thumb--empty {
	display: flex;
	align-items: center;
	justify-content: center;
	background: repeating-linear-gradient( 45deg, var( --caballo-soft ) 0, var( --caballo-soft ) 12px, var( --caballo-border ) 12px, var( --caballo-border ) 24px );
	color: var( --caballo-meta );
}

.caballo-single__video-card.is-unavailable .caballo-single__video-play {
	background: rgba( 0, 0, 0, .35 );
	cursor: default;
}

.caballo-single__video-thumb:not( .caballo-single__video-thumb--empty ) .caballo-single__video-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate( -50%, -50% );
	display: inline-flex;
	align-items: center;
	justify-content: center;
	z-index: 1;
	border: 0;
	cursor: pointer;
	transition: background .2s ease;
}

.caballo-single__video-thumb:not( .caballo-single__video-thumb--empty ):hover .caballo-single__video-play {
	background: var( --caballo-green, #143721 );
}

.caballo-single__video-modal {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba( 0, 0, 0, .85 );
}

.caballo-single__video-modal.is-open {
	display: flex;
}

.caballo-single__video-modal__frame {
	position: relative;
	width: min( 90vw, 1100px );
	aspect-ratio: 16 / 9;
	background: #000;
	border-radius: var( --caballo-radius, 12px );
	overflow: hidden;
	box-shadow: 0 24px 60px rgba( 0, 0, 0, .5 );
}

.caballo-single__video-modal__frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

.caballo-single__video-modal__title {
	position: absolute;
	top: -46px;
	left: 0;
	right: 56px;
	margin: 0;
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.caballo-single__video-modal__close {
	position: absolute;
	top: -46px;
	right: 0;
	width: 40px;
	height: 40px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: #111;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	z-index: 2;
}

.caballo-single__video-modal__close:hover {
	background: var( --caballo-green, #143721 );
	color: #fff;
}

@media ( max-width: 560px ) {
	.caballo-single__video-modal {
		padding: 0;
	}
	.caballo-single__video-modal__frame {
		width: 100vw;
		height: 100vh;
		aspect-ratio: auto;
		border-radius: 0;
	}
	.caballo-single__video-modal__close {
		top: 12px;
		right: 12px;
		background: rgba( 0, 0, 0, .6 );
		color: #fff;
	}
	.caballo-single__video-modal__title {
		display: none;
	}
}

/* ---------- Pestaña: Documentación ---------- */

.caballo-single__docs {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat( 2, 1fr );
	gap: 12px;
}

.caballo-single__doc-link {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	border: 1px solid var( --caballo-border );
	border-radius: 10px;
	text-decoration: none;
	color: var( --caballo-text );
	transition: border-color .2s ease, background .2s ease;
}

.caballo-single__doc-link:hover {
	border-color: var( --caballo-green );
	background: var( --caballo-soft );
}

.caballo-single__doc-icon {
	width: 22px;
	height: 22px;
	color: var( --caballo-green );
	flex: none;
}

.caballo-single__doc-title {
	flex: 1 1 auto;
	font-size: 14px;
	font-weight: 600;
}

.caballo-single__doc-arrow {
	width: 16px;
	height: 16px;
	color: var( --caballo-meta );
	flex: none;
}

/* ---------- Responsive ---------- */

@media ( max-width: 992px ) {
	.caballo-single__top {
		grid-template-columns: 1fr;
		gap: 32px;
	}
	.caballo-single__info-grid {
		grid-template-columns: 1fr 1fr;
	}
	.caballo-single__col--extra {
		grid-column: 1 / -1;
	}
}

@media ( max-width: 768px ) {
	.caballo-single__title {
		font-size: 30px;
	}
	.caballo-single__tabnav {
		gap: 20px;
	}
	.caballo-single__info-grid {
		grid-template-columns: 1fr;
		gap: 28px;
	}
	.caballo-single__video-grid,
	.caballo-single__docs {
		grid-template-columns: 1fr;
	}
}

@media ( max-width: 560px ) {
	.caballo-single__thumbs {
		grid-template-columns: repeat( 3, 1fr );
	}
	.caballo-single__features {
		gap: 12px;
	}
	.caballo-single__feature-label {
		font-size: 12px;
	}
}