/*
 * Nền theme HPT (D-18, docs/DESIGN-DIRECTION.md): nền tối toàn site, vàng là
 * màu nhấn duy nhất, focus ring, nút, ô nhập, "tờ nội dung sáng", khung trang
 * page/single/search/archive/404, hệ hiệu ứng xuất hiện (hpt-anim).
 *
 * Token (--hpt-*) định nghĩa trong theme.json (styles.css) để cả trình soạn
 * lẫn site cùng dùng. Bo góc chỉ 3 mức: thẻ 14px (--hpt-r-card), ảnh trong
 * thẻ 10px (--hpt-r-img), nút và ô nhập pill (--hpt-r-pill).
 * Thang z-index: header 100, lớp phủ ngăn kéo 999, ngăn kéo 1000, nút lên
 * đầu trang 90.
 */

/*
 * Token bổ sung cho 2 chế độ (lô M14, docs/LIGHT-MODE.md). Mặc định = tối (theme thương hiệu).
 * `accent-ink` = màu CHỮ/viền chỉ trạng thái của vàng thương hiệu (tối: chính vàng; sáng: vàng đậm đủ
 * tương phản trên nền sáng). Nền nút vàng vẫn dùng --hpt-accent. `focus` = màu vòng focus.
 */
:root {
	--hpt-accent-ink: var(--hpt-accent);
	--hpt-focus: var(--hpt-accent);
	--hpt-edge-hover: rgb(255 214 0 / 55%);
	--hpt-edge-soft: rgb(255 214 0 / 45%);
	--hpt-shadow-lift: 0 12px 32px rgb(0 0 0 / 45%);
	--hpt-shadow-lift-2: 0 1px 0 rgb(255 255 255 / 4%) inset, 0 12px 32px rgb(0 0 0 / 55%);
	--hpt-field-focus: #202027;
	--hpt-shadow-pop: 0 24px 48px rgb(0 0 0 / 45%);
	--hpt-shadow-big: 0 1px 0 rgb(255 255 255 / 5%) inset, 0 28px 64px rgb(0 0 0 / 55%);
	--hpt-shadow-drawer: 16px 0 48px rgb(0 0 0 / 55%);
	--hpt-scrim: rgb(11 11 13 / 50%);
	--hpt-scrim-drawer: rgb(0 0 0 / 65%);
	--hpt-overlay-btn: rgb(11 11 13 / 80%);
	--hpt-spot: rgb(255 214 0 / 10%);
	--hpt-field-hover: rgb(255 255 255 / 3%);
	--hpt-err-text: #ff7a7a;
	--hpt-shadow-inset: 0 1px 0 rgb(255 255 255 / 4%) inset;
	--hpt-item-active: #23232b;
	--hpt-submit-hover: #ffe033;
}

/*
 * Chế độ sáng: bật bằng data-theme="light" trên <html> (script trong <head> đọc localStorage,
 * nút ở đầu trang đổi). Không đảo máy móc: nền ấm #f6f6f4, thẻ trắng, bóng ấm nhẹ thay cho viền
 * sáng, chữ vàng chuyển sang vàng đậm. Ảnh banner nền tối giữ tối (xem cuối file).
 */
