/* CIS abstracts database — master/detail 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;
}

/* 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; }
/* Neutralise the theme's large heading top-margin on the detail title. */
#cis-abstracts-app h2 { margin-top: 0; }
#cis-abstracts-app .cis-abs__detail-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-excerpt { margin: 6px 0 0; }
#cis-abstracts-app .cis-abs__detail-authors { margin: 0 0 8px; }
#cis-abstracts-app .cis-abs__detail-source { margin: 0 0 18px; }

/* ---- 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; }
.cis-abs__select { cursor: pointer; }

/* ---- 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; }

/* ---- Layout ---- */
.cis-abs__layout {
	display: grid;
	grid-template-columns: minmax(440px, 600px) minmax(0, 1fr);
	gap: 24px;
	align-items: start;
}
.cis-abs__list-pane {
	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 14px;
	border-bottom: 1px solid var(--cis-border);
	background: var(--cis-bg);
}

/* ---- Result list ---- */
.cis-abs__list {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: calc(70vh + 180px);              /* ~2 more rows visible */
	overflow-y: auto;
	scrollbar-width: thin;                       /* Firefox */
	scrollbar-color: rgba(72, 107, 147, .22) transparent;
}
.cis-abs__list::-webkit-scrollbar { width: 8px; }
.cis-abs__list::-webkit-scrollbar-track { background: transparent; }
.cis-abs__list::-webkit-scrollbar-thumb {
	background: rgba(72, 107, 147, .22);
	border-radius: 8px;
}
.cis-abs__list::-webkit-scrollbar-thumb:hover { background: rgba(72, 107, 147, .4); }
.cis-abs__item {
	padding: 12px 14px;
	border-bottom: 1px solid var(--cis-border);
	cursor: pointer;
	transition: background .12s ease;
}
.cis-abs__item:last-child { border-bottom: none; }
.cis-abs__item:hover { background: var(--cis-bg); }
.cis-abs__item.is-active {
	background: #eef4fa;
	box-shadow: inset 3px 0 0 var(--cis-blue);
}
.cis-abs__item-title {
	color: var(--cis-navy);
	font-weight: 600;
	font-size: 16px;
	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-excerpt {
	font-size: 13.5px;
	color: #555;
	line-height: 1.5;
	margin: 6px 0 0;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.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;
}

/* ---- Detail pane ---- */
.cis-abs__detail-pane {
	border: 1px solid var(--cis-border);
	border-radius: 8px;
	background: #fff;
	padding: 24px 28px;
	min-height: 200px;
	position: relative;
}
.cis-abs__overlay {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding-top: 60px;
	background: rgba(255, 255, 255, .65);
	border-radius: 8px;
	z-index: 2;
}
.cis-abs__placeholder { color: var(--cis-slate); font-style: italic; padding: 40px 0; text-align: center; }
.cis-abs__detail h2 {
	color: var(--cis-navy);
	font-size: 20px;
	line-height: 1.3;
	margin: 0 0 12px;
	font-weight: 600;
}
.cis-abs__detail-authors { font-weight: 600; color: #222; margin: 0 0 8px; }
.cis-abs__detail-source {
	color: var(--cis-slate);
	font-size: 14px;
	border-left: 3px solid var(--cis-border);
	padding-left: 12px;
	margin: 0 0 18px;
}
.cis-abs__detail-body { font-size: 16px; line-height: 1.65; text-align: left; max-width: 82ch; }
.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;
}
.cis-abs__detail-badges { margin: 0 0 14px; }
.cis-abs__detail-badges .cis-abs__tag {
	display: inline-block;
	background: var(--cis-bg);
	color: var(--cis-navy);
	border: 1px solid var(--cis-border);
	border-radius: 4px;
	padding: 3px 10px;
	font-size: 13px;
	margin: 0 6px 6px 0;
}

/* ---- 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__list-pane { 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); } }

/* ---- Responsive: single column; the abstract opens as a bottom-sheet popup
   over a dimmed backdrop, so it's clearly a popup over the list (incl. deep
   links), not a bare standalone article. ---- */
@media (max-width: 860px) {
	.cis-abs__layout { grid-template-columns: 1fr; }
	.cis-abs__detail-pane { display: none; }

	/* Dimmed backdrop behind the sheet. */
	.cis-abs.show-detail::before {
		content: '';
		position: fixed;
		inset: 0;
		background: rgba(15, 28, 45, .45);
		z-index: 9998;
	}
	/* The sheet: leaves a gap at the top so the app is sensed behind it. */
	.cis-abs.show-detail .cis-abs__detail-pane {
		display: block;
		position: fixed;
		left: 0;
		right: 0;
		bottom: 0;
		top: 84px;
		z-index: 9999;
		margin: 0;
		border: none;
		border-radius: 16px 16px 0 0;
		box-shadow: 0 -6px 30px rgba(0, 0, 0, .28);
		min-height: 0;
		padding: 0 18px 40px;
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
	}
	/* Sticky close bar at the top of the sheet. */
	.cis-abs.show-detail .cis-abs__back {
		display: flex;
		align-items: center;
		position: sticky;
		top: 0;
		width: calc(100% + 36px);
		margin: 0 -18px 18px;
		padding: 16px 18px;
		background: #fff;
		border: none;
		border-bottom: 1px solid var(--cis-border);
		border-radius: 16px 16px 0 0;
		color: var(--cis-blue);
		font: inherit;
		font-size: 15px;
		cursor: pointer;
		z-index: 1;
	}
}
.cis-abs__back { display: none; }
