/* ==========================================================================
   Lotería Manises Blog — SISTEMA (tokens + componentes compartidos)
   Front y editor (enqueue_block_assets → 'lmb-theme').

   Orden de las hojas (cada una tiene un ámbito; ninguna redefine lo de otra):
     style.css ....... base mínima (incrustada)
     theme.css ....... tokens, accesibilidad y componentes: rótulo, chip, tarjeta,
                       panel, botones, buscador, cabecera de sección  ← ESTE
     parts.css ....... cabecera, barra de juegos y pie (marco común a todas las páginas)
     templates.css ... maquetación de cada plantilla (portada, entrada, archivo, búsqueda, 404)
     legacy.css ...... prosa del artículo (bloques y 217 entradas en HTML clásico) — solo singular
     editorial.css ... firmas de marca: troquel, bolas, numerales, décimo, tarjetas de juego,
                       cabecera de categoría con foto, interludio
     pwa.css ......... modo app en móvil (barra inferior, hojas, safe-area)

   Tokens de color/tamaño de WordPress en theme.json (--wp--preset--*, --wp--custom--*);
   aquí los alias cortos --lmb-* que usa todo el tema. Ver docs/COHERENCIA.md.
   ========================================================================== */

:root {
	/* Color (app: azul, azul noche y oro de acento). */
	--lmb-blue: #0a4792;
	--lmb-blue-mid: #083d7d;
	--lmb-blue-soft: #0d56b0;
	--lmb-blue-deep: #0a2142;
	--lmb-blue-night: #06142a;
	--lmb-gold: #f5c518;
	--lmb-gold-dark: #d4a017;
	--lmb-coral: #c0392b; /* único rojo de texto: «Lo último» (5,4:1 sobre blanco) */
	--lmb-ink: #1e293b;
	--lmb-muted: #56657a; /* 5,9:1 sobre blanco, 5,6:1 sobre el fondo */
	--lmb-paper: var(--wp--preset--color--background, #f6f8fb);
	--lmb-gold-rule: 1px solid rgb(245 197 24 / .8);

	/* Hilos: uno fino para separar, uno fuerte para contornos de control. */
	--lmb-hair: rgb(10 71 146 / .08);
	--lmb-hair-strong: rgb(10 71 146 / .14);
	--lmb-hair-hover: rgb(10 71 146 / .2);
	--lmb-rule-game: 2px;

	/* Radios: 4 escalones. */
	--lmb-radius-sm: 8px;    /* campos pequeños, iconos */
	--lmb-radius-md: 12px;   /* imágenes dentro de la prosa */
	--lmb-radius-xl: 20px;   /* tarjetas, paneles, CTA, tarjetas de juego, portada del artículo */
	--lmb-radius-xxl: 24px;  /* cabeceras grandes (categoría, 404), hojas */
	--lmb-radius-pill: 9999px; /* botones, buscador, bolas */
	--lmb-radius-xs: 6px;
	--lmb-radius-lg: 16px;

	/* Sombras: dos niveles + hover. */
	--lmb-shadow-soft: 0 1px 2px rgb(6 20 42 / .04), 0 2px 6px rgb(10 71 146 / .06);
	--lmb-shadow-premium: 0 1px 2px rgb(6 20 42 / .04), 0 8px 24px -6px rgb(10 71 146 / .12), 0 24px 48px -24px rgb(10 71 146 / .16);
	--lmb-shadow-premium-hover: 0 2px 4px rgb(6 20 42 / .05), 0 14px 30px -10px rgb(10 71 146 / .2), 0 30px 60px -30px rgb(10 71 146 / .24);

	/* Rótulo (kicker, chip, títulos del pie, enlaces legales, etiquetas): uno solo. */
	--lmb-label-size: .75rem;
	--lmb-label-weight: 800;
	--lmb-label-track: .14em;

	/* Ritmo vertical y márgenes laterales comunes a cabecera, cuerpo y pie. */
	--lmb-gutter: var(--wp--style--root--padding-left, var(--wp--preset--spacing--40, 1rem));
	--lmb-wide: 1240px;
	--lmb-section-gap: var(--wp--preset--spacing--70, clamp(2rem, 1.25rem + 3vw, 4rem));

	/* Movimiento: una curva de salida y tres duraciones. */
	--lmb-ease-out: cubic-bezier(.23, 1, .32, 1);
	--lmb-dur-fast: 150ms;
	--lmb-dur: 200ms;
	--lmb-dur-media: 300ms;

	--lmb-focus: var(--lmb-blue);
	--lmb-focus-ring: 0 0 0 2px #fff, 0 0 0 4px var(--lmb-focus);

	/* Juego por defecto (lo sobrescriben .lmb-chip--{key} / .lmb-game-{key}, generados en PHP). */
	--lmb-game-color: var(--lmb-blue);
	--lmb-game-bg: #e4e9f1;
	--lmb-game-accent: var(--lmb-blue);
	--lmb-game-icon: var(--lmb-icon-generic);

	/* Icono genérico sobrio (secciones editoriales sin símbolo de juego): hoja de periódico. */
	--lmb-icon-generic: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 4h11a2 2 0 0 1 2 2v13a1 1 0 0 0 2 0V8'/%3E%3Cpath d='M5 4v15a1 1 0 0 0 1 1h13'/%3E%3Cpath d='M8 8h6M8 11.5h6M8 15h4'/%3E%3C/svg%3E");

	/* Superficie alternativa: la única para bandas secundarias (relacionadas, interludio). */
	--lmb-surface-alt: var(--wp--preset--color--surface-2, #eceef2);
}

/* ---------- Fuente: respaldo con métricas de Geist (menos CLS) ---------- */
@font-face {
	font-family: "Geist Fallback";
	src: local("Arial"), local("ArialMT"), local("Helvetica");
	size-adjust: 101.5%;
	ascent-override: 99%;
	descent-override: 29%;
	line-gap-override: 0%;
}

body {
	font-kerning: normal;
	font-variant-ligatures: common-ligatures;
	text-rendering: auto;
}

img {
	color: transparent; /* sin texto alternativo pintado mientras carga */
}

/* ==========================================================================
   Accesibilidad
   ========================================================================== */

.skip-link {
	position: absolute;
	inset-inline-start: 1rem;
	top: -100px;
	z-index: 100000;
	padding: .75rem 1.125rem;
	border-radius: var(--lmb-radius-pill);
	background: var(--lmb-gold);
	color: var(--lmb-blue);
	font-weight: 800;
	text-decoration: none;
}

.skip-link:focus,
body .skip-link.screen-reader-text:focus {
	top: 1rem;
	left: 1rem;
	padding: .75rem 1.125rem;
	background: var(--lmb-gold);
	color: var(--lmb-blue);
	font-weight: 800;
	clip: auto;
	clip-path: none;
	width: auto;
	height: auto;
}

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--lmb-focus);
	outline-offset: 2px;
	border-radius: 4px;
}

