/**
 * Pulsoweb — Blog: piezas de la plantilla de entrada (meta de cabecera, tabla
 * de contenido y barra de compartir).
 *
 * Los colores salen de las custom properties de .pwb-root (definidas en
 * pulsoweb-blog.css) y los controles del panel Estilo de cada widget los pisan.
 */

/* --pwb-sticky-top NO se define aquí: lo escribe el control "Distancia
   superior al fijarse" en el wrapper del widget y tiene que heredarse hasta
   [data-pwb-toc], de donde lo lee el JS para el salto a cada apartado.
   Redefinirlo en .pwb-root lo pisaba con 120px. Fallbacks: CSS y JS (120). */

/* hello-elementor (reset.css) pinta los <button> en hover/focus con
   [type=button]:hover → fondo #c36 y texto blanco. Se neutraliza en los
   dos botones de la plantilla de entrada: cabecera del índice y "Volver arriba". */
.pwb-root .pwb-toc__head:hover,
.pwb-root .pwb-toc__head:focus,
.pwb-root .pwb-share__top:hover,
.pwb-root .pwb-share__top:focus {
	background: none;
	color: inherit;
	text-decoration: none;
}

/* ====================================== Cabecera: categoría + lectura ===== */
.pwb-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px;
}

.pwb-meta__badge {
	display: inline-flex;
	align-items: center;
	padding: 12px 24px;
	border-radius: 999px;
	background: #1a1c20;
	color: #ffffff;
	font-size: 0.9375rem;
	font-weight: 500;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease;
}

a.pwb-meta__badge:hover,
a.pwb-meta__badge:focus-visible {
	background: var(--pwb-accent-hover);
	outline: none;
}

.pwb-meta__sep {
	color: var(--pwb-border);
	font-size: 0.9375rem;
	line-height: 1;
}

.pwb-meta__readtime {
	color: var(--pwb-title);
	font-size: 0.9375rem;
	line-height: 1;
}

/* ================================================= Tabla de contenido ===== */
.pwb-toc {
	background: var(--pwb-card-bg);
	border: 1px solid var(--pwb-card-border);
	border-radius: var(--pwb-radius);
	box-shadow: 0 14px 40px -26px rgba(0, 29, 63, 0.3);
	overflow: hidden;
}

.pwb-toc__head {
	display: flex;
	align-items: center;
	gap: 14px;
	width: 100%;
	margin: 0;
	padding: 20px 22px;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: left;
	cursor: default;
}

.pwb-toc__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border-radius: 999px;
	background: var(--pwb-badge-bg);
}

.pwb-toc__icon svg {
	width: 17px;
	height: 17px;
	fill: var(--pwb-title);
}

.pwb-toc__title {
	flex: 1 1 auto;
	color: var(--pwb-title);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.3;
}

/* El chevron solo existe en móvil, donde la tarjeta se pliega. */
.pwb-toc__chevron {
	display: none;
	flex: 0 0 auto;
	transition: transform 0.25s ease;
}

.pwb-toc__chevron svg {
	width: 20px;
	height: 20px;
	fill: var(--pwb-title);
}

.pwb-toc__body {
	padding: 0 22px 8px;
}

.pwb-toc__list {
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: none;
}

.pwb-toc__item {
	border-bottom: 2px solid #e6e9f0;
	transition: border-color 0.2s ease;
}

.pwb-toc__item--h3 .pwb-toc__link {
	padding-left: 14px;
	font-size: 0.8125rem;
}

.pwb-toc__link {
	display: block;
	padding: 14px 0;
	color: var(--pwb-text);
	font-size: 0.875rem;
	line-height: 1.4;
	text-decoration: none;
	transition: color 0.2s ease;
}

.pwb-toc__link:hover,
.pwb-toc__link:focus-visible {
	color: var(--pwb-title);
	outline: none;
}

/* Sección visible: texto oscuro y subrayado naranja. */
.pwb-toc__item.is-active {
	border-bottom-color: var(--pwb-accent-hover);
}

