/* ===== Section header (kiểu 29/08) =====
   Một hàng, canh theo đáy: thanh dọc · tiêu đề · nhánh lá · đường kẻ ôm link.
   Cỡ chữ tiêu đề lặp lại ở --cg-sh-size vì thanh dọc và đường kẻ phải cao/thấp
   theo nó, mà chúng là phần tử anh em nên không thừa kế được font-size của h2. */
.cg-section-header {
	--cg-sh-size: clamp(26px, 3.2vw, 34px);
	display: flex;
	/* Hết chỗ thì THỨ RƠI XUỐNG LÀ ĐƯỜNG KẺ + LINK, không phải tiêu đề. Tiêu đề giữ
	   nguyên một dòng, không cắt ellipsis. */
	flex-wrap: wrap;
	align-items: flex-end;
	column-gap: 10px;
	row-gap: 12px;
	padding-bottom: 26px;
}

.cg-section-header__head {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	/* Không co: đây là thứ được ưu tiên chỗ. max-width chặn tràn ngang cho trường hợp
	   tên mục dài hơn cả hàng — lúc đó tiêu đề mới chịu cắt (xem __title). */
	flex: 0 0 auto;
	max-width: 100%;
}

.cg-section-header__bar {
	flex: none;
	width: 5px;
	height: calc(var(--cg-sh-size) * 1.05);
	background: var(--cg-green);
	border-radius: 1px;
}

.cg-section-header__title {
	font-size: var(--cg-sh-size);
	font-weight: 600;
	letter-spacing: -0.015em;
	line-height: 1.15;
	color: var(--cg-green);
	/* Một dòng, luôn luôn. Ellipsis ở đây là lưới an toàn cuối: chỉ chạm tới khi tên
	   mục dài hơn cả hàng, lúc đó lựa chọn còn lại là để trang cuộn ngang. */
	white-space: nowrap;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cg-section-header__leaf {
	flex: none;
	height: 46px;
	width: auto;
	/* Lá vẽ tràn nhẹ vào đường kẻ và xuống dưới đáy chữ, theo bản design. */
	margin-right: -6px;
	margin-bottom: -3px;
}

.cg-section-header__rule {
	flex: 1 1 40px;
	/* min-width vừa chống link đè lên nhánh lá, vừa là thứ QUYẾT ĐỊNH LÚC NÀO XUỐNG
	   DÒNG: flex tính chỗ theo min-width, nên hễ tiêu đề + khối này không cùng lọt một
	   hàng thì khối này rơi xuống hàng dưới và giãn hết chiều ngang. */
	min-width: max-content;
	padding-left: 24px;
	display: flex;
	align-items: flex-end;
	justify-content: flex-end;
	padding-bottom: 5px;
	border-bottom: 1px solid var(--cg-green-rule);
}

.cg-section-header__link {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--cg-green-dark);
	white-space: nowrap;
}

/* Dưới 620px thu nhỏ chữ và nhánh lá để tiêu đề dài nhất ("Nghiên cứu – Trao đổi")
   vẫn lọt một dòng ở khổ hẹp nhất — nếu không thì lưới an toàn ellipsis phải chạm tới.
   Việc xuống dòng của khối đường kẻ + link do flex-wrap tự lo, không cần media query. */
@media (max-width: 619.98px) {
	.cg-section-header {
		--cg-sh-size: clamp(20px, 5.4vw, 26px);
		column-gap: 8px;
		row-gap: 10px;
		padding-bottom: 20px;
	}

	.cg-section-header__head {
		gap: 8px;
	}

	.cg-section-header__leaf {
		height: 34px;
	}

	.cg-section-header__link {
		font-size: 11px;
		letter-spacing: 0.1em;
	}
}

/* ===== Heading gạch chân (sidebar + khối phụ) ===== */
.cg-heading-underline {
	margin: 0 0 2px;
	padding-bottom: 13px;
	font-family: var(--cg-font-sans);
	font-size: 13.5px;
	font-weight: 600;
	letter-spacing: 0.2em;
	text-transform: uppercase;
}

.cg-heading-underline--green {
	color: var(--cg-green);
	border-bottom: 2px solid var(--cg-green);
}

.cg-heading-underline--gold {
	color: var(--cg-gold);
	border-bottom: 2px solid var(--cg-gold);
}

/* Tạm — bỏ khi có front-page */
.cg-demo-section {
	padding: clamp(30px, 3.6vw, 44px) 0;
}

/* ===== Card bài viết chuẩn (trang-van.html:141-150) ===== */
.cg-card {
	display: flex;
	flex-direction: column;
	gap: 11px;
}

