/* LM Custom — paleta oficial, botones estandarizados y animaciones de aparición */

:root {
	--lmco-rojo: #AD1531;
	--lmco-negro: #000000;
	--lmco-blanco: #FFFFFF;
	--lmco-pie: #1A1A1A; /* único negro alterno: fondo del pie de página */
	--lmco-curva: cubic-bezier(0.22, 1, 0.36, 1); /* la misma curva suave del carrusel */
}

body { color: var(--lmco-negro); }

/* Nada empuja la página de lado: sin scroll horizontal en móvil ni
   escritorio (clip, no hidden: conserva position sticky). */
html, body { overflow-x: clip; }

/* ---- Botón primario (la base es el botón del carrusel: relleno carmesí) ----
   Cubre botones de bloques, WooCommerce y formularios. Los .lmc-btn del
   carrusel se excluyen: ya traen este mismo estilo desde su propio CSS. */
.wp-block-button__link,
.wp-element-button:not(.lmc-btn):not(.xoo-el-action-sc),
.wc-block-components-button,
.woocommerce a.button:not(.lmc-btn):not(.xoo-el-action-sc),
.woocommerce button.button:not(.lmc-btn),
.woocommerce input.button,
.woocommerce #respond input#submit,
a.add_to_cart_button:not(.lmc-btn),
.single_add_to_cart_button,
a.checkout-button,
input[type="submit"],
button[type="submit"] {
	background: var(--lmco-rojo);
	color: var(--lmco-blanco) !important;
	border: 1.5px solid var(--lmco-rojo);
	border-radius: 9px;
	padding: 10px 18px;
	font-weight: 600;
	font-size: 0.9rem;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: transform 0.18s var(--lmco-curva), opacity 0.15s ease, background 0.2s ease, color 0.2s ease;
}
.wp-block-button__link:hover,
.wp-element-button:not(.lmc-btn):not(.xoo-el-action-sc):hover,
.wc-block-components-button:hover,
.woocommerce a.button:not(.lmc-btn):not(.xoo-el-action-sc):hover,
.woocommerce button.button:not(.lmc-btn):hover,
.woocommerce input.button:hover,
a.add_to_cart_button:not(.lmc-btn):hover,
.single_add_to_cart_button:hover,
a.checkout-button:hover,
input[type="submit"]:hover,
button[type="submit"]:hover {
	opacity: 0.88;
	transform: translateY(-1px);
}
.wp-block-button__link:active,
.wp-element-button:not(.lmc-btn):not(.xoo-el-action-sc):active,
.wc-block-components-button:active,
.woocommerce a.button:not(.lmc-btn):not(.xoo-el-action-sc):active,
.woocommerce button.button:not(.lmc-btn):active,
.woocommerce input.button:active,
a.add_to_cart_button:not(.lmc-btn):active,
.single_add_to_cart_button:active,
a.checkout-button:active,
input[type="submit"]:active,
button[type="submit"]:active {
	transform: scale(0.96);
}

/* ---- Botón secundario: borde carmesí, se rellena al pasar el mouse ----
   El estilo "Contorno" de los bloques y el enlace "Ver carrito" de Woo. */
.is-style-outline .wp-block-button__link,
.is-style-outline.wp-block-button__link,
a.added_to_cart {
	background: transparent;
	color: var(--lmco-rojo) !important;
	border: 1.5px solid var(--lmco-rojo);
	border-radius: 9px;
	padding: 10px 18px;
	font-weight: 600;
	text-decoration: none;
	transition: transform 0.18s var(--lmco-curva), background 0.2s ease, color 0.2s ease;
}
.is-style-outline .wp-block-button__link:hover,
.is-style-outline.wp-block-button__link:hover,
a.added_to_cart:hover {
	background: var(--lmco-rojo);
	color: var(--lmco-blanco) !important;
}

/* ---- Buscador (BuscadorPro): esquinas redondeadas estandarizadas ----
   Cubre las clases de la versión en producción (lm-scrollwrap/lm-search-
   container) y las del código nuevo (lm-dropdown). El modo móvil a pantalla
   completa conserva sus esquinas rectas (su regla gana por especificidad). */
.lm-dropdown,
.lm-scrollwrap {
	border-radius: 14px !important;
	overflow: hidden !important;
}
/* Envoltorio blanco SIN clase que dibuja el fondo del dropdown — está por
   ENCIMA del .lm-scrollwrap y sus esquinas cuadradas tapan el redondeo
   interno. :has() lo agarra sin tocar el código del buscador. */
.lm-search-container :has(> .lm-scrollwrap) {
	border-radius: 14px !important;
	overflow: hidden !important;
}
.lm-dropdown .lm-result-card img,
.lm-search-container .lm-card-image-img,
.lm-search-container img[class*="attachment-"] {
	border-radius: 9px !important;
}

