/* =========================================================================
   Plantilla web · UGT Servicios Públicos Madrid · Sector de Enseñanza
   Hoja de estilos única. Los colores y medidas se cambian en :root.
   ========================================================================= */

/* ---------- 1. Variables ---------- */
:root {
	--ugt-rojo: #e4022c;
	--ugt-rojo-osc: #b0001f;

	--fondo: #ffffff;
	--texto: #111111;
	--texto-suave: #8a8a8a;
	--linea: #e7e7e7;
	--pastilla: #e8e8e8;
	--pastilla-hover: #dddddd;
	--marquesina: #efefef;
	--cabecera-fondo: rgba(255, 255, 255, 0.92);

	--fuente: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	--radio: 8px;
	--ancho-max: 1280px;
	--ancho-texto: 520px;
	--margen-lateral: 40px;
	--alto-cabecera: 88px;
	--transicion: 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
}

html.oscuro {
	--fondo: #0f0f0f;
	--texto: #f2f2f2;
	--texto-suave: #8f8f8f;
	--linea: #262626;
	--pastilla: #1f1f1f;
	--pastilla-hover: #2b2b2b;
	--marquesina: #1b1b1b;
	--cabecera-fondo: rgba(15, 15, 15, 0.92);
}

@media (max-width: 809px) {
	:root {
		--margen-lateral: 20px;
		--alto-cabecera: 72px;
	}
}

/* ---------- 2. Base ---------- */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
	scroll-padding-top: var(--alto-cabecera);
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--fondo);
	color: var(--texto);
	font-family: var(--fuente);
	font-size: 16px;
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	transition: background-color var(--transicion), color var(--transicion);
	overflow-x: hidden;
}

body.menu-abierto {
	overflow: hidden;
}

img {
	display: block;
	max-width: 100%;
	height: auto;
}

a {
	color: inherit;
	text-decoration: none;
}

h1, h2, h3, h4, p, ul, ol {
	margin: 0;
}

ul, ol {
	padding: 0;
	list-style: none;
}

strong, b {
	font-weight: 600;
}

:focus-visible {
	outline: 2px solid var(--ugt-rojo);
	outline-offset: 3px;
	border-radius: 4px;
}

.solo-lectores {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.contenedor {
	width: 100%;
	max-width: var(--ancho-max);
	margin: 0 auto;
	padding: 0 var(--margen-lateral);
}

.contenedor-estrecho {
	width: 100%;
	max-width: calc(var(--ancho-texto) + 2 * var(--margen-lateral));
	margin: 0 auto;
	padding: 0 var(--margen-lateral);
}

/* ---------- 3. Cabecera ---------- */
.cabecera {
	position: fixed;
	inset: 0 0 auto 0;
	z-index: 50;
	height: var(--alto-cabecera);
	background: var(--cabecera-fondo);
	-webkit-backdrop-filter: saturate(160%) blur(10px);
	backdrop-filter: saturate(160%) blur(10px);
	transition: background-color var(--transicion), box-shadow var(--transicion);
}

.cabecera.con-scroll {
	box-shadow: 0 1px 0 var(--linea);
}

.cabecera-interior {
	height: 100%;
	max-width: none;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
}

.marca {
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 0;
}

.marca-sello {
	width: 30px;
	height: 30px;
	flex-shrink: 0;
}

.marca-nombre {
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.12em;
}

.marca-separador {
	width: 1px;
	height: 14px;
	background: var(--texto-suave);
	opacity: 0.5;
	flex-shrink: 0;
}

/* Texto rotatorio junto a la marca */
.rotador {
	position: relative;
	display: inline-block;
	height: 1.4em;
	overflow: hidden;
	font-size: 12px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--texto-suave);
	white-space: nowrap;
	max-width: 46vw;
	text-overflow: ellipsis;
}

.rotador span {
	display: block;
	line-height: 1.4em;
	transition: transform 0.6s cubic-bezier(0.7, 0, 0.2, 1), opacity 0.6s ease;
}

.rotador span.sale {
	transform: translateY(-100%);
	opacity: 0;
}

.rotador span.entra {
	position: absolute;
	top: 0;
	left: 0;
	transform: translateY(100%);
	opacity: 0;
}

