/*
 * Post routes: single post, archives, blog home, search.
 * Visual language follows the "Cập nhật" block on the home page:
 * navy headings, orange category pills, 16px rounded cards, Montserrat body,
 * Mona Sans Expanded headings (set in Global Styles).
 *
 * Selectors are doubled (.cm-x .cm-y) so they win over the Global Styles
 * "margin-block-start:0" reset for constrained/flow containers.
 */

.cm-post-main,
.cm-archive {
	--cm-navy: #002042;
	--cm-brand: #002d62;
	--cm-blue: #00438b;
	--cm-orange: #e26d35;
	--cm-mist: #e2eaf3;
	--cm-sky: #c9dbe6;
	--cm-grey: #f4f3f2;
	--cm-ink: #1a1c1c;
	--cm-muted: #596878;
	--cm-line: #e3e2e1;
	--cm-wrap: 1180px;
	font-family: Montserrat, sans-serif;
	color: var(--cm-ink);
	margin: 0;
	padding: 0 clamp(16px, 4vw, 32px);
}

/* Full-bleed colour bands without depending on the root padding set in Global Styles. */
.cm-article .cm-article__hero,
.cm-archive .cm-archive__hero,
.cm-post-main .cm-more {
	position: relative;
	box-shadow: 0 0 0 100vmax var(--cm-band, transparent);
	clip-path: inset(0 -100vmax);
	background: var(--cm-band, transparent);
}

.cm-article .cm-article__hero,
.cm-archive .cm-archive__hero {
	--cm-band: var(--cm-mist);
	padding: clamp(40px, 6vw, 80px) 0 clamp(36px, 5vw, 64px);
	text-align: center;
}

.cm-post-main .cm-more {
	--cm-band: var(--cm-grey);
	margin-top: clamp(48px, 7vw, 96px);
	padding: clamp(40px, 6vw, 72px) 0;
}

.cm-wrap {
	width: min(var(--cm-wrap), 100%);
	margin-inline: auto;
}

/* ---------- Category pill (single + cards) ---------- */

.cm-article .cm-pill,
.cm-card .cm-card__cat {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	font-size: 11px;
}

.cm-article .cm-pill a,
.cm-card .cm-card__cat a {
	display: inline-block;
	background: var(--cm-orange);
	color: #fff;
	padding: 6px 12px;
	border-radius: 9999px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	text-decoration: none;
	transition: background-color 0.2s;
}

.cm-article .cm-pill a:hover,
.cm-card .cm-card__cat a:hover {
	background: var(--cm-navy);
	color: #fff;
	text-decoration: none;
}

/* ---------- Single post: hero ---------- */

.cm-article .cm-article__head {
	width: min(900px, 100%);
	margin-inline: auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 20px;
}

.cm-article .cm-article__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin: 0;
}

.cm-article .cm-article__date {
	margin: 0;
	font-size: 14px;
	font-weight: 500;
	color: var(--cm-muted);
}

.cm-article .cm-article__title {
	margin: 0;
	color: var(--cm-navy);
	font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem);
	line-height: 1.22;
	letter-spacing: -0.01em;
	text-wrap: balance;
}

/* ---------- Single post: cover ---------- */

.cm-article .cm-article__cover {
	width: min(1100px, 100%);
	margin: clamp(24px, 4vw, 48px) auto 0;
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 15px 30px rgba(0, 32, 66, 0.1);
}

.cm-article .cm-article__cover img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 16 / 9;
	object-fit: cover;
}

/* ---------- Single post: body text ---------- */

.cm-article .cm-article__content {
	margin-top: clamp(32px, 5vw, 56px);
	font-size: 17px;
	font-weight: 400;
	line-height: 1.8;
	color: var(--cm-ink);
}

.cm-article .cm-article__content > * {
	margin-block-start: 0;
	margin-block-end: 0;
}

.cm-article .cm-article__content > * + * {
	margin-block-start: 1.35em;
}

.cm-article .cm-article__content > h2,
.cm-article .cm-article__content > h3,
.cm-article .cm-article__content > h4 {
	color: var(--cm-navy);
	line-height: 1.3;
	margin-block-start: 2.2em;
}

.cm-article .cm-article__content > h2 + *,
.cm-article .cm-article__content > h3 + *,
.cm-article .cm-article__content > h4 + * {
	margin-block-start: 0.8em;
}

.cm-article .cm-article__content > h2 { font-size: 1.65rem; }
.cm-article .cm-article__content > h3 { font-size: 1.3rem; }
.cm-article .cm-article__content > h4 { font-size: 1.1rem; }

