/* Instagram Publication — фронт
 *
 * Мобильные: «ступенчатый» iframe с фиксированной высотой в px ломал вёрстку (внутренний контент IG ~326px+).
 * Решение: .tonuz-ip-embed__stage с aspect-ratio / padding-bottom + iframe position:absolute на всю коробку.
 */

.tonuz-ip-embed {
	display: block;
	width: 100%;
	max-width: 658px;
	min-width: 0;
	margin: 1.5em auto;
	padding: 0;
	box-sizing: border-box;
	position: relative;
	z-index: auto;
	float: none;
	clear: both;
	overflow: hidden;
}

.tonuz-ip-align-left {
	margin-left: 0;
	margin-right: auto;
}

.tonuz-ip-align-center {
	margin-left: auto;
	margin-right: auto;
}

.tonuz-ip-align-right {
	margin-left: auto;
	margin-right: 0;
}

/* Десктоп / планшет: фиксированная высота области, iframe заполняет её */
.tonuz-ip-embed__stage {
	position: relative;
	width: 100%;
	max-width: 100%;
	min-height: 760px;
	overflow: hidden;
	border-radius: 3px;
	background: #fff;
}

.tonuz-ip-embed--captioned .tonuz-ip-embed__stage {
	min-height: 920px;
}

.tonuz-ip-embed__iframe {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0;
	display: block;
	vertical-align: top;
}

/* Узкий экран: пропорциональная высота от ширины колонки — без горизонтального скролла страницы */
@media screen and (max-width: 600px) {
	.entry-content .tonuz-ip-embed,
	.wp-block-post-content .tonuz-ip-embed,
	.post-content .tonuz-ip-embed,
	.tonuz-ip-embed {
		max-width: 100%;
		width: 100%;
		margin-left: auto;
		margin-right: auto;
	}

	.tonuz-ip-embed__stage {
		min-height: 0;
		height: 0;
		/* 4:5 как у карточки IG */
		padding-bottom: 125%;
		max-height: none;
	}

	.tonuz-ip-embed--captioned .tonuz-ip-embed__stage {
		/* чуть выше под подпись */
		padding-bottom: 140%;
	}

	/* Современные браузеры: ограничить высоту экраном */
	@supports (aspect-ratio: 1) {
		.tonuz-ip-embed__stage {
			height: auto;
			padding-bottom: 0;
			aspect-ratio: 4 / 5;
			max-height: 88vh;
		}

		.tonuz-ip-embed--captioned .tonuz-ip-embed__stage {
			aspect-ratio: 3 / 4;
			max-height: 92vh;
		}
	}

	.entry-content iframe.tonuz-ip-embed__iframe,
	.wp-block-post-content iframe.tonuz-ip-embed__iframe,
	iframe.tonuz-ip-embed__iframe {
		display: block !important;
		visibility: visible !important;
		opacity: 1 !important;
		max-width: 100% !important;
	}
}
