/* UN Ontology Filter — panel compact + sidebar (v1.24).
 * Panel ≤ 320 px, dense, ChromaLab-coherent (text-only, underline on active).
 * Sidebar = slide-in droite, overlay backdrop, fullscreen mobile. */

.un-onto {
	--uo-color-text: #171717;
	--uo-color-muted: #a3a3a3;
	--uo-color-soft: #916F735C;
	--uo-panel-max: 320px;
	--uo-gap-field: 10px;
	display: block;
	width: 100%;
	max-width: var(--uo-panel-max);
	padding-top: 20px;
	font-size: 14px;
	color: var(--uo-color-text);
	box-sizing: border-box;
}

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

/* === Panel ======================================================= */

.un-onto__panel {
	display: flex;
	flex-direction: column;
	gap: var(--uo-gap-field);
}

.un-onto__section-title {
	margin: 0 0 4px;
	user-select: none;
}

.un-onto__section {
	display: flex;
	flex-direction: column;
	gap: var(--uo-gap-field);
}

/* === Field ======================================================= */

.un-onto__field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

/* Divider between fields. Segmented fields already have their own
   tab-track underline on .un-onto__field-values, so we skip them. */
.un-onto__field--multi,
.un-onto__field--toggle {
	padding-bottom: var(--uo-gap-field);
	border-bottom: 1px solid var(--uo-color-soft);
}

.un-onto__section .un-onto__field:last-child,
.un-onto__group .un-onto__field:last-child {
	padding-bottom: 0;
	border-bottom: 0;
}

.un-onto__field-label {
	font-size: 12px;
	font-weight: 600;
	color: var(--uo-color-text);
	user-select: none;
}

.un-onto__field-values {
	display: flex;
	flex-wrap: wrap;
	gap: 2px 12px;
}

/* === Value buttons (shared) ====================================== */

.un-onto__val {
	border: 0;
	background: transparent;
	padding: 3px 0;
	font: inherit;
	color: #525252;
	cursor: pointer;
	white-space: nowrap;
	transition: color 0.15s ease, opacity 0.15s ease;
	text-align: left;
}

.un-onto__val:hover { color: var(--uo-color-text); }

.un-onto__val.is-disabled {
	opacity: 0.3;
	cursor: not-allowed;
	pointer-events: none;
}

/* multi / toggle: simple underline. */
.un-onto__val--multi.is-active,
.un-onto__val--toggle.is-active {
	color: var(--uo-color-text);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
}

/* segmented: tab-like indicator. */
.un-onto__field--segmented .un-onto__field-values {
	gap: 0;
	border-bottom: 1px solid var(--uo-color-soft);
	padding-bottom: 1px;
}

.un-onto__val--segmented {
	padding: 4px 8px 6px;
	margin-bottom: -1px;
	border-bottom: 2px solid transparent;
	transition: color 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.un-onto__val--segmented:first-child { padding-left: 0; }

.un-onto__val--segmented.is-active {
	color: var(--uo-color-text);
	border-bottom-color: var(--uo-color-text);
	font-weight: 600;
}

/* === Sidebar trigger ============================================= */

.un-onto__trigger {
	margin-top: 8px;
	border: 0;
	background: transparent;
	padding: 4px 0;
	font: inherit;
	font-size: 13px;
	color: var(--uo-color-muted);
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	transition: color 0.15s ease;
	align-self: flex-start;
}

.un-onto__trigger:hover {
	color: var(--uo-color-text);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 4px;
}

.un-onto__trigger-icon {
	font-size: 13px;
	line-height: 1;
}

/* === Sidebar (full-page slide-in) ================================ */

.un-onto__sidebar {
	position: fixed;
	inset: 0;
	z-index: 100000;
	pointer-events: none;
}

.un-onto__sidebar[hidden] { display: none; }

.un-onto__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.4);
	opacity: 0;
	transition: opacity 0.2s ease;
	pointer-events: auto;
}

.un-onto__sidebar.is-open .un-onto__backdrop { opacity: 1; }

.un-onto__panel-side {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(420px, 100%);
	background: #fff;
	box-shadow: -8px 0 24px rgba(0, 0, 0, 0.12);
	transform: translateX(100%);
	transition: transform 0.22s ease;
	display: flex;
	flex-direction: column;
	pointer-events: auto;
	color: var(--uo-color-text);
}

.un-onto__sidebar.is-open .un-onto__panel-side {
	transform: translateX(0);
}

.un-onto__sb-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 16px 20px;
	border-bottom: 1px solid var(--uo-color-soft);
	flex-shrink: 0;
}

.un-onto__sb-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
}

.un-onto__sb-close {
	border: 0;
	background: transparent;
	padding: 4px 8px;
	font-size: 24px;
	line-height: 1;
	cursor: pointer;
	color: var(--uo-color-muted);
	transition: color 0.15s ease;
}

.un-onto__sb-close:hover { color: var(--uo-color-text); }

.un-onto__sb-body {
	flex: 1;
	overflow-y: auto;
	padding: 20px;
	display: flex;
	flex-direction: column;
	gap: 24px;
}

.un-onto__group {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.un-onto__group-title {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	color: var(--uo-color-muted);
	padding-bottom: 6px;
	border-bottom: 1px solid var(--uo-color-soft);
	user-select: none;
}

.un-onto__sb-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 20px;
	border-top: 1px solid var(--uo-color-soft);
	background: #fff;
	flex-shrink: 0;
}

.un-onto__sb-clear {
	border: 0;
	background: transparent;
	padding: 8px 4px;
	font: inherit;
	font-size: 13px;
	color: var(--uo-color-muted);
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
	transition: color 0.15s ease;
}

.un-onto__sb-clear:hover { color: var(--uo-color-text); }

.un-onto__sb-apply {
	border: 0;
	background: var(--uo-color-text);
	color: #fff;
	padding: 10px 18px;
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	border-radius: 0;
	transition: background 0.15s ease;
	flex: 1;
	text-align: center;
}

.un-onto__sb-apply:hover { background: #000; }

/* Scroll-lock hook (set on <body> when sidebar opens). */
body.un-onto-sb-open { overflow: hidden; }

/* === Mobile ====================================================== */

@media (max-width: 600px) {
	.un-onto { font-size: 13px; }
	.un-onto__panel-side { width: 100%; }
}