/* Navegación de escritorio */
.navegacion {
	display: flex;
	align-items: center;
	gap: 20px;
}

.navegacion ul {
	display: flex;
	gap: 6px;
}

.navegacion a {
	display: block;
	padding: 8px 18px;
	border-radius: 999px;
	font-size: 16px;
	font-weight: 500;
	transition: background-color var(--transicion), color var(--transicion);
}

.navegacion a:hover,
.navegacion a.activo {
	background: var(--pastilla);
}

/* Interruptor claro / oscuro */
.interruptor-tema {
	position: relative;
	width: 56px;
	height: 30px;
	border: 0;
	border-radius: 999px;
	background: var(--pastilla);
	cursor: pointer;
	flex-shrink: 0;
	transition: background-color var(--transicion);
}

.interruptor-tema::after {
	content: "";
	position: absolute;
	top: 4px;
	left: 4px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
	transition: transform var(--transicion), background-color var(--transicion);
}

html.oscuro .interruptor-tema::after {
	transform: translateX(26px);
	background: var(--ugt-rojo);
}

/* Botón de menú (móvil) */
.boton-menu {
	display: none;
	position: relative;
	width: 44px;
	height: 44px;
	margin-right: -8px;
	border: 0;
	background: none;
	cursor: pointer;
	color: var(--texto);
}

.boton-menu span {
	position: absolute;
	left: 9px;
	width: 26px;
	height: 2.5px;
	border-radius: 2px;
	background: currentColor;
	transition: transform var(--transicion), top var(--transicion);
}

.boton-menu span:nth-child(1) { top: 16px; }
.boton-menu span:nth-child(2) { top: 25px; }

body.menu-abierto .boton-menu span:nth-child(1) { top: 21px; transform: rotate(45deg); }
body.menu-abierto .boton-menu span:nth-child(2) { top: 21px; transform: rotate(-45deg); }

/* Menú a pantalla completa (móvil) */
.menu-movil {
	position: fixed;
	inset: 0;
	z-index: 40;
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: var(--alto-cabecera) var(--margen-lateral) 40px;
	background: var(--fondo);
	opacity: 0;
	visibility: hidden;
	transition: opacity var(--transicion), visibility var(--transicion);
}

body.menu-abierto .menu-movil {
	opacity: 1;
	visibility: visible;
}

.menu-movil ul li {
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 0.45s ease, transform 0.45s ease;
}

body.menu-abierto .menu-movil ul li {
	opacity: 1;
	transform: none;
}

body.menu-abierto .menu-movil ul li:nth-child(2) { transition-delay: 0.05s; }
body.menu-abierto .menu-movil ul li:nth-child(3) { transition-delay: 0.1s; }
body.menu-abierto .menu-movil ul li:nth-child(4) { transition-delay: 0.15s; }
body.menu-abierto .menu-movil ul li:nth-child(5) { transition-delay: 0.2s; }

.menu-movil a {
	display: block;
	padding: 10px 0;
	font-size: 36px;
	font-weight: 500;
	letter-spacing: -0.01em;
}

.menu-movil a.activo {
	color: var(--ugt-rojo);
}

.menu-movil .menu-pie {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 40px;
	padding-top: 24px;
	border-top: 1px solid var(--linea);
	color: var(--texto-suave);
	font-size: 14px;
}

@media (max-width: 809px) {
	.navegacion {
		display: none;
	}

	.boton-menu {
		display: block;
	}
}

@media (max-width: 480px) {
	.rotador {
		max-width: 56vw;
		font-size: 11px;
		letter-spacing: 0.14em;
	}
}

@media (max-width: 380px) {
	.rotador {
		max-width: none;
		letter-spacing: 0.06em;
		font-size: 11px;
	}
	.marca {
		gap: 10px;
	}
}

/* ---------- 4. Portada (hero) ---------- */
main {
	padding-top: var(--alto-cabecera);
}

.portada {
	padding: 120px 0 40px;
	text-align: center;
}

.portada-texto {
	max-width: 640px;
	margin: 0 auto;
	font-size: clamp(24px, 1.2vw + 14px, 30px);
	font-weight: 400;
	line-height: 1.55;
	letter-spacing: -0.01em;
}

.portada-texto strong {
	font-weight: 600;
}