.pwb-toc__item.is-active .pwb-toc__link {
	color: var(--pwb-title);
	font-weight: 500;
}

/* ================================== Compartir / volver arriba (columna) === */
.pwb-share {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 22px;
}

.pwb-share__top {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	border: 0;
	background: none;
	font: inherit;
	cursor: pointer;
}

.pwb-share__label {
	color: var(--pwb-text);
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.08em;
	line-height: 1;
	white-space: nowrap;
	/* De abajo arriba, como en el diseño. */
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	transition: color 0.2s ease;
}

.pwb-share__top:hover .pwb-share__label,
.pwb-share__top:focus-visible .pwb-share__label {
	color: var(--pwb-accent-hover);
}

.pwb-share__line {
	flex: 0 0 auto;
	width: 2px;
	height: 92px;
	border-radius: 2px;
	background: var(--pwb-accent-hover);
}

.pwb-share__links {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

.pwb-share__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 1px solid var(--pwb-border);
	border-radius: 999px;
	background: none;
	color: var(--pwb-text);
	cursor: pointer;
	transition:
		background-color 0.2s ease,
		border-color 0.2s ease,
		color 0.2s ease;
}

.pwb-share__btn svg {
	width: 17px;
	height: 17px;
	fill: currentColor;
}

.pwb-share__btn:hover,
.pwb-share__btn:focus-visible {
	background: var(--pwb-accent);
	border-color: var(--pwb-accent);
	color: #ffffff;
	outline: none;
}

/* Aviso de "enlace copiado". Se muestra añadiendo .is-visible desde el JS. */
.pwb-share__toast {
	position: absolute;
	right: calc(100% + 12px);
	bottom: 0;
	padding: 8px 14px;
	border-radius: 999px;
	background: var(--pwb-accent);
	color: #ffffff;
	font-size: 0.8125rem;
	line-height: 1;
	white-space: nowrap;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.25s ease;
}

.pwb-share__toast.is-visible {
	opacity: 1;
}

/* ============================================================== Sticky ==== */
/* Solo en escritorio: a partir de tablet las tres columnas se apilan y una
   barra fija estorbaría. El contenedor padre debe quedar estirado
   (align-items: stretch) para que el sticky tenga recorrido. */
@media (min-width: 1025px) {
	.elementor-widget-pulsoweb_blog_toc,
	.elementor-widget-pulsoweb_blog_share {
		position: sticky;
		top: var(--pwb-sticky-top, 120px);
		align-self: flex-start;
	}
}

/* ========================================================== Responsive ==== */
/* Tablet y móvil: la barra pasa a fila al final del artículo. */
@media (max-width: 1024px) {
	.pwb-share {
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
	}

	.pwb-share__label {
		writing-mode: horizontal-tb;
		transform: none;
	}

	.pwb-share__line {
		display: none;
	}

	.pwb-share__links {
		flex-direction: row;
	}

	.pwb-share__toast {
		right: auto;
		left: 0;
		bottom: calc(100% + 10px);
	}
}

/* Solo móvil: el índice se pliega (767px es el breakpoint del proyecto). */
@media (max-width: 767px) {
	/* Tabla de contenido plegable. */
	.pwb-toc__head {
		cursor: pointer;
	}

	.pwb-toc__chevron {
		display: inline-flex;
	}

	.pwb-toc__body {
		display: none;
	}

	.pwb-toc.is-open .pwb-toc__body {
		display: block;
	}

	.pwb-toc.is-open .pwb-toc__chevron {
		transform: rotate(180deg);
	}

	/* "Plegada en móvil" desactivada: lista siempre abierta, sin chevron. */
	.pwb-toc--static .pwb-toc__head {
		cursor: default;
	}

	.pwb-toc--static .pwb-toc__chevron {
		display: none;
	}

}

@media (prefers-reduced-motion: reduce) {
	.pwb-toc__chevron,
	.pwb-share__toast {
		transition: none;
	}
}