.cg-card__media {
	display: block;
	position: relative;
	width: 100%;
	aspect-ratio: 4 / 3;
	background: var(--cg-bg-media);
	overflow: hidden;
}

.cg-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cg-card__kicker {
	font-size: 10.5px;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: var(--cg-text-meta);
	font-weight: 500;
}

.cg-card__title {
	margin: 0;
	font-family: var(--cg-font-serif);
	font-size: clamp(19px, 2vw, 21px);
	line-height: 1.32;
	font-weight: 500;
	text-wrap: pretty;
}

.cg-card__excerpt {
	margin: 0;
	font-size: 14px;
	line-height: 1.7;
	color: var(--cg-text-soft);
	text-wrap: pretty;
}

.cg-card__meta {
	font-size: 12.5px;
	color: var(--cg-text-faint);
	margin-top: auto;
	padding-top: 4px;
}

/* ===== Lưới card trang danh sách ===== */
.cg-card-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: clamp(26px, 3vw, 40px) clamp(22px, 2.6vw, 34px);
}

@media (max-width: 619.98px) {
	.cg-card-grid {
		grid-template-columns: 1fr;
	}
}

/* ===== Breadcrumb (trang-van.html:118-122) ===== */
.cg-breadcrumb {
	padding-top: clamp(18px, 2.4vw, 26px);
	font-size: 12px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--cg-text-faint);
}

.cg-breadcrumb__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	/* row-gap 12px chứ không 9px: link nới 5px mỗi phía, khe 9px thì hai hàng
	   chồng vùng bấm 1px khi breadcrumb xuống dòng ở khổ hẹp. Khe ngang giữ
	   nguyên 9px nên hình thức ở khổ rộng không đổi. */
	column-gap: 9px;
	row-gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.cg-breadcrumb__item + .cg-breadcrumb__item::before {
	content: '/';
	margin-right: 9px;
}

/* Vùng chạm: chữ 12px cho hộp link cao 15px, dưới ngưỡng tối thiểu 24px của
   WCAG 2.5.8. Nới bằng padding dọc trên phần tử INLINE — với inline, padding dọc
   mở rộng vùng bấm mà KHÔNG đổi chiều cao dòng, nên hình thức không xê dịch.

   position: relative BẮT BUỘC phải có. .cg-breadcrumb chỉ có padding-top, nên
   5px padding dưới của link TRÀN RA NGOÀI <nav> và rơi vào khối kế tiếp; khối đó
   nằm sau trong DOM nên nó vẽ đè lên và nuốt luôn cú chạm. Đo bằng hình học thì
   thấy 25px và tưởng đã xong; đo bằng elementFromPoint() từng pixel thì chỉ
   19–20px thật sự bấm được, trên mọi trang bài và trang tĩnh.
   position: relative đẩy link lên lớp phần tử đã định vị, tức trên khối kế tiếp.

   Bài học: đo VÙNG CHẠM bằng elementFromPoint(), đừng đọc getBoundingClientRect(). */
.cg-breadcrumb a {
	color: var(--cg-text-meta);
	padding-block: 5px;
	position: relative;
	z-index: 1;
}

.cg-breadcrumb a:hover {
	color: var(--cg-accent);
}

.cg-breadcrumb__current {
	color: var(--cg-text);
}

/* ===== Phân trang (trang-van.html:154-166) ===== */
.cg-pagination {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 16px;
	margin-top: clamp(34px, 4vw, 52px);
	padding-top: 22px;
	border-top: 1px solid var(--cg-border);
}

.cg-pagination__arrow {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	border-radius: 50%;
	border: 1px solid var(--cg-border-btn);
	background: var(--cg-bg);
	color: var(--cg-text);
	transition: border-color 160ms ease, background 160ms ease;
}

.cg-pagination__arrow:hover {
	border-color: var(--cg-text);
	background: var(--cg-bg-alt);
}

.cg-pagination__arrow.is-disabled {
	color: var(--cg-text-ghost);
	pointer-events: none;
}

.cg-pagination__list {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 8px;
}

.cg-pagination__page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 10px;
	border: 1px solid var(--cg-border-btn);
	border-radius: 22px;
	background: transparent;
	color: var(--cg-text-muted);
	font-family: var(--cg-font-sans);
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	transition: background 160ms ease, color 160ms ease;
}

.cg-pagination__page:hover {
	background: var(--cg-bg-media);
}

.cg-pagination__page.is-current {
	border-color: var(--cg-border-active);
	background: var(--cg-bg-media);
	color: var(--cg-accent);
	font-weight: 600;
}