.portada-texto .rojo,
.rojo {
	color: var(--ugt-rojo);
}

.portada .acciones {
	margin-top: 36px;
}

/* Variante: cabecera de página interior */
.portada--interior {
	padding-top: 80px;
}

.antetitulo {
	display: inline-block;
	margin-bottom: 20px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--ugt-rojo);
}

@media (max-width: 809px) {
	.portada {
		padding-top: 72px;
	}
}

/* ---------- 4b. Imagen de cabecera (banner opcional) ----------
   Se usa solo si la web tiene imagen de cabecera: añadir la clase
   "portada--con-banner" a la portada y el bloque <figure class="banner">.
   Pensada para imágenes 3:1 (p. ej. 2400 × 800 px); con otra proporción,
   cambiar --banner-proporcion en el propio <figure> (style="--banner-proporcion: 16 / 9"). */
.banner {
	--banner-proporcion: 3 / 1;
	max-width: 1200px;
	margin: 0 auto 64px;
	border-radius: calc(var(--radio) * 1.5);
	overflow: hidden;
	background: #1c1c1e;
	box-shadow: 0 18px 50px -24px rgba(0, 0, 0, 0.45);
}

.banner img {
	width: 100%;
	height: auto;
	aspect-ratio: var(--banner-proporcion);
	object-fit: cover;
}

.portada--con-banner {
	padding-top: 36px;
}

@media (max-width: 809px) {
	.portada--con-banner {
		padding-top: 20px;
	}
	.banner {
		margin: 0 calc(-1 * var(--margen-lateral) + 8px) 44px;
		border-radius: var(--radio);
	}
}

/* ---------- 5. Botones ---------- */
.acciones {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.acciones--izquierda {
	justify-content: flex-start;
}

.boton {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 52px;
	padding: 0 36px;
	border: 0;
	border-radius: 999px;
	background: var(--pastilla);
	color: var(--texto);
	font-family: inherit;
	font-size: 16px;
	font-weight: 500;
	cursor: pointer;
	transition: background-color var(--transicion), color var(--transicion), transform var(--transicion);
}

.boton:hover {
	background: var(--pastilla-hover);
}

.boton--rojo {
	background: var(--ugt-rojo);
	color: #ffffff;
}

.boton--rojo:hover {
	background: var(--ugt-rojo-osc);
}

.boton-flecha {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--pastilla);
	color: var(--texto);
	transition: background-color var(--transicion), color var(--transicion);
}

.boton-flecha svg {
	width: 20px;
	height: 20px;
	transition: transform var(--transicion);
}

.acciones:hover .boton-flecha,
.boton-flecha:hover {
	background: var(--ugt-rojo);
	color: #ffffff;
}

.acciones:hover .boton-flecha svg,
.boton-flecha:hover svg {
	transform: rotate(45deg);
}

@media (max-width: 809px) {
	.boton {
		height: 48px;
		padding: 0 32px;
	}
	.boton-flecha {
		display: none;
	}
}

/* ---------- 6. Línea con círculo (separador animado con el scroll) ---------- */
.linea-scroll {
	--progreso: 0;
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	height: 200px;
	margin: 40px auto;
	pointer-events: none;
}

.linea-scroll .trazo {
	width: 1.5px;
	flex: 1;
	background: var(--texto);
	transform-origin: top center;
	transform: scaleY(var(--progreso));
}

.linea-scroll .circulo {
	width: 24px;
	height: 24px;
	margin-top: -1px;
	border: 1.5px solid var(--texto);
	border-radius: 50%;
	opacity: clamp(0, calc((var(--progreso) - 0.85) * 7), 1);
	transform: scale(clamp(0.4, calc(var(--progreso) * 1.1), 1));
	transition: border-color var(--transicion);
}

.linea-scroll--corta {
	height: 110px;
}

.linea-scroll--sin-circulo .circulo {
	display: none;
}

@media (max-width: 809px) {
	.linea-scroll {
		height: 140px;
		margin: 24px auto;
	}
}

/* ---------- 7. Secciones ---------- */
.seccion {
	padding: 40px 0 24px;
}

.seccion-titulo {
	margin-bottom: 28px;
	font-size: 22px;
	font-weight: 500;
	letter-spacing: -0.01em;
}