/* Sobre fondos oscuros el foco pasa a oro. */
:where(.lmb-header, .lmb-pie, .lmb-404__hero, .lmb-cat-hero, .lmb-tabbar, .has-navy-background-color, .has-navy-deep-background-color, .has-manises-blue-background-color, .is-style-card-navy) :where(a, button, input, [tabindex]):focus-visible {
	outline-color: var(--lmb-gold);
}

.screen-reader-text {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

/* ==========================================================================
   Componente: RÓTULO (kicker). Un único estilo para todo el tema:
   Geist 800 · 12px · mayúsculas · tracking .14em. Variante --line con filete oro.
   ========================================================================== */

.lmb-kicker,
.is-style-kicker {
	display: inline-flex;
	align-items: center;
	gap: .625rem;
	margin: 0;
	font-family: var(--wp--preset--font-family--geist);
	font-size: var(--lmb-label-size) !important; /* vence a has-*-font-size heredados */
	font-weight: var(--lmb-label-weight);
	letter-spacing: var(--lmb-label-track);
	line-height: 1.3;
	text-transform: uppercase;
}

.lmb-kicker--line::before {
	content: "";
	flex: none;
	inline-size: 1.5rem;
	border-block-start: var(--lmb-gold-rule);
}

/* ==========================================================================
   Componente: CHIP de categoría. Un único estilo en todo el sitio:
   punto del color del juego + rótulo. Sin cápsulas ni iconos.
   ========================================================================== */

.wp-block-post-terms.is-style-chips {
	display: flex;
	flex-wrap: wrap;
	gap: .25rem 1rem;
}

.wp-block-post-terms.is-style-chips .wp-block-post-terms__separator {
	display: none;
}

.lmb-chip,
.lmb-badge-breaking {
	display: inline-flex;
	align-items: center;
	gap: .5rem;
	min-block-size: 24px; /* objetivo táctil mínimo */
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	color: var(--lmb-blue-deep); /* 16:1 sobre blanco: el color va solo en el punto */
	font-family: var(--wp--preset--font-family--geist);
	font-size: var(--lmb-label-size);
	font-weight: var(--lmb-label-weight);
	letter-spacing: var(--lmb-label-track);
	line-height: 1.2;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
	hyphens: manual;
}

.lmb-chip::before,
.lmb-badge-breaking::before {
	content: "";
	flex: none;
	inline-size: 7px;
	block-size: 7px;
	border-radius: 50%;
	background: var(--lmb-game-accent);
}

a.lmb-chip:hover {
	color: var(--lmb-blue);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: .3em;
}

/* Categoría sin juego mapeado: punto azul. */
.lmb-chip--default {
	--lmb-game-accent: var(--lmb-blue);
}

/* «Lo último» / «Última hora»: mismo rótulo, en coral (estado, no categoría). */
.lmb-badge-breaking {
	color: var(--lmb-coral);
}

.lmb-badge-breaking::before {
	background: #f25549;
}

@media (prefers-reduced-motion: no-preference) {
	.lmb-badge-breaking::before {
		animation: lmb-pulse 1.6s var(--lmb-ease-out) 3;
	}
}

@keyframes lmb-pulse {
	0%, 100% { opacity: 1; }
	50% { opacity: .35; }
}

/* Hilo de color del juego (tarjetas sin imagen). */
.lmb-game-bar {
	block-size: var(--lmb-rule-game);
	border-radius: 2px;
	background: var(--lmb-game-accent);
}

/* ==========================================================================
   Componente: TARJETA de entrada. La misma en portada, categoría, archivo,
   búsqueda, 404 y relacionadas: foto 16:9 · chip · título · extracto · fecha.
   ========================================================================== */

.lmb-card {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
	block-size: 100%;
	border: 1px solid var(--lmb-hair);
	border-radius: var(--lmb-radius-xl);
	background: #fff;
	box-shadow: var(--lmb-shadow-premium);
	transition: transform var(--lmb-dur-media) var(--lmb-ease-out), box-shadow var(--lmb-dur-media) var(--lmb-ease-out), border-color var(--lmb-dur-media) var(--lmb-ease-out);
}

.lmb-card .wp-block-post-featured-image {
	margin: 0;
	overflow: hidden;
	aspect-ratio: 16 / 9;
	border-radius: 0;
	background: #e4e9f1; /* mientras carga la imagen */
}

.lmb-card .wp-block-post-featured-image img {
	aspect-ratio: 16 / 9;
	object-fit: cover;
	object-position: 50% 30%; /* carteles: se ve la parte alta, donde va el titular */
	border-radius: 0;
	transition: transform var(--lmb-dur-media) var(--lmb-ease-out);
}

.lmb-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: .75rem;
	padding: 1.25rem 1.5rem 1.375rem !important; /* el bloque trae padding en línea */
}

