/**
 * Block styles của theme Saigon Quan Sát.
 * Dùng chung cho front-end và Block Editor.
 */

/* =========================================================
   1. Ảnh nửa trang — chữ chảy bên cạnh
   ========================================================= */

/* Tỉ lệ ảnh nửa trang: đổi 45% thành 50% tại đây là đổi cho cả ngoài site và editor. */
:root {
	--sqs-anh-nua-width: 45%;
}

.wp-block-image.is-style-anh-nua-trai,
.wp-block-image.is-style-anh-nua-phai {
	max-width: var(--sqs-anh-nua-width, 45%);
	margin-block: 0.35rem 1rem;
}

.wp-block-image.is-style-anh-nua-trai.is-resized,
.wp-block-image.is-style-anh-nua-phai.is-resized {
	max-width: 100%;
}

.wp-block-image.is-style-anh-nua-trai {
	float: left;
	margin-inline: 0 1.75rem;
}

.wp-block-image.is-style-anh-nua-phai {
	float: right;
	margin-inline: 1.75rem 0;
}

.wp-block-image.is-style-anh-nua-trai img,
.wp-block-image.is-style-anh-nua-phai img {
	display: block;
	width: 100%;
	height: auto;
}

.wp-block-image.is-style-anh-nua-trai figcaption,
.wp-block-image.is-style-anh-nua-phai figcaption {
	margin-top: 0.4rem;
	font-size: var(--wp--preset--font-size--small);
	line-height: 1.4;
	text-align: left;
	color: var(--wp--preset--color--muted);
}

.wp-block-image.is-style-anh-rong img {
	width: 100%;
	height: auto;
}

/* Dọn float sau khi nội dung bài kết thúc. */
.wp-block-post-content::after,
.sqs-entry::after {
	content: "";
	display: block;
	clear: both;
}

/* =========================================================
   2. Box nổi bật trong thân bài
   ========================================================= */

.wp-block-group.is-style-box-noi-bat {
	clear: both;
	overflow: hidden;
	padding: 1.4rem 1.6rem;
	background-color: var(--wp--preset--color--accent-soft);
	border-left: 4px solid var(--wp--preset--color--accent);
	border-radius: 0 4px 4px 0;
}

.wp-block-group.is-style-box-noi-bat > :is(h1, h2, h3, h4, h5, h6) {
	margin-block: 0 0.5rem;
	font-size: var(--wp--preset--font-size--medium);
	line-height: 1.35;
}

.wp-block-group.is-style-box-noi-bat p {
	margin-block: 0 0.6rem;
	font-size: 0.95rem;
	line-height: 1.65;
}

.wp-block-group.is-style-box-noi-bat > :last-child {
	margin-bottom: 0;
}

/* Biến thể ghi chú / cảnh báo. */
.wp-block-group.is-style-box-ghi-chu {
	clear: both;
	overflow: hidden;
	padding: 1.4rem 1.6rem;
	background-color: var(--wp--preset--color--highlight);
	border-left: 4px solid #c99a2e;
	border-radius: 0 4px 4px 0;
}

.wp-block-group.is-style-box-ghi-chu > :is(h1, h2, h3, h4, h5, h6) {
	margin-block: 0 0.5rem;
	font-size: var(--wp--preset--font-size--medium);
}

.wp-block-group.is-style-box-ghi-chu p {
	margin-block: 0 0.6rem;
	font-size: 0.95rem;
}

.wp-block-group.is-style-box-ghi-chu > :last-child {
	margin-bottom: 0;
}

/* =========================================================
   3. Đoạn mở đầu (lead)
   ========================================================= */

p.is-style-doan-mo-dau {
	margin-block: 0 1.25rem;
	font-size: 1.2rem;
	font-weight: 600;
	line-height: 1.65;
	color: var(--wp--preset--color--contrast);
}

/* =========================================================
   4. Panel thông báo / quảng cáo nội bộ
   ========================================================= */

.wp-block-group.is-style-panel-thong-bao {
	padding: 1rem;
	background-color: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 6px;
}

/* Chỗ trống chờ thay banner, tránh ảnh vỡ khi chưa có nội dung. */
.sqs-panel-slot {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 140px;
	padding: 0.75rem;
	background-color: var(--wp--preset--color--base);
	border: 1px dashed var(--wp--preset--color--line);
	border-radius: 4px;
}

.sqs-panel-slot p {
	margin: 0;
	color: var(--wp--preset--color--muted);
}

.sqs-panel-label {
	margin-block: 0 0.5rem;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

/* =========================================================
   5. Trích dẫn lớn
   ========================================================= */

.wp-block-quote.is-style-trich-dan-lon {
	padding-left: 1.25rem;
	border-left: 3px solid var(--wp--preset--color--accent);
	font-family: var(--wp--preset--font-family--serif);
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.45;
}

.wp-block-quote.is-style-trich-dan-lon cite {
	display: block;
	margin-top: 0.75rem;
	font-family: var(--wp--preset--font-family--sans);
	font-size: var(--wp--preset--font-size--small);
	font-style: normal;
	color: var(--wp--preset--color--muted);
}

/* =========================================================
   6. Nhúng video YouTube co giãn theo khung
   ========================================================= */

.wp-block-embed {
	width: 100%;
}

.wp-block-embed.is-type-video .wp-block-embed__wrapper {
	position: relative;
	width: 100%;
}

.wp-block-embed.is-type-video.alignleft,
.wp-block-embed.is-type-video.alignright {
	width: var(--sqs-anh-nua-width, 45%);
	max-width: 100%;
	margin-block: 0.35rem 1rem;
}

.wp-block-embed.is-type-video.alignleft {
	float: left;
	margin-inline: 0 1.75rem;
}

.wp-block-embed.is-type-video.alignright {
	float: right;
	margin-inline: 1.75rem 0;
}

.wp-block-embed:not(.wp-has-aspect-ratio) iframe {
	width: 100% !important;
	max-width: 100% !important;
	aspect-ratio: 16 / 9;
	height: auto !important;
}

/* =========================================================
   7. Dòng nguồn cuối bài
   ========================================================= */

.sqs-nguon {
	margin-top: 2rem;
	padding-top: 0.75rem;
	border-top: 1px solid var(--wp--preset--color--line);
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}

/* =========================================================
   8. Mobile: ảnh nửa trang về full width để không vỡ layout
   ========================================================= */

@media (max-width: 780px) {
	.wp-block-image.is-style-anh-nua-trai,
	.wp-block-image.is-style-anh-nua-phai {
		float: none;
		max-width: 100%;
		margin: 1rem 0;
	}
}
