/* Trang blog: danh sách bài (index.php) và bài viết (single.php). Chỉ được nạp
   ở các trang blog và trang 404; token và thành phần dùng chung (nút, chip,
   thẻ bài cơ bản, dải xanh) nằm trong style.css. */

/* Dải xanh của trang danh sách */

.blog-band {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 32px;
}

.blog-band__text {
	flex: 1 1 520px;
	min-width: 0;
}

.blog-band__stats {
	display: flex;
	gap: 12px;
	margin: 0;
}

/* Số đứng trên nhãn khi nhìn, nhưng nhãn (dt) đi trước trong markup để
   trình đọc màn hình đọc "bài viết: 4". */
.blog-band__stat {
	display: flex;
	flex-direction: column-reverse;
	gap: 2px;
	padding: 18px 22px;
	border-radius: var(--radius-sm);
	background: rgba(255, 255, 255, .14);
}

.blog-band__stat dt {
	font-size: 14px;
	color: var(--c-brand-soft);
}

.blog-band__stat dd {
	margin: 0;
	font-family: var(--font-display);
	font-size: 36px;
	font-weight: 800;
	line-height: 1;
}

/* Danh sách bài */

.blog-list {
	display: flex;
	flex-direction: column;
	gap: 24px;
	padding-block: 40px 24px;
}

.category-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.category-filter__link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 10px 18px;
	border: 1px solid var(--c-line);
	border-radius: 999px;
	background: var(--c-surface);
	font-size: 15px;
	font-weight: 600;
	transition: border-color .2s ease, background-color .2s ease, color .2s ease, transform .15s ease;
}

.category-filter__link:hover,
.category-filter__link:focus-visible {
	border-color: var(--c-ink);
}

.category-filter__link:active {
	transform: scale(.96);
}

.category-filter__link[aria-current="page"] {
	border-color: var(--c-ink);
	background: var(--c-ink);
	color: #FFFFFF;
}

.category-filter__count {
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--c-ground);
	font-size: 13px;
	font-weight: 700;
}

.category-filter__link[aria-current="page"] .category-filter__count {
	background: rgba(255, 255, 255, .2);
}

.post-grid {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
}

.post-grid .post-card {
	gap: 16px;
}

.post-card__cover {
	width: 56px;
	height: 56px;
	border-radius: 16px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--cover, var(--c-sun));
	color: var(--c-ink);
}

.post-card__cover svg {
	transition: transform .5s var(--ease-spring);
}

.post-card:hover .post-card__cover svg,
.post-card:focus-within .post-card__cover svg {
	transform: scale(1.12) rotate(-6deg);
}

.post-card__body {
	flex: 1 1 auto;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.post-card__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.post-card__chips:empty {
	display: none;
}

.post-card__meta {
	margin-top: auto;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 12px;
}

.post-card__arrow {
	font-weight: 700;
	color: var(--c-brand);
}

/* Trên màn hình có chuột, "Đọc bài →" chỉ trượt vào khi rê chuột; trên màn
   hình cảm ứng thì luôn hiện, vì không có trạng thái rê chuột. */
@media (hover: hover) {
	.post-card__arrow {
		opacity: 0;
		transform: translateX(-10px);
		transition: opacity .3s ease, transform .3s ease;
	}

	.post-card:hover .post-card__arrow,
	.post-card:focus-within .post-card__arrow {
		opacity: 1;
		transform: none;
	}
}

.post-card--featured {
	flex-basis: 100%;
	flex-direction: row;
	flex-wrap: wrap;
	padding: 0;
	overflow: hidden;
	border-radius: var(--radius-lg);
}

.post-card--featured .post-card__cover {
	flex: 1 1 320px;
	width: auto;
	height: auto;
	min-height: 260px;
	border-radius: 0;
}

.post-card--featured .post-card__body {
	flex: 2 1 480px;
	gap: 16px;
	padding: 40px;
}

.post-card--featured .post-card__title {
	font-family: var(--font-display);
	font-size: clamp(28px, 3vw, 40px);
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.02em;
}

.post-card--featured .post-card__excerpt {
	max-width: 620px;
	font-size: 17px;
	line-height: 1.65;
}

/* Phân trang của the_posts_pagination(). */
.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.pagination .page-numbers {
	min-width: 44px;
	min-height: 44px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 14px;
	border-radius: 999px;
	background: var(--c-surface);
	font-weight: 600;
}

.pagination a.page-numbers:hover,
.pagination a.page-numbers:focus-visible {
	background: var(--c-hover);
}

.pagination .page-numbers.current {
	background: var(--c-ink);
	color: #FFFFFF;
}

.empty-state {
	padding: 48px 32px;
	border-radius: var(--radius-lg);
	background: var(--c-surface);
	text-align: center;
}

.empty-state h2 {
	font-size: clamp(26px, 3vw, 36px);
}

.empty-state p {
	margin-top: 10px;
	color: var(--c-ink-soft);
}

.empty-state .button {
	margin-top: 24px;
}

/* Dải kêu gọi liên hệ */

.contact-cta {
	padding-block: 48px 72px;
}

.contact-cta__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	padding: clamp(28px, 5vw, 48px);
	border-radius: var(--radius-lg);
	background: var(--c-sun);
}