.lmb-card__body > * {
	margin-block: 0;
}

.lmb-card .wp-block-post-title {
	margin: 0;
	font-size: 1.1875rem !important; /* vence a has-large-font-size */
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: -.012em;
	text-wrap: balance;
	hyphens: manual;
}

.lmb-card .wp-block-post-title a {
	color: var(--lmb-blue);
	text-decoration: underline;
	text-decoration-color: transparent;
	text-decoration-thickness: 1px;
	text-underline-offset: .2em;
	transition: text-decoration-color var(--lmb-dur) var(--lmb-ease-out);
}

.lmb-card .wp-block-post-excerpt {
	margin: 0;
}

.lmb-card .wp-block-post-excerpt__excerpt {
	display: -webkit-box;
	margin: 0;
	overflow: hidden;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 3; /* el texto ya viene recortado por palabras (excerptLength) */
	color: var(--lmb-muted);
	font-size: .875rem;
	line-height: 1.55;
	text-wrap: pretty;
}

/* Fecha al pie, separada por un hilo. */
.lmb-card .wp-block-post-date {
	margin-block-start: auto;
	padding-block-start: .875rem;
	border-block-start: 1px solid var(--lmb-hair);
	color: var(--lmb-muted);
	font-size: .8125rem;
	font-variant-numeric: tabular-nums;
}

/* Anatomía fija: como máximo un chip y su fila siempre reservada (alinean títulos y extractos). */
.lmb-card .wp-block-post-terms {
	min-block-size: 24px;
}