:root[data-theme="light"] {
	--wp--preset--color--bg: #f6f6f4;
	--wp--preset--color--surface: #fff;
	--wp--preset--color--surface-2: #f0f0ec;
	--wp--preset--color--line: #dddcd5;
	--wp--preset--color--text: #141418;
	--wp--preset--color--muted: #5b5b66;
	--wp--preset--color--heat: #bd3d03;
	--wp--preset--color--ok: #16743a;
	--wp--preset--color--err: #c62828;
	--wp--preset--color--paper: #fff;
	--hpt-bg: #f6f6f4;
	--hpt-surface: #fff;
	--hpt-surface-2: #f0f0ec;
	--hpt-line: #dddcd5;
	--hpt-text: #141418;
	--hpt-muted: #5b5b66;
	--hpt-heat: #bd3d03;
	--hpt-orange: #bd3d03;
	--hpt-paper: #fff;
	--hpt-ok: #16743a;
	--hpt-err: #c62828;
	--hpt-accent-ink: #826200;
	--hpt-focus: #826200;
	--hpt-edge-hover: rgb(130 98 0 / 55%);
	--hpt-edge-soft: rgb(130 98 0 / 40%);
	--hpt-shadow-lift: 0 10px 28px rgb(60 40 0 / 12%);
	--hpt-shadow-lift-2: 0 14px 36px rgb(60 40 0 / 15%);
	--hpt-field-focus: #fff;
	--hpt-shadow: 0 1px 2px rgb(60 40 0 / 6%), 0 8px 24px rgb(60 40 0 / 8%);
	--hpt-shadow-pop: 0 18px 40px rgb(60 40 0 / 14%);
	--hpt-shadow-big: 0 2px 4px rgb(60 40 0 / 6%), 0 22px 54px rgb(60 40 0 / 16%);
	--hpt-shadow-drawer: 16px 0 40px rgb(60 40 0 / 16%);
	--hpt-scrim: rgb(20 20 24 / 28%);
	--hpt-scrim-drawer: rgb(20 20 24 / 45%);
	--hpt-overlay-btn: rgb(255 255 255 / 90%);
	--hpt-spot: rgb(255 214 0 / 18%);
	--hpt-field-hover: rgb(20 20 24 / 3%);
	--hpt-err-text: #c62828;
	--hpt-shadow-inset: 0 1px 2px rgb(60 40 0 / 6%);
	--hpt-item-active: #fffbe8;
	--hpt-submit-hover: #ffe24d;
	--hpt-logo-1: #b08a3e;
	--hpt-logo-2: #8c6a2c;
	--hpt-logo-3: #6b4f1e;
	--hpt-logo-hi: #bd9648;
	--hpt-logo-ring: #16161a;

	color-scheme: light;
}

html {
	background: var(--hpt-bg);
	color-scheme: dark;
	scroll-behavior: auto;
	scroll-padding-top: calc(var(--hpt-header-stuck) + 16px);
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	overflow-x: clip;
	background: var(--hpt-bg);
	color: var(--hpt-text);
	font-family: var(--hpt-font-body);
	font-size: var(--hpt-fs-body);
	line-height: 1.6;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizelegibility;
}

.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	overflow-x: clip;
	background: var(--hpt-bg);
}

.wp-site-blocks > * {
	margin-block-start: 0;
	margin-block-end: 0;
}

.wp-site-blocks > .hpt-main {
	flex: 1 0 auto;
}

::selection {
	background: var(--hpt-accent);
	color: var(--hpt-on-accent);
}

/* Trợ năng ------------------------------------------------------------ */
.screen-reader-text,
.hpt-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

.screen-reader-text:focus {
	clip-path: none;
	width: auto;
	height: auto;
	margin: 0;
	padding: 12px 20px;
	border-radius: var(--hpt-r-pill);
	background: var(--hpt-accent);
	color: var(--hpt-on-accent);
	z-index: 100000;
	top: 8px;
	left: 8px;
}

:focus-visible {
	outline: 2px solid var(--hpt-focus);
	outline-offset: 2px;
}

/* Tiện ích theo điểm ngắt (hợp đồng BLOCKS-CONTRACT) */
@media (max-width: 549px) {

	.hpt-hide-sm {
		display: none !important;
	}
}

@media (max-width: 849px) {

	.hpt-hide-md {
		display: none !important;
	}
}

@media (min-width: 850px) {

	.hpt-show-md {
		display: none !important;
	}
}

.hpt-upper {
	text-transform: uppercase;
}

.hpt-bold {
	font-weight: 700;
}

