/**
 * ATA single post — layout chi tiết bài viết (template-parts/posts/single-ata.php).
 * Màu chủ đạo lấy từ Flatsome: --primary-color (#122d72).
 */
.ata-post {
	--ata-accent: var(--primary-color, #122d72);
	--ata-text: #374151;
	--ata-muted: #6b7280;
	--ata-border: #e5e7eb;
	--ata-soft: #f9fafb;
}

/* ---------- Hero ---------- */
.ata-post .ata-post__hero {
	position: relative;
	display: flex;
	align-items: flex-end;
	min-height: 300px;
	aspect-ratio: var(--ata-hero-ratio, auto);
	padding: 72px 16px 64px;
	overflow: hidden;
	background: #0f1b3d;
	color: #fff;
	margin: 0;
}
.ata-post .ata-post__hero-bg,
.ata-post .ata-post__hero-bg img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.ata-post .ata-post__hero-bg::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(0deg, rgba(15, 23, 42, .95) 0%, rgba(15, 23, 42, .8) 30%, rgba(15, 23, 42, .35) 65%, rgba(15, 23, 42, 0) 100%);
}
.ata-post .ata-post__hero--no-image {
	background: linear-gradient(135deg, var(--ata-accent) 0%, #0f1b3d 100%);
}
.ata-post .ata-post__hero-inner {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 900px;
	margin: 0 auto;
}
.ata-post .ata-post__title {
	margin: 0 0 24px;
	color: #fff;
	font-size: clamp(1.75rem, 4vw, 3rem);
	font-weight: 800;
	line-height: 1.2;
	text-transform: none;
	text-shadow: 0 2px 12px rgba(0, 0, 0, .25);
}
.ata-post .ata-post__meta {
	display: flex;
	align-items: center;
	gap: 12px;
}
.ata-post .ata-post__avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 40px;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, .25);
	color: #fff;
}
.ata-post .ata-post__author {
	display: flex;
	flex-direction: column;
	line-height: 1.35;
}
.ata-post .ata-post__author strong {
	font-size: 14px;
	color: #fff;
}
.ata-post .ata-post__author small {
	font-size: 12px;
	color: rgba(255, 255, 255, .75);
}

/* ---------- Body ---------- */
.ata-post .ata-post__body {
	max-width: 800px;
	margin: 0 auto;
	padding: 64px 16px 48px;
}
.ata-post .ata-post__lead {
	margin-bottom: 32px;
	padding: 2px 0 2px 16px;
	border-left: 4px solid var(--ata-accent);
	color: #4b5563;
	font-size: clamp(1.05rem, 1.6vw, 1.25rem);
	font-style: italic;
	font-weight: 500;
	line-height: 1.6;
}
.ata-post .ata-post__lead p:last-child {
	margin-bottom: 0;
}

/* ---------- Mục lục ---------- */
.ata-post .ata-post__toc {
	margin-bottom: 40px;
	padding: 28px 24px;
	border: 1px solid var(--ata-border);
	border-radius: 12px;
	background: var(--ata-soft);
}
.ata-post .ata-post__toc[hidden] {
	display: none;
}
.ata-post .ata-post__toc-title {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 16px;
	color: #111827;
	font-size: 18px;
	font-weight: 700;
}
.ata-post .ata-post__toc-title svg {
	color: var(--ata-accent);
}
.ata-post .ata-post__toc-list {
	margin: 0;
	padding: 0;
	list-style: none;
}
.ata-post .ata-post__toc-list li {
	position: relative;
	margin: 0;
	padding: 6px 0;
	list-style: none;
}
.ata-post .ata-post__toc-list li.is-sub {
	padding-left: 16px;
}
.ata-post .ata-post__toc-list a {
	display: block;
	color: #4b5563;
	font-size: 14px;
	line-height: 1.5;
	transition: color .2s;
}
.ata-post .ata-post__toc-list a:hover,
.ata-post .ata-post__toc-list a.is-active {
	color: var(--ata-accent);
}
.ata-post .ata-post__toc-list a.is-active {
	font-weight: 600;
}
.ata-post .ata-post__toc-list a.is-active::before {
	content: "";
	position: absolute;
	top: 13px;
	left: -12px;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--ata-accent);
}
.ata-post .ata-post__toc-list li.is-sub a.is-active::before {
	left: 4px;
}

