/**
 * Typography for editor HTML (.cncgc-prose) — shared by news
 * (single-news.php) and information pages (template-parts/page/info.php).
 *
 * main.css globally resets ul/ol (no bullets, no padding) and has no styles
 * for blockquote/table/figure, so list/table/quote markup from the editor
 * would otherwise render as flat unstyled text.
 * Mobile First. Breakpoints: 576 / 768.
 */

/* Same text and h2 as the product «Описание» tab (product.css). */
.cncgc-prose {
	font-size: 1rem;
	line-height: 1.7;
	color: var(--cncgc-text);
	overflow-wrap: break-word;

	/* Russian hyphenation by the browser dictionary (<html lang="ru-RU">). */
	hyphens: auto;
	hyphenate-limit-chars: 6 3 3;
}

.cncgc-prose > * {
	max-width: 72ch;
}

.cncgc-prose > figure,
.cncgc-prose > .wp-block-image,
.cncgc-prose > .wp-block-gallery,
.cncgc-prose > .wp-block-embed,
.cncgc-prose > .wp-block-video,
.cncgc-prose > .wp-block-table,
.cncgc-prose > .wp-caption,
.cncgc-prose > table,
.cncgc-prose > iframe,
.cncgc-prose > p:has(> img:only-child),
.cncgc-prose > p:has(> a:only-child > img) {
	max-width: none;
}

.cncgc-prose > :first-child {
	margin-top: 0;
}

.cncgc-prose h2,
.cncgc-prose h3,
.cncgc-prose h4,
.cncgc-prose h5,
.cncgc-prose h6 {
	margin: 1.75em 0 0.6em;
	font-weight: 600;
	line-height: 1.3;
	color: var(--cncgc-black);
	hyphens: manual;
}

.cncgc-prose h2 {
	font-size: clamp(1.3rem, 1.1rem + 0.8vw, 1.625rem);
}

.cncgc-prose h3 {
	font-size: clamp(1.125rem, 1rem + 0.4vw, 1.3rem);
}

.cncgc-prose h4,
.cncgc-prose h5,
.cncgc-prose h6 {
	font-size: 1.0625rem;
}

.cncgc-prose p {
	margin: 0 0 1em;
}

.cncgc-prose strong,
.cncgc-prose b {
	color: var(--cncgc-text);
	font-weight: 700;
}

.cncgc-prose a {
	color: var(--cncgc-black);
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
}

.cncgc-prose a:hover {
	color: var(--cncgc-red);
}

.cncgc-prose ul,
.cncgc-prose ol {
	margin: 0 0 1.25em;
	padding-left: 1.5em;
}

.cncgc-prose ul {
	list-style: disc;
}

.cncgc-prose ol {
	list-style: decimal;
}

.cncgc-prose li {
	margin-bottom: 0.4em;
}

.cncgc-prose li > ul,
.cncgc-prose li > ol {
	margin: 0.4em 0 0;
}

.cncgc-prose li::marker {
	color: var(--cncgc-text-muted);
}

.cncgc-prose blockquote {
	margin: 1.5em 0;
	padding: 4px 0 4px 20px;
	border-left: 3px solid var(--cncgc-red);
	color: var(--cncgc-text);
	font-size: 1.0625rem;
}

.cncgc-prose blockquote p:last-child {
	margin-bottom: 0;
}

.cncgc-prose hr {
	margin: 2em 0;
	border: 0;
	border-top: 1px solid var(--cncgc-border);
}

.cncgc-prose img {
	max-width: 100%;
	height: auto;
}

.cncgc-prose figure {
	margin: 1.75em 0;
}

.cncgc-prose figure img,
.cncgc-prose .wp-caption img,
.cncgc-prose > p > img:only-child,
.cncgc-prose > p > a:only-child > img {
	width: 100%;
	max-height: none;
}

.cncgc-prose figcaption,
.cncgc-prose .wp-caption-text {
	margin-top: 8px;
	font-size: 0.8125rem;
	color: var(--cncgc-text-muted);
	text-align: left;
}

.cncgc-prose .wp-caption {
	width: auto !important; /* classic editor writes an inline px width */
	max-width: 100%;
	margin: 1.75em 0;
}

.cncgc-prose .aligncenter {
	margin-inline: auto;
}

@media (min-width: 768px) {
	.cncgc-prose .alignleft {
		float: left;
		max-width: 50%;
		margin: 0.4em 1.5em 1em 0;
	}

	.cncgc-prose .alignright {
		float: right;
		max-width: 50%;
		margin: 0.4em 0 1em 1.5em;
	}

	.cncgc-prose::after {
		content: "";
		display: table;
		clear: both;
	}
}

/* Tables (e.g. results) — horizontally scrollable on narrow screens. */
.cncgc-prose .wp-block-table {
	margin: 1.5em 0;
	overflow-x: auto;
}

.cncgc-prose table {
	width: 100%;
	margin: 1.5em 0;
	border-collapse: collapse;
	font-size: 0.9375rem;
	color: var(--cncgc-text);
}

.cncgc-prose .wp-block-table table {
	margin: 0;
}

.cncgc-prose th,
.cncgc-prose td {
	padding: 12px 12px 12px 0;
	border-bottom: 1px solid var(--cncgc-border);
	text-align: left;
	vertical-align: top;
}

.cncgc-prose th {
	font-weight: 600;
	color: var(--cncgc-black);
}

.cncgc-prose td:last-child,
.cncgc-prose th:last-child {
	padding-right: 0;
}

@media (max-width: 575.98px) {
	.cncgc-prose > table {
		display: block;
		overflow-x: auto;
	}
}

/* Core gallery / [gallery] shortcode inside the text itself. */
.cncgc-prose .wp-block-gallery,
.cncgc-prose .gallery {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 8px;
	margin: 1.5em 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 768px) {
	.cncgc-prose .wp-block-gallery,
	.cncgc-prose .gallery {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.cncgc-prose .wp-block-gallery figure,
.cncgc-prose .gallery .gallery-item {
	margin: 0;
	width: auto !important; /* core writes an inline/percent width */
}

.cncgc-prose .wp-block-gallery img,
.cncgc-prose .gallery img {
	width: 100%;
	height: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.cncgc-prose iframe,
.cncgc-prose video {
	max-width: 100%;
}

.cncgc-prose .wp-block-embed__wrapper iframe,
.cncgc-prose > iframe,
.cncgc-prose > p > iframe {
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
}
