/*
 * Página de campaña (plantilla "Campaña Duendes").
 * Colores tomados de las piezas: rojo de la franja y dorado del duende.
 */
:root {
	--mcd-rojo: #d72630;
	--mcd-oro: #b5913a;
	--mcd-oro-claro: #ead28c;
	--mcd-estrella: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cdefs%3E%3ClinearGradient id='g' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23ead28c'/%3E%3Cstop offset='1' stop-color='%23b5913a'/%3E%3C/linearGradient%3E%3C/defs%3E%3Cpath fill='url(%23g)' d='M12 0c.9 6.4 4.7 10.6 12 12-7.3 1.4-11.1 5.6-12 12-.9-6.4-4.7-10.6-12-12C7.3 10.6 11.1 6.4 12 0z'/%3E%3C/svg%3E");
}

/* ---------- Título con líneas doradas a los costados ----------
 * Se aplica al título de la página (el que pone el tema) y a cualquier
 * bloque Título con la clase "mcd-titulo" (patrón "Título navideño").
 */
.mcd-pagina .entry-header .entry-title,
.mcd-titulo {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 18px;
	margin: 1.2em auto .6em;
	color: var(--mcd-oro);
	font-size: clamp(26px, 4vw, 44px);
	font-weight: 700;
	line-height: 1.15;
	text-align: center;
	letter-spacing: .01em;
}

.mcd-pagina .entry-header .entry-title::before,
.mcd-pagina .entry-header .entry-title::after,
.mcd-titulo::before,
.mcd-titulo::after {
	content: "";
	flex: 1 1 0;
	max-width: 240px;
	min-width: 40px;
	height: 18px;
}

/* Texto dorado con un destello que lo recorre cada pocos segundos.
 * El texto va en un <span> (lo agrega apariciones.js / el PHP) porque el
 * degradado no puede ir en el h1/h2: ahí viven las líneas ::before/::after. */
