/*
 * Long-form content of a post: typography of the article body and the block styles an editor can
 * pick for core blocks ("Kiểu" in the block sidebar). Loaded on single posts and inside the block
 * editor, so a block looks the same while it is being written.
 *
 * Figma file "Redesign - B2C_THN", node 1:2583. Box sizes are measured from the vector PDF export;
 * font sizes and text colours are read from its rendering (±1px).
 *
 * The body rules are scoped to .mnn-article__content (the front end). The block styles are scoped
 * only by their own .is-style-mnn-* class, which is what makes them work in the editor as well.
 */

/* ---------- Article body ---------- */

.mnn-article__content {
	color: var(--wp--preset--color--contrast);
	font-size: 15px;
	line-height: 26px;
	overflow-wrap: anywhere;
}

.mnn-article__content > * {
	margin-block: 0 20px;
}

.mnn-article__content > :last-child {
	margin-bottom: 0;
}

.mnn-article__content :is(h2, h3, h4) {
	color: var(--wp--preset--color--contrast);
	font-weight: 700;
	letter-spacing: -0.2px;
}

.mnn-article__content > h2 {
	margin-top: 44px;
	margin-bottom: 14px;
	font-size: 20px;
	line-height: 28px;
}

.mnn-article__content > h3 {
	margin-top: 32px;
	margin-bottom: 10px;
	font-size: 17px;
	line-height: 25px;
}

.mnn-article__content > h4 {
	margin-top: 24px;
	margin-bottom: 8px;
	font-size: 15px;
	line-height: 22px;
}

.mnn-article__content > :first-child {
	margin-top: 0;
}

.mnn-article__content a {
	color: var(--wp--preset--color--primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* :where() keeps these two rules weak, so lists that are laid out as cards or grids override them. */
.mnn-article__content :where(ul, ol):where(:not([class*="is-style-mnn-"]):not(.mnn-post-products__list)) {
	padding-left: 24px;
}

.mnn-article__content :where(li + li) {
	margin-top: 6px;
}

.mnn-article__content img,
.mnn-article__content video,
.mnn-article__content iframe {
	max-width: 100%;
	height: auto;
}

.mnn-article__content .wp-block-image,
.mnn-article__content .wp-block-gallery,
.mnn-article__content .wp-block-embed {
	margin-block: 28px;
}

.mnn-article__content .wp-block-image img {
	border-radius: var(--wp--custom--radius--sm);
}

.mnn-article__content .wp-block-image.alignwide,
.mnn-article__content .wp-block-image.alignfull {
	max-width: 100%;
}

.mnn-article__content figcaption {
	margin-top: 8px;
	color: var(--wp--preset--color--muted);
	font-size: 13px;
	line-height: 20px;
	text-align: center;
}

.mnn-article__content .wp-block-quote {
	margin-inline: 0;
	padding: 16px 20px;
	border-left: 4px solid var(--wp--preset--color--primary);
	border-radius: 0 var(--wp--custom--radius--xs) var(--wp--custom--radius--xs) 0;
	background-color: #fff5f5;
	font-style: italic;
}

.mnn-article__content .wp-block-quote > :last-child {
	margin-bottom: 0;
}

.mnn-article__content .wp-block-quote cite {
	display: block;
	margin-top: 8px;
	color: var(--wp--preset--color--muted);
	font-size: 13px;
	font-style: normal;
}

.mnn-article__content .wp-block-columns {
	gap: 16px;
}

/* A wide table scrolls inside its own box instead of pushing the page sideways. */
.mnn-article__content .wp-block-table {
	margin-inline: 0;
	overflow-x: auto;
}

.mnn-article__content .wp-block-table table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
	line-height: 22px;
}

.mnn-article__content .wp-block-table:not(.is-style-mnn-spec) :is(th, td) {
	padding: 10px 14px;
	border: 1px solid var(--wp--preset--color--border);
	text-align: left;
}

/* ---------- Content written in the classic editor ---------- */

/* Same look as the block versions above; these elements carry no wp-block-* class. */
.mnn-article__content .mnn-table-scroll {
	overflow-x: auto;
}

.mnn-article__content .mnn-table-scroll table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
	line-height: 22px;
}

