/* CIS abstracts database — single vertical list UI. Tokens mirror theme.json. */
.cis-abs {
	--cis-navy: #012e5b;
	--cis-blue: #3072a9;
	--cis-slate: #486b93;
	--cis-border: #dedede;
	--cis-bg: #f5f5f5;
	font-family: 'Montserrat', 'Helvetica Neue', Helvetica, Arial, sans-serif;
	color: #1a1a1a;
	margin: 0 0 2rem;
}

/* ============================================================
   Flat, content-appropriate header + wide light body for the
   abstracts / preview pages (search-tool look, not a marketing hero).
   Header and content share one width (1440px) so nothing misaligns.
   ============================================================ */
.cis-abs-head {
	background: #fff;
	border-bottom: 1px solid #e6ecf2;
	padding: 18px 0 22px;
}
.cis-abs-head__inner,
.cis-abs-body__inner {
	width: min(calc(100% - 64px), 1440px);
	margin-left: auto;
	margin-right: auto;
}
.cis-abs-head .cis-abs-title {
	font-size: 27px;
	font-weight: 600;
	line-height: 1.2;
	color: #012e5b;
	margin: 10px 0 0;
}
.cis-abs-body {
	background: #fff;
	padding: 26px 0 56px;
}

/* Intro/description shown above the search tool on the БД pages.
   Full width, aligned with the title and the search tool below it. */
.cis-abs-intro {
	margin: 0 0 26px;
}
.cis-abs-intro p {
	font-size: 15.5px;
	line-height: 1.65;
	color: #333;
	text-align: left;
	margin: 0 0 12px;
}
.cis-abs-intro p:last-child { margin-bottom: 0; }

/* The widget lives inside .entry-content, whose theme rule
   `.entry-content p { text-align: justify; margin-bottom: 1em }`
   would justify and over-space every <p> we render. Neutralise it with
   id-level specificity, then restore our own per-element spacing below. */
#cis-abstracts-app p { text-align: left; margin: 0; }
#cis-abstracts-app .cis-abs__full-body { text-align: left; }
#cis-abstracts-app .cis-abs__item-title { margin: 0 0 5px; }
#cis-abstracts-app .cis-abs__item-authors { margin: 0 0 4px; }
#cis-abstracts-app .cis-abs__item-teaser { margin: 8px 0 0; }
#cis-abstracts-app .cis-abs__full-authors { margin: 0 0 8px; }
#cis-abstracts-app .cis-abs__full-source { margin: 0 0 14px; }

/* ---- Toolbar ---- */
.cis-abs__toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	margin-bottom: 18px;
}
.cis-abs__search { flex: 1 1 280px; }
.cis-abs__input,
.cis-abs__select {
	font: inherit;
	height: 42px;                 /* keep input and selects the same height */
	color: #1a1a1a;
	background: #fff;
	border: 1px solid var(--cis-border);
	border-radius: 6px;
	padding: 0 12px;
	box-sizing: border-box;
	line-height: normal;
}
.cis-abs__input {
	width: 100%;
	font-size: 16px;
}
.cis-abs__input:focus,
.cis-abs__select:focus {
	outline: none;
	border-color: var(--cis-blue);
	box-shadow: 0 0 0 3px rgba(48, 114, 169, .15);
}
.cis-abs__filters { display: flex; flex-wrap: wrap; gap: 10px; }
/* Replace the cramped native dropdown arrow with a custom chevron that has
   a comfortable gap from the right edge; padding-right keeps option text clear. */
.cis-abs__select {
	cursor: pointer;
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	padding-right: 38px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23486b93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
}
.cis-abs__select::-ms-expand { display: none; }

