/* ==========================================================================
   CROPAS — блоки редактора WordPress (Gutenberg)

   Правила привязаны к классам самих блоков (.wp-block-*), а не к обёртке
   контента: один и тот же файл подключается и на фронтенде (inc/enqueue.php,
   только на singular — там, где выводится the_content()), и в редакторе
   (add_editor_style в inc/setup.php). Так вид в админке и на сайте не расходится.

   Собственная разметка темы классы .wp-block-* не использует, поэтому
   пересечений с дизайн-секциями нет. Немногие правила на голые теги
   (инлайн-код, подписи) оставлены под обёрткой контента.
   ========================================================================== */

/* --- Ритм между блоками -------------------------------------------------- */
.article-body > *,
.page-content > *,
.case-body > * { margin-top: 26px; margin-bottom: 0; }
.article-body > *:first-child,
.page-content > *:first-child,
.case-body > *:first-child { margin-top: 0; }

/* --- Заголовки ----------------------------------------------------------- */
h2.wp-block-heading, h3.wp-block-heading { margin-top: 38px; }
h4.wp-block-heading { font-weight: 800; font-size: 19px; line-height: 1.3; letter-spacing: -.01em; color: var(--c-black); margin: 30px 0 8px; }
h5.wp-block-heading { font-weight: 800; font-size: 17px; line-height: 1.35; color: var(--c-black); margin: 26px 0 8px; }
h6.wp-block-heading { font-weight: 700; font-size: 15px; line-height: 1.4; text-transform: uppercase; letter-spacing: .06em; color: var(--c-muted); margin: 24px 0 8px; }

/* --- Буквица ------------------------------------------------------------- */
.has-drop-cap:not(:focus)::first-letter {
	float: left; font-weight: 800; font-size: 3.4em; line-height: .82;
	margin: .06em .12em 0 0; color: var(--accent-hover);
}

