/**
 * Hubs de claustro — listas de enlaces, navegación por secciones.
 */

.jursoc-claustro.jursoc-hub {
	--hub-primary: var(--claustro-primary, #5548a8);
	--hub-primary-dark: var(--claustro-dark, #3d3480);
	--hub-accent: var(--claustro-accent, #6d5fc7);
	--hub-surface: #fff;
	--hub-border: #e8ecf2;
	--hub-muted: #64748b;
	--hub-radius: 12px;
	--hub-row-hover: color-mix(in srgb, var(--hub-primary) 6%, #fff);
	/* Fallback CSS; el JS claustro-hub-anchors.js ajusta el valor real del header. */
	--hub-anchor-offset: 9rem;
}

.admin-bar .jursoc-claustro.jursoc-hub {
	--hub-anchor-offset: calc(9rem + 32px);
}

@media screen and (max-width: 782px) {
	.admin-bar .jursoc-claustro.jursoc-hub {
		--hub-anchor-offset: calc(9rem + 46px);
	}
}

/* Evita el margen negativo de Kadence (.alignwide) que recorta títulos a la izquierda. */
.jursoc-claustro.jursoc-hub.alignwide,
.jursoc-claustro.jursoc-hub.alignfull,
.content-style-boxed .entry-content .jursoc-claustro.jursoc-hub.alignwide,
.content-style-boxed .entry-content .jursoc-claustro.jursoc-hub.alignfull,
.wp-site-blocks .entry-content .jursoc-claustro.jursoc-hub.alignwide,
.wp-site-blocks .entry-content .jursoc-claustro.jursoc-hub.alignfull {
	margin-left: 0 !important;
	margin-right: 0 !important;
	width: 100% !important;
	max-width: none;
	left: auto;
	right: auto;
	position: relative;
}

.jursoc-hub__main {
	margin-top: 0;
	/* Espacio extra al final para que la ancla de la última sección quede bajo el header. */
	padding: 0 clamp(1rem, 3vw, 2rem) calc(var(--hub-anchor-offset) + 6rem);
	box-sizing: border-box;
}

/* Hero más compacto: priorizar el listado */
.jursoc-hub .jursoc-claustro__hero {
	margin-bottom: clamp(0.85rem, 1.8vw, 1.15rem);
}

.jursoc-hub .jursoc-claustro__hero-inner {
	padding-block: clamp(0.7rem, 1.6vw, 0.95rem);
}

.jursoc-hub .jursoc-claustro__title {
	font-size: clamp(1.35rem, 2.8vw, 1.65rem);
}

.jursoc-hub .jursoc-claustro__lead {
	font-size: 0.88rem;
	line-height: 1.45;
	max-width: 40rem;
}

/* Hero de presentación: sin accesos rápidos en el encabezado */
.jursoc-hub .jursoc-claustro__hero-inner {
	align-items: flex-start;
}

.jursoc-hub .jursoc-claustro__hero-copy {
	max-width: 40rem;
}

/* Salto entre secciones */
.jursoc-hub__jump {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
	margin: 0 0 clamp(1rem, 2vw, 1.35rem);
	padding: 0.4rem;
	border-radius: 999px;
	background: #f4f6f9;
	border: 1px solid var(--hub-border);
	width: fit-content;
	max-width: 100%;
	box-sizing: border-box;
}

.jursoc-hub__jump-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.48rem 1.05rem;
	border-radius: 999px;
	font-size: 0.82rem;
	font-weight: 600;
	line-height: 1.25;
	color: var(--hub-muted);
	text-decoration: none;
	white-space: nowrap;
	transition: color 0.15s ease, background 0.15s ease;
}

.jursoc-hub__jump-link:hover,
.jursoc-hub__jump-link:focus-visible {
	color: var(--hub-primary-dark);
	background: #fff;
}

.jursoc-hub__jump-link:focus-visible {
	outline: 2px solid var(--hub-primary);
	outline-offset: 2px;
}

/* Secciones */
.jursoc-hub__sections {
	display: flex;
	flex-direction: column;
	gap: clamp(1.75rem, 3.5vw, 2.5rem);
}

/* Compensa el header sticky; JS sobrescribe con la altura medida. */
.jursoc-hub__section,
.jursoc-hub__section-title {
	scroll-margin-top: var(--hub-anchor-offset, 9rem);
}

.jursoc-hub__section-title:focus {
	outline: none;
}

.jursoc-hub__section-head {
	margin-bottom: 0.75rem;
	padding-left: 1rem;
	border-left: 3px solid var(--hub-primary);
}

.jursoc-hub__section--exclusive .jursoc-hub__section-head,
.jursoc-hub__section--shared .jursoc-hub__section-head {
	padding-left: 1rem;
	border-left: 3px solid var(--hub-primary);
}

.jursoc-hub__section-title {
	margin: 0 0 0.25rem;
	font-size: clamp(1.1rem, 2.2vw, 1.3rem);
	font-weight: 700;
	line-height: 1.35;
	color: var(--hub-primary-dark);
	letter-spacing: 0;
	overflow: visible;
}

.jursoc-hub__section-lead {
	margin: 0;
	max-width: 42rem;
	font-size: 0.86rem;
	line-height: 1.5;
	color: var(--hub-muted);
}

/* Lista unificada */
.jursoc-hub-list {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	gap: 0;
	grid-template-columns: 1fr;
	background: var(--hub-surface);
	border: 1px solid var(--hub-border);
	border-radius: var(--hub-radius);
	overflow: hidden;
}

@media (min-width: 768px) {
	.jursoc-hub-list--cols-2 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.jursoc-hub-item {
	border-bottom: 1px solid var(--hub-border);
}

.jursoc-hub-list--cols-2 .jursoc-hub-item:nth-last-child(-n + 2) {
	border-bottom: none;
}

.jursoc-hub-list:not(.jursoc-hub-list--cols-2) .jursoc-hub-item:last-child,
.jursoc-hub-list--cols-2 .jursoc-hub-item:last-child:nth-child(odd) {
	border-bottom: none;
}

.jursoc-hub-list--cols-2 .jursoc-hub-item:nth-child(odd) {
	border-right: 1px solid var(--hub-border);
}

/* Enlace directo */
.jursoc-hub-item__link {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	min-height: 3.25rem;
	padding: 0.65rem 0.85rem;
	color: inherit;
	text-decoration: none;
	transition: background 0.15s ease;
}

.jursoc-hub-item__link:hover,
.jursoc-hub-item__link:focus-visible {
	background: var(--hub-row-hover);
}

.jursoc-hub-item__link:focus-visible {
	outline: 2px solid var(--hub-primary);
	outline-offset: -2px;
}

.jursoc-hub-item__icon {
	display: inline-flex;
	flex-shrink: 0;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	color: var(--hub-primary);
	opacity: 0.85;
}

.jursoc-hub-item__body {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
}

.jursoc-hub-item__label {
	font-size: 0.92rem;
	font-weight: 600;
	line-height: 1.35;
	color: #0f172a;
	overflow-wrap: anywhere;
	text-wrap: pretty;
}

.jursoc-hub-item__summary .jursoc-hub-item__label {
	flex: 1 1 auto;
	min-width: 0;
}

.jursoc-hub-item__desc {
	font-size: 0.78rem;
	line-height: 1.4;
	color: var(--hub-muted);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.jursoc-hub-item__arrow {
	flex-shrink: 0;
	color: #94a3b8;
	transition: color 0.15s ease, transform 0.15s ease;
}

.jursoc-hub-item__link:hover .jursoc-hub-item__arrow,
.jursoc-hub-item__link:focus-visible .jursoc-hub-item__arrow {
	color: var(--hub-primary);
	transform: translateX(2px);
}

/* Grupo con subenlaces (<details>) */
.jursoc-hub-item__details {
	margin: 0;
}

.jursoc-hub-item__summary {
	display: flex;
	align-items: center;
	gap: 0.65rem;
	min-height: 3.25rem;
	padding: 0.65rem 0.85rem;
	list-style: none;
	cursor: pointer;
	user-select: none;
	transition: background 0.15s ease;
}

.jursoc-hub-item__summary::-webkit-details-marker {
	display: none;
}

.jursoc-hub-item__summary::marker {
	content: "";
}

.jursoc-hub-item__details[open] > .jursoc-hub-item__summary,
.jursoc-hub-item__summary:hover,
.jursoc-hub-item__summary:focus-visible {
	background: var(--hub-row-hover);
}

.jursoc-hub-item__summary:focus-visible {
	outline: 2px solid var(--hub-primary);
	outline-offset: -2px;
}

.jursoc-hub-item__chev {
	flex-shrink: 0;
	width: 0.45rem;
	height: 0.45rem;
	margin-left: auto;
	border-right: 2px solid #94a3b8;
	border-bottom: 2px solid #94a3b8;
	transform: rotate(45deg);
	transition: transform 0.2s ease, border-color 0.15s ease;
}

.jursoc-hub-item__details[open] > .jursoc-hub-item__summary .jursoc-hub-item__chev {
	transform: rotate(-135deg);
	border-color: var(--hub-primary);
}

.jursoc-hub-item--group > .jursoc-hub-item__details > .jursoc-hub-item__desc {
	margin: 0;
	padding: 0 0.85rem 0.55rem calc(0.85rem + 1.75rem + 0.65rem);
	font-size: 0.78rem;
	line-height: 1.45;
	color: var(--hub-muted);
}

.jursoc-hub-item__summary .jursoc-hub-item__desc {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.jursoc-hub-item__panel {
	margin: 0;
	padding: 0.75rem 0.85rem 0.95rem calc(0.85rem + 1.75rem + 0.65rem);
	border-top: 1px dashed color-mix(in srgb, var(--hub-border) 80%, var(--hub-primary) 20%);
	background: color-mix(in srgb, var(--hub-primary) 3%, #fff);
}

.jursoc-hub-item__panel-content {
	/* Tipografía: .jursoc-claustro-prose (claustro-content.css) */
	--claustro-primary: var(--hub-primary);
	--claustro-dark: var(--hub-primary-dark);
}

.jursoc-hub-item__panel-actions {
	margin: 0.85rem 0 0;
}

.jursoc-hub-item__cta,
.jursoc-hub-item__panel-content .jursoc-claustro-interior__cta {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	padding: 0.5rem 0.95rem;
	border-radius: 8px;
	background: var(--hub-primary);
	color: #fff !important;
	font-family: var(--font-body, "Source Sans 3", system-ui, sans-serif);
	font-size: var(--jursoc-text-sm, 0.9375rem);
	font-weight: var(--jursoc-weight-semibold, 600);
	text-decoration: none !important;
	line-height: 1.3;
	transition: background 0.15s ease;
}

.jursoc-hub-item__cta:hover,
.jursoc-hub-item__cta:focus-visible,
.jursoc-hub-item__panel-content .jursoc-claustro-interior__cta:hover,
.jursoc-hub-item__panel-content .jursoc-claustro-interior__cta:focus-visible {
	background: var(--hub-primary-dark);
}

.jursoc-hub-item__cta:focus-visible,
.jursoc-hub-item__panel-content .jursoc-claustro-interior__cta:focus-visible {
	outline: 2px solid var(--hub-primary);
	outline-offset: 2px;
}

.jursoc-hub-item__children {
	margin: 0;
	padding: 0.35rem 0.65rem 0.65rem calc(0.85rem + 1.75rem + 0.65rem);
	list-style: none;
	border-top: 1px dashed color-mix(in srgb, var(--hub-border) 80%, var(--hub-primary) 20%);
	background: color-mix(in srgb, var(--hub-primary) 3%, #fff);
}

.jursoc-hub-item__child-link {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.42rem 0.5rem;
	border-radius: 6px;
	font-size: 0.84rem;
	font-weight: 500;
	color: #334155;
	text-decoration: none;
	transition: background 0.15s ease, color 0.15s ease;
}

.jursoc-hub-item__child-link:hover,
.jursoc-hub-item__child-link:focus-visible {
	background: #fff;
	color: var(--hub-primary-dark);
}

.jursoc-hub-item__child-link:focus-visible {
	outline: 2px solid var(--hub-primary);
	outline-offset: 1px;
}

.jursoc-hub-item__child-label {
	flex: 1;
	min-width: 0;
	line-height: 1.35;
}

.jursoc-hub-item__badge {
	flex-shrink: 0;
	font-size: 0.58rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	padding: 0.12rem 0.38rem;
	border-radius: 4px;
	background: #e2e8f0;
	color: #475569;
}

.jursoc-hub-item__badge--video {
	background: #dbeafe;
	color: #1e40af;
}

.jursoc-hub-item__badge--pdf {
	background: #fee2e2;
	color: #991b1b;
}

@media (max-width: 479px) {
	.jursoc-hub-item__desc {
		display: none;
	}

	.jursoc-hub-item--group > .jursoc-hub-item__details > .jursoc-hub-item__desc {
		display: block;
		padding-left: 0.85rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.jursoc-hub-item__link,
	.jursoc-hub-item__arrow,
	.jursoc-hub-item__chev,
	.jursoc-hub__jump-link {
		transition: none;
	}

	.jursoc-hub-item__link:hover .jursoc-hub-item__arrow {
		transform: none;
	}
}