/* ---- Overlay del buscador: oscurece el fondo cuando el dropdown se abre.
   El JS de lm-custom observa el contenedor de BuscadorPro y añade la clase
   `lmco-buscador-abierto` al <body>. No uso :has() porque el minificador
   de LiteSpeed lo elimina silenciosamente, dejando la regla sin efecto.
   El dropdown vive en z-index: 999999, así que el overlay se queda justo
   debajo (999990) para no taparlo. */
.lmco-overlay-buscador {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	z-index: 999990;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.32s var(--lmco-curva), backdrop-filter 0.32s var(--lmco-curva);
	backdrop-filter: blur(0);
	-webkit-backdrop-filter: blur(0);
}
body.lmco-buscador-abierto .lmco-overlay-buscador {
	opacity: 1;
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
}
@media (prefers-reduced-motion: reduce) {
	.lmco-overlay-buscador {
		transition: none;
		backdrop-filter: none;
		-webkit-backdrop-filter: none;
	}
}
.lm-dropdown .lm-btn-hover,
.lm-search-container .lm-btn-hover {
	border-radius: 9px !important;
}

/* ---- Títulos de producto en rejillas: 15px (pedido del usuario) ---- */
li.wc-block-product .wp-block-post-title,
.woocommerce ul.products li.product .woocommerce-loop-product__title {
	font-size: 15px !important;
}

/* ---- Respuesta al clic en "añadir al carrito" (AJAX de Woo) ----
   Woo pone .loading mientras procesa y .added al confirmar. */
.add_to_cart_button.loading {
	pointer-events: none;
	opacity: 0.85;
}
.add_to_cart_button.loading::after {
	content: "";
	display: inline-block;
	width: 12px;
	height: 12px;
	margin-left: 7px;
	vertical-align: -2px;
	border: 2px solid rgba(255, 255, 255, 0.35);
	border-top-color: var(--lmco-blanco);
	border-radius: 50%;
	animation: lmco-girar 0.6s linear infinite;
}
.add_to_cart_button.added::after {
	content: "✓";
	margin-left: 7px;
	font-weight: 700;
}
@keyframes lmco-girar {
	to { transform: rotate(360deg); }
}

/* ---- Aparición al hacer scroll: CSS PURO (animation-timeline: view()) ----
   Cero JS: cada elemento anima mientras entra en pantalla. Los navegadores
   sin soporte muestran todo estático (nada se oculta jamás).
   Tarjetas: suben. Títulos: entran por un lado, alternando. */
@supports (animation-timeline: view()) {
	@media (prefers-reduced-motion: no-preference) {
		ul.products > li.product:not(.lmc *),
		.wc-block-product-template > li.wc-block-product,
		.wp-block-post-template > li,
		.wp-block-media-text,
		.wp-block-pullquote,
		.wp-block-quote,
		[data-lmco] {
			animation: lmco-sube linear both;
			animation-timeline: view();
			animation-range: entry 5% entry 80%;
		}
		h1.wp-block-heading:nth-of-type(odd),
		h2.wp-block-heading:nth-of-type(odd),
		h1.wp-block-query-title {
			animation: lmco-lado-izq linear both;
			animation-timeline: view();
			animation-range: entry 5% entry 90%;
		}
		h1.wp-block-heading:nth-of-type(even),
		h2.wp-block-heading:nth-of-type(even) {
			animation: lmco-lado-der linear both;
			animation-timeline: view();
			animation-range: entry 5% entry 90%;
		}
		/* Separadores: la línea se traza de izquierda a derecha */
		main hr, hr.wp-block-separator {
			transform-origin: left center;
			animation: lmco-traza linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 100%;
		}
		/* Cortina: la imagen del blog se descubre de abajo hacia arriba */
		.wp-block-post-template > li img {
			animation: lmco-cortina linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 90%;
		}
	}
}
@keyframes lmco-sube {
	from { opacity: 0; transform: translateY(18px); }
	to { opacity: 1; transform: none; }
}
@keyframes lmco-lado-izq {
	from { opacity: 0; transform: translateX(-38px); }
	to { opacity: 1; transform: none; }
}
@keyframes lmco-lado-der {
	from { opacity: 0; transform: translateX(38px); }
	to { opacity: 1; transform: none; }
}
@keyframes lmco-traza {
	from { transform: scaleX(0); }
	to { transform: scaleX(1); }
}

/* ============================================================
   v1.1.0 — animaciones avanzadas (CSS puro, sin dependencias)
   ============================================================ */

/* 5. Fundido entre páginas: el navegador cruza las páginas con un fade
   suave al navegar. Quien no lo soporta navega normal. */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation-duration: 0.28s; }
::view-transition-new(root) { animation-duration: 0.28s; }

/* 1. Marquesinas ligadas al scroll. En Gutenberg, añade a un párrafo o
   título la clase adicional lmco-marquesina-1 (viaja a la izquierda) o
   lmco-marquesina-2 (a la derecha). */