.contact-cta__text {
	flex: 1 1 420px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
	font-size: 17px;
}

.contact-cta__title {
	font-size: clamp(28px, 3.2vw, 42px);
}

/* Bài viết */

/* Thanh tiến độ đọc nằm ngay dưới header dính; post.js đặt --progress từ 0
   tới 1. scaleX thay vì width để trình duyệt không phải dàn lại trang. */
.reading-progress {
	position: fixed;
	z-index: 21;
	left: 0;
	right: 0;
	top: var(--header-height);
	height: 3px;
	background: var(--c-brand);
	transform: scaleX(var(--progress, 0));
	transform-origin: left center;
}

.admin-bar .reading-progress {
	top: calc(var(--header-height) + var(--wp-admin--admin-bar--height, 32px));
}

/* Cùng lý do với .site-header trong style.css: dưới 600px admin bar cuộn đi,
   header dừng sát mép trên. */
@media screen and (max-width: 600px) {
	.admin-bar .reading-progress {
		top: var(--header-height);
	}
}

.article-page {
	padding-block: 32px 0;
}

.breadcrumb {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	font-size: 14px;
	color: var(--c-ink-soft);
}

/* Điện thoại: một cột theo đúng thứ tự markup (tiêu đề → mục lục → nội dung).
   Desktop: mục lục ở cột trái, kéo dài cạnh cả tiêu đề lẫn nội dung, và dính
   theo khi cuộn. */
.article {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 28px;
	padding-top: 28px;
}

.article-aside {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

@media (min-width: 901px) {
	.article {
		grid-template-columns: minmax(220px, 280px) minmax(0, 780px);
		grid-template-rows: auto 1fr;
		column-gap: 48px;
	}

	.article__header {
		grid-column: 2;
		grid-row: 1;
	}

	.article-aside {
		grid-column: 1;
		grid-row: 1 / span 2;
		align-self: start;
		position: sticky;
		top: calc(var(--header-height) + 24px);
	}

	.article__body {
		grid-column: 2;
		grid-row: 2;
	}

	.article--no-toc {
		grid-template-columns: minmax(0, 780px);
		justify-content: center;
	}

	.article--no-toc .article__header,
	.article--no-toc .article__body {
		grid-column: 1;
	}
}

/* Trên điện thoại, ô kêu gọi liên hệ ở đầu bài chỉ chen giữa mục lục và nội
   dung; thẻ tác giả cuối bài đã có nút "Bàn về dự án". */
@media (max-width: 900px) {
	/* Viết kèm .article-aside cho độ ưu tiên cao hơn luật .aside-cta ở dưới. */
	.article-aside .aside-cta {
		display: none;
	}
}

.article__body {
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 28px;
}

.toc {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 22px;
	border-radius: 24px;
	background: var(--c-surface);
}

.toc__title {
	padding: 0 10px 6px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--c-ink-soft);
}