/* ---- Highlight legend (shown only while searching) ---- */
.cis-abs__legend {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 16px;
	margin: -2px 0 16px;
	font-size: 13px;
	color: var(--cis-slate);
}
.cis-abs__legend[hidden] { display: none; }
.cis-abs__legend-label { font-weight: 600; color: #333; }
.cis-abs__legend mark { padding: 1px 7px; border-radius: 3px; color: inherit; }

/* ---- Results ---- */
.cis-abs__results {
	border: 1px solid var(--cis-border);
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
}
.cis-abs__meta {
	font-size: 14px;
	color: var(--cis-slate);
	padding: 10px 16px;
	border-bottom: 1px solid var(--cis-border);
	background: var(--cis-bg);
}

/* ---- Result list: one card per row, top to bottom ---- */
.cis-abs__list {
	list-style: none;
	margin: 0;
	padding: 0;
}
.cis-abs__item {
	padding: 18px 20px;
	border-bottom: 1px solid var(--cis-border);
}
.cis-abs__item:last-child { border-bottom: none; }
.cis-abs__item.is-open { background: #f8fafc; }
.cis-abs__item-title {
	color: var(--cis-navy);
	font-weight: 600;
	font-size: 18px;
	line-height: 1.35;
	margin: 0 0 5px;
}
.cis-abs__item-authors { font-size: 15px; color: #333; margin: 0 0 4px; }
.cis-abs__item-src { font-size: 14px; color: var(--cis-slate); line-height: 1.4; }
.cis-abs__item-src .cis-abs__tag {
	display: inline-block;
	background: var(--cis-blue);
	color: #fff;
	border-radius: 3px;
	padding: 1px 7px;
	font-size: 13px;
	margin-right: 6px;
}

/* ---- Rubrics (preview page): two sources (ВИНИТИ / ИИ), chips + tooltip ---- */
.cis-abs__rubrics {
	display: flex;
	flex-direction: column;
	gap: 5px;
	margin: 9px 0 0;
}
.cis-abs__rubgroup {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
}
.cis-abs__rubsrc {
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .03em;
	color: var(--cis-slate);
	padding: 2px 8px;
	border-radius: 4px;
	background: #eef2f6;
	white-space: nowrap;
}
.cis-abs__rubgroup--ai .cis-abs__rubsrc { color: #6a3fb0; background: #efe9fa; }
.cis-abs__rubric {
	display: inline-flex;
	align-items: baseline;
	gap: 6px;
	max-width: 100%;
	padding: 3px 10px;
	border-radius: 20px;
	font-size: 12.5px;
	line-height: 1.35;
	background: #eef4fa;
	color: var(--cis-navy);
	border: 1px solid #d5e3f0;
	cursor: help;
}
.cis-abs__rubgroup--ai .cis-abs__rubric {
	background: #f4f0fc;
	color: #4a2f7a;
	border-color: #e0d5f3;
}
.cis-abs__udc-chip { cursor: default; }
.cis-abs__rubric-code { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cis-abs__rubric-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 34ch; }
.cis-abs__rubric:focus-visible { outline: 2px solid var(--cis-navy); outline-offset: 1px; }

.cis-abs__rubric-tip {
	position: fixed;
	z-index: 10000;
	max-width: 340px;
	background: #0f1c2d;
	color: #fff;
	padding: 10px 12px;
	border-radius: 8px;
	font-size: 13px;
	line-height: 1.5;
	box-shadow: 0 8px 28px rgba(0, 0, 0, .28);
	pointer-events: none;
}
.cis-abs__rubric-tip[hidden] { display: none; }
.cis-abs__rubric-tip-title {
	display: block;
	font-weight: 700;
	font-size: 13.5px;
	margin-bottom: 5px;
}
.cis-abs__rubric-tip-meta {
	display: block;
	font-weight: 600;
	font-size: 11.5px;
	color: #9ec7ea;
	margin-bottom: 5px;
}
.cis-abs__rubric-tip-text { display: block; color: #dfe7f0; }

/* "Читать полностью" link to the external source (elibrary etc.). */
.cis-abs__readfull {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 14px;
	font-size: 14.5px;
	font-weight: 600;
	color: var(--cis-blue);
	text-decoration: none;
}
.cis-abs__readfull:hover { text-decoration: underline; }
.cis-abs__readfull:focus-visible { outline: 2px solid var(--cis-navy); outline-offset: 2px; border-radius: 3px; }
.cis-abs__readfull svg { flex: 0 0 auto; }
#cis-abstracts-app .cis-abs__noabs + .cis-abs__readfull { margin-top: 8px; }

/* Records whose abstract is missing in the source data. */
.cis-abs__noabs {
	margin: 10px 0 0;
	font-size: 14px;
	font-style: italic;
	color: var(--cis-slate);
}
#cis-abstracts-app .cis-abs__noabs { margin: 10px 0 0; }
.cis-abs__full-body.cis-abs__noabs { font-size: 15px; }

/* 2-line abstract teaser */
.cis-abs__item-teaser {
	font-size: 15px;
	color: #444;
	line-height: 1.55;
	margin: 8px 0 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
/* When the card is open the teaser is replaced by the full body — hide it. */
.cis-abs__item.is-open .cis-abs__item-teaser { display: none; }

/* ---- Inline full abstract ---- */
.cis-abs__full { margin-top: 12px; }
.cis-abs__full[hidden] { display: none; }
.cis-abs__full-loading {
	display: flex;
	align-items: center;
	color: var(--cis-slate);
	font-size: 15px;
	padding: 6px 0;
}
.cis-abs__full-authors { font-weight: 600; color: #222; margin: 0 0 8px; }
.cis-abs__full-source {
	color: var(--cis-slate);
	font-size: 14px;
	border-left: 3px solid var(--cis-border);
	padding-left: 12px;
	margin: 0 0 14px;
}
.cis-abs__full-body {
	font-size: 16px;
	line-height: 1.65;
	text-align: left;
	max-width: 82ch;
	color: #1a1a1a;
}

/* ---- "Смотреть полностью" / "Свернуть" button ---- */
.cis-abs__toggle {
	font: inherit;
	font-size: 15px;
	margin-top: 12px;
	padding: 8px 16px;
	border: 1px solid var(--cis-blue);
	background: #fff;
	color: var(--cis-blue);
	border-radius: 6px;
	cursor: pointer;
	transition: background .12s ease, color .12s ease;
}
.cis-abs__toggle:hover { background: var(--cis-blue); color: #fff; }
.cis-abs__item.is-open .cis-abs__toggle {
	border-color: var(--cis-border);
	color: var(--cis-slate);
}
.cis-abs__item.is-open .cis-abs__toggle:hover {
	background: var(--cis-bg);
	color: var(--cis-navy);
}

/* ---- Search-match highlight tiers ---- */
.cis-abs__hl {
	background: #fff3a0;          /* exact / morphological match */
	color: inherit;
	padding: 0 1px;
	border-radius: 2px;
}
.cis-abs__hl-stem {
	background: #c6ead0;          /* same-root (stemmed) match — green */
	color: inherit;
	padding: 0 1px;
	border-radius: 2px;
}
.cis-abs__hl-fuzzy {
	background: #cdbdf0;          /* approximate (typo) match — muted purple */
	color: inherit;
	padding: 0 1px;
	border-radius: 2px;
}

/* ---- Pager ---- */
.cis-abs__pager {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	align-items: center;
	justify-content: center;
	padding: 12px;
	border-top: 1px solid var(--cis-border);
	background: var(--cis-bg);
}
.cis-abs__pager button {
	font: inherit;
	font-size: 14px;
	min-width: 34px;
	padding: 6px 10px;
	border: 1px solid var(--cis-border);
	background: #fff;
	color: var(--cis-navy);
	border-radius: 5px;
	cursor: pointer;
}
.cis-abs__pager button:hover:not(:disabled) { border-color: var(--cis-blue); color: var(--cis-blue); }
.cis-abs__pager button.is-active {
	background: var(--cis-navy);
	color: #fff;
	border-color: var(--cis-navy);
	cursor: default;
}
.cis-abs__pager button:disabled { opacity: .45; cursor: default; }
.cis-abs__pager .cis-abs__ellipsis { padding: 0 4px; color: var(--cis-slate); }

/* ---- States ---- */
.cis-abs__state {
	padding: 30px 16px;
	text-align: center;
	color: var(--cis-slate);
	font-size: 15px;
}
.cis-abs.is-loading .cis-abs__results { opacity: .55; }
.cis-abs__spinner {
	display: inline-block;
	width: 18px; height: 18px;
	border: 2px solid var(--cis-border);
	border-top-color: var(--cis-blue);
	border-radius: 50%;
	animation: cis-spin .7s linear infinite;
	vertical-align: middle;
	margin-right: 8px;
}
@keyframes cis-spin { to { transform: rotate(360deg); } }

/* ============================================================
   Rubricator filter panel (preview page): left sidebar with a
   collapsible VINITI class tree; becomes a modal on narrow screens.
   ============================================================ */
.cis-abs__layout { display: flex; align-items: flex-start; gap: 24px; }
.cis-abs__main { flex: 1 1 auto; min-width: 0; }

.cis-abs__sidebar {
	flex: 0 0 384px;
	width: 384px;
	position: sticky;
	top: 16px;
	align-self: flex-start;
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 32px);
	border: 1px solid var(--cis-border);
	border-radius: 8px;
	background: #fff;
	overflow: hidden;
}
.cis-abs__rubhead {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px;
	border-bottom: 1px solid var(--cis-border);
	background: var(--cis-bg);
}
.cis-abs__rubtitle {
	margin: 0;
	font-size: 15px;
	font-weight: 700;
	color: var(--cis-navy);
}
.cis-abs__classtabs {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 4px;
	padding: 10px 12px 0;
}
.cis-abs__classtab {
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	padding: 7px 8px;
	border: 1px solid var(--cis-border);
	border-radius: 6px;
	background: #fff;
	color: var(--cis-slate);
	cursor: pointer;
}
.cis-abs__classtab:hover { border-color: var(--cis-blue); color: var(--cis-blue); }
.cis-abs__classtab.is-active {
	border-color: var(--cis-navy);
	background: var(--cis-navy);
	color: #fff;
}
.cis-abs__classtab:focus-visible { outline: 2px solid var(--cis-blue); outline-offset: 2px; }
.cis-abs__rubclose {
	display: none;                 /* only shown in the mobile modal */
	font: inherit;
	font-size: 18px;
	line-height: 1;
	border: none;
	background: none;
	color: var(--cis-slate);
	cursor: pointer;
	padding: 4px 6px;
}
.cis-abs__rubsearchwrap { padding: 10px 12px 0; }
.cis-abs__rubsearch {
	width: 100%;
	font: inherit;
	font-size: 14px;
	height: 36px;
	color: #1a1a1a;
	background: #fff;
	border: 1px solid var(--cis-border);
	border-radius: 6px;
	padding: 0 10px;
	box-sizing: border-box;
}
.cis-abs__rubsearch:focus {
	outline: none;
	border-color: var(--cis-blue);
	box-shadow: 0 0 0 3px rgba(48, 114, 169, .15);
}
.cis-abs__rubbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 20px;
	padding: 8px 14px 10px;
	gap: 10px;
}
.cis-abs__rubselcount { font-size: 12.5px; color: var(--cis-slate); }
.cis-abs__rubreset {
	font: inherit;
	font-size: 12.5px;
	border: none;
	background: none;
	color: var(--cis-blue);
	cursor: pointer;
	padding: 0;
	text-decoration: underline;
}
.cis-abs__rubreset[hidden] { display: none; }

/* ---- tree ---- */
.cis-abs__rubtree {
	flex: 1 1 auto;
	min-height: 0;                 /* allow the flex child to shrink and scroll */
	overflow-y: auto;
	padding: 4px 8px 12px;
	border-top: 1px solid var(--cis-border);
}
.cis-abs__rubloading, .cis-abs__rubempty {
	padding: 16px 8px;
	font-size: 14px;
	color: var(--cis-slate);
	display: flex;
	align-items: center;
}
.cis-abs__rubchildren { padding-left: 15px; }
.cis-abs__rubchildren[hidden] { display: none; }
.cis-abs__rubrow {
	display: flex;
	align-items: flex-start;
	gap: 2px;
	border-radius: 5px;
}
.cis-abs__rubrow:hover { background: #f2f6fa; }

/* grey "selection inside" pill on collapsed ancestors of a selected class */
.cis-abs__rubtrail {
	display: none;
	flex: 0 0 auto;
	align-self: center;
	min-width: 16px;
	height: 16px;
	box-sizing: border-box;
	padding: 0 5px;
	font-size: 10.5px;
	font-weight: 700;
	line-height: 16px;
	text-align: center;
	color: #55677a;
	background: #dde4ec;
	border-radius: 9px;
}
.cis-abs__rubnode.is-selpath:not(.is-open) > .cis-abs__rubrow > .cis-abs__rubtrail { display: inline-block; }
.cis-abs__rubnode.is-selpath > .cis-abs__rubrow > .cis-abs__rubtoggle { color: var(--cis-blue); }
.cis-abs__rubnode.is-selpath:not(.is-open) > .cis-abs__rubrow { background: #eef2f6; }
.cis-abs__rubtoggle {
	flex: 0 0 20px;
	width: 20px;
	height: 26px;
	padding: 0;
	border: none;
	background: none;
	cursor: pointer;
	position: relative;
	color: var(--cis-slate);
}
.cis-abs__rubtoggle:not(.cis-abs__rubtoggle--leaf)::before {
	content: "";
	position: absolute;
	top: 9px;
	left: 6px;
	width: 6px;
	height: 6px;
	border-right: 1.6px solid currentColor;
	border-bottom: 1.6px solid currentColor;
	transform: rotate(-45deg);   /* ▸ collapsed */
	transition: transform .12s ease;
}
.cis-abs__rubnode.is-open > .cis-abs__rubrow > .cis-abs__rubtoggle::before {
	transform: rotate(45deg);    /* ▾ expanded */
}
.cis-abs__rublabel {
	flex: 1 1 auto;
	display: flex;
	align-items: baseline;
	gap: 7px;
	padding: 4px 8px 4px 2px;
	cursor: pointer;
	min-width: 0;
}
.cis-abs__rubcheck {
	flex: 0 0 auto;
	margin: 0;
	position: relative;
	top: 2px;
	accent-color: var(--cis-blue);
	cursor: pointer;
}
.cis-abs__rubcode {
	flex: 0 0 auto;
	font-size: 12px;
	font-weight: 700;
	color: var(--cis-blue);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}
.cis-abs__rubname {
	flex: 1 1 auto;
	font-size: 13px;
	line-height: 1.35;
	color: #22303f;
	min-width: 0;
	overflow-wrap: anywhere;
}
.cis-abs__rubcount {
	flex: 0 0 auto;
	margin-left: auto;             /* always separated from the name */
	font-size: 11.5px;
	color: var(--cis-slate);
	font-variant-numeric: tabular-nums;
	background: #eef2f6;
	border-radius: 10px;
	padding: 1px 7px;
	align-self: center;
	white-space: nowrap;
}
/* checked row emphasis */
.cis-abs__rublabel:has(.cis-abs__rubcheck:checked) .cis-abs__rubname { font-weight: 600; color: var(--cis-navy); }
.cis-abs__rublabel:has(.cis-abs__rubcheck:checked) .cis-abs__rubcount { background: #d7e6f4; color: var(--cis-navy); }

/* ---- orange "not all records have a rubric" notice ---- */
.cis-abs__rubnotice {
	display: flex;
	align-items: center;
	gap: 9px;
	margin: 0 0 14px;
	padding: 10px 14px;
	font-size: 13.5px;
	line-height: 1.45;
	color: #7a4e0a;
	background: #fff5e6;
	border: 1px solid #f2c98a;
	border-radius: 7px;
}
.cis-abs__rubnotice[hidden] { display: none; }
.cis-abs__rubnotice svg { flex: 0 0 auto; color: #d98917; }

/* ---- mobile "Рубрикатор" trigger (hidden on desktop) ---- */
.cis-abs__rubopen {
	display: none;
	align-items: center;
	gap: 7px;
	font: inherit;
	font-size: 15px;
	height: 42px;
	padding: 0 14px;
	border: 1px solid var(--cis-border);
	border-radius: 6px;
	background: #fff;
	color: var(--cis-navy);
	cursor: pointer;
}
.cis-abs__rubopen.has-sel { border-color: var(--cis-blue); color: var(--cis-blue); }
.cis-abs__rubopen.has-sel[data-count]::after {
	content: attr(data-count);
	font-size: 11px;
	font-weight: 700;
	color: #fff;
	background: var(--cis-blue);
	border-radius: 10px;
	padding: 1px 7px;
}
.cis-abs__rubbackdrop {
	display: none;
	position: fixed;
	top: 0; right: 0; bottom: 0; left: 0;
	z-index: 998;
	border: none;
	padding: 0;
	background: rgba(10, 25, 45, .45);
}

/* ---- Tablet / mobile: sidebar becomes an off-canvas modal ---- */
@media (max-width: 980px) {
	.cis-abs__rubopen { display: inline-flex; }
	.cis-abs__rubbackdrop:not([hidden]) { display: block; }
	.cis-abs__sidebar {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		z-index: 999;
		width: min(360px, 88vw);
		max-height: none;
		height: 100%;
		border-radius: 0;
		border-right: 1px solid var(--cis-border);
		box-shadow: 0 0 40px rgba(0, 0, 0, .25);
		transform: translateX(-102%);
		transition: transform .22s ease;
	}
	.cis-abs.is-rubopen .cis-abs__sidebar { transform: translateX(0); }
	.cis-abs__rubclose { display: block; }
	.cis-abs__rubtree { flex: 1 1 auto; }
}

/* ---- Narrow screens ---- */
@media (max-width: 600px) {
	.cis-abs__item { padding: 16px 14px; }
	.cis-abs__item-title { font-size: 17px; }
	.cis-abs__toggle { width: 100%; }
}