/* ---------- Nội dung ---------- */
.ata-post .ata-post__content {
	color: var(--ata-text);
	font-size: 16px;
	line-height: 1.75;
}
.ata-post .ata-post__content h2,
.ata-post .ata-post__content h3,
.ata-post .ata-post__content h4 {
	margin: 32px 0 12px;
	color: var(--ata-accent);
	font-weight: 700;
	line-height: 1.35;
	scroll-margin-top: 110px;
}
.ata-post .ata-post__content h2 { font-size: 22px; }
.ata-post .ata-post__content h3 { font-size: 19px; }
.ata-post .ata-post__content h4 { font-size: 17px; }
.ata-post .ata-post__content [data-ata-toc] {
	color: var(--ata-accent);
	scroll-margin-top: 110px;
}
.ata-post .ata-post__content p[data-ata-toc],
.ata-post .ata-post__content li[data-ata-toc] {
	font-size: 18px;
}
.ata-post .ata-post__content a {
	color: var(--ata-accent);
	text-decoration: underline;
}
.ata-post .ata-post__content img {
	height: auto;
	margin: 12px 0;
	border: 1px solid var(--ata-border);
	border-radius: 6px;
}
.ata-post .ata-post__content blockquote {
	padding: 4px 0 4px 16px;
	border-left: 4px solid var(--ata-accent);
	color: #4b5563;
	font-style: italic;
}
.ata-post .ata-post__content table {
	width: 100%;
	display: block;
	overflow-x: auto;
}

.ata-post .ata-post__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 32px;
	padding-top: 24px;
	border-top: 1px solid var(--ata-border);
}
.ata-post .ata-post__tags a {
	padding: 4px 12px;
	border-radius: 999px;
	background: var(--ata-soft);
	border: 1px solid var(--ata-border);
	color: var(--ata-muted);
	font-size: 13px;
}
.ata-post .ata-post__tags a:hover {
	border-color: var(--ata-accent);
	color: var(--ata-accent);
}

/* ---------- Bài viết liên quan ---------- */
.ata-post .ata-post__related {
	max-width: 1100px;
	margin: 0 auto;
	padding: 0 16px 72px;
}
.ata-post .ata-post__related-title {
	margin-bottom: 24px;
	padding-left: 12px;
	border-left: 4px solid var(--ata-accent);
	color: #111827;
	font-size: 24px;
	line-height: 1.3;
}
.ata-post .ata-post__related-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
}
.ata-post .ata-post__card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--ata-border);
	border-radius: 12px;
	background: #fff;
	transition: box-shadow .25s, transform .25s;
}
.ata-post .ata-post__card:hover {
	box-shadow: 0 12px 28px rgba(17, 24, 39, .1);
	transform: translateY(-3px);
}
.ata-post .ata-post__card-img {
	display: block;
	aspect-ratio: 16 / 9;
	background: var(--ata-soft);
}
.ata-post .ata-post__card-img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.ata-post .ata-post__card-body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 16px 18px 20px;
}
.ata-post .ata-post__card-body time {
	color: var(--ata-muted);
	font-size: 12px;
}
.ata-post .ata-post__card-body strong {
	display: -webkit-box;
	overflow: hidden;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	color: #111827;
	font-size: 15px;
	line-height: 1.45;
}
.ata-post .ata-post__card:hover strong {
	color: var(--ata-accent);
}

@media (max-width: 849px) {
	.ata-post .ata-post__related-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}
@media (max-width: 549px) {
	.ata-post .ata-post__hero {
		min-height: 240px;
		padding: 48px 16px 40px;
	}
	/* Mobile: ảnh hiện đủ ở trên, tiêu đề nằm dưới ảnh để ảnh không bị cắt */
	.ata-post .ata-post__hero:not(.ata-post__hero--no-image) {
		display: block;
		min-height: 0;
		aspect-ratio: auto;
		padding: 0;
	}
	.ata-post .ata-post__hero:not(.ata-post__hero--no-image) .ata-post__hero-bg {
		position: relative;
		aspect-ratio: var(--ata-hero-ratio, 16 / 9);
	}
	.ata-post .ata-post__hero:not(.ata-post__hero--no-image) .ata-post__hero-bg::after {
		display: none;
	}
	.ata-post .ata-post__hero:not(.ata-post__hero--no-image) .ata-post__hero-inner {
		padding: 24px 16px 28px;
	}
	.ata-post .ata-post__title {
		margin-bottom: 18px;
	}
	.ata-post .ata-post__body {
		padding-top: 40px;
	}
	.ata-post .ata-post__toc {
		padding: 20px 18px 20px 22px;
	}
	.ata-post .ata-post__content {
		font-size: 15px;
	}
	.ata-post .ata-post__related-grid {
		grid-template-columns: 1fr;
	}
}