.cm-article .cm-article__content a {
	color: var(--cm-blue);
	text-decoration: underline;
	text-underline-offset: 0.18em;
}

.cm-article .cm-article__content a:hover {
	color: var(--cm-orange);
}

.cm-article .cm-article__content ul,
.cm-article .cm-article__content ol {
	padding-left: 1.4em;
}

.cm-article .cm-article__content li + li {
	margin-top: 0.4em;
}

.cm-article .cm-article__content li::marker {
	color: var(--cm-orange);
}

.cm-article .cm-article__content blockquote {
	margin-inline: 0;
	padding: 20px 24px;
	background: var(--cm-grey);
	border: 0;
	border-left: 4px solid var(--cm-orange);
	border-radius: 0 12px 12px 0;
	font-size: 1.05em;
	color: var(--cm-navy);
}

.cm-article .cm-article__content img {
	max-width: 100%;
	height: auto;
	border-radius: 12px;
}

.cm-article .cm-article__content figcaption {
	margin-top: 10px;
	font-size: 13px;
	line-height: 1.5;
	color: var(--cm-muted);
	text-align: center;
}

.cm-article .cm-article__content hr {
	border: 0;
	border-top: 1px solid var(--cm-line);
}

.cm-article .cm-article__content table {
	width: 100%;
	border-collapse: collapse;
	font-size: 15px;
}

.cm-article .cm-article__content th,
.cm-article .cm-article__content td {
	padding: 10px 12px;
	border: 1px solid var(--cm-line);
	text-align: left;
}

.cm-article .cm-article__content th {
	background: var(--cm-mist);
	color: var(--cm-navy);
}

/* ---------- Single post: tags + prev/next ---------- */

.cm-article .cm-article__foot {
	width: min(760px, 100%);
	margin: clamp(32px, 5vw, 56px) auto 0;
	display: flex;
	flex-direction: column;
	gap: 28px;
}

.cm-article .cm-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding-top: 28px;
	border-top: 1px solid var(--cm-line);
}

.cm-article .cm-tags:empty {
	display: none;
}

.cm-article .cm-tags a {
	display: inline-block;
	padding: 7px 14px;
	border-radius: 9999px;
	background: var(--cm-mist);
	color: var(--cm-blue);
	font-size: 13px;
	font-weight: 600;
	line-height: 1;
	text-decoration: none;
	transition: background-color 0.2s, color 0.2s;
}

.cm-article .cm-tags a:hover {
	background: var(--cm-blue);
	color: #fff;
}

.cm-article .cm-article__nav {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 16px;
	margin: 0;
}

.cm-article .cm-article__nav > * {
	margin: 0;
	padding: 18px 20px;
	border: 1px solid var(--cm-line);
	border-radius: 12px;
	background: #fff;
	display: flex;
	flex-direction: column;
	gap: 6px;
	transition: border-color 0.2s, box-shadow 0.2s;
}

.cm-article .cm-article__nav > *:hover {
	border-color: var(--cm-orange);
	box-shadow: 0 10px 24px rgba(0, 0, 0, 0.06);
}

.cm-article .cm-article__nav > *:empty,
.cm-article .cm-article__nav:not(:has(a)) {
	display: none;
}

.cm-article .cm-article__nav .post-navigation-link-next {
	text-align: right;
	grid-column: 2;
}

.cm-article .cm-article__nav .post-navigation-link__label {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--cm-muted);
}

.cm-article .cm-article__nav a {
	color: var(--cm-navy);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.4;
	text-decoration: none;
}

.cm-article .cm-article__nav > *:hover a {
	color: var(--cm-orange);
}

/* ---------- More articles ---------- */

.cm-more .cm-more__title {
	margin: 0 0 28px;
	color: var(--cm-brand);
	font-size: 24px;
	font-weight: 700;
	line-height: 1.3;
}

/* ---------- Archive / home / search: hero ---------- */

.cm-archive .cm-archive__hero {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 16px;
}

.cm-archive .cm-archive__title {
	margin: 0;
	color: var(--cm-navy);
	font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem);
	line-height: 1.22;
	letter-spacing: -0.01em;
	text-wrap: balance;
}

.cm-archive .cm-archive__desc {
	margin: 0;
	max-width: 640px;
	font-size: 16px;
	line-height: 1.7;
	color: var(--cm-muted);
}

.cm-archive .cm-archive__desc:empty {
	display: none;
}

.cm-archive .cm-archive__search {
	width: min(520px, 100%);
	margin: 8px 0 0;
}

.cm-archive .cm-archive__search .wp-block-search__inside-wrapper {
	background: #fff;
	border-radius: 8px;
}