/* --- Цитаты -------------------------------------------------------------- */
.wp-block-quote {
	margin: 30px 0; padding: 20px 24px; border-left: 3px solid var(--accent);
	background: var(--bg-soft, #F5F8FC); border-radius: 0 14px 14px 0;
}
.wp-block-quote p { font-weight: 600; font-size: 17px; line-height: 1.6; color: var(--c-black); margin: 0 0 8px; }
.wp-block-quote cite { display: block; font-style: normal; font-weight: 600; font-size: 13.5px; color: var(--c-muted); }

.wp-block-pullquote { margin: 36px 0; padding: 28px 0; border-top: 2px solid var(--bd); border-bottom: 2px solid var(--bd); text-align: center; }
.wp-block-pullquote blockquote { margin: 0; padding: 0; border: 0; background: none; }
.wp-block-pullquote p { font-weight: 800; font-size: clamp(20px, 2.2vw, 26px); line-height: 1.3; letter-spacing: -.01em; color: var(--c-black); margin: 0; }
.wp-block-pullquote cite { display: block; margin-top: 10px; font-style: normal; font-weight: 600; font-size: 13.5px; color: var(--c-muted); }

/* --- Изображения и подписи ----------------------------------------------- */
.wp-block-image { margin: 30px 0; }
.wp-block-image img { display: block; width: 100%; height: auto; border-radius: 16px; }
.wp-block-image.alignleft { float: left; max-width: 46%; margin: 6px 26px 18px 0; }
.wp-block-image.alignright { float: right; max-width: 46%; margin: 6px 0 18px 26px; }
.wp-element-caption,
.wp-block-image figcaption,
.wp-block-table figcaption,
.wp-block-embed figcaption,
.wp-block-gallery figcaption { margin-top: 10px; font-weight: 500; font-size: 13.5px; line-height: 1.5; color: var(--c-muted); text-align: center; }

/* --- Галерея ------------------------------------------------------------- */
.wp-block-gallery.has-nested-images { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 30px 0; }
.wp-block-gallery.columns-1 { grid-template-columns: 1fr; }
.wp-block-gallery.columns-2 { grid-template-columns: repeat(2, 1fr); }
.wp-block-gallery.columns-4 { grid-template-columns: repeat(4, 1fr); }
.wp-block-gallery figure { margin: 0; }
.wp-block-gallery img { border-radius: 12px; aspect-ratio: 4 / 3; object-fit: cover; }

/* --- Колонки и группы ---------------------------------------------------- */
.wp-block-columns { display: flex; flex-wrap: wrap; gap: 26px; margin: 30px 0; }
.wp-block-column { flex: 1 1 0; min-width: 220px; }
.wp-block-column > *:first-child,
.wp-block-group > *:first-child,
.wp-block-group__inner-container > *:first-child { margin-top: 0; }
.wp-block-group.has-background { padding: 24px 26px; border-radius: 16px; }

/* --- Таблицы ------------------------------------------------------------- */
.wp-block-table { margin: 30px 0; overflow-x: auto; }
.wp-block-table table {
	width: 100%; border-collapse: collapse; font-size: 15px; background: #fff;
	border: 1px solid var(--bd); border-radius: 14px; overflow: hidden;
}
.wp-block-table th {
	text-align: left; font-weight: 700; font-size: 13.5px; text-transform: uppercase; letter-spacing: .03em;
	color: var(--c-text-3, #3B4557); background: var(--bg-soft, #F5F8FC); padding: 12px 16px; border-bottom: 1px solid var(--bd);
}
.wp-block-table td { padding: 12px 16px; border-bottom: 1px solid var(--bd-4, #EEF2F8); color: var(--c-text); }
.wp-block-table tr:last-child td { border-bottom: none; }
.wp-block-table.is-style-stripes tbody tr:nth-child(odd) td { background: var(--bg-soft-2, #FBFCFE); }

/* --- Код, преформат, стихи ----------------------------------------------- */
.wp-block-code,
.wp-block-preformatted {
	margin: 26px 0; padding: 18px 20px; background: #0F1830; color: #E7EDF9;
	border-radius: 14px; overflow-x: auto;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 14px; line-height: 1.6; white-space: pre;
}
.wp-block-code code { background: none; padding: 0; color: inherit; font-size: inherit; }
.wp-block-verse {
	margin: 26px 0; padding: 18px 20px; background: var(--bg-soft, #F5F8FC); color: var(--c-text);
	border-radius: 14px; font-style: italic; white-space: pre-wrap;
}
/* Инлайн-код: правило на голый тег — держим под обёрткой контента. */
.article-body :not(pre) > code,
.page-content :not(pre) > code,
.case-body :not(pre) > code {
	background: var(--accent-tint); color: var(--accent-hover); padding: 2px 6px; border-radius: 6px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em;
}

/* --- Кнопки -------------------------------------------------------------- */
.wp-block-buttons { display: flex; flex-wrap: wrap; gap: 12px; margin: 28px 0; }
.wp-block-button__link {
	display: inline-flex; align-items: center; justify-content: center; min-height: 46px;
	padding: 13px 22px; border-radius: var(--r-pill, 999px);
	background: var(--accent); color: #fff; font-weight: 700; font-size: 15px; line-height: 1;
	text-decoration: none; border: 1px solid var(--accent); transition: background var(--tr), border-color var(--tr);
}
.wp-block-button__link:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.wp-block-button.is-style-outline .wp-block-button__link { background: transparent; color: var(--accent-hover); border-color: var(--bd); }
.wp-block-button.is-style-outline .wp-block-button__link:hover { border-color: var(--accent); background: var(--accent-tint); color: var(--accent-hover); }

/* --- Разделители --------------------------------------------------------- */
.wp-block-separator { height: 0; border: 0; border-top: 1px solid var(--bd); margin: 36px auto; max-width: 120px; opacity: 1; }
.wp-block-separator.is-style-wide { max-width: none; }
.wp-block-separator.is-style-dots { border: 0; max-width: none; text-align: center; line-height: 1; height: auto; }
.wp-block-separator.is-style-dots::before { content: "···"; font-size: 26px; letter-spacing: 12px; color: var(--c-muted-3, #7C8698); padding-left: 12px; }

/* --- Встраивания, видео, аудио ------------------------------------------- */
.wp-block-embed { margin: 30px 0; }
.wp-block-embed__wrapper { position: relative; }
.wp-embed-aspect-16-9 .wp-block-embed__wrapper { aspect-ratio: 16 / 9; }
.wp-embed-aspect-4-3 .wp-block-embed__wrapper { aspect-ratio: 4 / 3; }
.wp-block-embed iframe,
.wp-block-video video { width: 100%; height: 100%; border: 0; border-radius: 16px; display: block; }
.wp-block-audio audio { width: 100%; }

/* --- Медиа и текст ------------------------------------------------------- */
.wp-block-media-text { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: center; margin: 30px 0; }
.wp-block-media-text.has-media-on-the-right { grid-template-areas: "content media"; }
.wp-block-media-text.has-media-on-the-right .wp-block-media-text__media { grid-area: media; }
.wp-block-media-text__media img { width: 100%; height: auto; border-radius: 16px; display: block; }
.wp-block-media-text__content > *:first-child { margin-top: 0; }

/* --- Обложка ------------------------------------------------------------- */
.wp-block-cover {
	position: relative; display: flex; align-items: center; justify-content: center;
	min-height: 360px; padding: 40px; margin: 30px 0; overflow: hidden; border-radius: 20px;
	background: #0F1830; color: #fff; text-align: center;
}
.wp-block-cover img.wp-block-cover__image-background { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.wp-block-cover__background { position: absolute; inset: 0; background: rgba(11, 20, 38, .55); }
.wp-block-cover__inner-container { position: relative; z-index: 1; max-width: 640px; }
.wp-block-cover p { color: #fff; font-weight: 800; font-size: clamp(22px, 2.6vw, 32px); line-height: 1.2; margin: 0; }

/* --- Спойлер ------------------------------------------------------------- */
.wp-block-details { margin: 24px 0; padding: 16px 20px; border: 1px solid var(--bd); border-radius: 14px; background: #fff; }
.wp-block-details summary { cursor: pointer; font-weight: 700; font-size: 16px; color: var(--c-black); }
.wp-block-details[open] summary { margin-bottom: 10px; }

/* --- Файл ---------------------------------------------------------------- */
.wp-block-file {
	display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 24px 0;
	padding: 14px 18px; border: 1px solid var(--bd); border-radius: 14px; background: var(--bg-soft, #F5F8FC);
	font-weight: 600; font-size: 15px;
}
.wp-block-file__button { margin-left: auto; background: var(--accent); color: #fff; border-radius: 999px; padding: 9px 18px; font-weight: 700; font-size: 14px; text-decoration: none; }

/* --- Утилиты ядра -------------------------------------------------------- */
.wp-block-spacer { margin: 0; }

/* --- Адаптив ------------------------------------------------------------- */
@media (max-width: 780px) {
	.wp-block-columns { flex-direction: column; gap: 20px; }
	.wp-block-media-text,
	.wp-block-media-text.has-media-on-the-right { grid-template-columns: 1fr; grid-template-areas: none; }
	.wp-block-gallery.has-nested-images { grid-template-columns: repeat(2, 1fr); }
	.wp-block-image.alignleft,
	.wp-block-image.alignright { float: none; max-width: 100%; margin: 24px 0; }
	.wp-block-cover { min-height: 260px; padding: 28px; }
}
