/*
 * Trang "Hướng dẫn chọn sản phẩm".
 * Chỉ được nạp bởi page-huong-dan-chon-san-pham.php; mọi selector nằm trong .buying-guide
 * và chỉ dùng biến màu/khoảng cách có sẵn trong assets/css/main.css.
 */

.buying-guide {
	/* Chiều cao header sticky: ~65px trên desktop, ~120px khi header xuống dòng (<992px). */
	--bg-anchor-offset: 96px;
	padding-bottom: 64px;
}

.buying-guide section[id] {
	scroll-margin-top: var(--bg-anchor-offset);
}

/* Hero: chữ căn trái, các bước ở cột phải */
.buying-guide__hero {
	padding: 48px 0 40px;
	background: var(--ap-white);
	border-bottom: 1px solid var(--ap-surface-high);
}

.buying-guide__hero-inner {
	display: grid;
	grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
	gap: 48px;
	align-items: center;
}

.buying-guide__eyebrow,
.buying-guide__kicker {
	margin: 0 0 8px;
	color: var(--ap-primary);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.buying-guide__title {
	margin: 0 0 16px;
	font-size: clamp(30px, 3.4vw, 42px);
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -0.02em;
	color: var(--ap-text);
}

.buying-guide__lead {
	max-width: 62ch;
	margin: 0 0 24px;
	color: var(--ap-muted);
	font-size: 17px;
	line-height: 1.7;
}

.buying-guide__hero-actions,
.buying-guide__cta-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.buying-guide .ap-btn {
	transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.buying-guide .ap-btn:active {
	transform: translateY(1px) scale(0.98);
}

.buying-guide__steps {
	display: grid;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.buying-guide__steps a {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 12px 16px;
	border: 1px solid var(--ap-surface-high);
	border-radius: var(--ap-radius);
	background: var(--ap-surface);
	color: var(--ap-text);
	font-weight: 600;
	text-decoration: none;
	transition: border-color 160ms ease, transform 160ms ease;
}

.buying-guide__steps a:hover,
.buying-guide__steps a:focus-visible {
	border-color: var(--ap-primary);
	transform: translateX(4px);
}

.buying-guide__step-num {
	flex: none;
	color: var(--ap-primary);
	font-size: 14px;
	font-weight: 800;
	font-variant-numeric: tabular-nums;
}

/* Bố cục chính: mục lục dính bên trái + nội dung */
.buying-guide__layout {
	display: grid;
	grid-template-columns: 220px minmax(0, 1fr);
	gap: 48px;
	align-items: start;
	max-width: 1120px;
	padding-top: 40px;
}

.buying-guide__toc {
	position: sticky;
	top: var(--bg-anchor-offset);
}

.buying-guide__toc-title {
	margin: 0 0 10px;
	color: var(--ap-outline-strong);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.buying-guide__toc ol {
	margin: 0;
	padding: 0;
	list-style: none;
	border-left: 2px solid var(--ap-surface-high);
}

.buying-guide__toc a {
	display: block;
	margin-left: -2px;
	padding: 7px 0 7px 14px;
	border-left: 2px solid transparent;
	color: var(--ap-muted);
	font-size: 15px;
	text-decoration: none;
	transition: color 160ms ease, border-color 160ms ease;
}

.buying-guide__toc a:hover,
.buying-guide__toc a:focus-visible {
	border-left-color: var(--ap-primary);
	color: var(--ap-text);
}

/* Nội dung */
.buying-guide__content {
	min-width: 0;
}

.buying-guide__section {
	padding: 32px 0;
	border-top: 1px solid var(--ap-surface-high);
}

.buying-guide__section:first-child {
	padding-top: 0;
	border-top: 0;
}

.buying-guide__section h2 {
	margin: 0 0 12px;
	font-size: clamp(22px, 2.2vw, 28px);
	font-weight: 800;
	line-height: 1.25;
	letter-spacing: -0.01em;
}

.buying-guide__section h3 {
	margin: 0 0 8px;
	font-size: 17px;
	font-weight: 700;
}

.buying-guide__section p {
	max-width: 70ch;
	margin: 0 0 16px;
	color: var(--ap-muted);
	line-height: 1.75;
}

.buying-guide__list {
	display: grid;
	gap: 10px;
	margin: 0 0 16px;
	padding-left: 20px;
	color: var(--ap-muted);
	line-height: 1.7;
}

.buying-guide__list strong {
	color: var(--ap-text);
}

.buying-guide__list li::marker {
	color: var(--ap-primary);
}

.buying-guide__split,
.buying-guide__compare {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 24px;
}

.buying-guide__compare-col {
	padding: 20px 20px 4px;
	border-radius: var(--ap-radius);
	border: 1px solid var(--ap-surface-high);
	background: var(--ap-white);
}

.buying-guide__compare-col.is-good {
	border-top: 3px solid var(--ap-success);
}

.buying-guide__compare-col.is-warn {
	border-top: 3px solid var(--ap-danger);
}

.buying-guide__note {
	margin-top: 8px;
	padding: 14px 18px;
	border-left: 3px solid var(--ap-secondary);
	border-radius: 0 var(--ap-radius) var(--ap-radius) 0;
	background: var(--ap-surface-low);
}

.buying-guide__note.is-accent {
	border-left-color: var(--ap-primary);
	background: #fff4ec;
}

.buying-guide__section .buying-guide__note p {
	margin: 0;
	color: var(--ap-text);
}

.buying-guide__hint {
	font-size: 14px;
}

/* Bảng thông số: cuộn ngang trên màn nhỏ */
.buying-guide__table-wrap {
	overflow-x: auto;
	margin: 0 0 12px;
	border: 1px solid var(--ap-surface-high);
	border-radius: var(--ap-radius);
	background: var(--ap-white);
}

.buying-guide__table-wrap:focus-visible {
	outline: 2px solid var(--ap-primary);
	outline-offset: 2px;
}

.buying-guide__table {
	width: 100%;
	min-width: 620px;
	border-collapse: collapse;
	font-size: 15px;
}

.buying-guide__table th,
.buying-guide__table td {
	padding: 12px 16px;
	border-bottom: 1px solid var(--ap-surface-high);
	text-align: left;
	vertical-align: top;
	line-height: 1.6;
}

.buying-guide__table thead th {
	background: var(--ap-surface-low);
	color: var(--ap-text);
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.buying-guide__table tbody th {
	width: 140px;
	color: var(--ap-text);
	font-weight: 700;
}

.buying-guide__table td {
	color: var(--ap-muted);
}

.buying-guide__table tbody tr:last-child th,
.buying-guide__table tbody tr:last-child td {
	border-bottom: 0;
}

/* Checklist */
.buying-guide__checklist {
	display: grid;
	gap: 10px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.buying-guide__checklist li {
	position: relative;
	padding: 12px 16px 12px 48px;
	border: 1px solid var(--ap-surface-high);
	border-radius: var(--ap-radius);
	background: var(--ap-white);
	color: var(--ap-text);
	line-height: 1.6;
}

.buying-guide__checklist li::before {
	content: "";
	position: absolute;
	top: 14px;
	left: 16px;
	width: 18px;
	height: 18px;
	border: 2px solid var(--ap-primary);
	border-radius: var(--ap-radius-sm);
}

/* FAQ */
.buying-guide__faq {
	display: grid;
	gap: 10px;
}

.buying-guide__faq details {
	border: 1px solid var(--ap-surface-high);
	border-radius: var(--ap-radius);
	background: var(--ap-white);
}

.buying-guide__faq summary {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	padding: 14px 18px;
	font-weight: 700;
	cursor: pointer;
	list-style: none;
}

.buying-guide__faq summary::-webkit-details-marker {
	display: none;
}

.buying-guide__faq summary::after {
	content: "+";
	flex: none;
	color: var(--ap-primary);
	font-size: 22px;
	line-height: 1;
	transition: transform 200ms ease;
}

.buying-guide__faq details[open] summary::after {
	transform: rotate(45deg);
}

.buying-guide__faq summary:focus-visible {
	outline: 2px solid var(--ap-primary);
	outline-offset: -2px;
	border-radius: var(--ap-radius);
}

.buying-guide__faq details p {
	margin: 0;
	padding: 0 18px 16px;
}

.buying-guide__extra {
	padding: 24px 0;
	border-top: 1px solid var(--ap-surface-high);
}

/* Lời kêu gọi cuối trang */
.buying-guide__cta {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 24px;
	align-items: center;
	margin-top: 16px;
	padding: 28px 32px;
	border-radius: var(--ap-radius);
	background: var(--ap-inverse);
	color: var(--ap-white);
}

.buying-guide__cta h2 {
	margin: 0 0 6px;
	font-size: 22px;
	font-weight: 800;
	color: var(--ap-white);
}

.buying-guide__cta p {
	margin: 0;
	color: rgba(255, 255, 255, 0.78);
}

.buying-guide__cta .ap-btn-ghost {
	border-color: rgba(255, 255, 255, 0.4);
	color: var(--ap-white);
}

/* Hiệu ứng xuất hiện nhẹ cho các bước */
@media (prefers-reduced-motion: no-preference) {
	.buying-guide__steps li {
		animation: buying-guide-rise 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
		animation-delay: calc(var(--step-index, 1) * 60ms);
	}

	@keyframes buying-guide-rise {
		from {
			opacity: 0;
			transform: translateY(8px);
		}
		to {
			opacity: 1;
			transform: none;
		}
	}
}

@media (prefers-reduced-motion: reduce) {
	.buying-guide .ap-btn,
	.buying-guide__steps a,
	.buying-guide__faq summary::after {
		transition: none;
	}
}

/* Responsive */
@media (max-width: 991px) {
	.buying-guide {
		--bg-anchor-offset: 132px;
	}

	.buying-guide__hero-inner {
		grid-template-columns: minmax(0, 1fr);
		gap: 28px;
	}

	.buying-guide__layout {
		grid-template-columns: minmax(0, 1fr);
		gap: 24px;
	}

	.buying-guide__toc {
		position: static;
		padding: 16px 18px;
		border: 1px solid var(--ap-surface-high);
		border-radius: var(--ap-radius);
		background: var(--ap-white);
	}

	.buying-guide__toc ol {
		display: flex;
		flex-wrap: wrap;
		gap: 8px;
		border-left: 0;
	}

	.buying-guide__toc a {
		margin: 0;
		padding: 6px 12px;
		border: 1px solid var(--ap-surface-high);
		border-radius: 999px;
		font-size: 14px;
	}

	.buying-guide__toc a:hover,
	.buying-guide__toc a:focus-visible {
		border-color: var(--ap-primary);
	}
}

@media (max-width: 767px) {
	.buying-guide__hero {
		padding: 28px 0 24px;
	}

	.buying-guide__lead {
		font-size: 16px;
	}

	.buying-guide__split,
	.buying-guide__compare,
	.buying-guide__cta {
		grid-template-columns: minmax(0, 1fr);
	}

	.buying-guide__section {
		padding: 24px 0;
	}

	.buying-guide__cta {
		padding: 22px 20px;
	}

	.buying-guide__hero-actions .ap-btn,
	.buying-guide__cta-actions .ap-btn {
		flex: 1 1 auto;
		justify-content: center;
	}
}