.mcd-titulo__texto {
	background: linear-gradient(100deg,
		#8f6d1f 0%, #c9a24a 30%, #f7e7b0 45%, #fffbe8 50%, #f7e7b0 55%, #c9a24a 70%, #8f6d1f 100%);
	background-size: 250% 100%;
	background-position: 100% 0;
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
	color: transparent;
	filter: drop-shadow(0 1px 0 rgba(120, 90, 20, .25));
	animation: mcd-brillo 4.5s ease-in-out infinite;
}

@keyframes mcd-brillo {
	0%, 40% { background-position: 100% 0; }
	100%    { background-position: 0 0; }
}

@media (prefers-reduced-motion: reduce) {
	.mcd-titulo__texto { animation: none; background-position: 50% 0; }
}

/* Línea doble que se aclara hacia el título y remata en una estrella */
.mcd-pagina .entry-header .entry-title::before,
.mcd-titulo::before {
	background:
		var(--mcd-estrella) right center / 16px 16px no-repeat,
		linear-gradient(90deg, transparent, var(--mcd-oro) 55%, var(--mcd-oro-claro)) left calc(50% - 2px) / calc(100% - 22px) 2px no-repeat,
		linear-gradient(90deg, transparent 30%, var(--mcd-oro) 80%, transparent) left calc(50% + 3px) / calc(100% - 22px) 1px no-repeat;
}

.mcd-pagina .entry-header .entry-title::after,
.mcd-titulo::after {
	background:
		var(--mcd-estrella) left center / 16px 16px no-repeat,
		linear-gradient(270deg, transparent, var(--mcd-oro) 55%, var(--mcd-oro-claro)) right calc(50% - 2px) / calc(100% - 22px) 2px no-repeat,
		linear-gradient(270deg, transparent 30%, var(--mcd-oro) 80%, transparent) right calc(50% + 3px) / calc(100% - 22px) 1px no-repeat;
}

/* Bajada bajo el título */
.mcd-subtitulo {
	max-width: 640px;
	margin: 0 auto 2em;
	color: #6b5a2e;
	font-size: clamp(15px, 1.6vw, 18px);
	text-align: center;
}

/* ---------- Separador dorado entre secciones ---------- */
hr.mcd-separador,
.wp-block-separator.mcd-separador {
	max-width: 420px;
	height: 18px;
	margin: 2.5em auto;
	border: 0;
	opacity: 1;
	background:
		var(--mcd-estrella) center / 16px 16px no-repeat,
		linear-gradient(90deg, transparent, var(--mcd-oro)) left center / calc(50% - 16px) 1px no-repeat,
		linear-gradient(270deg, transparent, var(--mcd-oro)) right center / calc(50% - 16px) 1px no-repeat;
}

@media (max-width: 767px) {
	.mcd-pagina .entry-header .entry-title,
	.mcd-titulo { gap: 10px; }

	.mcd-pagina .entry-header .entry-title::before,
	.mcd-pagina .entry-header .entry-title::after,
	.mcd-titulo::before,
	.mcd-titulo::after { min-width: 28px; }
}

/* =====================================================================
 * Apariciones de duendes (apariciones.js)
 * ================================================================== */

/* ---------- Laterales: viven en el espacio libre a los costados ---------- */
.mcd-lado {
	position: fixed;
	top: 50%;
	z-index: 5;
	width: var(--mcd-libre, 0px);
	display: flex;
	justify-content: center;
	pointer-events: none;
	opacity: 0;
	transition: transform .6s cubic-bezier(.5, -0.3, .7, 1), opacity .4s ease;
}

.mcd-lado--izq { left: 0;  transform: translate(-100%, -50%) rotate(-10deg); }
.mcd-lado--der { right: 0; transform: translate(100%, -50%) rotate(10deg); }

.mcd-lado.is-in {
	opacity: 1;
	transform: translate(0, -50%) rotate(0);
	transition: transform .8s cubic-bezier(.2, 1.4, .4, 1), opacity .3s ease;
}

.mcd-lado img {
	display: block;
	width: auto;
	max-width: min(calc(var(--mcd-libre, 0px) - 24px), 230px);
	max-height: 42vh;
	filter: drop-shadow(0 8px 12px rgba(0, 0, 0, .15));
}

.mcd-lado.is-in img { animation: mcd-flota-lado 3.6s ease-in-out .8s infinite; }
.mcd-lado--der.is-in img { animation-delay: 1.6s; }

@keyframes mcd-flota-lado {
	0%, 100% { transform: translateY(0) rotate(0); }
	50%      { transform: translateY(-12px) rotate(2deg); }
}

/* ---------- Footer: se asoman desde abajo ---------- */
.mcd-tira {
	display: flex;
	justify-content: space-evenly;
	align-items: flex-end;
	height: clamp(110px, 13vw, 180px);
	margin-top: 2em;
	overflow: hidden;
	pointer-events: none;
}

.mcd-tira__duende {
	height: 100%;
	transform: translateY(105%);
	transition: transform .7s cubic-bezier(.2, 1.3, .4, 1);
}

.mcd-tira.is-in .mcd-tira__duende { transform: translateY(14%); }

.mcd-tira__duende img {
	display: block;
	height: 100%;
	width: auto;
}

.mcd-tira.is-in .mcd-tira__duende img {
	animation: mcd-asoma 3s ease-in-out 1.2s infinite;
	transform-origin: 50% 100%;
}
.mcd-tira__duende:nth-child(even) img { animation-delay: 1.9s !important; }

@keyframes mcd-asoma {
	0%, 100% { transform: rotate(0); }
	30%      { transform: rotate(-4deg); }
	60%      { transform: rotate(3deg); }
}

@media (max-width: 767px) {
	.mcd-tira__duende:nth-child(n+4) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.mcd-tira__duende,
	.mcd-tira.is-in .mcd-tira__duende img { transition: none; animation: none; }
}

@media print {
	.mcd-lado, .mcd-tira { display: none !important; }
}