.seccion .acciones {
	margin-top: 44px;
}

/* ---------- 8. Rejilla de tarjetas (actualidad, galería…) ---------- */
.rejilla {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 16px;
}

.rejilla--3 {
	grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1199px) {
	.rejilla--3 {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 809px) {
	.rejilla,
	.rejilla--3 {
		grid-template-columns: 1fr;
		gap: 20px;
	}
}

.tarjeta {
	display: block;
}

.tarjeta-imagen {
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border-radius: var(--radio);
	background: var(--pastilla);
}

.tarjeta-imagen img,
.tarjeta-imagen .relleno {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.tarjeta:hover .tarjeta-imagen img,
.tarjeta:hover .tarjeta-imagen .relleno {
	transform: scale(1.04);
}

.tarjeta-numero {
	position: absolute;
	top: 16px;
	left: 18px;
	z-index: 2;
	font-size: 13px;
	font-weight: 500;
	color: #ffffff;
	text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.tarjeta-icono {
	position: absolute;
	right: 16px;
	bottom: 16px;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	background: #ffffff;
	color: #111111;
	opacity: 0;
	transform: translateY(8px) scale(0.9);
	transition: opacity var(--transicion), transform var(--transicion), background-color var(--transicion), color var(--transicion);
}

.tarjeta-icono svg {
	width: 18px;
	height: 18px;
}

.tarjeta:hover .tarjeta-icono {
	opacity: 1;
	transform: none;
	background: var(--ugt-rojo);
	color: #ffffff;
}

.tarjeta-pie {
	padding: 14px 2px 0;
}

.tarjeta-titulo {
	font-size: 18px;
	font-weight: 500;
	line-height: 1.35;
}

.tarjeta-categoria {
	margin-top: 4px;
	font-size: 15px;
	color: var(--texto-suave);
}

/* Rellenos de ejemplo mientras no haya fotografía (sustituir por <img>) */
.relleno {
	display: flex;
	align-items: flex-end;
	padding: 22px;
	font-size: clamp(28px, 4vw, 56px);
	font-weight: 700;
	line-height: 0.95;
	letter-spacing: -0.03em;
	color: rgba(255, 255, 255, 0.92);
	text-transform: uppercase;
}

.relleno--rojo { background: linear-gradient(140deg, #f0334f 0%, #e4022c 45%, #9a0019 100%); }
.relleno--negro { background: linear-gradient(140deg, #3a3a3a 0%, #161616 70%); }
.relleno--gris { background: linear-gradient(140deg, #d9d9d9 0%, #a9a9a9 100%); color: rgba(17, 17, 17, 0.85); }
.relleno--granate { background: linear-gradient(140deg, #7b0d18 0%, #3b060c 100%); }

/* ---------- 9. Lista numerada (comunicados, noticias…) ---------- */
.lista-entradas {
	border-top: 1px solid var(--linea);
}

.entrada {
	border-bottom: 1px solid var(--linea);
}

.entrada a {
	position: relative;
	display: block;
	padding: 26px 48px 26px 0;
}

.entrada-numero {
	display: block;
	font-size: 15px;
	font-weight: 500;
}

.entrada-titulo {
	display: block;
	margin-top: 10px;
	font-size: 27px;
	font-weight: 400;
	line-height: 1.25;
	letter-spacing: -0.01em;
	transition: transform var(--transicion), color var(--transicion);
}

.entrada-categoria {
	display: block;
	margin-top: 10px;
	font-size: 15px;
	font-weight: 500;
	color: var(--texto-suave);
}

.entrada .flecha {
	position: absolute;
	right: 0;
	top: 50%;
	width: 22px;
	height: 22px;
	color: var(--ugt-rojo);
	opacity: 0;
	transform: translate(-10px, -50%);
	transition: opacity var(--transicion), transform var(--transicion);
}

.entrada a:hover .entrada-titulo {
	transform: translateX(6px);
}

.entrada a:hover .flecha {
	opacity: 1;
	transform: translate(0, -50%);
}

@media (max-width: 809px) {
	.entrada-titulo {
		font-size: 24px;
	}
	.entrada .flecha {
		opacity: 1;
		transform: translate(0, -50%);
	}
}

/* ---------- 10. Bloque de texto destacado ---------- */
.destacado-centro {
	max-width: 620px;
	margin: 0 auto;
	text-align: center;
	font-size: clamp(22px, 1.1vw + 14px, 28px);
	line-height: 1.5;
	letter-spacing: -0.01em;
}

/* ---------- 11. Texto corrido (páginas de contenido) ---------- */
.texto-corrido {
	font-size: 17px;
	line-height: 1.7;
}

.texto-corrido > * + * {
	margin-top: 1.1em;
}

.texto-corrido h2 {
	margin-top: 2em;
	font-size: 26px;
	font-weight: 500;
	line-height: 1.3;
}

.texto-corrido h3 {
	margin-top: 1.6em;
	font-size: 20px;
	font-weight: 600;
}

.texto-corrido a {
	color: var(--ugt-rojo);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.texto-corrido ul,
.texto-corrido ol {
	padding-left: 1.4em;
}

.texto-corrido ul { list-style: disc; }
.texto-corrido ol { list-style: decimal; }

.texto-corrido li + li {
	margin-top: 0.5em;
}

.texto-corrido li::marker {
	color: var(--ugt-rojo);
	font-weight: 700;
}

.texto-corrido blockquote {
	margin: 1.6em 0;
	padding: 4px 0 4px 22px;
	border-left: 3px solid var(--ugt-rojo);
	font-size: 20px;
	line-height: 1.5;
}

/* ---------- 12. Marquesinas fijas al fondo + pie ---------- */
main,
.pie {
	position: relative;
	z-index: 1;
}

.marquesinas {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 0;
	user-select: none;
	pointer-events: none;
}

.marquesina {
	overflow: hidden;
	white-space: nowrap;
	line-height: 1.08;
	margin-top: -0.12em;
}

.marquesina-pista {
	display: inline-flex;
	will-change: transform;
	animation: marquesina var(--duracion, 40s) linear infinite;
}

.marquesina--inversa .marquesina-pista {
	animation-direction: reverse;
}

.marquesina-grupo {
	display: inline-block;
	padding-right: 0.35em;
	font-size: clamp(64px, 11vw, 168px);
	font-weight: 700;
	letter-spacing: -0.02em;
	text-transform: uppercase;
	color: var(--marquesina);
	transition: color var(--transicion);
}

.marquesina--difusa .marquesina-grupo {
	filter: blur(3px);
	opacity: 0.75;
}

@keyframes marquesina {
	from { transform: translate3d(0, 0, 0); }
	to { transform: translate3d(var(--desplazamiento, -50%), 0, 0); }
}

.pie {
	margin-top: 40px;
}

.pie .linea-scroll {
	height: 240px;
	margin: 0 auto;
}

.pie-datos {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	gap: 24px;
	align-items: end;
	margin-top: 70px;
	padding-bottom: 28px;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.6;
}

.pie-datos .centro {
	text-align: center;
}

.pie-datos .derecha {
	text-align: right;
}

.pie-datos a:hover {
	color: var(--ugt-rojo);
}

.pie-logo {
	width: 240px;
	margin: 0 auto 10px;
}

.pie-logo .logo-oscuro { display: none; }
html.oscuro .pie-logo .logo-claro { display: none; }
html.oscuro .pie-logo .logo-oscuro { display: block; }

@media (max-width: 809px) {
	.pie .linea-scroll {
		height: 180px;
	}
	.pie-datos {
		grid-template-columns: 1fr;
		gap: 18px;
		margin-top: 48px;
	}
	.pie-datos .centro,
	.pie-datos .derecha {
		text-align: left;
	}
	.pie-logo {
		margin: 0 0 6px;
		width: 190px;
	}
}

/* ---------- 13. Aparición al hacer scroll ---------- */
.js [data-aparece] {
	opacity: 0;
	transform: translateY(28px);
	transition: opacity 0.9s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1);
	transition-delay: var(--retardo, 0s);
}

.js [data-aparece].visible {
	opacity: 1;
	transform: none;
}

/* ---------- 14. Movimiento reducido ---------- */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}
	.marquesina-pista {
		animation: none;
	}
	.js [data-aparece] {
		opacity: 1;
		transform: none;
		transition: none;
	}
	.linea-scroll {
		--progreso: 1 !important;
	}
}
