/**
 * Homepage ([tp_home])
 * Layout: UI8-style marketplace home (approximation from its public look; light theme).
 * Tokens: TruePress (Google Sans + #155dff, numbers in Inter), shared with cart/checkout.
 * Dials: variance 6, motion 4, density 4.
 * Radius rule: buttons, chips, tabs, price = full pill; product media = 16px.
 */

.tp-home {
	--tp-primary: #155dff;
	--tp-primary-hover: #3e6fff;
	--tp-primary-press: #0e4ae0;
	--tp-ink: #1f3147;
	--tp-muted: #6b7384;
	--tp-border: #d8dee7;
	--tp-hairline: #e6ebf5;
	--tp-tint: #f0f4ff;
	--tp-surface: #f8fbff;
	--tp-r-media: 16px;
	--tp-r-pill: 9999px;
	--tp-shadow: 0 1px 2px rgba(31, 49, 71, 0.06), 0 12px 32px -12px rgba(31, 49, 71, 0.18);
	--tp-ease: cubic-bezier(0.16, 1, 0.3, 1);
	--tp-font-num: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

	width: 100%;
	max-width: 1280px;
	margin: 0 auto;
	padding: 0 24px;
	color: var(--tp-ink);
}

.tp-home *,
.tp-home *::before,
.tp-home *::after {
	box-sizing: border-box;
}

.tp-home .tp-num,
.tp-home .woocommerce-Price-amount {
	font-family: var(--tp-font-num);
	font-feature-settings: "tnum";
	letter-spacing: -0.01em;
}

.tp-home a:focus-visible,
.tp-home button:focus-visible,
.tp-home summary:focus-visible,
.tp-home input:focus-visible {
	outline: 2px solid var(--tp-primary);
	outline-offset: 3px;
}

.tp-h2 {
	margin: 0;
	font-size: clamp(24px, 2.6vw, 30px);
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: -0.01em;
	color: var(--tp-ink);
}

/* ---------- Buttons ---------- */

.tp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 12px 24px;
	font: inherit;
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
	text-decoration: none;
	border: 0;
	border-radius: var(--tp-r-pill);
	cursor: pointer;
	transition: background-color 0.2s var(--tp-ease), transform 0.2s var(--tp-ease);
}

.tp-btn:active {
	transform: translateY(1px);
}

.tp-btn--primary {
	color: #fff;
	background: var(--tp-primary);
}

.tp-btn--primary:hover {
	color: #fff;
	background: var(--tp-primary-hover);
}

/* ---------- Hero: headline, search, category chips ---------- */

.tp-hero {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 72px 0 64px;
	text-align: center;
}

.tp-hero__title {
	max-width: 17ch;
	margin: 0;
	font-size: clamp(36px, 4.8vw, 60px);
	font-weight: 500;
	line-height: 1.08;
	letter-spacing: -0.025em;
	color: var(--tp-ink);
}

.tp-hero__lead {
	max-width: 46ch;
	margin: 20px 0 0;
	font-size: 18px;
	line-height: 1.55;
	color: var(--tp-muted);
}

.tp-search {
	display: flex;
	align-items: center;
	gap: 8px;
	width: min(100%, 640px);
	margin-top: 36px;
	padding: 6px 6px 6px 20px;
	background: #fff;
	border-radius: var(--tp-r-pill);
	box-shadow: inset 0 0 0 1px var(--tp-border), var(--tp-shadow);
	transition: box-shadow 0.2s var(--tp-ease);
}

.tp-search:focus-within {
	box-shadow: inset 0 0 0 2px var(--tp-primary), var(--tp-shadow);
}

.tp-search > .tp-icon {
	flex: none;
	font-size: 20px;
	color: var(--tp-muted);
}

.tp-search input[type="search"] {
	flex: 1;
	min-width: 0;
	height: 44px;
	padding: 0 4px;
	font: inherit;
	font-size: 16px;
	text-align: left;
	color: var(--tp-ink);
	background: transparent;
	border: 0;
	outline: none;
	box-shadow: none;
	appearance: none;
}