.toc__list {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.toc__link {
	display: flex;
	gap: 10px;
	padding: 10px;
	border-radius: 12px;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
	transition: background-color .2s ease, color .2s ease;
}

.toc__item--level-3 .toc__link {
	padding-left: 24px;
	font-weight: 500;
}

.toc__link:hover,
.toc__link:focus-visible {
	background: var(--c-ground);
}

/* "true": phần đang đọc, do post.js đặt. */
.toc__link[aria-current="true"] {
	background: var(--c-ink);
	color: #FFFFFF;
}

.toc__number {
	padding-top: 2px;
	font-family: var(--font-mono);
	font-size: 13px;
}

.aside-cta {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 22px;
	border-radius: 24px;
	background: var(--c-sun);
	font-size: 14px;
	line-height: 1.55;
	transition: transform .4s var(--ease-spring), box-shadow .4s ease;
}

.aside-cta:hover,
.aside-cta:focus-visible {
	transform: translateY(-4px);
	box-shadow: 0 14px 32px rgba(22, 22, 22, .14);
}

.aside-cta__title {
	font-size: 17px;
	font-weight: 800;
	line-height: 1.3;
}

.aside-cta__link {
	font-weight: 700;
}

.article__header {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.article__title {
	font-size: clamp(36px, 4.6vw, 60px);
	line-height: 1.04;
}

.article__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 16px;
	font-size: 15px;
	color: var(--c-ink-soft);
}

.article__author {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	font-weight: 600;
	color: var(--c-ink);
}

.avatar {
	width: 36px;
	height: 36px;
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: var(--c-accent);
	color: #FFFFFF;
	font-size: 13px;
	font-weight: 800;
}

.avatar--large {
	width: 64px;
	height: 64px;
	font-size: 20px;
}

/* Trang tĩnh (page.php) */

.page-content {
	padding-block: 32px 72px;
}

.page-content__article {
	max-width: 780px;
	margin-inline: auto;
	display: flex;
	flex-direction: column;
	gap: 24px;
}

/* Nội dung bài */

.prose {
	font-size: 18px;
	line-height: 1.75;
}

.prose > * + * {
	margin-top: 1.1em;
}

.prose p,
.prose li {
	overflow-wrap: anywhere;
}

.prose h2 {
	margin-top: 1.8em;
	font-size: 28px;
	letter-spacing: -0.02em;
}

.prose h3 {
	margin-top: 1.5em;
	font-size: 22px;
}

/* Bấm mục lục (hay link #english của trang chính sách) thì heading dừng cách
   đáy header một khoảng, không dính sát vào nó. */
.prose [id] {
	scroll-margin-top: 16px;
}

.prose ul,
.prose ol {
	padding-left: 1.3em;
}

.prose li + li {
	margin-top: .4em;
}

.prose a {
	color: var(--c-brand);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.prose img {
	height: auto;
	border-radius: var(--radius-sm);
}

.prose blockquote {
	margin-inline: 0;
	padding: 4px 0 4px 20px;
	border-left: 4px solid var(--c-accent);
	color: var(--c-ink-soft);
}

.prose code {
	padding: 2px 6px;
	border-radius: 6px;
	background: var(--c-hover);
	font-family: var(--font-mono);
	font-size: .88em;
}

/* Khối code: <pre class="brush: …"> do plugin SyntaxHighlighter sinh ra, hoặc
   <pre> thường. post.js bọc nó trong .code-block kèm nhãn và nút sao chép. */
.prose pre {
	overflow-x: auto;
	margin: 0;
	padding: 20px 22px;
	border-radius: var(--radius-sm);
	background: var(--c-ink);
	color: #E6EDF3;
	font-family: var(--font-mono);
	font-size: 15px;
	line-height: 1.7;
	white-space: pre;
	tab-size: 4;
}

.prose pre code {
	padding: 0;
	background: none;
	color: inherit;
	font-size: inherit;
}

.code-block {
	overflow: hidden;
	border-radius: var(--radius-sm);
	background: var(--c-ink);
}

.code-block pre {
	border-radius: 0;
}

.code-block__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 10px 8px 18px;
	border-bottom: 1px solid #2A2A2A;
}

.code-block__label {
	font-family: var(--font-mono);
	font-size: 13px;
	color: #B8B8B8;
}

.code-block__copy {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 36px;
	padding: 6px 14px;
	border: 0;
	border-radius: 999px;
	background: #2A2A2A;
	color: #FFFFFF;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: background-color .2s ease, color .2s ease, transform .15s ease;
}

.code-block__copy:hover,
.code-block__copy:focus-visible {
	background: var(--c-sun);
	color: var(--c-ink);
}

.code-block__copy:active {
	transform: scale(.94);
}

/* Cuối bài */

.author-card {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 20px;
	margin-top: 12px;
	padding: 28px;
	border-radius: var(--radius-md);
	background: var(--c-surface);
}

.author-card__text {
	flex: 1 1 280px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.author-card__name {
	font-size: 18px;
	font-weight: 800;
}

.author-card__bio {
	font-size: 15px;
	line-height: 1.6;
	color: var(--c-ink-soft);
}

.post-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
}

.post-nav__link {
	flex: 1 1 280px;
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 22px 26px;
	border-radius: 24px;
	background: var(--c-surface);
	transition: transform .4s var(--ease-spring), box-shadow .4s ease;
}

.post-nav__link--next {
	text-align: right;
}

.post-nav__link:hover,
.post-nav__link:focus-visible {
	transform: translateY(-4px);
	box-shadow: 0 14px 32px rgba(22, 22, 22, .12);
}

.post-nav__label {
	font-size: 13px;
	font-weight: 700;
	color: var(--c-ink-soft);
}

.post-nav__title {
	font-size: 18px;
	font-weight: 700;
	line-height: 1.4;
}

.related {
	display: flex;
	flex-direction: column;
	gap: 24px;
	padding-block: 72px;
}

.related__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 16px;
}

.related__title {
	font-size: clamp(30px, 3.4vw, 44px);
}

@media (prefers-reduced-motion: reduce) {
	.post-card:hover .post-card__cover svg,
	.post-card:focus-within .post-card__cover svg,
	.aside-cta:hover,
	.post-nav__link:hover,
	.code-block__copy:active,
	.category-filter__link:active {
		transform: none;
	}
}
