/* ==========================================================================
   Lotería Manises Blog — PROSA del artículo (bloques + 217 entradas en HTML clásico)
   Solo se encola en singular y en el editor. Ámbito: .entry-content / .wp-block-post-content.
   Selectores con :where() para no pelear con los estilos de bloque; !important solo donde
   el HTML antiguo trae atributos/estilos en línea (width/height de tablas, figuras, iframes).
   Las firmas de la prosa (pies «FIG.», hr perforado) están en editorial.css.
   ========================================================================== */

/* ---------- Cuerpo y ritmo ---------- */

.lmb-prose {
	--wp--style--block-gap: 1.1em;
	color: var(--lmb-ink);
	font-size: clamp(1.0625rem, 1rem + .25vw, 1.1875rem);
	line-height: 1.65;
}

@media (max-width: 599px) {
	.lmb-prose {
		line-height: 1.6;
	}

	/* Sin guiones de partición automáticos: solo los que escriba el autor (&shy;). */
	.lmb-prose :where(p, li) {
		-webkit-hyphens: manual;
		hyphens: manual;
		overflow-wrap: break-word;
	}
}

:where(.entry-content, .wp-block-post-content) > :where(p, ul, ol, blockquote, table, figure, iframe, h2, h3, h4) {
	margin-block: 0;
}

:where(.entry-content, .wp-block-post-content) > * + :where(p, ul, ol, blockquote, table, figure, .wp-caption, iframe) {
	margin-block-start: 1.25em;
}

.lmb-prose > * + :is(p, ul, ol) {
	margin-block-start: var(--wp--style--block-gap);
}

.lmb-prose > :first-child {
	margin-block-start: 0;
}

.lmb-prose > :where(p, ul, ol),
.lmb-prose li {
	text-wrap: pretty;
}

/* Párrafos vacíos del editor clásico (&nbsp;). */
:where(.entry-content, .wp-block-post-content) > p:empty {
	display: none;
}

.wp-block-post-content::after {
	content: "";
	display: table;
	clear: both;
}

/* ---------- Entradilla (primer párrafo corto, marcado en PHP) ---------- */

.lmb-prose > p.lmb-lede {
	color: var(--lmb-blue-deep); /* 16:1 */
	font-size: clamp(1.25rem, 1.1rem + .7vw, 1.5rem);
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: -.008em;
}

/* Las entradas clásicas suelen meter la entradilla entera en <strong>: sin negrita extra. */
.lmb-prose > p.lmb-lede :where(strong, b, em, i) {
	color: inherit;
	font-style: normal;
	font-weight: inherit;
}

/* ---------- Encabezados (escala por debajo del H1 del artículo) ---------- */

:where(.entry-content, .wp-block-post-content) :where(h2, h3, h4) {
	color: var(--lmb-blue);
	font-weight: 800;
	letter-spacing: -.02em;
	line-height: 1.2;
	text-wrap: balance;
	scroll-margin-top: calc(var(--wp--custom--header--height, 68px) + 1rem);
}

.entry-content h2,
.wp-block-post-content h2 {
	margin-block: 2.25em .5em;
	font-size: clamp(1.5rem, 1.2rem + 1vw, 1.875rem);
	letter-spacing: -.022em;
	line-height: 1.15;
}

.entry-content h3,
.wp-block-post-content h3 {
	margin-block: 1.75em .4em;
	font-size: 1.3125rem;
	font-weight: 700;
	letter-spacing: -.012em;
}

.entry-content h4,
.wp-block-post-content h4 {
	margin-block: 1.4em .4em;
	font-size: 1.125rem;
	font-weight: 700;
}

:where(.entry-content, .wp-block-post-content) :where(h2, h3, h4) :where(strong, b) {
	color: inherit;
	font-weight: inherit;
}

:where(.entry-content, .wp-block-post-content) > :where(h2, h3, h4):first-child {
	margin-block-start: 0;
}

