/*
Theme Name:   CiviRed ePosters
Description:  Tema para las pantallas táctiles de ePosters de CiviRed. Cabecera blanca con espacio para el logo del evento y degradado con sus colores, pie con botón de inicio. Pensado para pantallas verticales de 55", también horizontal y móvil. Los colores se cambian en Apariencia → Personalizar → Evento.
Version:      0.1.4
Author:       CiviRed
Requires at least: 6.0
Requires PHP: 7.4
Text Domain:  civired-eposters-tema
*/

/* Las variables --cv-* las define functions.php con los valores de Personalizar. */

@font-face {
	font-family: "Manrope";
	src: url("assets/fonts/manrope.woff2") format("woff2");
	font-weight: 200 800;
	font-style: normal;
	font-display: swap;
}

:root {
	--cv-font: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--cv-ink: #161A20;
	--cv-muted: #5B6270;
	--cv-line: #DDE1E7;
	--cv-card: #FFFFFF;
	/* Unidad que crece con la pantalla: ~24px en 55", ~15px en móvil. */
	--cv-u: clamp(15px, 2.1vmin, 30px);
	--cv-pad: calc(var(--cv-u) * 2.3);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	background: var(--cv-bg, #F6F7F9);
	color: var(--cv-ink);
	font-family: var(--cv-font);
	font-size: var(--cv-u);
	line-height: 1.5;
	-webkit-font-smoothing: antialiased;
	-webkit-tap-highlight-color: transparent;
}

a { color: var(--cv-primary); }
a:hover { color: color-mix(in srgb, var(--cv-primary) 75%, #000); }
img { max-width: 100%; height: auto; }

.screen-reader-text,
.cv-sr {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.cv-skip:focus {
	position: fixed; top: 8px; left: 8px; z-index: 100001;
	width: auto; height: auto; clip: auto;
	padding: .6em 1em; background: #fff; border-radius: 8px;
}

/* Cabecera ----------------------------------------------------------------- */

.cv-header {
	position: relative;
	flex-shrink: 0;
	min-height: var(--cv-header-h, 18vh);
	background: #fff;
	display: flex;
	align-items: center;
	overflow: hidden;
	isolation: isolate;
}
/* Degradado: mismo sentido y colores que la barra inferior, desvanecido hacia arriba
   para que el logo quede sobre blanco. */
.cv-header::before,
.cv-header::after {
	content: "";
	position: absolute;
	pointer-events: none;
	z-index: -1;
	display: none;
}
.cv-fx-degradado .cv-header::before,
.cv-fx-animado .cv-header::before {
	display: block;
	inset: 0;
	background: linear-gradient(90deg, var(--cv-tint-a, #fff), var(--cv-tint-b, #fff));
	-webkit-mask-image: linear-gradient(180deg, transparent 30%, #000 100%);
	mask-image: linear-gradient(180deg, transparent 30%, #000 100%);
}
/* Movimiento: dos manchas de luz muy suaves que derivan despacio (solo transform, ligero
   para las pantallas del congreso). */
.cv-fx-animado .cv-header::after {
	display: block;
	inset: -40% -20%;
	background:
		radial-gradient(closest-side, color-mix(in srgb, var(--cv-tint-a, #fff) 80%, transparent), transparent) 8% 75% / 45% 90% no-repeat,
		radial-gradient(closest-side, color-mix(in srgb, var(--cv-tint-b, #fff) 80%, transparent), transparent) 88% 80% / 50% 95% no-repeat;
	-webkit-mask-image: linear-gradient(180deg, transparent 35%, #000 85%);
	mask-image: linear-gradient(180deg, transparent 35%, #000 85%);
	opacity: .9;
	will-change: transform;
	animation: cv-drift 26s ease-in-out infinite alternate;
}
@keyframes cv-drift {
	0%   { transform: translate3d(-6%, 0, 0) scale(1); }
	50%  { transform: translate3d(3%, -4%, 0) scale(1.08); }
	100% { transform: translate3d(8%, 2%, 0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
	.cv-fx-animado .cv-header::after { animation: none; }
}
.cv-header__in {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: calc(var(--cv-u) * 2);
	padding: calc(var(--cv-u) * 1.2) var(--cv-pad) calc(var(--cv-u) * 1.6);
}
.cv-logo {
	display: flex;
	align-items: center;
	min-width: 0;
	color: var(--cv-ink);
	text-decoration: none;
}
.cv-logo img,
.cv-logo .custom-logo {
	display: block;
	width: auto;
	height: auto;
	max-width: min(var(--cv-logo-w, 60%), 100%);
	max-height: calc(var(--cv-header-h, 18vh) - var(--cv-u) * 2.8);
	object-fit: contain;
}
.cv-logo .custom-logo-link { display: block; }
.cv-logo__text {
	color: var(--cv-ink);
	text-decoration: none;
	font-size: calc(var(--cv-u) * 2.2);
	font-weight: 800;
	letter-spacing: -.02em;
	line-height: 1.1;
}
.cv-header__info {
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: calc(var(--cv-u) * .5);
	text-align: right;
}
.cv-label {
	font-size: calc(var(--cv-u) * 1.8);
	font-weight: 800;
	letter-spacing: -.02em;
	line-height: 1.1;
	color: var(--cv-primary);
}
.cv-sub {
	font-size: calc(var(--cv-u) * .9);
	color: var(--cv-muted);
}
.cv-header__bar {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	height: calc(var(--cv-u) * .25);
	min-height: 4px;
	background: linear-gradient(90deg, var(--cv-primary), var(--cv-secondary));
}

/* Selector de idioma (TranslatePress u otros) como pastillas. */
.cv-lang .trp-language-switcher,
.cv-lang ul { margin: 0; }
.cv-lang a { text-decoration: none; }
.cv-langs {
	display: flex;
	gap: 4px;
	padding: 4px;
	margin: 0;
	list-style: none;
	background: #fff;
	border: 1px solid var(--cv-line);
	border-radius: 999px;
}
.cv-langs a {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: calc(var(--cv-u) * 2.6);
	min-height: 44px;
	padding: 0 calc(var(--cv-u) * .7);
	border-radius: 999px;
	color: var(--cv-muted);
	font-weight: 700;
	font-size: calc(var(--cv-u) * .8);
	text-transform: uppercase;
}
.cv-langs .is-current a { background: var(--cv-ink); color: #fff; }

/* Contenido ---------------------------------------------------------------- */

.cv-main {
	flex: 1 0 auto;
	width: 100%;
	padding: calc(var(--cv-u) * 1.6) var(--cv-pad) calc(var(--cv-u) * 2);
}
.cv-page { max-width: 100%; }
.cv-page--narrow { max-width: 52em; margin: 0 auto; }
.cv-page__title {
	margin: 0 0 .8em;
	font-size: calc(var(--cv-u) * 1.8);
	line-height: 1.15;
	letter-spacing: -.02em;
}
.cv-content > *:first-child { margin-top: 0; }
.cv-content h2 { font-size: calc(var(--cv-u) * 1.3); }
.cv-content p, .cv-content li { max-width: 60em; }

/* Ficha de póster */
.cv-poster {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: calc(var(--cv-u) * 1.4);
	max-width: 70em;
	margin: 0 auto;
}
.cv-poster__img {
	display: block;
	background: #fff;
	border-radius: 10px;
	overflow: hidden;
	box-shadow: 0 2px 4px rgba(22,26,32,.06), 0 16px 40px rgba(22,26,32,.12);
}
.cv-poster__img img { display: block; width: 100%; height: auto; }
.cv-poster__title { margin: 0; font-size: calc(var(--cv-u) * 1.6); line-height: 1.2; }
.cv-poster__authors { margin: .3em 0 0; color: var(--cv-muted); font-size: calc(var(--cv-u) * 1); }
.cv-chip {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	margin-top: calc(var(--cv-u) * .6);
	padding: .3em 1em;
	border: 2px solid color-mix(in srgb, var(--cv-primary) 35%, #fff);
	border-radius: 999px;
	background: color-mix(in srgb, var(--cv-primary) 9%, #fff);
	color: var(--cv-primary);
	font-weight: 700;
	font-size: calc(var(--cv-u) * .8);
	text-decoration: none;
}
.cv-back {
	display: inline-flex;
	align-items: center;
	gap: .4em;
	min-height: 44px;
	margin-bottom: calc(var(--cv-u) * 1);
	font-weight: 700;
	text-decoration: none;
}
@media (orientation: landscape) and (min-width: 1000px) {
	.cv-poster { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; }
}

/* Pie ---------------------------------------------------------------------- */

.cv-footer {
	position: sticky;
	bottom: 0;
	z-index: 50;
	flex-shrink: 0;
	display: grid;
	/* La columna central reserva el hueco del botón de inicio, que va centrado en la pantalla. */
	grid-template-columns: minmax(0, 1fr) var(--cv-home-w) minmax(0, 1fr);
	align-items: center;
	gap: calc(var(--cv-u) * 1);
	min-height: calc(var(--cv-u) * 4.6);
	padding: calc(var(--cv-u) * .6) var(--cv-pad);
	background: rgba(255, 255, 255, .96);
	border-top: 1px solid var(--cv-line);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	--cv-home-w: max(56px, calc(var(--cv-u) * 3.4));
	/* Final del degradado del icono: el secundario mezclado con el principal, para que el dibujo se lea
	   sobre blanco aunque el secundario sea muy claro (p. ej. amarillo). El borde usa los dos colores tal cual. */
	--cv-home-c2: var(--cv-primary);
	--cv-home-c2: color-mix(in srgb, var(--cv-secondary) 55%, var(--cv-primary));
}
.cv-footer__brand {
	grid-column: 1;
	display: flex;
	flex-direction: column;
	line-height: 1.1;
	font-weight: 800;
	font-size: calc(var(--cv-u) * .95);
}
.cv-footer__brand small { font-weight: 500; font-size: .7em; color: var(--cv-muted); white-space: nowrap; }
.cv-credit { color: var(--cv-muted); text-decoration: none; }
a.cv-credit:hover { color: var(--cv-primary); }
a.cv-credit strong { font-weight: 800; color: var(--cv-ink); }
/* Botón de inicio: blanco, con el degradado solo en el borde y en el icono.
   Va centrado respecto a la pantalla (50vw), no respecto al hueco que deja la barra de desplazamiento. */
.cv-home {
	position: absolute;
	top: 50%;
	left: 50vw;
	transform: translate(-50%, -50%);
	box-sizing: border-box;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--cv-home-w);
	height: var(--cv-home-w);
	border: 4px solid transparent;
	border-radius: 999px;
	background:
		linear-gradient(#fff, #fff) padding-box,
		linear-gradient(135deg, var(--cv-primary), var(--cv-secondary)) border-box;
	box-shadow: 0 6px 16px rgba(22, 26, 32, .12);
	transition: box-shadow .15s ease, transform .15s ease;
}
.cv-home:hover { box-shadow: 0 8px 22px rgba(22, 26, 32, .2); }
.cv-home:active { transform: translate(-50%, -50%) scale(.96); }
.cv-home svg { width: 50%; height: 50%; display: block; overflow: visible; }
.cv-home__s1 { stop-color: var(--cv-primary); }
.cv-home__s2 { stop-color: var(--cv-home-c2); }
.cv-nav { grid-column: 3; display: flex; justify-content: flex-end; min-width: 0; }
.cv-nav ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: calc(var(--cv-u) * .5);
	margin: 0;
	padding: 0;
	list-style: none;
}
.cv-nav a {
	display: flex;
	align-items: center;
	min-height: 48px;
	height: calc(var(--cv-u) * 2.3);
	padding: 0 calc(var(--cv-u) * .9);
	border: 2px solid var(--cv-line);
	border-radius: 999px;
	background: #fff;
	color: var(--cv-ink);
	font-weight: 700;
	font-size: calc(var(--cv-u) * .8);
	text-decoration: none;
	white-space: nowrap;
}
.cv-nav .current-menu-item a,
.cv-nav a[aria-current="page"] { border-color: var(--cv-primary); color: var(--cv-primary); }

/* Móvil */
@media (max-width: 720px) {
	:root { --cv-pad: 16px; }
	.cv-header__in { flex-wrap: wrap; }
	.cv-header__info { align-items: flex-start; text-align: left; }
	.cv-footer { grid-template-columns: auto auto minmax(0, 1fr); gap: 10px; }
	.cv-home { position: static; transform: none; grid-column: 2; }
	.cv-home:active { transform: scale(.96); }
	.cv-nav { grid-column: 3; }
	.cv-footer__brand > span { display: none; }
	.cv-footer__brand small { font-size: 11px; }
	.cv-nav ul { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; }
}

/* Barra de administración de WordPress */
.admin-bar .cv-footer { bottom: 0; }

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