.tp-search input[type="search"]::placeholder {
	color: var(--tp-muted);
	opacity: 1;
}

.tp-search input:focus-visible {
	outline: none;
}

/* ---------- Product card ---------- */

.tp-card {
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-width: 0;
}

.tp-card[hidden] {
	display: none;
}

.tp-card__media {
	position: relative;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--tp-surface);
	border-radius: var(--tp-r-media);
	box-shadow: inset 0 0 0 1px var(--tp-hairline);
}

.tp-card__media > a {
	display: block;
	width: 100%;
	height: 100%;
}

.tp-card__media img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s var(--tp-ease);
}

.tp-card:hover .tp-card__media img {
	transform: scale(1.04);
}

.tp-media-fallback {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	font-size: clamp(40px, 5vw, 64px);
	font-weight: 500;
	letter-spacing: -0.03em;
	color: var(--tp-primary);
	background:
		radial-gradient(120% 90% at 100% 0%, rgba(21, 93, 255, 0.14), transparent 60%),
		var(--tp-tint);
}

.tp-card__badge {
	position: absolute;
	top: 12px;
	left: 12px;
	padding: 4px 10px;
	font-size: 12px;
	font-weight: 500;
	line-height: 1.4;
	color: #fff;
	background: var(--tp-primary);
	border-radius: var(--tp-r-pill);
}

/* Add-to-cart: revealed on hover/focus over the preview (always visible on touch) */
.tp-card__actions {
	position: absolute;
	right: 12px;
	bottom: 12px;
	opacity: 0;
	transform: translateY(6px);
	transition: opacity 0.25s var(--tp-ease), transform 0.25s var(--tp-ease);
}

.tp-card:hover .tp-card__actions,
.tp-card:focus-within .tp-card__actions {
	opacity: 1;
	transform: none;
}

@media (hover: none) {
	.tp-card__actions {
		opacity: 1;
		transform: none;
	}
}

.tp-home .tp-cart-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 40px;
	padding: 8px 16px;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
	color: var(--tp-ink);
	text-decoration: none;
	background: #fff;
	border: 0;
	border-radius: var(--tp-r-pill);
	box-shadow: var(--tp-shadow);
	transition: background-color 0.2s var(--tp-ease), color 0.2s var(--tp-ease), transform 0.2s var(--tp-ease);
}

.tp-home .tp-cart-btn .tp-icon {
	font-size: 18px;
}

.tp-home .tp-cart-btn:hover,
.tp-home .tp-cart-btn.added {
	color: #fff;
	background: var(--tp-primary);
}

.tp-home .tp-cart-btn:active {
	transform: translateY(1px);
}

.tp-home .tp-cart-btn.is-in-cart {
	color: var(--tp-primary);
	background: var(--tp-tint);
}

.tp-home .tp-cart-btn.is-in-cart:hover {
	color: #fff;
	background: var(--tp-primary);
}

/* Keep the "in cart" state visible without hover */
.tp-card__actions:has(.is-in-cart) {
	opacity: 1;
	transform: none;
}

.tp-home .tp-cart-btn.loading {
	opacity: 0.6;
	pointer-events: none;
}

/* Woo appends a "Xem giỏ hàng" link after an AJAX add */
.tp-home .tp-card__actions .added_to_cart {
	display: none;
}

.tp-card__body {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
}

.tp-card__text {
	min-width: 0;
}

.tp-card__name {
	display: -webkit-box;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	overflow: hidden;
	margin: 0;
	font-size: 16px;
	font-weight: 500;
	line-height: 1.4;
}

.tp-card__name a {
	color: var(--tp-ink);
	text-decoration: none;
}

.tp-card__name a:hover {
	color: var(--tp-primary);
}

.tp-card__version {
	font-size: 13px;
	font-weight: 400;
	color: var(--tp-muted);
	white-space: nowrap;
}

.tp-card__meta {
	margin: 4px 0 0;
	font-size: 14px;
	line-height: 1.4;
	color: var(--tp-muted);
}