/* Subtítulos de las entradas antiguas (<p><strong>…</strong></p> → .lmb-subhead, en PHP):
   se pintan como un H3. */
.lmb-prose > p.lmb-subhead {
	margin-block: 1.75em .4em;
	color: var(--lmb-blue);
	font-size: 1.3125rem;
	font-weight: 700;
	letter-spacing: -.012em;
	line-height: 1.25;
	text-wrap: balance;
}

.lmb-prose > p.lmb-subhead :where(strong, b, em, i) {
	color: inherit;
	font-style: normal;
	font-weight: inherit;
}

/* ---------- Texto y enlaces ---------- */

:where(.entry-content, .wp-block-post-content) :where(strong, b) {
	color: inherit;
	font-weight: 650;
}

:where(.entry-content, .wp-block-post-content) :where(p, li, td) a:not([class]) {
	color: var(--lmb-blue-soft);
	font-weight: 500;
	text-decoration: underline;
	text-decoration-color: rgb(10 71 146 / .35);
	text-decoration-thickness: 1px;
	text-underline-offset: .2em;
	transition: text-decoration-color var(--lmb-dur) var(--lmb-ease-out), color var(--lmb-dur) var(--lmb-ease-out);
}

:where(.entry-content, .wp-block-post-content) :where(p, li, td) a:not([class]):hover {
	color: var(--lmb-blue);
	text-decoration-color: currentColor;
}

/* ---------- Listas ---------- */

:where(.entry-content, .wp-block-post-content) :where(ul, ol):not([class]) {
	padding-inline-start: 1.5em;
}

:where(.entry-content, .wp-block-post-content) :where(ul, ol):not([class]) li {
	padding-inline-start: .25em;
}

:where(.entry-content, .wp-block-post-content) :where(ul, ol):not([class]) li + li {
	margin-block-start: .45em;
}

:where(.entry-content, .wp-block-post-content) ul:not([class]) li::marker {
	color: var(--lmb-gold-dark);
	font-size: 1.1em;
}

:where(.entry-content, .wp-block-post-content) ol:not([class]) li::marker {
	color: var(--lmb-blue);
	font-weight: 800;
}

/* ---------- Citas: un solo estilo (hilo oro, cuerpo grande, autor en rótulo) ---------- */

.lmb-prose :is(blockquote:not([class]), .wp-block-quote),
:where(.entry-content, .wp-block-post-content) blockquote:not([class]) {
	margin-block: 2.25em;
	margin-inline: 0;
	padding: 0 0 0 1.5rem;
	border: 0;
	border-inline-start: 2px solid var(--lmb-gold);
	border-radius: 0;
	background: none;
	color: var(--lmb-blue-deep); /* 16:1 */
	font-size: clamp(1.375rem, 1.15rem + .9vw, 1.625rem);
	font-style: normal;
	font-weight: 400;
	letter-spacing: -.01em;
	line-height: 1.35;
}

.lmb-prose .wp-block-pullquote blockquote {
	color: var(--lmb-blue-deep);
	font-style: normal;
	font-weight: 400;
}

.lmb-prose :is(blockquote, .wp-block-pullquote) :is(p, strong, b) {
	font-weight: 400;
}

.lmb-prose blockquote > :first-child {
	margin-block-start: 0;
}

.lmb-prose blockquote > :last-child {
	margin-block-end: 0;
}

.lmb-prose :is(blockquote, .wp-block-pullquote) :is(cite, figcaption, .wp-block-pullquote__citation) {
	display: block;
	margin-block-start: .875rem;
	color: var(--lmb-muted);
	font-size: var(--lmb-label-size);
	font-style: normal;
	font-weight: var(--lmb-label-weight);
	letter-spacing: var(--lmb-label-track);
	line-height: 1.4;
	text-transform: uppercase;
}

.lmb-prose :is(blockquote, .wp-block-pullquote) :is(cite, figcaption)::before {
	content: none;
}

/* ---------- Imágenes ---------- */