.cg-pagination__dots {
	min-width: 44px;
	text-align: center;
	color: var(--cg-text-ghost);
	font-size: 14px;
}

/* ===== Trang danh sách chuyên mục (header + cột chính) ===== */
.cg-archive-header {
	display: flex;
	flex-direction: column;
	gap: 14px;
	max-width: 62ch;
	padding-top: clamp(20px, 2.6vw, 30px);
}

.cg-archive-header__title {
	margin: 0;
	font-family: var(--cg-font-serif);
	font-size: clamp(30px, 5vw, 46px);
	line-height: 1.12;
	font-weight: 500;
	letter-spacing: -0.01em;
}

.cg-archive-header__desc {
	font-size: clamp(14px, 1.4vw, 15.5px);
	line-height: 1.75;
	color: var(--cg-text-soft);
	text-wrap: pretty;
}

.cg-archive-header__desc p {
	margin: 0;
}

.cg-archive-header__range {
	font-size: 12.5px;
	color: var(--cg-text-meta);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	padding-top: 2px;
}

.cg-archive__main {
	padding-top: clamp(26px, 3.2vw, 38px);
}

.cg-archive__empty {
	margin: 0;
	padding: clamp(26px, 3.2vw, 38px) 0;
	color: var(--cg-text-soft);
}

/* ===== Card video (danh-sach-video.html:142-155) ===== */
.cg-card--video {
	gap: 0;
	border: 1px solid var(--cg-border);
	background: var(--cg-bg);
	color: inherit;
	transition: box-shadow 180ms ease, border-color 180ms ease;
}

.cg-card--video:hover {
	border-color: var(--cg-border-search);
	box-shadow: 0 14px 30px rgba(26, 23, 20, 0.09);
}

.cg-card--video:hover .cg-card__title {
	color: var(--cg-text);
}

.cg-card__media--video {
	aspect-ratio: 16 / 9;
}

.cg-card__shade {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(26, 23, 20, 0) 45%, rgba(26, 23, 20, 0.42) 100%);
	pointer-events: none;
}

.cg-card__play {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	width: 54px;
	height: 54px;
	border-radius: 50%;
	background: rgba(138, 51, 36, 0.92);
	color: var(--cg-on-dark);
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	box-shadow: 0 6px 18px rgba(26, 23, 20, 0.28);
}

.cg-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 8px;
	padding: 14px 15px 16px;
}

.cg-card--video .cg-card__title {
	font-size: clamp(16.5px, 1.8vw, 18px);
	line-height: 1.4;
}

.cg-card--video .cg-card__meta {
	font-size: 12px;
	padding-top: 0;
}

.cg-card-grid--video {
	gap: clamp(24px, 2.8vw, 34px) clamp(20px, 2.4vw, 28px);
}

/* ===== Modal video (danh-sach-video.html:191-214) ===== */
.cg-video-modal {
	position: fixed;
	inset: 0;
	z-index: 80;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: clamp(14px, 3vw, 40px);
}

.cg-video-modal[hidden] {
	display: none;
}

.cg-video-modal__scrim {
	position: absolute;
	inset: 0;
	background: rgba(16, 14, 12, 0.86);
	backdrop-filter: blur(3px);
}

.cg-video-modal__box {
	position: relative;
	width: min(1120px, 100%, (92vh - 140px) * 16 / 9);
	max-height: 92vh;
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-height: 0;
}

.cg-video-modal__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
}

.cg-video-modal__text {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.cg-video-modal__kicker {
	font-size: 10.5px;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: var(--cg-gold-on-dark);
	font-weight: 500;
}

.cg-video-modal__title {
	margin: 0;
	font-family: var(--cg-font-serif);
	font-size: clamp(17px, 2.2vw, 24px);
	line-height: 1.3;
	font-weight: 500;
	color: var(--cg-on-dark);
	text-wrap: pretty;
}

.cg-video-modal__meta {
	font-size: 12.5px;
	color: rgba(255, 255, 255, 0.55);
}

.cg-video-modal__close {
	width: 48px;
	height: 48px;
	flex: none;
	border-radius: 50%;
	border: 1px solid rgba(255, 255, 255, 0.32);
	background: rgba(255, 255, 255, 0.06);
	color: var(--cg-on-dark);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
	transition: background 160ms ease, border-color 160ms ease;
}

.cg-video-modal__close:hover {
	background: rgba(255, 255, 255, 0.18);
	border-color: var(--cg-on-dark);
}

.cg-video-modal__frame {
	position: relative;
	width: 100%;
	aspect-ratio: 16 / 9;
	flex: none;
	min-height: 0;
	background: var(--cg-surface-dark);
	box-shadow: 0 30px 70px rgba(0, 0, 0, 0.5);
}

.cg-video-modal__frame iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
	display: block;
}