.tp-card__meta a {
	color: var(--tp-ink);
	text-decoration: none;
}

.tp-card__meta a:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Price pill */
.tp-card__price {
	display: inline-flex;
	flex: none;
	align-items: baseline;
	gap: 6px;
	padding: 5px 12px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	color: var(--tp-primary);
	background: var(--tp-tint);
	border-radius: var(--tp-r-pill);
}

.tp-card__price del {
	font-size: 12px;
	font-weight: 400;
	color: var(--tp-muted);
}

.tp-card__price del .woocommerce-Price-amount {
	color: var(--tp-muted);
}

.tp-card__price ins {
	text-decoration: none;
}

/* ---------- Shop section: hero + toolbar + grid ---------- */

.tp-shop {
	padding-bottom: 96px;
	scroll-margin-top: 24px;
}

.tp-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 24px;
	margin-bottom: 28px;
}

.tp-count {
	margin: 0;
	font-size: 14px;
	color: var(--tp-muted);
}

.tp-results {
	transition: opacity 0.2s var(--tp-ease);
}

.tp-results[aria-busy="true"] {
	opacity: 0.5;
}

.tp-tabs {
	display: flex;
	gap: 4px;
	padding: 4px;
	width: max-content;
	max-width: 100%;
	overflow-x: auto;
	background: var(--tp-surface);
	border-radius: var(--tp-r-pill);
	box-shadow: inset 0 0 0 1px var(--tp-hairline);
	scrollbar-width: none;
}

.tp-tab {
	flex: none;
	min-height: 36px;
	padding: 8px 18px;
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	color: var(--tp-muted);
	background: transparent;
	border: 0;
	border-radius: var(--tp-r-pill);
	cursor: pointer;
	transition: background-color 0.2s var(--tp-ease), color 0.2s var(--tp-ease);
}

.tp-tab:hover {
	color: var(--tp-ink);
}

a.tp-tab {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
}

.tp-tab[aria-pressed="true"],
.tp-tab[aria-current="page"] {
	color: var(--tp-ink);
	background: #fff;
	box-shadow: 0 1px 2px rgba(31, 49, 71, 0.08), inset 0 0 0 1px var(--tp-hairline);
}

.tp-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 40px 24px;
}

.tp-grid__empty {
	margin: 0;
	padding: 48px 0;
	font-size: 16px;
	color: var(--tp-muted);
}

/* ---------- Shop / category / search header ([tp_shop]) ---------- */

.tp-shop-page .tp-shop {
	padding-top: 56px;
}

.tp-shop-head {
	margin-bottom: 32px;
}

.tp-shop-head__title {
	margin: 0;
	font-size: clamp(32px, 3.6vw, 44px);
	font-weight: 500;
	line-height: 1.15;
	letter-spacing: -0.02em;
	color: var(--tp-ink);
}

.tp-shop-head__desc {
	max-width: 60ch;
	margin: 12px 0 0;
	font-size: 16px;
	line-height: 1.55;
	color: var(--tp-muted);
}

.tp-shop-head .tp-search {
	margin-top: 24px;
}

/* ---------- How to buy ---------- */

.tp-steps {
	margin: 0 0 96px;
	padding: 56px;
	background: var(--tp-surface);
	border-radius: var(--tp-r-media);
	box-shadow: inset 0 0 0 1px var(--tp-hairline);
	scroll-margin-top: 24px;
}

.tp-steps .tp-h2 {
	margin-bottom: 40px;
}

.tp-steps__list {
	position: relative;
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 40px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.tp-steps__list::before {
	content: "";
	position: absolute;
	top: 28px;
	right: 16%;
	left: 28px;
	height: 1px;
	background: var(--tp-border);
}

.tp-step {
	position: relative;
}

.tp-step__icon {
	position: relative;
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	font-size: 26px;
	color: var(--tp-primary);
	background: #fff;
	border-radius: var(--tp-r-pill);
	box-shadow: inset 0 0 0 1px var(--tp-border);
}

.tp-step__title {
	margin: 20px 0 8px;
	font-size: 20px;
	font-weight: 500;
	line-height: 1.3;
}

.tp-step__text {
	max-width: 32ch;
	margin: 0;
	font-size: 15px;
	line-height: 1.55;
	color: var(--tp-muted);
}

/* ---------- FAQ ---------- */

.tp-faq {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr);
	gap: 64px;
	padding: 0 0 112px;
}

