/* UI propia agregada al template (buscador, modo edición, videos).
   Archivo aparte para no tocar el CSS generado por el template
   (assets/css/main.css). */

/* --- Videos diferidos (ver assets/js/videos.js) --------------------
   Reserva el lugar del video para que no salte el layout cuando el
   iframe real lo reemplaza. */

.video-diferido {
	display: block;
	width: 560px;
	max-width: 100%;
	aspect-ratio: 560 / 315;
	background: rgba(0, 0, 0, 0.35);
	border-radius: 4px;
}

/* --- Animación de entrada del template ----------------------------
   El original tarda ~3,3s en aclarar la pantalla (2,5s de transición
   + 0,75s de delay). Lo dejamos en algo perceptible pero corto. */

#bg:before {
	transition: background-color 0.8s ease-in-out !important;
	transition-delay: 0s !important;
}

/* Ahora vive adentro del <header>, como una barra más (mismo look
   que el menú de navegación que tiene justo debajo). */
#buscador {
	display: flex;
	align-items: center;
	width: 100%;
	max-width: 40rem;
	margin-left: auto;
	margin-right: auto;
	height: 2.75rem;
	border: solid 1px #ffffff;
	border-radius: 4px;
	font-family: inherit;
	color: #fff;
	/* deja que "#header > *" (main.css) le ponga el margin-top y la
	   línea vertical de conexión, igual que a los demás bloques del header */
}

#buscador > .fa-search {
	padding: 0 0 0 1.25rem;
	font-size: 0.9rem;
	opacity: 0.8;
}

#buscador-input {
	flex: 1;
	background: transparent;
	color: #fff;
	border: 0;
	outline: none;
	padding: 0 1.25rem;
	font-size: 0.85rem;
	letter-spacing: 0.05rem;
}

#buscador-input::placeholder {
	color: rgba(255, 255, 255, 0.6);
}

#buscador-caja {
	display: none;
	position: absolute;
	top: calc(100% + 0.4rem);
	left: 0;
	right: 0;
	background: rgba(20, 20, 20, 0.97);
	border-radius: 0.5rem;
	padding: 0.6rem;
	box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.5);
	z-index: 10000;
	text-align: left;
}

#buscador.con-resultados #buscador-caja {
	display: block;
}

#buscador-resultados {
	list-style: none;
	margin: 0.5rem 0 0 0;
	padding: 0;
	max-height: 60vh;
	overflow-y: auto;
}

#buscador-resultados li {
	border-radius: 0.35rem;
}

#buscador-resultados button {
	display: block;
	width: 100%;
	text-align: left;
	background: none;
	border: 0;
	color: #fff;
	padding: 0.5rem 0.5rem;
	cursor: pointer;
	border-radius: 0.35rem;
	font-family: inherit;
}

#buscador-resultados button:hover,
#buscador-resultados button:focus {
	background: rgba(255, 255, 255, 0.12);
}

#buscador-resultados .titulo {
	display: block;
	font-weight: 600;
}

#buscador-resultados .camino {
	display: block;
	font-size: 0.75rem;
	opacity: 0.65;
}

#buscador-mensaje {
	color: rgba(255, 255, 255, 0.7);
	font-size: 0.85rem;
	padding: 0.4rem 0.5rem 0.1rem;
}

/* Cuenta: login / acceso al panel, arriba a la derecha */
#cuenta {
	position: fixed;
	top: 1.25rem;
	right: 1.5rem;
	z-index: 10000;
}

.cuenta-boton {
	width: 2.75rem;
	height: 2.75rem;
	border-radius: 100%;
	background: rgba(0, 0, 0, 0.6);
	color: #fff !important;
	font-size: 1.1rem;
	display: flex;
	align-items: center;
	justify-content: center;
	border-bottom: 0 !important;
}

.cuenta-boton:hover {
	background: rgba(0, 0, 0, 0.8);
}

/* Modo edición (sesión iniciada) */

#barra-panel {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 9999;
	background: #b8860b;
	color: #1b1f22;
	font-size: 0.8rem;
	padding: 0.4rem 1rem;
	font-weight: 600;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1.5rem;
	flex-wrap: wrap;
}

#barra-panel a {
	color: #1b1f22;
	border-bottom-color: rgba(27, 31, 34, 0.4);
}

.switch-form {
	margin: 0;
}

.switch-etiqueta {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	cursor: pointer;
}

.switch {
	width: 2.4rem;
	height: 1.3rem;
	border-radius: 999px;
	background: rgba(27, 31, 34, 0.35);
	border: 0;
	position: relative;
	cursor: pointer;
	padding: 0;
	flex-shrink: 0;
}

.switch-bolita {
	position: absolute;
	top: 0.15rem;
	left: 0.15rem;
	width: 1rem;
	height: 1rem;
	border-radius: 50%;
	background: #fff;
	transition: left 0.15s ease-in-out;
}

.switch.switch-on {
	background: #1b1f22;
}

.switch.switch-on .switch-bolita {
	left: calc(100% - 1.15rem);
	background: #b8860b;
}

.panel-editar-link {
	display: inline-block;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: normal;
	text-transform: none;
	background: #b8860b;
	color: #1b1f22 !important;
	border: 0 !important;
	border-radius: 0.25rem;
	padding: 0.15rem 0.5rem;
	vertical-align: middle;
	margin-left: 0.5rem;
}

/* En el título de una sección, main.css le da al h2 "width: max-content"
   (para que la línea de abajo mida lo que el texto). Con el botón al
   lado se salía de la tarjeta: lo limitamos al ancho disponible y, si
   no entra, el botón baja de renglón en vez de desbordar. */
#main article h2.major:has(> .panel-editar-link) {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 0.75rem;
	max-width: 100%;
}

#main article h2.major > .panel-editar-link {
	margin-left: 0;
	letter-spacing: normal;
}

/* Resalta por un momento el nodo al que saltamos desde un resultado. */
.nodo-destacado > summary {
	animation: buscador-flash 1.8s ease-out;
}

@keyframes buscador-flash {
	0%   { background-color: rgba(255, 214, 0, 0.55); }
	100% { background-color: transparent; }
}