:where(.entry-content, .wp-block-post-content) img {
	max-inline-size: 100%;
	block-size: auto;
}

.wp-block-post-content img[class*="wp-image-"] {
	background: var(--wp--preset--color--surface, #f7f8fa);
}

:where(.entry-content, .wp-block-post-content) img:where(.alignleft, .alignright, .aligncenter, .alignnone, [class*="wp-image-"]),
:where(.entry-content, .wp-block-post-content) .wp-block-image img {
	border-radius: var(--lmb-radius-md);
}

:where(.entry-content, .wp-block-post-content) :where(img, .wp-caption).alignleft,
.wp-block-post-content .alignleft:not(.wp-block-image) {
	float: left;
	margin: .35em 1.5em 1em 0;
	max-inline-size: 50%;
}

:where(.entry-content, .wp-block-post-content) :where(img, .wp-caption).alignright,
.wp-block-post-content .alignright:not(.wp-block-image) {
	float: right;
	margin: .35em 0 1em 1.5em;
	max-inline-size: 50%;
}

:where(.entry-content, .wp-block-post-content) :where(img, .wp-caption).aligncenter {
	display: block;
	margin-inline: auto;
	clear: both;
}

:where(.entry-content, .wp-block-post-content) img.alignnone {
	display: inline-block;
}

:where(.entry-content, .wp-block-post-content) p:has(> img.aligncenter:only-child) {
	text-align: center;
}

/* [caption] → .wp-caption (el HTML trae style="width: 1280px"). */
:where(.entry-content, .wp-block-post-content) .wp-caption {
	inline-size: auto !important;
	max-inline-size: 100% !important;
	margin-block: 1.5em;
}

:where(.entry-content, .wp-block-post-content) .wp-caption.aligncenter {
	inline-size: fit-content !important;
}

:where(.entry-content, .wp-block-post-content) .wp-caption img {
	display: block;
	margin: 0;
	inline-size: 100%;
	max-inline-size: 100%;
}

/* Pies de foto: un solo estilo para bloques, [caption] y portada. #475569: 7,6:1. */
:is(.lmb-prose, .wp-block-post-content, .entry-content, .lmb-article__media) :is(figcaption, .wp-element-caption, .wp-caption-text),
.wp-block-post-featured-image figcaption {
	margin: .75rem 0 0;
	padding: 0;
	border: 0;
	color: #475569;
	font-size: .9375rem;
	font-style: normal;
	font-weight: 400;
	line-height: 1.45;
	text-align: start;
	text-wrap: pretty;
}

/* Galerías: el pie va sobre la foto (estilo del bloque). */
.lmb-prose .wp-block-gallery .wp-block-image :is(figcaption, .wp-element-caption) {
	margin: 0;
	color: #fff;
	font-size: .875rem;
	text-align: center;
}

/* Móvil: sin flotantes (con :is para pesar más que la regla base; con :where no se aplicaba). */
@media (max-width: 600px) {
	:where(.entry-content, .wp-block-post-content) :is(img, .wp-caption):is(.alignleft, .alignright),
	.wp-block-post-content :is(.alignleft, .alignright):not(.wp-block-image) {
		float: none;
		display: block;
		max-inline-size: 100% !important;
		margin: 1.25em auto;
	}
}

/* ---------- Tablas (bloque y HTML clásico): cabecera azul noche, filas cebra ---------- */

.wp-block-table {
	overflow-x: auto;
}

.wp-block-table table,
:where(.entry-content, .wp-block-post-content) :not(.wp-block-table) > table {
	inline-size: 100% !important; /* el HTML trae width="942" y style="height: 312px" */
	block-size: auto !important;
	max-inline-size: 100%;
	border-collapse: separate;
	border-spacing: 0;
	overflow: hidden;
	border: 1px solid var(--lmb-hair-strong);
	border-radius: var(--lmb-radius-md);
	background: #fff;
	font-size: .9375rem;
	font-variant-numeric: tabular-nums lining-nums;
	line-height: 1.45;
}

.wp-block-table :is(th, td),
:where(.entry-content, .wp-block-post-content) :not(.wp-block-table) > table :where(td, th) {
	block-size: auto !important;
	padding: .75rem 1rem;
	border: 0;
	border-block-end: 1px solid var(--lmb-hair-strong);
	text-align: start;
	vertical-align: top;
}

:where(.entry-content, .wp-block-post-content) :not(.wp-block-table) > table :where(td, th) + :where(td, th) {
	border-inline-start: 1px solid var(--lmb-hair-strong);
}

:where(.wp-block-table, .entry-content, .wp-block-post-content) table tr:last-child > :where(td, th) {
	border-block-end: 0;
}

:where(.entry-content, .wp-block-post-content) :not(.wp-block-table) > table tbody tr:nth-child(even) {
	background: var(--wp--preset--color--surface, #f7f8fa);
}

.wp-block-table thead {
	border-bottom: 0;
}

/* Cabecera: <thead>/<th>, o la primera fila del HTML antiguo que solo trae <strong>. */
.wp-block-table th,
:where(.entry-content, .wp-block-post-content) :not(.wp-block-table) > table :where(thead th, thead td, th),
:where(.entry-content, .wp-block-post-content) :not(.wp-block-table) > table > tbody:first-child > tr:first-child > td:has(> strong:only-child) {
	background: var(--lmb-blue-deep);
	color: #fff;
	font-size: var(--lmb-label-size);
	font-weight: var(--lmb-label-weight);
	letter-spacing: .08em;
	text-transform: uppercase;
}

:where(.entry-content, .wp-block-post-content) :not(.wp-block-table) > table > tbody:first-child > tr:first-child > td:has(> strong:only-child) strong {
	color: inherit;
}

/* Tabla numérica (clase is-style-numeric): cifras a la derecha. */
.wp-block-table.is-style-numeric :is(td, th):where(:not(:first-child)) {
	text-align: end;
}

@media (max-width: 781px) {
	:where(.entry-content, .wp-block-post-content) :not(.wp-block-table) > table {
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}

	/* Fechas, importes y números no se parten: la tabla se desplaza en horizontal. */
	.wp-block-table :is(th, td),
	:where(.entry-content, .wp-block-post-content) :not(.wp-block-table) > table :is(th, td) {
		white-space: nowrap;
		font-variant-numeric: tabular-nums lining-nums;
	}
}

/* ---------- Vídeos e iframes 16:9 ---------- */

:where(.entry-content, .wp-block-post-content) iframe:where([src*="youtube"], [src*="youtu.be"], [src*="vimeo"], [src*="dailymotion"]) {
	display: block;
	inline-size: 100% !important;
	max-inline-size: 100%;
	block-size: auto !important;
	aspect-ratio: 16 / 9;
	margin-inline: auto;
	border: 0;
	border-radius: var(--lmb-radius-md);
	background: var(--lmb-blue-deep);
}

:where(.entry-content, .wp-block-post-content) iframe {
	max-inline-size: 100%;
}

:where(.entry-content, .wp-block-post-content) p:has(> iframe:only-child) {
	margin-block: 1.5em;
}

/* ---------- Galerías antiguas [gallery] ---------- */

:where(.entry-content, .wp-block-post-content) .gallery {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
	gap: .75rem;
	margin-block: 1.5em;
}

:where(.entry-content, .wp-block-post-content) .gallery-item {
	margin: 0;
}

:where(.entry-content, .wp-block-post-content) .gallery img {
	inline-size: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border: 0 !important;
	border-radius: var(--lmb-radius-md);
}

:where(.entry-content, .wp-block-post-content) .gallery br {
	display: none;
}

/* ---------- Limpieza de floats ---------- */

:where(.entry-content, .wp-block-post-content) :where(h2, h3, hr, table, .wp-caption.aligncenter) {
	clear: both;
}