.lmb-card .wp-block-post-terms .lmb-chip ~ .lmb-chip {
	display: none;
}

/* Sin imagen destacada: reserva 16:9 con el degradado del juego y su símbolo en blanco. */
.lmb-card:not(:has(.wp-block-post-featured-image))::before {
	content: "";
	display: block;
	aspect-ratio: 16 / 9;
	background:
		radial-gradient(60% 90% at 100% 0%, rgb(255 255 255 / .12), rgb(255 255 255 / 0) 60%),
		linear-gradient(135deg, var(--lmb-game-accent) 0%, var(--lmb-blue-deep) 100%);
}

.lmb-card:not(:has(.wp-block-post-featured-image))::after {
	content: "";
	position: absolute;
	inset: 0 0 auto;
	aspect-ratio: 16 / 9;
	background-color: #fff;
	opacity: .9;
	-webkit-mask: var(--lmb-game-icon) center / 3.5rem no-repeat;
	mask: var(--lmb-game-icon) center / 3.5rem no-repeat;
	pointer-events: none;
}

/* Toda la tarjeta clicable vía el enlace del título; el chip queda por encima. */
.lmb-card--link .wp-block-post-title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.lmb-card--link :where(.wp-block-post-terms a, .lmb-chip) {
	position: relative;
	z-index: 2;
}

/* Foco con teclado: el anillo rodea la tarjeta entera. */
.lmb-card--link:has(.wp-block-post-title a:focus-visible) {
	outline: 2px solid var(--lmb-focus);
	outline-offset: 3px;
}

.lmb-card--link .wp-block-post-title a:focus-visible {
	outline: none;
}

@media (hover: hover) and (pointer: fine) {
	.lmb-card:hover {
		border-color: var(--lmb-hair-hover);
		box-shadow: var(--lmb-shadow-premium-hover);
	}

	.lmb-card:hover .wp-block-post-title a {
		text-decoration-color: rgb(10 71 146 / .35);
	}
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
	.lmb-card:hover {
		transform: translateY(-2px);
	}

	.lmb-card:hover .wp-block-post-featured-image img {
		transform: scale(1.02);
	}
}

/* ==========================================================================
   Componente: PANEL (grupo «Tarjeta», Próximos sorteos, anterior/siguiente).
   Mismo contorno, radio y sombra que la tarjeta.
   ========================================================================== */

.wp-block-group.is-style-card {
	border: 1px solid var(--lmb-hair) !important;
	border-radius: var(--lmb-radius-xl) !important;
	background: #fff;
	box-shadow: var(--lmb-shadow-premium) !important;
}

/* ==========================================================================
   Componente: CABECERA DE SECCIÓN (h2 de bloque: Últimas entradas, Relacionadas…)
   ========================================================================== */

.lmb-section-title,
.lmb-section > .lmb-section__head h2,
.lmb-related > .alignwide h2,
.lmb-404 .lmb-section-title {
	margin: 0;
	font-size: clamp(1.75rem, 1.35rem + 1.3vw, 2.25rem) !important;
	font-weight: 800;
	letter-spacing: -.022em;
	line-height: 1.1;
	text-wrap: balance;
}

/* ==========================================================================
   Componente: BOTONES. Todos en píldora (como la app): primario azul, oro para «Jugar».
   ========================================================================== */

.wp-block-button__link,
.wp-element-button {
	border-radius: var(--lmb-radius-pill);
	transition: background-color var(--lmb-dur-fast) var(--lmb-ease-out), color var(--lmb-dur-fast) var(--lmb-ease-out), box-shadow var(--lmb-dur-fast) var(--lmb-ease-out), transform var(--lmb-dur-fast) var(--lmb-ease-out);
}

:where(.wp-block-button__link, .wp-element-button):focus-visible {
	outline: 2px solid var(--lmb-focus) !important;
	outline-offset: 3px;
}

.wp-block-button:not(.is-style-gold) .wp-block-button__link:active {
	transform: translateY(1px);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
	border-color: var(--lmb-blue);
	background-color: var(--lmb-blue);
	color: #fff;
}

.wp-block-button.is-style-coral .wp-block-button__link:hover {
	background-color: #a93226;
	color: #fff;
}