.lmco-marquesina-1, .lmco-marquesina-2 {
	white-space: nowrap;
	width: max-content;
	will-change: transform;
}
:where(*:has(> .lmco-marquesina-1), *:has(> .lmco-marquesina-2)) { overflow-x: clip; }
@supports (animation-timeline: view()) {
	.lmco-marquesina-1 { animation: lmco-mq-izq linear both; animation-timeline: view(); }
	.lmco-marquesina-2 { animation: lmco-mq-der linear both; animation-timeline: view(); }
}
@keyframes lmco-mq-izq { from { transform: translateX(4%); } to { transform: translateX(-22%); } }
@keyframes lmco-mq-der { from { transform: translateX(-22%); } to { transform: translateX(4%); } }

/* 2. Parallax suave en las tarjetas del blog: el contenido interno se
   desliza a ritmos distintos por columna; el <li> conserva su aparición. */
@supports (animation-timeline: view()) {
	.wp-block-post-template > li:nth-child(3n+1) > * { animation: lmco-par-a linear both; animation-timeline: view(); }
	.wp-block-post-template > li:nth-child(3n+2) > * { animation: lmco-par-b linear both; animation-timeline: view(); }
}
@keyframes lmco-par-a { from { transform: translateY(16px); } to { transform: translateY(-16px); } }
@keyframes lmco-par-b { from { transform: translateY(30px); } to { transform: translateY(-30px); } }

/* 3. Palabra acento: pon UNA palabra en cursiva dentro de un título y se
   vuelve serif carmesí. */
h1.wp-block-heading em, h2.wp-block-heading em, main h1 em, main h2 em, .lmco-acento {
	font-family: Georgia, 'Times New Roman', serif;
	font-style: italic;
	color: var(--lmco-rojo);
}

/* 6. Zoom sutil de portada al pasar el mouse (rejillas de producto) */
li.wc-block-product img,
.woocommerce ul.products li.product img {
	transition: transform 0.35s var(--lmco-curva);
}
li.wc-block-product :where(figure, .wc-block-components-product-image):has(> img, > a > img),
.woocommerce ul.products li.product a:has(> img) {
	overflow: hidden;
	display: block;
}
li.wc-block-product:hover img,
.woocommerce ul.products li.product:hover img {
	transform: scale(1.04);
}

/* 7. Subrayado que se dibuja en los enlaces del menú */
.wp-block-navigation a {
	background-image: linear-gradient(currentColor, currentColor);
	background-size: 0% 1.5px;
	background-repeat: no-repeat;
	background-position: 0 100%;
	transition: background-size 0.25s var(--lmco-curva);
	text-decoration: none;
}
.wp-block-navigation a:hover { background-size: 100% 1.5px; }

/* 8. Barra de progreso de lectura (el PHP la imprime en entradas del blog;
   la animación es 100% CSS ligada al scroll de la página) */
.lmco-progreso {
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 3px;
	background: var(--lmco-rojo);
	transform-origin: 0 50%;
	transform: scaleX(0);
	z-index: 99999;
	pointer-events: none;
}
@supports (animation-timeline: scroll()) {
	.lmco-progreso { animation: lmco-prog linear both; animation-timeline: scroll(root); }
}
@keyframes lmco-prog { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* 10. Pulso del carrito flotante al añadir un libro (clase puesta por el
   JS del carrito; la animación es CSS) */
.lmco-pulso { animation: lmco-pulso 0.55s var(--lmco-curva); }
@keyframes lmco-pulso {
	0% { transform: scale(1); }
	40% { transform: scale(1.18); }
	100% { transform: scale(1); }
}

/* 11. Cortina (keyframes; las reglas viven arriba con view()) */
@keyframes lmco-cortina {
	from { clip-path: inset(100% 0 0 0); }
	to { clip-path: inset(0 0 0 0); }
}

@media (prefers-reduced-motion: reduce) {
	.add_to_cart_button.loading::after { animation: none; }
	::view-transition-old(root), ::view-transition-new(root) { animation: none; }
	.lmco-marquesina-1, .lmco-marquesina-2,
	.wp-block-post-template > li > *,
	.lmco-progreso, .lmco-pulso { animation: none !important; }
	li.wc-block-product:hover img, .woocommerce ul.products li.product:hover img { transform: none; }
}

/* ── "Ver carrito" del aviso de añadido: outline carmesí LEGIBLE.
      Selector de alta especificidad (5 clases) para ganarle al CSS de WooCommerce Blocks
      que dejaba el texto en blanco (invisible) sobre el banner verde. ── */
.wc-block-components-notice-banner.is-success a.button.wc-forward.wp-element-button,
.wc-block-components-notice-banner a.wc-forward.button,
.woocommerce-message a.wc-forward {
	color: var(--lmco-rojo) !important;
	background: #fff !important;
	border: 1.5px solid var(--lmco-rojo) !important;
	border-radius: 9px !important;
	padding: 7px 16px !important;
	font-weight: 700 !important;
	text-decoration: none !important;
	white-space: nowrap !important;
	line-height: 1.2 !important;
	box-shadow: none !important;
}
.wc-block-components-notice-banner.is-success a.button.wc-forward.wp-element-button:hover,
.woocommerce-message a.wc-forward:hover {
	background: var(--lmco-rojo) !important;
	color: #fff !important;
}
