/* ==========================================================
   Danh Mục Đẹp v1.1 – Giao diện lưới, bài viết & thanh bên
   Biến màu (--dmd-*) được sinh từ trang cài đặt.
   ========================================================== */

:root {
	--dmd-accent: #c62828;
	--dmd-radius: 12px;
	--dmd-ratio: 16/9;
	--dmd-fs: 17px;
	--dmd-sticky-top: 90px;
	--dmd-ink: #f3f4f6;
	--dmd-ink-2: #c9ccd1;
	--dmd-ink-3: #8d9199;
	--dmd-line: rgba(255, 255, 255, .09);
	--dmd-card: #262626;
	--dmd-soft: #1c1c1c;
	--dmd-shadow: 0 2px 6px rgba(0, 0, 0, .35);
	--dmd-shadow-hover: 0 14px 34px rgba(0, 0, 0, .55);
	--dmd-accent-soft: color-mix(in srgb, var(--dmd-accent) 16%, transparent);
}

.dmd { color: var(--dmd-ink); }
.dmd *, .dmd *::before, .dmd *::after { box-sizing: border-box; }
.dmd a,
.dmd .dmd-card a,
.entry-content .dmd .dmd-card a { text-decoration: none !important; box-shadow: none !important; border-bottom: 0 !important; }

.dmd-container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ==========================================================
   HERO (đầu trang chuyên mục / tìm kiếm)
   ========================================================== */
.dmd-hero {
	position: relative;
	padding: 48px 0 40px;
	margin-bottom: 32px;
	background:
		radial-gradient(900px 260px at 0% 0%, color-mix(in srgb, var(--dmd-accent) 28%, transparent), transparent 70%),
		linear-gradient(180deg, var(--dmd-soft), transparent);
	border-bottom: 1px solid var(--dmd-line);
	overflow: hidden;
}
.dmd-hero::after {
	content: "";
	position: absolute;
	left: 0; right: 0; bottom: -1px;
	height: 3px;
	background: linear-gradient(90deg, var(--dmd-accent), transparent 60%);
}
.dmd-hero--compact { padding: 40px 0 34px; }
.dmd-eyebrow {
	margin: 0 0 8px;
	font-size: 12px;
	font-weight: 800;
	letter-spacing: .12em;
	text-transform: uppercase;
	color: var(--dmd-accent);
}
.dmd .dmd-hero__title {
	margin: 0 0 10px;
	font-size: clamp(28px, 4.2vw, 44px);
	line-height: 1.15;
	font-weight: 800;
	letter-spacing: -.01em;
	color: var(--dmd-ink);
	text-transform: none;
}
.dmd-hero__desc { max-width: 760px; font-size: 16px; line-height: 1.7; color: var(--dmd-ink-2); }
.dmd-hero__desc p { margin: 0 0 6px; }
.dmd-hero__count { margin: 12px 0 0; font-size: 14px; color: var(--dmd-ink-3); }
.dmd-hero__count strong { color: var(--dmd-accent); font-size: 16px; }

.dmd-breadcrumb { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; font-size: 13px; color: var(--dmd-ink-3); }
.dmd-breadcrumb a { color: var(--dmd-ink-2); }
.dmd-breadcrumb a:hover { color: var(--dmd-accent); }

/* Ô tìm kiếm */
.dmd-searchbar {
	display: flex;
	max-width: 580px;
	margin-top: 20px;
	background: var(--dmd-card);
	border: 1px solid var(--dmd-line);
	border-radius: 999px;
	overflow: hidden;
	transition: border-color .2s, box-shadow .2s;
}
.dmd-searchbar:focus-within { border-color: var(--dmd-accent); box-shadow: 0 0 0 4px var(--dmd-accent-soft); }
.dmd .dmd-searchbar input {
	flex: 1; min-width: 0; height: 50px; margin: 0;
	padding: 0 22px; border: 0; outline: 0; box-shadow: none;
	background: transparent; color: var(--dmd-ink); font-size: 15px;
}
.dmd .dmd-searchbar button {
	margin: 0; padding: 0 28px; border: 0; border-radius: 0;
	background: var(--dmd-accent); color: #fff;
	font-weight: 800; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; cursor: pointer;
}
.dmd .dmd-searchbar button:hover { filter: brightness(1.1); }