/* Oro («Jugar ahora»): degradado y sombra de la variación de theme.json + brillo y pulsación. */
.wp-block-button.is-style-gold .wp-block-button__link {
	border: 1px solid rgb(212 160 23 / .6);
	background-image: linear-gradient(180deg, #f7cf34 0%, #f5c518 100%);
	box-shadow: inset 0 1px 0 rgb(255 255 255 / .45), 0 4px 12px -6px rgb(212 160 23 / .6);
	color: var(--lmb-blue); /* 5,5:1 */
	font-weight: 800;
	letter-spacing: -.005em;
	transition: transform 160ms var(--lmb-ease-out), box-shadow var(--lmb-dur) var(--lmb-ease-out);
}

.wp-block-button.is-style-gold .wp-block-button__link:hover,
.wp-block-button.is-style-gold .wp-block-button__link:focus-visible {
	background-image: linear-gradient(180deg, #f9d84f 0%, #f6ca2c 100%);
	box-shadow: inset 0 1px 0 rgb(255 255 255 / .5), 0 8px 18px -8px rgb(212 160 23 / .7);
	color: var(--lmb-blue);
}

@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
	.wp-block-button.is-style-gold .wp-block-button__link:hover {
		transform: translateY(-1px);
	}
}

@media (prefers-reduced-motion: no-preference) {
	.wp-block-button.is-style-gold .wp-block-button__link:active {
		transform: scale(.97);
		transition-duration: 80ms;
	}
}

/* ==========================================================================
   Componente: BUSCADOR (página de búsqueda y 404). Píldora con botón píldora.
   ========================================================================== */

.lmb-search .wp-block-search__inside-wrapper {
	max-inline-size: 560px;
	min-block-size: 56px;
	padding: .3125rem;
	/* #7C8BA1: 3,46:1 sobre blanco (límite de control, 1.4.11). */
	border: 1px solid #7c8ba1;
	border-radius: var(--lmb-radius-pill);
	background: #fff;
	box-shadow: var(--lmb-shadow-soft);
	transition: border-color var(--lmb-dur-fast) var(--lmb-ease-out);
}

.lmb-search .wp-block-search__input {
	min-inline-size: 0;
	min-block-size: 2.75rem;
	padding-inline: 1rem;
	border: 0;
	background: transparent;
	color: var(--lmb-ink);
	font-size: 1rem; /* evita el zoom de iOS */
	text-overflow: ellipsis;
}

.lmb-search .wp-block-search__input:focus-visible {
	outline: none;
}

.lmb-search .wp-block-search__inside-wrapper:focus-within {
	border-color: var(--lmb-blue);
	outline: 2px solid var(--lmb-blue);
	outline-offset: 2px;
}

.lmb-search .wp-block-search__button {
	margin: 0;
	padding-inline: 1.5rem;
	border: 0;
	border-radius: var(--lmb-radius-pill);
	background: var(--lmb-blue);
	color: #fff;
	font-weight: 700;
}

.lmb-search .wp-block-search__button:hover {
	background: var(--lmb-blue-mid);
}

/* Móvil estrecho: el botón queda solo con la lupa y el texto de ejemplo cabe entero. */
@media (max-width: 479px) {
	.lmb-search .wp-block-search__button {
		position: relative;
		inline-size: 2.75rem;
		min-inline-size: 2.75rem;
		padding: 0;
		overflow: hidden;
		color: transparent;
	}

	.lmb-search .wp-block-search__button::before {
		content: "";
		position: absolute;
		inset: 0;
		background-color: #fff;
		-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E") center / 1.25rem no-repeat;
		mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='m16 16 4 4'/%3E%3C/svg%3E") center / 1.25rem no-repeat;
	}
}

/* ==========================================================================
   Utilidades
   ========================================================================== */

.lmb-tabular,
.wp-block-query-pagination {
	font-variant-numeric: tabular-nums;
}

:where(.lmb-card .wp-block-post-excerpt__excerpt, .lmb-lead__excerpt, .lmb-page-intro__lead, .lmb-archive-head__desc) {
	text-wrap: pretty;
}

/* ==========================================================================
   Movimiento reducido: se quita el desplazamiento (transform, animaciones,
   scroll suave); color, borde y opacidad se mantienen, cortos.
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto !important;
	}

	*,
	*::before,
	*::after {
		animation: none !important;
	}

	.lmb-card,
	.lmb-card img,
	.wp-block-button__link,
	.lmb-sorteo::after {
		transform: none !important;
		transition-property: color, background-color, border-color, box-shadow, opacity, text-decoration-color !important;
		transition-duration: var(--lmb-dur-fast) !important;
	}

	.lmb-header__nav .wp-block-navigation-item__content::after {
		transition: none !important;
	}
}