/* ===== Thẻ video biến thể trang chủ — dùng lại ở archive-tac_gia. Chuyển từ
   home.css vì không còn là thứ riêng của trang chủ. ===== */
.cg-card--video-home {
	border: 0;
	gap: 12px;
}

.cg-card--video-home:hover {
	border: 0;
	box-shadow: none;
}

.cg-card--video-home .cg-card__body {
	padding: 0;
	gap: 8px;
}

.cg-card--video-home .cg-card__title {
	font-size: 17px;
	line-height: 1.4;
}

.cg-card--video-home .cg-card__meta {
	font-size: 12px;
}

/* Nút play nhỏ góc dưới trái — nền alpha dùng nguyên văn theo docs/02. */
.cg-card--video-home .cg-card__play {
	left: 12px;
	bottom: 12px;
	top: auto;
	right: auto;
	transform: none;
	width: 36px;
	height: 36px;
	background: rgba(26, 23, 20, 0.85);
	box-shadow: none;
}

/* ===== Item list ngang có thumb (section Văn) — dùng lại ở archive-tac_gia. ===== */
.cg-scard {
	display: flex;
	gap: 16px;
	padding: 16px 0;
	border-bottom: 1px solid var(--cg-border-light);
	color: inherit;
}

/* Thẻ đầu danh sách canh thẳng đỉnh với cột bên cạnh. */
.cg-scard:first-child {
	padding-top: 0;
}

.cg-scard:hover .cg-scard__title {
	color: var(--cg-accent);
}

.cg-scard__media {
	width: clamp(84px, 11vw, 104px);
	aspect-ratio: 4 / 3;
	flex: none;
	background: var(--cg-bg-media);
	overflow: hidden;
}

.cg-scard__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cg-scard__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.cg-scard__kicker {
	font-size: 10.5px;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--cg-text-meta);
}

.cg-scard__title {
	margin: 0;
	font-family: var(--cg-font-serif);
	font-size: 17px;
	line-height: 1.4;
	font-weight: 500;
	text-wrap: pretty;
	transition: color 160ms ease;
}

.cg-scard__meta {
	font-size: 12px;
	color: var(--cg-text-faint);
}

/* ===== Item list chỉ tiêu đề (section Nghiên cứu – Trao đổi) — dùng lại ở archive-tac_gia. ===== */
.cg-tcard {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 15px 0;
	border-bottom: 1px solid var(--cg-border-light);
	color: inherit;
}

.cg-tcard:hover .cg-tcard__title {
	color: var(--cg-accent);
}

.cg-tcard__title {
	margin: 0;
	font-family: var(--cg-font-serif);
	font-size: 17px;
	line-height: 1.42;
	font-weight: 500;
	text-wrap: pretty;
	transition: color 160ms ease;
}

.cg-tcard__date {
	font-size: 12px;
	color: var(--cg-text-faint);
}

/* ===== Thẻ thơ (section Thơ) — dùng lại ở archive-tac_gia. ===== */
.cg-poem {
	display: flex;
	flex-direction: column;
	gap: 16px;
	background: var(--cg-bg-alt);
	padding: clamp(22px, 2.4vw, 30px);
}

.cg-poem__title {
	margin: 0;
	font-family: var(--cg-font-serif);
	font-size: 22px;
	line-height: 1.3;
	font-weight: 500;
	text-wrap: pretty;
}

.cg-poem__verse {
	margin: 0;
	font-family: var(--cg-font-serif);
	font-style: italic;
	font-size: 15.5px;
	line-height: 2;
	color: var(--cg-text-footer);
	white-space: pre-line;
}

.cg-poem__author {
	font-size: 12.5px;
	color: var(--cg-text-meta);
	margin-top: auto;
}

/* ===== Thẻ tác giả (section Tác giả – Tác phẩm) — dùng lại ở archive-tac_gia
   (docblock của card-author.php đã nói trước điều này). ===== */
.cg-acard {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 11px;
	color: inherit;
}

.cg-acard:hover .cg-acard__name {
	color: var(--cg-accent);
}

.cg-acard__media {
	width: 100%;
	aspect-ratio: 1 / 1;
	background: var(--cg-bg-media);
	overflow: hidden;
}

.cg-acard__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cg-acard__name {
	margin: 0;
	font-family: var(--cg-font-serif);
	font-size: 17px;
	font-weight: 500;
	transition: color 160ms ease;
}

.cg-acard__note {
	font-size: 12.5px;
	color: var(--cg-text-meta);
}