.hpt-dark {
	color: var(--hpt-text);
}

/* Nút ----------------------------------------------------------------- */

/*
 * Chính = pill vàng chữ tối; phụ (is-style-outline / --ghost) = pill viền,
 * hover viền vàng.
 */
:is(.wp-element-button, .wp-block-button__link, .hpt-button) {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 44px;
	border: 1px solid transparent;
	border-radius: var(--hpt-r-pill);
	background: var(--hpt-accent);
	color: var(--hpt-on-accent);
	font-family: var(--hpt-font-body);
	font-size: var(--hpt-fs-btn);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: normal;
	text-decoration: none;
	text-transform: none;
	white-space: nowrap;
	cursor: pointer;
	transition:
		background 200ms var(--hpt-ease),
		border-color 200ms var(--hpt-ease),
		color 200ms var(--hpt-ease),
		transform 200ms var(--hpt-ease);
}

:is(.wp-element-button, .wp-block-button__link, .hpt-button):is(:hover, :focus-visible) {
	background: var(--wp--custom--accent-hover, #ffe24d);
	color: var(--hpt-on-accent);
}

:is(.wp-element-button, .wp-block-button__link, .hpt-button):active {
	transform: scale(0.98);
}

:is(.is-style-outline > .wp-block-button__link, .hpt-button--ghost) {
	border-color: var(--hpt-line);
	background: transparent;
	color: var(--hpt-text);
}

:is(.is-style-outline > .wp-block-button__link, .hpt-button--ghost):is(:hover, :focus-visible) {
	border-color: var(--hpt-accent);
	background: transparent;
	color: var(--hpt-text);
}

/*
 * Ô nhập: pill (một dòng), 14px cho ô nhiều dòng; nền surface-2, viền line,
 * focus vàng.
 */
:where(input[type="text"], input[type="email"], input[type="tel"], input[type="url"], input[type="search"], input[type="number"], input[type="password"], select, textarea) {
	box-sizing: border-box;
	max-width: 100%;
	min-height: 44px;
	padding: 0 18px;
	border: 1px solid var(--hpt-line);
	border-radius: var(--hpt-r-pill);
	background: var(--hpt-surface-2);
	color: var(--hpt-text);
	font: inherit;
	font-size: var(--hpt-fs-search);
	transition:
		border-color 200ms var(--hpt-ease),
		background 200ms var(--hpt-ease);
}

:where(textarea) {
	padding: 12px 18px;
	border-radius: var(--hpt-r-card);
	line-height: 1.6;
}

:where(input, select, textarea)::placeholder {
	color: var(--hpt-muted);
	opacity: 1;
}

:where(input, select, textarea):focus {
	border-color: var(--hpt-accent);
	outline: none;
}

:where(input, select, textarea):focus-visible {
	outline: 2px solid var(--hpt-focus);
	outline-offset: 2px;
}

/* Khung trang ---------------------------------------------------------- */
.hpt-main {
	box-sizing: border-box;
}

.hpt-main--list,
.hpt-main--single,
.hpt-404 {
	width: 100%;
	max-width: var(--hpt-container);
	margin-inline: auto;
	padding: clamp(32px, 5vw, 64px) var(--hpt-gutter) var(--hpt-section-gap);
}

.hpt-main--list > :where(h1, .wp-block-query-title),
.hpt-main--single > .wp-block-post-title {
	margin: 0 0 24px;
	font-family: var(--hpt-font-display);
	font-size: var(--hpt-fs-h1);
	font-weight: 700;
	line-height: 1.2;
}

/* Danh sách bài viết/kết quả tìm kiếm: thẻ surface */
.hpt-list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hpt-list > li {
	box-sizing: border-box;
	margin: 0;
	padding: 20px;
	border: 1px solid var(--hpt-line);
	border-radius: var(--hpt-r-card);
	background: var(--hpt-surface);
	transition:
		border-color 200ms var(--hpt-ease),
		transform 200ms var(--hpt-ease),
		box-shadow 200ms var(--hpt-ease);
}

.hpt-list > li:hover,
.hpt-list > li:focus-within {
	border-color: var(--hpt-accent);
	box-shadow: var(--hpt-shadow);
	transform: translateY(-4px);
}

.hpt-list .wp-block-post-title {
	margin: 0 0 8px;
	font-size: var(--hpt-fs-h3);
	font-weight: 600;
	line-height: 1.35;
}

.hpt-list .wp-block-post-title a {
	text-decoration: none;
}

.hpt-list .wp-block-post-excerpt {
	margin: 0;
	color: var(--hpt-muted);
	font-size: var(--hpt-fs-small);
}

.hpt-main--list .wp-block-query-pagination {
	margin-top: 32px;
	gap: 8px;
}

.hpt-main--list .page-numbers {
	display: inline-grid;
	place-items: center;
	min-width: 44px;
	min-height: 44px;
	padding: 0 12px;
	box-sizing: border-box;
	border: 1px solid var(--hpt-line);
	border-radius: var(--hpt-r-pill);
	color: var(--hpt-text);
	text-decoration: none;
}

.hpt-main--list .page-numbers.current {
	border-color: var(--hpt-accent);
	background: var(--hpt-accent);
	color: var(--hpt-on-accent);
	font-weight: 700;
}

.hpt-main--list a.page-numbers:hover {
	border-color: var(--hpt-accent);
}

.hpt-main--single .wp-block-post-featured-image {
	margin: 0 0 24px;
}

.hpt-main--single .wp-block-post-featured-image img {
	border-radius: var(--hpt-r-card);
}

/* Tờ nội dung sáng ----------------------------------------------------- *
 * Ngoại lệ có chủ đích của theme tối (DESIGN-DIRECTION mục 3): nội dung soạn
 * bằng TinyMCE
 * (màu inline cho nền trắng) hiển thị trên một tấm sáng bo góc. Trang dựng
 * bằng khối của theme
 * (có gốc .hpt-page) không bị bọc tờ sáng.
 */
.hpt-paper,
.hpt-main--single .wp-block-post-content,
.hpt-main--page > .wp-block-post-content:not(:has([class*="hpt-"], .woocommerce)) {
	box-sizing: border-box;
	max-width: 880px;
	margin-inline: auto;
	padding: clamp(20px, 4vw, 48px);
	border-radius: var(--hpt-r-card);
	background: var(--hpt-paper);
	color: var(--hpt-paper-ink);
	overflow-wrap: break-word;
}

.hpt-main--page:not(:has([class*="hpt-"])),
.hpt-main--page:has(.woocommerce) {
	box-sizing: border-box;
	width: 100%;
	max-width: var(--hpt-container);
	margin-inline: auto;
	padding: clamp(32px, 5vw, 64px) var(--hpt-gutter) var(--hpt-section-gap);
}

:is(
	.hpt-paper,
	.hpt-main--single .wp-block-post-content,
	.hpt-main--page > .wp-block-post-content:not(:has([class*="hpt-"], .woocommerce))
) :is(h1, h2, h3, h4, h5, h6, p, li, td, th, blockquote, figcaption) {
	color: inherit;
}

:is(
	.hpt-paper,
	.hpt-main--single .wp-block-post-content,
	.hpt-main--page > .wp-block-post-content:not(:has([class*="hpt-"], .woocommerce))
) a:not(.wp-element-button, .wp-block-button__link) {
	color: var(--wp--custom--paper-link, #0a5aa8);
	text-decoration: underline;
}

:is(
	.hpt-paper,
	.hpt-main--single .wp-block-post-content,
	.hpt-main--page > .wp-block-post-content:not(:has([class*="hpt-"], .woocommerce))
) img {
	max-width: 100%;
	height: auto;
	border-radius: var(--hpt-r-img);
}

:is(
	.hpt-paper,
	.hpt-main--single .wp-block-post-content,
	.hpt-main--page > .wp-block-post-content:not(:has([class*="hpt-"], .woocommerce))
) table {
	width: 100%;
	border-collapse: collapse;
}

:is(
	.hpt-paper,
	.hpt-main--single .wp-block-post-content,
	.hpt-main--page > .wp-block-post-content:not(:has([class*="hpt-"], .woocommerce))
) :is(td, th) {
	padding: 8px 12px;
	border: 1px solid #d8d8d4;
}

/* Trang 404 (D-13) ----------------------------------------------------- */
.hpt-404 {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	justify-content: center;
	min-height: min(60vh, 560px);
}

.hpt-404 > * {
	margin: 0;
}

.hpt-404__code {
	color: var(--hpt-accent-ink);
	font-family: var(--hpt-font-display);
	font-size: clamp(2.5rem, 1.6rem + 2.4vw, 4rem);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -0.02em;
}

.hpt-404__text {
	margin-top: 12px !important;
	color: var(--hpt-text);
	font-size: var(--hpt-fs-h3);
	font-weight: 600;
}

.hpt-404 .wp-block-buttons {
	margin-top: 28px !important;
	gap: 12px;
}

/* Hiệu ứng xuất hiện (hpt-anim, port từ casa) ---------------------------- *
 * animate.js/reveal-first.js thêm .is-visible. Chỉ ẩn khi <html> có hpt-js;
 * .hpt-anim-off hoặc giảm
 * chuyển động: hiện sẵn. Fade-up 16px, 380ms, ease-out mạnh; so le 60ms (JS,
 * tối đa 360ms).
 * Dùng thuộc tính `translate` riêng để không đụng transform của hover.
 */
html.hpt-js:not(.hpt-anim-off) :is(
	.hpt-anim,
	.hpt-product,
	.hpt-cat,
	.hpt-promo,
	.hpt-catcard,
	.hpt-bgsection,
	.hpt-logo-grid > .wp-block-image
) {
	opacity: 0;
	translate: 0 16px;
	transition:
		opacity 380ms var(--hpt-ease),
		translate 380ms var(--hpt-ease),
		transform 200ms var(--hpt-ease),
		box-shadow 200ms var(--hpt-ease),
		border-color 200ms var(--hpt-ease);
}

html.hpt-js:not(.hpt-anim-off) .hpt-anim--fade-left {
	translate: -16px 0;
}

html.hpt-js:not(.hpt-anim-off) .hpt-anim--fade-right {
	translate: 16px 0;
}

html.hpt-js:not(.hpt-anim-off) .hpt-anim--zoom-in {
	translate: none;
	scale: 0.96;
}

html.hpt-js:not(.hpt-anim-off) :is(
	.hpt-anim,
	.hpt-product,
	.hpt-cat,
	.hpt-promo,
	.hpt-catcard,
	.hpt-bgsection,
	.hpt-logo-grid > .wp-block-image
).is-visible {
	opacity: 1;
	translate: none;
	scale: none;
}

@media (prefers-reduced-motion: reduce) {

	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
	}
}

/*
 * ===== M15 (lô sửa bố cục QA Q5): BẮT ĐẦU khối riêng, chỉ bố cục/kích thước,
 * không đổi màu =====
 */

/* V-23: trang 404 canh giữa khối, khoảng đệm cân. Chữ (D-13) giữ nguyên. */
.hpt-404 {
	align-items: center;
	min-height: min(65vh, 600px);
	text-align: center;
}

.hpt-404 .wp-block-buttons {
	justify-content: center;
}

/* V-24: nhịp dòng chung cho mọi đoạn trong tờ sáng. */
.hpt-paper :is(p, li, strong, b) {
	line-height: 1.6;
}

/* ===== M15: KẾT THÚC ===== */