.cm-archive .cm-archive__search .wp-block-search__input {
	min-height: 48px;
	border: 1px solid var(--cm-sky);
	border-radius: 8px;
	font-family: inherit;
	font-size: 15px;
}

.cm-archive .cm-archive__search .wp-block-search__button {
	min-height: 48px;
	border: 0;
	border-radius: 8px;
	background: var(--cm-blue);
	color: #fff;
	font-family: inherit;
	font-weight: 600;
}

.cm-archive .cm-archive__list {
	width: min(var(--cm-wrap), 100%);
	margin: clamp(32px, 5vw, 56px) auto clamp(56px, 8vw, 96px);
}

/* ---------- Card grid (archive + more articles) ---------- */

.cm-grid-query .cm-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cm-grid-query .cm-grid > li {
	margin: 0;
	display: flex;
}

.cm-card {
	width: 100%;
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--cm-line);
	border-radius: 16px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.01);
	transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.cm-card:hover {
	box-shadow: 0 15px 30px rgba(0, 0, 0, 0.06);
	transform: translateY(-4px);
}

.cm-card .cm-card__media {
	position: relative;
	aspect-ratio: 3 / 2;
	margin: 0;
	overflow: hidden;
	background: linear-gradient(135deg, var(--cm-mist), var(--cm-sky));
}

.cm-card .cm-card__img,
.cm-card .cm-card__img a,
.cm-card .cm-card__img img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
}

.cm-card .cm-card__img img {
	object-fit: cover;
	transition: transform 0.5s ease;
}

.cm-card:hover .cm-card__img img {
	transform: scale(1.05);
}

.cm-card .cm-card__cat {
	position: absolute;
	top: 12px;
	left: 12px;
	z-index: 2;
}

.cm-card .cm-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 10px;
	margin: 0;
	padding: 20px;
}

.cm-card .cm-card__date {
	margin: 0;
	font-size: 12px;
	font-weight: 500;
	color: var(--cm-muted);
}

.cm-card .cm-card__title {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
	color: var(--cm-brand);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cm-card .cm-card__title a {
	color: inherit;
	text-decoration: none;
}

.cm-card .cm-card__title a:hover {
	color: var(--cm-orange);
}

.cm-card .cm-card__excerpt {
	margin: 0;
	font-size: 14px;
	line-height: 1.6;
	color: var(--cm-muted);
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cm-card .cm-card__excerpt:empty {
	display: none;
}

.cm-card .cm-card__more {
	margin: auto 0 0;
	padding-top: 6px;
	font-size: 13px;
	font-weight: 700;
}

.cm-card .cm-card__more {
	color: var(--cm-brand);
	text-decoration: none;
	transition: color 0.2s;
}

.cm-card .cm-card__more:hover {
	color: var(--cm-orange);
	text-decoration: underline;
}

/* ---------- Pagination + empty state ---------- */

.cm-grid-query .cm-pagination {
	margin-top: clamp(32px, 5vw, 56px);
	gap: 8px;
	font-size: 14px;
	font-weight: 600;
}

.cm-grid-query .cm-pagination .page-numbers,
.cm-grid-query .cm-pagination .wp-block-query-pagination-previous,
.cm-grid-query .cm-pagination .wp-block-query-pagination-next {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	border: 1px solid var(--cm-line);
	border-radius: 9999px;
	background: #fff;
	color: var(--cm-brand);
	text-decoration: none;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.cm-grid-query .cm-pagination a:hover {
	border-color: var(--cm-orange);
	color: var(--cm-orange);
}

.cm-grid-query .cm-pagination .page-numbers.current {
	background: var(--cm-brand);
	border-color: var(--cm-brand);
	color: #fff;
}

.cm-grid-query .cm-pagination .page-numbers.dots {
	border-color: transparent;
	background: transparent;
}

.cm-archive .cm-empty {
	margin: 0;
	padding: 48px 24px;
	text-align: center;
	color: var(--cm-muted);
	background: var(--cm-grey);
	border-radius: 16px;
}

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
	.cm-grid-query .cm-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.cm-grid-query .cm-grid {
		grid-template-columns: 1fr;
	}

	.cm-article .cm-article__content {
		font-size: 16px;
		line-height: 1.75;
	}

	.cm-article .cm-article__cover {
		border-radius: 12px;
	}

	.cm-article .cm-article__nav {
		grid-template-columns: 1fr;
	}

	.cm-article .cm-article__nav .post-navigation-link-next {
		grid-column: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cm-card,
	.cm-card .cm-card__img img {
		transition: none;
	}

	.cm-card:hover,
	.cm-card:hover .cm-card__img img {
		transform: none;
	}
}
