/* CM24 additions on top of the WordPress CSS (cm24.css): blocks of the CM24 editor that the
   SmartMag theme does not know. Styled to look like their WordPress counterparts. */

/* Gallery (editor "qm-gallery") ≈ core/gallery, columns-default, is-cropped */
.post-content .qm-gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 0 0 1.7em; }
.post-content .qm-gallery[data-count="2"], .post-content .qm-gallery[data-count="4"] { grid-template-columns: repeat(2, 1fr); }
.post-content .qm-gallery--slider { grid-template-columns: 1fr; }
.post-content .qm-gallery__item { margin: 0; position: relative; display: flex; flex-direction: column; }
.post-content .qm-gallery__link, .post-content .qm-gallery picture { display: block; height: 100%; }
.post-content .qm-gallery__img { display: block; width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.post-content .qm-gallery--slider .qm-gallery__img { aspect-ratio: auto; height: auto; }
.post-content .qm-gallery__caption { font-size: 13px; font-style: italic; color: var(--c-contrast-450, #7d7d7d); text-align: center; margin-top: 6px; }
@media (max-width: 540px) { .post-content .qm-gallery { grid-template-columns: 1fr; } }

/* Inline photo: same caption look as WP figure captions */
.post-content figure > picture > img.inline-picture { display: block; max-width: 100%; height: auto; margin: 0 auto; }
.post-content figure > figcaption { font-size: 13px; font-style: italic; color: var(--c-contrast-450, #7d7d7d); text-align: center; margin-top: 7px; }

/* YouTube: responsive 16:9 like wp-embed-aspect-16-9 */
.post-content .youtube-block { position: relative; padding-top: 56.25%; margin: 0 0 1.7em; }
.post-content .youtube-block iframe { position: absolute; inset: 0; width: 100%; height: 100%; }

/* Social embeds (Instagram, Telegram, TikTok, X, Threads, Facebook) */
.post-content .frame-block { display: flex; justify-content: center; margin: 0 0 1.7em; }
.post-content .frame-block > * { max-width: 100%; }
.post-content .frame-block iframe { max-width: 100%; }

/* Smooth scrolling to anchors, as on the WP sites (it came with Elementor's CSS there) */
@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}

/* CMS «Просмотр» of an unpublished post (/preview/<id>/) */
.cm24-preview-bar {
	position: sticky;
	top: 0;
	z-index: 1000;
	padding: 8px 16px;
	background: #d92b2b;
	color: #fff;
	font: 600 14px/1.4 "Open Sans", sans-serif;
	text-align: center;
}

/* «RU / KZ» in the mobile header (CM24-34; desktop uses the WP «RU ▾» menu item): only while the Kazakh version is on. Takes the colour of the row
   it sits in: white on the dark top bar, dark in the light mobile bar. The current language is underlined. */
.lang-switch { display: inline-flex; align-items: center; margin: 0 8px; font-size: 12px; font-weight: 600; line-height: 1; letter-spacing: .05em; white-space: nowrap; }
.lang-switch__item { display: inline-block; padding: 7px 6px; color: inherit; text-decoration: none; opacity: .7; border-bottom: 2px solid transparent; }
a.lang-switch__item:hover, a.lang-switch__item:focus-visible { color: inherit; opacity: 1; }
.lang-switch__item.is-current { opacity: 1; border-bottom-color: currentColor; }
@media (max-width: 940px) { .lang-switch { margin: 0 2px; } }
