/**
 * Front-end presentation for imported content (v3.6).
 *
 * Replaces the inline styles the plugin used to bake into post_content.
 * Everything is scoped to the plugin's own classes so it can never leak into
 * the rest of the theme, works in both LTR and RTL, and inherits the theme's
 * colors through currentColor / color-mix instead of hardcoding a palette.
 *
 * Local asset only — no CDN, no web fonts (see the project rule).
 */

/* ---------------------------------------------------------------------
 * Article body
 * ------------------------------------------------------------------- */

.cei-article {
	text-align: justify;
	text-justify: inter-word;
}

.cei-article h2,
.cei-article h3 {
	margin-top: 2em;
}

.cei-article figure {
	margin: 1.75em 0;
}

/* v4.16 — every picture this plugin places is centred.
 *
 * The markup carries core's own `aligncenter` class, which a block theme
 * already styles. These rules are for the two cases where it does not: a
 * classic theme with no block stylesheet, and a target site that received the
 * post over REST and got this file inlined with it. Scoped to the plugin's own
 * wrappers so nothing else on the page moves. */
.cei-article figure.aligncenter,
.cei-article .wp-block-image.aligncenter,
figure.wp-block-image.aligncenter.cei-generated-image {
	margin-left: auto;
	margin-right: auto;
	text-align: center;
}

.cei-article figure.aligncenter img,
.cei-article .wp-block-image.aligncenter img,
figure.wp-block-image.aligncenter.cei-generated-image img {
	display: block;
	margin-left: auto;
	margin-right: auto;
}

.cei-article figure img,
.cei-generated-image img {
	max-width: 100%;
	height: auto;
	border-radius: 8px;
}

.cei-article figcaption,
.cei-generated-image figcaption {
	font-size: 0.875em;
	opacity: 0.75;
	margin-top: 0.5em;
	text-align: center;
}

/* ---------------------------------------------------------------------
 * Shared collapsible chrome (TOC + FAQ)
 * ------------------------------------------------------------------- */

.cei-collapsible > summary {
	cursor: pointer;
	list-style: none;
	position: relative;
	padding-inline-end: 1.75em;
	font-weight: 700;
}

/* Hide the native marker; the arrow below replaces it in every browser. */
.cei-collapsible > summary::-webkit-details-marker {
	display: none;
}

.cei-collapsible > summary::after {
	content: "";
	position: absolute;
	inset-inline-end: 0.25em;
	top: 50%;
	width: 0.55em;
	height: 0.55em;
	border-inline-end: 2px solid currentColor;
	border-block-end: 2px solid currentColor;
	transform: translateY(-70%) rotate(45deg);
	transition: transform 0.2s ease;
	opacity: 0.6;
}

.cei-collapsible[open] > summary::after {
	transform: translateY(-30%) rotate(225deg);
}

.cei-collapsible > summary:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
	border-radius: 4px;
}

/* ---------------------------------------------------------------------
 * Table of contents
 * ------------------------------------------------------------------- */

.cei-toc {
	border: 1px solid rgba(128, 128, 128, 0.3);
	border-radius: 8px;
	padding: 16px 24px;
	margin: 0 0 24px;
	background: rgba(128, 128, 128, 0.04);
}

.cei-toc-title {
	display: block;
	font-weight: 700;
	margin-bottom: 0.5em;
}

.cei-toc .cei-toc-body ul {
	margin: 0;
	padding-inline-start: 1.25em;
}

.cei-toc .cei-toc-body > ul {
	list-style: decimal;
}

.cei-toc .cei-toc-body ul ul {
	list-style: disc;
	margin-top: 0.25em;
}

.cei-toc li {
	margin: 0.25em 0;
}

.cei-toc a {
	text-decoration: none;
}

.cei-toc a:hover,
.cei-toc a:focus {
	text-decoration: underline;
}

.cei-toc-h4 {
	font-size: 0.95em;
	opacity: 0.85;
}

/* Collapsed TOC needs no bottom padding under the summary. */
.cei-toc.cei-collapsible:not([open]) {
	padding-bottom: 12px;
}

/* ---------------------------------------------------------------------
 * FAQ
 * ------------------------------------------------------------------- */

.cei-faq {
	margin: 2.5em 0 0;
}

.cei-faq-title {
	margin-bottom: 0.75em;
}

.cei-faq-item {
	border: 1px solid rgba(128, 128, 128, 0.3);
	border-radius: 8px;
	padding: 12px 18px;
	margin-bottom: 10px;
}

.cei-faq-item[open] {
	background: rgba(128, 128, 128, 0.04);
}

.cei-faq-question {
	font-size: 1.05em;
	font-weight: 700;
	margin: 0;
}

.cei-faq-answer {
	padding-top: 0.5em;
}

.cei-faq-answer p:last-child {
	margin-bottom: 0;
}

/* ---------------------------------------------------------------------
 * Source attribution + keyword links
 * ------------------------------------------------------------------- */

.cei-source {
	font-size: 0.875em;
	opacity: 0.7;
	margin-top: 2em;
}

.cei-keyword-link {
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

/* ---------------------------------------------------------------------
 * Print: expand everything, drop the chrome
 * ------------------------------------------------------------------- */

@media print {
	.cei-collapsible > summary::after {
		display: none;
	}

	.cei-faq-item,
	.cei-toc {
		border-color: #999;
		background: none;
	}
}