.mnn-article__content .mnn-table-scroll :is(th, td) {
	padding: 10px 14px;
	border: 1px solid var(--wp--preset--color--border);
	text-align: left;
	vertical-align: top;
}

.mnn-article__content .mnn-table-scroll th {
	background-color: var(--wp--preset--color--surface);
	font-weight: 700;
}

.mnn-article__content img[class*="wp-image-"] {
	border-radius: var(--wp--custom--radius--sm);
}

.mnn-article__content .wp-caption {
	max-width: 100%;
	margin-inline: 0;
}

.mnn-article__content .wp-caption-text {
	margin: 8px 0 0;
	color: var(--wp--preset--color--muted);
	font-size: 13px;
	line-height: 20px;
	text-align: center;
}

.mnn-article__content :is(img, .wp-caption).aligncenter {
	display: block;
	margin-inline: auto;
}

.mnn-article__content :is(img, .wp-caption).alignleft {
	float: left;
	max-width: 50%;
	margin: 4px 20px 12px 0;
}

.mnn-article__content :is(img, .wp-caption).alignright {
	float: right;
	max-width: 50%;
	margin: 4px 0 12px 20px;
}

.mnn-article__content > :is(h2, h3, h4, .mnn-table-scroll, .mnn-post-products) {
	clear: both;
}

.mnn-article__content > blockquote:not([class]) {
	margin-inline: 0;
	padding: 16px 20px;
	border-left: 4px solid var(--wp--preset--color--primary);
	border-radius: 0 var(--wp--custom--radius--xs) var(--wp--custom--radius--xs) 0;
	background-color: #fff5f5;
	font-style: italic;
}

.mnn-article__content > blockquote:not([class]) > :last-child {
	margin-bottom: 0;
}

@media (max-width: 599px) {
	.mnn-article__content :is(img, .wp-caption):is(.alignleft, .alignright) {
		float: none;
		display: block;
		max-width: 100%;
		margin: 0 auto 16px;
	}
}

/* ---------- Heading with a running number ---------- */

.mnn-article__content,
.editor-styles-wrapper {
	counter-reset: mnn-heading;
}

.wp-block-heading.is-style-mnn-numbered {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	counter-increment: mnn-heading;
}