/* Chuyên mục con & sắp xếp */
.dmd-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.dmd-chip {
	display: inline-flex; align-items: center; gap: 8px;
	padding: 7px 14px; border-radius: 999px;
	border: 1px solid var(--dmd-line); background: var(--dmd-card);
	color: var(--dmd-ink); font-size: 14px; font-weight: 600;
	transition: border-color .2s, color .2s, background .2s;
}
.dmd-chip span { padding: 1px 8px; border-radius: 999px; background: var(--dmd-soft); color: var(--dmd-ink-3); font-size: 12px; }
.dmd-chip:hover { border-color: var(--dmd-accent); color: #fff; background: var(--dmd-accent); }
.dmd-chip:hover span { background: rgba(0, 0, 0, .25); color: #fff; }

.dmd-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-bottom: 24px; padding-bottom: 14px; border-bottom: 1px solid var(--dmd-line); }
.dmd-toolbar__label { margin-right: 8px; font-size: 13px; color: var(--dmd-ink-3); }
.dmd-sort { padding: 6px 12px; border-radius: 8px; color: var(--dmd-ink-2); font-size: 14px; font-weight: 600; }
.dmd-sort:hover { background: var(--dmd-card); color: var(--dmd-ink); }
.dmd-sort.is-active { background: var(--dmd-accent); color: #fff; }

/* Tiêu đề khối */
.dmd-section-head { display: flex; align-items: center; gap: 16px; margin: 0 0 22px; }
.dmd-section-head::after { content: ""; flex: 1; height: 1px; background: var(--dmd-line); }
.dmd .dmd-section-title {
	position: relative; margin: 0; padding: 0 0 0 14px;
	font-size: 20px; font-weight: 800; line-height: 1.3;
	letter-spacing: .02em; text-transform: uppercase; color: var(--dmd-ink);
}
.dmd .dmd-section-title::before {
	content: ""; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px;
	border-radius: 4px; background: var(--dmd-accent);
}

/* ==========================================================
   LƯỚI
   ========================================================== */
.dmd-grid { display: grid; gap: 22px; margin: 0 0 36px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dmd-cols-1 { grid-template-columns: minmax(0, 1fr); }
.dmd-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dmd-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dmd-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ==========================================================
   THẺ BÀI VIẾT – bố cục "Lưới thẻ" (mặc định)
   ========================================================== */
.dmd-card {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	height: 100%;
	margin: 0;
	background: var(--dmd-card);
	border: 1px solid var(--dmd-line);
	border-radius: var(--dmd-radius);
	overflow: hidden;
	box-shadow: var(--dmd-shadow);
	transition: transform .28s ease, box-shadow .28s ease, border-color .28s ease;
	isolation: isolate;
}
.dmd-card__thumb {
	position: relative;
	aspect-ratio: var(--dmd-ratio);
	overflow: hidden;
	background: var(--dmd-soft);
	flex-shrink: 0;
}
.dmd .dmd-card__thumb img,
.dmd .dmd-card__thumb .dmd-img {
	position: absolute; inset: 0;
	display: block; width: 100%; height: 100%; max-width: none;
	margin: 0; object-fit: cover; opacity: 1 !important; z-index: 1;
	transition: transform .6s cubic-bezier(.2, .7, .2, 1);
}
.dmd-thumb-placeholder {
	position: absolute; inset: 0; z-index: 0;
	display: flex; align-items: center; justify-content: center;
	font-size: 54px; font-weight: 900; color: rgba(255, 255, 255, .9);
	background:
		radial-gradient(circle at 30% 20%, rgba(255, 255, 255, .18), transparent 50%),
		linear-gradient(135deg, var(--dmd-accent), color-mix(in srgb, var(--dmd-accent) 35%, #000));
}
/* Nhãn chuyên mục: góc dưới-trái ảnh (tránh đè nhãn của plugin khác ở góc trên) */
.dmd-badge {
	position: absolute; left: 12px; bottom: 12px; z-index: 2;
	max-width: calc(100% - 24px);
	padding: 4px 10px; border-radius: 6px;
	background: var(--dmd-accent); color: #fff;
	font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
	white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

.dmd-card__body { display: flex; flex: 1; flex-direction: column; padding: 16px 18px 18px; }
.dmd-card__meta {
	display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
	margin: 0 0 8px; font-size: 12.5px; color: var(--dmd-ink-3);
}
.dmd-dot { opacity: .6; }
.dmd .dmd-card__title {
	margin: 0 0 8px; padding: 0;
	font-size: 17px; line-height: 1.4; font-weight: 700;
	letter-spacing: 0; text-transform: none; text-align: left;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.dmd .dmd-card__title a { color: var(--dmd-ink); transition: color .2s; }
/* Cả thẻ là liên kết */
.dmd .dmd-card__title a::after { content: ""; position: absolute; inset: 0; z-index: 3; }
.dmd .dmd-card:hover .dmd-card__title a { color: var(--dmd-accent); }
.dmd mark { padding: 0 3px; border-radius: 3px; background: var(--dmd-accent-soft); color: inherit; box-shadow: inset 0 -2px 0 var(--dmd-accent); }
.dmd .dmd-card__excerpt {
	margin: 0 0 14px; font-size: 14px; line-height: 1.6; color: var(--dmd-ink-2);
	display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.dmd-card__more {
	margin-top: auto; font-size: 13px; font-weight: 800;
	letter-spacing: .03em; text-transform: uppercase; color: var(--dmd-accent);
}
.dmd-card__more span { display: inline-block; transition: transform .2s; }
.dmd-card:hover .dmd-card__more span { transform: translateX(4px); }

/* Hiệu ứng rê chuột (chọn trong cài đặt) */
.dmd-hover-lift .dmd-card:hover { transform: translateY(-5px); box-shadow: var(--dmd-shadow-hover); }
.dmd-hover-lift .dmd-card:hover .dmd-card__thumb img,
.dmd-hover-zoom .dmd-card:hover .dmd-card__thumb img { transform: scale(1.07); }
.dmd-hover-glow .dmd-card:hover { border-color: var(--dmd-accent); box-shadow: 0 0 0 1px var(--dmd-accent), 0 10px 30px color-mix(in srgb, var(--dmd-accent) 35%, transparent); }

/* ==========================================================
   BỐ CỤC: Ảnh phủ chữ
   ========================================================== */
.dmd-layout--overlay .dmd-card,
.dmd-layout--magazine .dmd-card:first-child { border: 0; }
.dmd-layout--overlay .dmd-card__thumb { aspect-ratio: var(--dmd-ratio); }
.dmd-layout--overlay .dmd-card__thumb::after,
.dmd-layout--magazine .dmd-card:first-child .dmd-card__thumb::after {
	content: ""; position: absolute; inset: 0; z-index: 1;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, .55) 62%, rgba(0, 0, 0, .92) 100%);
}
.dmd-layout--overlay .dmd-card__body,
.dmd-layout--magazine .dmd-card:first-child .dmd-card__body {
	position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
	padding: 16px 18px; background: none;
}
.dmd-layout--overlay .dmd-badge,
.dmd-layout--magazine .dmd-card:first-child .dmd-badge { top: 12px; bottom: auto; left: auto; right: 12px; }
.dmd-layout--overlay .dmd-card__meta,
.dmd-layout--magazine .dmd-card:first-child .dmd-card__meta { color: rgba(255, 255, 255, .78); }
.dmd .dmd-layout--overlay .dmd-card__title a,
.dmd .dmd-layout--magazine .dmd-card:first-child .dmd-card__title a { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.dmd .dmd-layout--overlay .dmd-card:hover .dmd-card__title a { color: #fff; }
.dmd-layout--overlay .dmd-card__excerpt,
.dmd-layout--overlay .dmd-card__more { display: none; }
.dmd-layout--overlay .dmd-card__body::before {
	content: ""; display: block; width: 32px; height: 3px; margin-bottom: 10px;
	border-radius: 3px; background: var(--dmd-accent); transition: width .3s;
}
.dmd-layout--overlay .dmd-card:hover .dmd-card__body::before { width: 64px; }

/* Ô màu giữ chỗ: ẩn chữ cái khi chữ tiêu đề nằm đè lên ảnh */
.dmd-layout--overlay .dmd-thumb-placeholder,
.dmd-layout--magazine .dmd-card:first-child .dmd-thumb-placeholder { font-size: 0; }
.dmd-layout--compact .dmd-thumb-placeholder { font-size: 26px; }

/* ==========================================================
   BỐ CỤC: Tạp chí (bài đầu lớn chiếm 2×2)
   ========================================================== */
.dmd-layout--magazine.dmd-cols-3 .dmd-card:first-child,
.dmd-layout--magazine.dmd-cols-4 .dmd-card:first-child { grid-column: span 2; grid-row: span 2; }
.dmd-layout--magazine .dmd-card:first-child .dmd-card__thumb { position: absolute; inset: 0; aspect-ratio: auto; height: 100%; }
.dmd-layout--magazine .dmd-card:first-child { min-height: 340px; }
.dmd .dmd-layout--magazine .dmd-card:first-child .dmd-card__title { font-size: clamp(20px, 2.4vw, 28px); -webkit-line-clamp: 3; }
.dmd-layout--magazine .dmd-card:first-child .dmd-card__body { padding: 26px 28px; }
.dmd .dmd-layout--magazine .dmd-card:first-child .dmd-card__excerpt { color: rgba(255, 255, 255, .82); -webkit-line-clamp: 2; }
.dmd-layout--magazine .dmd-card:first-child .dmd-card__more { color: #fff; }
.dmd-layout--magazine.dmd-cols-1 .dmd-card:first-child,
.dmd-layout--magazine.dmd-cols-2 .dmd-card:first-child { grid-column: 1 / -1; }

/* ==========================================================
   BỐ CỤC: Danh sách ngang
   ========================================================== */
.dmd-layout--list .dmd-card { flex-direction: row; }
.dmd-layout--list .dmd-card__thumb { width: 40%; max-width: 320px; aspect-ratio: auto; min-height: 160px; }
.dmd-layout--list .dmd-card__body { padding: 18px 22px; justify-content: center; }
.dmd .dmd-layout--list .dmd-card__title { font-size: 18px; }

/* ==========================================================
   BỐ CỤC: Gọn (ảnh nhỏ)
   ========================================================== */
.dmd-layout--compact { gap: 12px; }
.dmd-layout--compact .dmd-card { flex-direction: row; align-items: center; padding: 10px; gap: 12px; }
.dmd-layout--compact .dmd-card__thumb { width: 96px; height: 72px; aspect-ratio: auto; border-radius: calc(var(--dmd-radius) * .6); }
.dmd-layout--compact .dmd-card__body { padding: 0; }
.dmd-layout--compact .dmd-badge,
.dmd-layout--compact .dmd-card__more,
.dmd-layout--compact .dmd-card__excerpt { display: none; }
.dmd .dmd-layout--compact .dmd-card__title { font-size: 15px; margin: 0; }
.dmd-layout--compact .dmd-card__meta { order: 2; margin: 6px 0 0; font-size: 12px; }
.dmd-hover-lift .dmd-layout--compact .dmd-card:hover { transform: translateX(4px); }

/* ==========================================================
   KHỐI LIÊN QUAN (nằm trong nội dung bài)
   ========================================================== */
.dmd-related,
.dmd-sc { container-type: inline-size; }
.dmd-related { clear: both; margin: 44px 0 10px; }
.dmd-layout--overlay .dmd-card { min-height: 0; }

/* Tự giảm cột theo bề rộng thật của cột nội dung (không phụ thuộc màn hình) */
@container (max-width: 760px) {
	.dmd-grid.dmd-cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@container (max-width: 600px) {
	.dmd-layout--overlay .dmd-card__thumb { aspect-ratio: 4/3; }
	.dmd-layout--overlay .dmd-card__meta { display: none; }
	.dmd-layout--overlay .dmd-card__body { padding: 12px !important; }
	.dmd-grid.dmd-cols-3,
	.dmd-grid.dmd-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
	.dmd .dmd-card__title { font-size: 15px; }
	.dmd-layout--list .dmd-card__thumb { width: 42%; }
}
@container (max-width: 360px) {
	.dmd-grid.dmd-layout--grid,
	.dmd-grid.dmd-layout--list { grid-template-columns: minmax(0, 1fr); }
}
.dmd-related .dmd-grid { gap: 16px; margin-bottom: 0; }
.dmd .dmd-related .dmd-card__title,
.dmd-related .dmd-card__title { font-size: 15.5px; }
.dmd-related .dmd-card__body { padding: 13px 15px 15px; }
.dmd-related .dmd-layout--overlay .dmd-card__body { padding: 14px 15px; }
.dmd-article .entry-content .dmd img,
.entry-content .dmd img { width: 100%; height: 100%; border-radius: 0; margin: 0; box-shadow: none; }
.dmd-article .entry-content .dmd p.dmd-card__excerpt { margin: 0 0 12px; }

/* ==========================================================
   PHÂN TRANG & TRỐNG
   ========================================================== */
.dmd-pagination { margin: 8px 0 56px; }
.dmd-pagination ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.dmd-pagination li { margin: 0; }
.dmd-pagination .page-numbers {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 42px; height: 42px; padding: 0 14px;
	border: 1px solid var(--dmd-line); border-radius: 10px;
	background: var(--dmd-card); color: var(--dmd-ink); font-weight: 700;
}
.dmd-pagination a.page-numbers:hover { border-color: var(--dmd-accent); color: var(--dmd-accent); }
.dmd-pagination .page-numbers.current { background: var(--dmd-accent); border-color: var(--dmd-accent); color: #fff; }
.dmd-pagination .page-numbers.dots { border: 0; background: transparent; }

.dmd-empty { margin-bottom: 40px; padding: 40px 24px; border: 1px dashed var(--dmd-line); border-radius: var(--dmd-radius); background: var(--dmd-card); text-align: center; color: var(--dmd-ink-2); }
.dmd-empty__title { margin: 0 0 6px; font-size: 19px; font-weight: 800; color: var(--dmd-ink); }

/* ==========================================================
   TRANG BÀI VIẾT (body.dmd-single, article.dmd-article)
   Tương thích Flatsome và đa số theme.
   ========================================================== */
.dmd-single-card .dmd-article > .article-inner,
.dmd-single-card article.dmd-article:not(:has(> .article-inner)) {
	padding: clamp(18px, 3vw, 36px);
	background: var(--dmd-card);
	border: 1px solid var(--dmd-line);
	border-radius: var(--dmd-radius);
	box-shadow: var(--dmd-shadow);
}

/* Tiêu đề bài */
.dmd-article .entry-header-text { padding-top: 0; padding-bottom: 8px; }
.dmd-article .entry-category,
.dmd-article .entry-header .cat-links { margin-bottom: 12px; }
.dmd-article .entry-category a,
.dmd-article .entry-header .cat-links a {
	display: inline-block; margin: 0 4px 4px 0; padding: 4px 12px;
	border-radius: 999px; background: var(--dmd-accent); color: #fff !important;
	font-size: 11px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
	opacity: 1;
}
.dmd-article .entry-title {
	margin-bottom: 12px;
	font-size: clamp(24px, 3.2vw, 36px);
	line-height: 1.25; font-weight: 800; letter-spacing: -.005em;
	color: var(--dmd-ink);
}
.dmd-article .entry-divider.is-divider,
.dmd-article .entry-header .is-divider { width: 56px; max-width: 56px; height: 3px; margin: 14px auto; border-radius: 3px; background: var(--dmd-accent); opacity: 1; }
.dmd-article .entry-header .entry-meta,
.dmd-article .entry-meta.uppercase { font-size: 12.5px; letter-spacing: .05em; color: var(--dmd-ink-3); }
.dmd-article .entry-header .entry-meta a { color: var(--dmd-ink-2); }
.dmd-article .entry-header .entry-meta a:hover { color: var(--dmd-accent); }

/* Ảnh đầu bài */
.dmd-article .entry-image { margin-bottom: 26px; }
.dmd-article .entry-image img,
.dmd-article .post-thumbnail img { width: 100%; border-radius: var(--dmd-radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .35); }
.dmd-article .badge.post-date .badge-inner { background: var(--dmd-accent); border-color: var(--dmd-accent); border-radius: 8px; color: #fff; }

/* Nội dung */
.dmd-article .entry-content {
	font-size: var(--dmd-fs);
	line-height: 1.8;
	color: var(--dmd-ink-2);
	overflow-wrap: anywhere;
}
.dmd-article .entry-content > * { max-width: 100%; }
.dmd-article .entry-content p { margin: 0 0 1.15em; }
.dmd-article .entry-content strong,
.dmd-article .entry-content b { color: var(--dmd-ink); }
.dmd-article .entry-content h1:not(.dmd-card__title):not(.dmd-section-title),
.dmd-article .entry-content h2:not(.dmd-card__title):not(.dmd-section-title),
.dmd-article .entry-content h3:not(.dmd-card__title):not(.dmd-section-title),
.dmd-article .entry-content h4:not(.dmd-card__title):not(.dmd-section-title),
.dmd-article .entry-content h5:not(.dmd-card__title):not(.dmd-section-title) { margin: 1.8em 0 .7em; line-height: 1.35; font-weight: 800; color: var(--dmd-ink); text-transform: none; letter-spacing: 0; }
.dmd-article .entry-content h2:not(.dmd-card__title):not(.dmd-section-title) { font-size: 1.5em; padding: 2px 0 2px 14px; border-left: 4px solid var(--dmd-accent); }
.dmd-article .entry-content h3:not(.dmd-card__title):not(.dmd-section-title) { font-size: 1.25em; }
.dmd-article .entry-content h3:not(.dmd-card__title):not(.dmd-section-title)::before { content: ""; display: inline-block; width: 9px; height: 9px; margin: 0 10px 2px 0; border-radius: 2px; background: var(--dmd-accent); transform: rotate(45deg); }
.dmd-article .entry-content h4:not(.dmd-card__title):not(.dmd-section-title) { font-size: 1.1em; }
.dmd-article .entry-content > :first-child { margin-top: 0; }

.dmd-article .entry-content :is(p, li, td, th, dd, blockquote, figcaption) a:not(.button):not(.wp-block-button__link) {
	color: var(--dmd-accent);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	font-weight: 600;
}
.dmd-article .entry-content :is(p, li, td, th, dd, blockquote, figcaption) a:not(.button):not(.wp-block-button__link):hover { text-decoration-thickness: 2px; filter: brightness(1.15); }

.dmd-article .entry-content img { height: auto; border-radius: calc(var(--dmd-radius) * .75); }
.dmd-article .entry-content figure { margin: 1.6em 0; }
.dmd-article .entry-content figcaption,
.dmd-article .entry-content .wp-caption-text { margin-top: 8px; font-size: 13.5px; text-align: center; color: var(--dmd-ink-3); }
.dmd-article .entry-content .wp-caption { max-width: 100%; }

.dmd-article .entry-content ul,
.dmd-article .entry-content ol { margin: 0 0 1.3em; padding-left: 1.4em; }
.dmd-article .entry-content li { margin-bottom: .45em; }
.dmd-article .entry-content li::marker { color: var(--dmd-accent); font-weight: 800; }

.dmd-article .entry-content blockquote {
	position: relative;
	margin: 1.6em 0; padding: 18px 22px 18px 26px;
	border: 0; border-left: 4px solid var(--dmd-accent);
	border-radius: 0 var(--dmd-radius) var(--dmd-radius) 0;
	background: var(--dmd-soft); color: var(--dmd-ink);
	font-size: 1.02em; font-style: normal;
}
.dmd-article .entry-content blockquote p:last-child { margin-bottom: 0; }

.dmd-article .entry-content table { width: 100%; margin: 1.5em 0; border-collapse: separate; border-spacing: 0; border: 1px solid var(--dmd-line); border-radius: var(--dmd-radius); overflow: hidden; font-size: .93em; }
.dmd-article .entry-content th { background: var(--dmd-soft); color: var(--dmd-ink); font-weight: 800; text-align: left; }
.dmd-article .entry-content th,
.dmd-article .entry-content td { padding: 11px 14px; border: 0; border-bottom: 1px solid var(--dmd-line); }
.dmd-article .entry-content tr:last-child td { border-bottom: 0; }

.dmd-article .entry-content code { padding: 2px 6px; border-radius: 5px; background: var(--dmd-soft); color: var(--dmd-ink); font-size: .9em; }
.dmd-article .entry-content pre { padding: 16px 18px; border-radius: var(--dmd-radius); background: var(--dmd-soft); border: 1px solid var(--dmd-line); overflow: auto; }
.dmd-article .entry-content pre code { padding: 0; background: none; }
.dmd-article .entry-content hr { height: 1px; margin: 2em 0; border: 0; background: var(--dmd-line); }

.dmd-article .entry-content iframe[src*="youtube"],
.dmd-article .entry-content iframe[src*="youtu.be"],
.dmd-article .entry-content iframe[src*="vimeo"] { display: block; width: 100%; height: auto; aspect-ratio: 16/9; border: 0; border-radius: var(--dmd-radius); }

.dmd-article .entry-content .wp-block-button__link,
.dmd-article .entry-content .button.primary {
	border-radius: 10px; background: var(--dmd-accent); color: #fff;
	font-weight: 800; text-decoration: none;
	box-shadow: 0 6px 18px color-mix(in srgb, var(--dmd-accent) 40%, transparent);
	transition: transform .2s, filter .2s;
}
.dmd-article .entry-content .wp-block-button__link:hover,
.dmd-article .entry-content .button.primary:hover { transform: translateY(-2px); filter: brightness(1.1); }

/* Chân bài: thẻ, tác giả, điều hướng */
.dmd-article footer.entry-meta { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--dmd-line); font-size: 13.5px; color: var(--dmd-ink-3); }
.dmd-article footer.entry-meta a {
	display: inline-block; margin: 3px 2px; padding: 3px 11px;
	border: 1px solid var(--dmd-line); border-radius: 999px;
	color: var(--dmd-ink-2); background: var(--dmd-soft);
	transition: all .2s;
}
.dmd-article footer.entry-meta a:hover { border-color: var(--dmd-accent); background: var(--dmd-accent); color: #fff; }
.dmd-article .entry-author { margin-top: 24px; padding: 20px !important; border: 1px solid var(--dmd-line); border-radius: var(--dmd-radius); background: var(--dmd-soft); }
.dmd-single .navigation-post { margin-top: 24px; padding: 0; border: 0; }
.dmd-single .navigation-post a { color: var(--dmd-ink-2); font-weight: 700; }
.dmd-single .navigation-post a:hover { color: var(--dmd-accent); }

/* Ẩn điều hướng bài trước/sau & khung tác giả (tuỳ chọn) */
.dmd-hide-nav :is(.navigation-post, #nav-below, .post-navigation, .nav-links.post-nav, nav.navigation.post-navigation, .wp-block-post-navigation-link),
.dmd-hide-author .dmd-article .entry-author { display: none !important; }

/* Thanh tiến độ đọc */
.dmd-progress { position: fixed; top: 0; left: 0; right: 0; z-index: 100000; height: 3px; pointer-events: none; }
.admin-bar .dmd-progress { top: 32px; }
.dmd-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--dmd-accent), color-mix(in srgb, var(--dmd-accent) 60%, #ffd54f)); transform: scaleX(0); transform-origin: left; box-shadow: 0 0 10px var(--dmd-accent); }

/* ==========================================================
   THANH BÊN (body.dmd-sb) – Flatsome #secondary và theme khác
   ========================================================== */
.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar, .sidebar-inner) > .widget,
.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar) aside.widget {
	margin: 0 0 22px;
	padding: 20px 20px 16px;
	background: var(--dmd-card);
	border: 1px solid var(--dmd-line);
	border-radius: var(--dmd-radius);
	box-shadow: var(--dmd-shadow);
}
.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar) .widget :is(.widget-title, .widgettitle, .wp-block-heading, h2.widget-title, h3.widget-title) {
	position: relative; display: block;
	margin: 0 0 14px; padding: 0 0 12px;
	font-size: 15px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
	color: var(--dmd-ink);
	border-bottom: 1px solid var(--dmd-line);
}
.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar) .widget :is(.widget-title, .widgettitle, .wp-block-heading)::after {
	content: ""; position: absolute; left: 0; bottom: -1px; width: 44px; height: 3px; border-radius: 3px; background: var(--dmd-accent);
}
.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar) .widget > .is-divider { display: none; }

.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar) .widget ul { margin: 0; padding: 0; list-style: none; }
.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar) .widget li { margin: 0; padding: 0; border: 0; border-bottom: 1px dashed var(--dmd-line); list-style: none; }
.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar) .widget li:last-child { border-bottom: 0; }
.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar) :is(.widget_categories, .widget_archive, .widget_pages, .widget_nav_menu, .widget_meta, .wp-block-categories, .wp-block-archives) li > a {
	display: flex; align-items: center; justify-content: space-between; gap: 10px;
	padding: 10px 6px; color: var(--dmd-ink-2); font-size: 14.5px; font-weight: 600;
	transition: color .2s, padding .2s;
}
.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar) :is(.widget_categories, .widget_archive, .widget_pages, .widget_nav_menu, .widget_meta, .wp-block-categories, .wp-block-archives) li > a::before {
	content: ""; flex: 0 0 6px; width: 6px; height: 6px; margin-right: 2px; border-radius: 50%; background: var(--dmd-ink-3); transition: background .2s;
}
.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar) :is(.widget_categories, .widget_archive, .widget_pages, .widget_nav_menu, .widget_meta, .wp-block-categories, .wp-block-archives) li > a:hover { color: var(--dmd-ink); padding-left: 10px; }
.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar) :is(.widget_categories, .widget_archive, .widget_pages, .widget_nav_menu, .widget_meta, .wp-block-categories, .wp-block-archives) li > a:hover::before { background: var(--dmd-accent); }
.dmd-sb .widget li.current-cat > a,
.dmd-sb .widget li.current-menu-item > a { color: var(--dmd-accent); }
.dmd-sb .widget li ul.children { padding-left: 14px; border-top: 1px dashed var(--dmd-line); }
.dmd-count {
	margin-left: auto; padding: 1px 9px; min-width: 28px; text-align: center;
	border-radius: 999px; background: var(--dmd-soft);
	color: var(--dmd-ink-3); font-size: 12px; font-weight: 800;
	transition: background .2s, color .2s;
}
.dmd-sb .widget li > a:hover .dmd-count { background: var(--dmd-accent); color: #fff; }

/* Bài viết gần đây, văn bản, thẻ */
.dmd-sb :is(.widget_recent_entries, .wp-block-latest-posts) li a { display: block; padding: 10px 0; color: var(--dmd-ink-2); font-weight: 600; line-height: 1.45; }
.dmd-sb :is(.widget_recent_entries, .wp-block-latest-posts) li a:hover { color: var(--dmd-accent); }
.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar) :is(.widget_text, .widget_block) p { margin-bottom: .8em; font-size: 14.5px; line-height: 1.7; color: var(--dmd-ink-2); }
.dmd-sb :is(.widget_tag_cloud, .wp-block-tag-cloud) a,
.dmd-sb .tagcloud a {
	display: inline-block; margin: 0 4px 6px 0; padding: 4px 11px;
	border: 1px solid var(--dmd-line); border-radius: 999px;
	background: var(--dmd-soft); color: var(--dmd-ink-2);
	font-size: 12.5px !important; font-weight: 600;
}
.dmd-sb :is(.widget_tag_cloud, .wp-block-tag-cloud) a:hover,
.dmd-sb .tagcloud a:hover { border-color: var(--dmd-accent); background: var(--dmd-accent); color: #fff; }
.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar) .widget img { border-radius: calc(var(--dmd-radius) * .6); }
.dmd-sb :is(#secondary, .widget-area, .post-sidebar, .sidebar) .widget_search input[type="search"] { border-radius: 8px; }

/* Thanh bên dính khi cuộn (máy tính) */
@media (min-width: 850px) {
	.dmd-sb-sticky .post-sidebar,
	.dmd-sb-sticky .large-3.col.post-sidebar,
	.dmd-sb-sticky aside#secondary:not(.post-sidebar *) {
		position: sticky;
		top: var(--dmd-sticky-top);
		align-self: flex-start;
	}
}

/* ==========================================================
   ĐÁP ỨNG
   ========================================================== */
@media (max-width: 1024px) {
	.dmd-cols-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.dmd-layout--magazine.dmd-cols-4 .dmd-card:first-child { grid-column: span 2; }
}
@media (max-width: 849px) {
	.dmd-grid.dmd-cols-3,
	.dmd-grid.dmd-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
	.dmd-layout--magazine .dmd-card:first-child { grid-column: 1 / -1 !important; grid-row: auto; min-height: 300px; }
	.dmd-layout--list .dmd-card__thumb { width: 42%; }
}
@media (max-width: 549px) {
	.dmd-grid.dmd-cols-2,
	.dmd-grid.dmd-cols-3,
	.dmd-grid.dmd-cols-4 { grid-template-columns: minmax(0, 1fr); }
	.dmd-hero { padding: 32px 0 26px; margin-bottom: 22px; }
	.dmd .dmd-searchbar button { padding: 0 18px; }
	.dmd-layout--list .dmd-card { flex-direction: column; }
	.dmd-layout--list .dmd-card__thumb { width: 100%; max-width: none; aspect-ratio: var(--dmd-ratio); min-height: 0; }
	/* Liên quan trên điện thoại: 2 cột gọn cho lưới & ảnh phủ */
	.dmd-related .dmd-grid.dmd-layout--overlay { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
	.dmd-related .dmd-layout--overlay .dmd-card__body { padding: 10px; }
	.dmd .dmd-related .dmd-layout--overlay .dmd-card__title { font-size: 13.5px; -webkit-line-clamp: 3; }
	.dmd-related .dmd-layout--overlay .dmd-card__meta,
	.dmd-related .dmd-layout--overlay .dmd-badge { display: none; }
	.dmd-related .dmd-layout--overlay .dmd-card__thumb { aspect-ratio: 4/5; }
}

@media (prefers-reduced-motion: reduce) {
	.dmd-card, .dmd-card__thumb img, .dmd-card__more span, .dmd-progress span { transition: none !important; }
	.dmd-card:hover { transform: none !important; }
}
