/* =========================================================================
   Interaccion: foco de teclado y microinteracciones (desde la 2.56.0).
   ========================================================================= */

:root {
	--lmt-foco: #047857;
	--lmt-halo: rgba(5, 150, 105, .22);
}

html[data-lomito-theme="dark"] {
	--lmt-foco: #6ee7b7;
	--lmt-halo: rgba(110, 231, 183, .25);
}

/* Paneles oscuros en las dos modalidades (Test y vitrina): anillo menta. */
.lmt-test,
.lmt-vit {
	--lmt-foco: #6ee7b7;
	--lmt-halo: rgba(110, 231, 183, .25);
}

/* 1. Anillo de foco unico, solo al navegar con teclado. */
html body :is(a, button, summary, [tabindex]:not([tabindex="-1"]), input[type="range"], input[type="checkbox"], input[type="radio"]):focus-visible {
	outline: 3px solid var(--lmt-foco) !important;
	outline-offset: 2px !important;
}

/* Casillas y opciones ocultas a la vista: el anillo va en su etiqueta (lo pone interaccion.js). */
html body .lmt-foco-anillo {
	outline: 3px solid var(--lmt-foco) !important;
	outline-offset: 2px !important;
}

/* La tarjeta de calculadora ya no se marca entera: el anillo va en su enlace. */
html body .lmt-calc-card:focus-within {
	outline: none;
}

html body .lmt-calc-card__t a:focus-visible {
	outline: 3px solid var(--lmt-foco) !important;
}

/* 2. Campos que se iluminan. interaccion.js marca el campo, o la caja que lo
   rodea cuando el campo no tiene borde propio. */
html body .lmt-campo-activo {
	border-color: var(--lmt-foco) !important;
	box-shadow: 0 0 0 4px var(--lmt-halo) !important;
	outline: none !important;
}

html body :is(input, select, textarea).lmt-campo-dentro:focus {
	outline: none !important;
}

/* 3. Movimiento: solo si la persona no pidio reducirlo. */
@media (prefers-reduced-motion: no-preference) {

	/* Botones que se hunden. «scale» es independiente de «transform»: no
	   choca con botones que ya usan transform para moverse o centrarse. */
	html body :is(.lmt-btn, .lmt-barra-cta, .lmt-ruta__cta, .lmt-vit__cta, .lmt-tr__opt, .lmt-tr__cta, .lmt-tr__llevar, .lmt-tr__atras, .lmt-post__leer, .lmt-tool__go, .lmt-tool__clip, .lmt-tool__cancel, .lmt-calcfiltro__btn, .lmt-poll__option, .lmt-share__btn, .lmt-bus-btn, .lmt-theme-toggle, .lmt-rutas__tema, .lmt-bus__chip, .lmt-pub__chip, .lmt-calc-indice__a, .lmt-ruta-fin__hecho, .lmt-af-clip, .lmt-cd-clip, .lmt-az-clip, .lmt-cv-clip, .wp-element-button, .entry-content button:not(.lmt-vit__tab)):active {
		scale: .97;
	}

	/* Campos: el halo aparece suave. */
	html body .lmt-campo-activo {
		transition: border-color .15s ease, box-shadow .15s ease;
	}

	/* Confirmaciones. */
	.lmt-confirma,
	.lmt-ruta-fin__hecho[aria-pressed="true"]::before,
	.lmt-copiado {
		animation: lmt-aparece .22s ease-out both;
	}
}

/* Tarjetas que se elevan: solo con mouse, siempre igual en todo el sitio. */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
	html body :is(.lmt-post, .lmt-ruta, .lmt-calc-card, .lmt-tool, .lmt-fcard) {
		transition: translate .18s ease, transform .25s ease, box-shadow .18s ease, border-color .18s ease;
	}

	html body :is(.lmt-post, .lmt-ruta, .lmt-calc-card, .lmt-tool, .lmt-fcard):hover {
		transform: none;
		translate: 0 -2px;
		box-shadow: var(--lmt-shadow-lg);
		border-color: var(--lmt-accent);
	}
}

/* La tarjeta ya no salta al recibir foco: basta el anillo. */
html body .lmt-calc-card:focus-within:not(:hover) {
	transform: none;
}

@keyframes lmt-aparece {
	from { opacity: 0; scale: .9; }
	to   { opacity: 1; scale: 1; }
}

/* 4. Confirmaciones visibles. */
.lmt-confirma {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 12px 0 0;
	padding: 6px 12px;
	border-radius: 999px;
	background: var(--lmt-halo);
	color: #065f46;
	font-size: .85rem;
	font-weight: 700;
}

html[data-lomito-theme="dark"] .lmt-confirma {
	color: #6ee7b7;
}

.lmt-confirma::before {
	content: "✓";
	font-weight: 800;
}

.lmt-ruta-fin__hecho[aria-pressed="true"]::before {
	content: "✓";
	display: inline-block;
	margin-right: 6px;
	font-weight: 800;
}

/* Boton «Copiar enlace» de compartir y su aviso. */
.lmt-share {
	position: relative;
}

.lmt-share__copiar {
	cursor: pointer;
	font: inherit;
}

.lmt-copiado {
	position: absolute;
	z-index: 5;
	padding: 6px 10px;
	border-radius: 8px;
	background: var(--lmt-text);
	color: var(--lmt-bg);
	font-size: .8rem;
	font-weight: 700;
	white-space: nowrap;
	pointer-events: none;
}