.wp-block-heading.is-style-mnn-numbered::before {
	content: counter(mnn-heading);
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	min-width: 30px;
	height: 28px;
	border-radius: 6px;
	background-color: var(--wp--preset--color--primary-dark, #7c000b);
	color: #fff;
	font-size: 15px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0;
}

/* ---------- Columns as comparison cards (two cards 359 wide, 16 apart) ---------- */

.wp-block-columns.is-style-mnn-compare {
	align-items: stretch;
	gap: 16px;
}

.wp-block-columns.is-style-mnn-compare > .wp-block-column {
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
	padding: 20px 16px 16px;
	border: 1px solid var(--wp--preset--color--surface-strong, #ebeef4);
	border-radius: var(--wp--custom--radius--sm, 8px);
	background-color: #fff;
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.wp-block-columns.is-style-mnn-compare > .wp-block-column > * {
	margin-block: 0 10px;
}

.wp-block-columns.is-style-mnn-compare > .wp-block-column > :last-child {
	margin-bottom: 0;
}

.wp-block-columns.is-style-mnn-compare > .wp-block-column > :is(h3, h4) {
	color: var(--wp--preset--color--muted, #5b6570);
	font-size: 15px;
	font-weight: 700;
	line-height: 22px;
}

/* The first card is the one the article leans towards. */
.wp-block-columns.is-style-mnn-compare > .wp-block-column:first-child > :is(h3, h4) {
	color: var(--wp--preset--color--primary-dark, #7c000b);
}

/* A note at the foot of a card lines up across the cards. */
.wp-block-columns.is-style-mnn-compare > .wp-block-column > .wp-block-group:last-child {
	margin-top: auto;
}

/* ---------- Boxes: panel, note, advantage, caution, recommendation, warning ---------- */

.wp-block-group[class*="is-style-mnn-"] {
	box-sizing: border-box;
	border-radius: var(--wp--custom--radius--sm, 8px);
}

.wp-block-group[class*="is-style-mnn-"] > * {
	margin-block: 0 10px;
}

.wp-block-group[class*="is-style-mnn-"] > :last-child {
	margin-bottom: 0;
}

.wp-block-group.is-style-mnn-panel {
	padding: 24px;
	border: 1px solid var(--wp--preset--color--surface-strong, #ebeef4);
	background-color: #fff;
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.wp-block-group.is-style-mnn-panel > * {
	margin-bottom: 16px;
}

.wp-block-group.is-style-mnn-note {
	padding: 10px 12px;
	border-radius: var(--wp--custom--radius--xs, 4px);
	background-color: var(--wp--preset--color--surface, #f1f4f9);
	color: var(--wp--preset--color--muted, #5b6570);
	font-size: 14px;
	line-height: 22px;
}

.wp-block-group.is-style-mnn-note strong {
	color: var(--wp--preset--color--contrast, #181c20);
}

.wp-block-group.is-style-mnn-pros,
.wp-block-group.is-style-mnn-caution,
.wp-block-group.is-style-mnn-recommend,
.wp-block-group.is-style-mnn-warning {
	position: relative;
	padding: 14px 16px 14px 46px;
	font-size: 14px;
	line-height: 22px;
}

.wp-block-group.is-style-mnn-pros::before,
.wp-block-group.is-style-mnn-caution::before,
.wp-block-group.is-style-mnn-recommend::before,
.wp-block-group.is-style-mnn-warning::before {
	content: "";
	position: absolute;
	top: 15px;
	left: 16px;
	width: 20px;
	height: 20px;
	background-color: currentColor;
	-webkit-mask: center / contain no-repeat;
	mask: center / contain no-repeat;
}

.wp-block-group.is-style-mnn-pros {
	border: 1px solid #b7e4c7;
	background-color: #ecfdf3;
	color: #005e39;
}

.wp-block-group.is-style-mnn-pros::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m10.600 16.600 7.050-7.050-1.400-1.400-5.650 5.650-2.850-2.850-1.400 1.400zM12 22q-2.075 0-3.900-.788t-3.175-2.137T2.788 15.900 2 12t.788-3.900 2.137-3.175T8.100 2.788 12 2t3.900.788 3.175 2.137T21.213 8.100 22 12t-.788 3.900-2.137 3.175-3.175 2.138T12 22'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m10.600 16.600 7.050-7.050-1.400-1.400-5.650 5.650-2.850-2.850-1.400 1.400zM12 22q-2.075 0-3.900-.788t-3.175-2.137T2.788 15.900 2 12t.788-3.900 2.137-3.175T8.100 2.788 12 2t3.900.788 3.175 2.137T21.213 8.100 22 12t-.788 3.900-2.137 3.175-3.175 2.138T12 22'/%3E%3C/svg%3E");
}

.wp-block-group.is-style-mnn-caution {
	border: 1px solid #f5d98b;
	background-color: #fffbeb;
	color: #92400e;
}

.wp-block-group.is-style-mnn-caution::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M1 21h22L12 2zm12-3h-2v-2h2zm0-4h-2v-4h2z'/%3E%3C/svg%3E");
}

.wp-block-group.is-style-mnn-recommend {
	border: 1px solid #c7d7f5;
	background-color: #f0f5ff;
	color: #1e40af;
}

.wp-block-group.is-style-mnn-recommend::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.900-.788t-3.175-2.137T2.788 15.900 2 12t.788-3.900 2.137-3.175T8.100 2.788 12 2t3.900.788 3.175 2.137T21.213 8.100 22 12t-.788 3.900-2.137 3.175-3.175 2.138T12 22'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.900-.788t-3.175-2.137T2.788 15.900 2 12t.788-3.900 2.137-3.175T8.100 2.788 12 2t3.900.788 3.175 2.137T21.213 8.100 22 12t-.788 3.900-2.137 3.175-3.175 2.138T12 22'/%3E%3C/svg%3E");
}

/* Warning: 685 × 80, background #ffdad6, text #93000a (measured). */
.wp-block-group.is-style-mnn-warning {
	border-radius: var(--wp--custom--radius--xs, 4px);
	background-color: #ffdad6;
	color: #93000a;
}

.wp-block-group.is-style-mnn-warning::before {
	-webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m8.400 17 3.600-3.600 3.600 3.600 1.400-1.400-3.600-3.600 3.600-3.600L15.600 7 12 10.600 8.400 7 7 8.400l3.600 3.600L7 15.600zm3.600 5q-2.075 0-3.900-.788t-3.175-2.137T2.788 15.900 2 12t.788-3.900 2.137-3.175T8.100 2.788 12 2t3.900.788 3.175 2.137T21.213 8.100 22 12t-.788 3.900-2.137 3.175-3.175 2.138T12 22m0-2q3.350 0 5.675-2.325T20 12t-2.325-5.675T12 4 6.325 6.325 4 12t2.325 5.675T12 20'/%3E%3C/svg%3E");
	mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m8.400 17 3.600-3.600 3.600 3.600 1.400-1.400-3.600-3.600 3.600-3.600L15.600 7 12 10.600 8.400 7 7 8.400l3.600 3.600L7 15.600zm3.600 5q-2.075 0-3.900-.788t-3.175-2.137T2.788 15.900 2 12t.788-3.900 2.137-3.175T8.100 2.788 12 2t3.900.788 3.175 2.137T21.213 8.100 22 12t-.788 3.900-2.137 3.175-3.175 2.138T12 22m0-2q3.350 0 5.675-2.325T20 12t-2.325-5.675T12 4 6.325 6.325 4 12t2.325 5.675T12 20'/%3E%3C/svg%3E");
}

.wp-block-group[class*="is-style-mnn-"] :is(h3, h4, h5) {
	margin-bottom: 4px;
	color: inherit;
	font-size: 15px;
	font-weight: 700;
	line-height: 22px;
}

.wp-block-group.is-style-mnn-panel > :is(h3, h4, h5) {
	margin-bottom: 12px;
	color: var(--wp--preset--color--contrast, #181c20);
	font-size: 16px;
}

/* ---------- Steps: numbered boxes (223 × 112, 8 apart) ---------- */

.wp-block-list.is-style-mnn-steps,
ol.is-style-mnn-steps {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 8px;
	margin-inline: 0;
	padding: 0;
	list-style: none;
	counter-reset: mnn-step;
}

.is-style-mnn-steps > li {
	position: relative;
	box-sizing: border-box;
	min-height: 52px;
	margin: 0;
	padding: 12px 12px 12px 46px;
	border-radius: var(--wp--custom--radius--xs, 4px);
	background-color: var(--wp--preset--color--surface, #f1f4f9);
	color: var(--wp--preset--color--contrast, #181c20);
	font-size: 14px;
	line-height: 22px;
	counter-increment: mnn-step;
}

.is-style-mnn-steps > li::before {
	content: counter(mnn-step);
	position: absolute;
	top: 12px;
	left: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background-color: var(--wp--preset--color--primary-dark, #7c000b);
	color: #fff;
	font-size: 13px;
	font-weight: 700;
	line-height: 1;
}

.is-style-mnn-steps > li strong:first-child {
	display: block;
	margin-bottom: 2px;
}

/* ---------- Things to avoid: one card per item (733 wide, 8 apart) ---------- */

.wp-block-list.is-style-mnn-mistakes,
ul.is-style-mnn-mistakes {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-inline: 0;
	padding: 0;
	list-style: none;
}

.is-style-mnn-mistakes > li {
	position: relative;
	margin: 0;
	padding: 16px 20px 18px 44px;
	border: 1px solid var(--wp--preset--color--surface-strong, #ebeef4);
	border-radius: var(--wp--custom--radius--sm, 8px);
	background-color: #fff;
	box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
	color: var(--wp--preset--color--muted, #5b6570);
	font-size: 15px;
	line-height: 24px;
}

.is-style-mnn-mistakes > li::before {
	content: "";
	position: absolute;
	top: 18px;
	left: 16px;
	width: 20px;
	height: 20px;
	background-color: var(--wp--preset--color--contrast, #181c20);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m8.400 17 3.600-3.600 3.600 3.600 1.400-1.400-3.600-3.600 3.600-3.600L15.600 7 12 10.600 8.400 7 7 8.400l3.600 3.600L7 15.600zm3.600 5q-2.075 0-3.900-.788t-3.175-2.137T2.788 15.900 2 12t.788-3.900 2.137-3.175T8.100 2.788 12 2t3.900.788 3.175 2.137T21.213 8.100 22 12t-.788 3.900-2.137 3.175-3.175 2.138T12 22m0-2q3.350 0 5.675-2.325T20 12t-2.325-5.675T12 4 6.325 6.325 4 12t2.325 5.675T12 20'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m8.400 17 3.600-3.600 3.600 3.600 1.400-1.400-3.600-3.600 3.600-3.600L15.600 7 12 10.600 8.400 7 7 8.400l3.600 3.600L7 15.600zm3.600 5q-2.075 0-3.900-.788t-3.175-2.137T2.788 15.900 2 12t.788-3.900 2.137-3.175T8.100 2.788 12 2t3.900.788 3.175 2.137T21.213 8.100 22 12t-.788 3.900-2.137 3.175-3.175 2.138T12 22m0-2q3.350 0 5.675-2.325T20 12t-2.325-5.675T12 4 6.325 6.325 4 12t2.325 5.675T12 20'/%3E%3C/svg%3E") center / contain no-repeat;
}

.is-style-mnn-mistakes > li strong:first-child {
	display: block;
	color: var(--wp--preset--color--contrast, #181c20);
}

/* ---------- Technical table: header band, second column emphasised ---------- */

.wp-block-table.is-style-mnn-spec {
	overflow-x: auto;
}

.wp-block-table.is-style-mnn-spec table {
	width: 100%;
	min-width: 520px;
	border: 1px solid var(--wp--preset--color--surface-strong, #ebeef4);
	border-collapse: collapse;
	font-size: 14px;
	line-height: 22px;
}

.wp-block-table.is-style-mnn-spec :is(th, td) {
	padding: 14px 16px;
	border: 0;
	border-bottom: 1px solid var(--wp--preset--color--surface-strong, #ebeef4);
	text-align: left;
	vertical-align: middle;
}

.wp-block-table.is-style-mnn-spec thead {
	border-bottom: 0;
}

.wp-block-table.is-style-mnn-spec thead :is(th, td) {
	border-bottom: 0;
	background-color: var(--wp--preset--color--surface-strong, #ebeef4);
	color: var(--wp--preset--color--contrast, #181c20);
	font-weight: 700;
}

.wp-block-table.is-style-mnn-spec tbody td {
	background-color: #fff;
}

.wp-block-table.is-style-mnn-spec thead :is(th, td):nth-child(2) {
	background-color: #f3dfe2;
	color: var(--wp--preset--color--primary-dark, #7c000b);
}

.wp-block-table.is-style-mnn-spec tbody td:nth-child(2) {
	background-color: #fdf3f3;
	color: var(--wp--preset--color--primary-dark, #7c000b);
	font-weight: 700;
}

.wp-block-table.is-style-mnn-spec tbody tr:last-child td {
	border-bottom: 0;
}

.wp-block-table.is-style-mnn-spec figcaption {
	text-align: left;
}

/* ---------- Responsive (proposed) ---------- */

@media (max-width: 767px) {
	.mnn-article__content > h2 {
		margin-top: 32px;
		font-size: 19px;
		line-height: 26px;
	}

	/* Comparison cards stack; WordPress already stacks plain columns at this width. */
	.wp-block-columns.is-style-mnn-compare {
		flex-direction: column;
	}

	.wp-block-columns.is-style-mnn-compare > .wp-block-column {
		flex-basis: auto;
	}

	.wp-block-group.is-style-mnn-panel {
		padding: 16px;
	}

	.wp-block-list.is-style-mnn-steps,
	ol.is-style-mnn-steps {
		grid-template-columns: minmax(0, 1fr);
	}
}