.tp-faq__intro .tp-h2 {
	margin-bottom: 16px;
}

.tp-faq__intro p {
	max-width: 36ch;
	margin: 0;
	font-size: 15px;
	line-height: 1.55;
	color: var(--tp-muted);
}

.tp-faq__intro a {
	color: var(--tp-primary);
}

.tp-faq__item {
	border-bottom: 1px solid var(--tp-hairline);
}

.tp-faq__item:first-child {
	border-top: 1px solid var(--tp-hairline);
}

.tp-faq__item summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 0;
	font-size: 17px;
	font-weight: 500;
	line-height: 1.4;
	list-style: none;
	cursor: pointer;
}

.tp-faq__item summary::-webkit-details-marker {
	display: none;
}

.tp-faq__item summary .tp-icon {
	flex: none;
	font-size: 20px;
	color: var(--tp-muted);
	transition: transform 0.3s var(--tp-ease);
}

.tp-faq__item[open] summary .tp-icon {
	transform: rotate(45deg);
}

.tp-faq__item p {
	max-width: 60ch;
	margin: 0;
	padding: 0 0 20px;
	font-size: 15px;
	line-height: 1.6;
	color: var(--tp-muted);
}

/* ---------- Motion (hierarchy on load, reveal on scroll) ---------- */

@media (prefers-reduced-motion: no-preference) {
	@keyframes tp-rise {
		from { opacity: 0; transform: translateY(16px); }
		to { opacity: 1; transform: none; }
	}

	.tp-hero > * {
		animation: tp-rise 0.7s var(--tp-ease) both;
	}

	.tp-hero > :nth-child(2) { animation-delay: 0.06s; }
	.tp-hero > :nth-child(3) { animation-delay: 0.12s; }
	.tp-hero > :nth-child(4) { animation-delay: 0.18s; }

	@supports (animation-timeline: view()) {
		.tp-card,
		.tp-step,
		.tp-faq__item {
			animation: tp-rise linear both;
			animation-timeline: view();
			animation-range: entry 0% entry 35%;
		}
	}
}

/* ---------- Responsive ---------- */

@media (max-width: 1023px) {
	.tp-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 767px) {
	.tp-home {
		padding: 0 16px;
	}

	.tp-hero {
		align-items: stretch;
		padding: 40px 0 56px;
		text-align: left;
	}

	.tp-hero__lead {
		font-size: 16px;
	}

	.tp-search {
		margin-top: 28px;
		padding-left: 16px;
	}

	.tp-search .tp-btn {
		padding: 12px 18px;
	}

	.tp-shop {
		padding-bottom: 64px;
	}

	.tp-shop-page .tp-shop {
		padding-top: 32px;
	}

	.tp-hero {
		padding-bottom: 40px;
	}

	.tp-grid {
		grid-template-columns: 1fr;
		gap: 32px;
	}

	.tp-steps {
		margin-bottom: 64px;
		padding: 40px 24px;
	}

	.tp-steps__list {
		grid-template-columns: 1fr;
		gap: 32px;
	}

	.tp-steps__list::before {
		top: 28px;
		bottom: 28px;
		left: 28px;
		right: auto;
		width: 1px;
		height: auto;
	}

	.tp-step {
		display: grid;
		grid-template-columns: 56px 1fr;
		column-gap: 20px;
	}

	.tp-step__icon {
		grid-row: span 2;
	}

	.tp-step__title {
		margin-top: 4px;
	}

	.tp-faq {
		grid-template-columns: 1fr;
		gap: 24px;
		padding-bottom: 80px;
	}
}
