/**
 * Single product ([tp_product])
 * Builds on home.css (TruePress tokens, .tp-btn, .tp-cart-btn, .tp-card, .tp-grid live there).
 * Layout: gallery (7fr) + sticky buy box (5fr) → description + details → related grid.
 * Radius rule (same as home): buttons, chips, price = full pill; media and panels = 16px.
 */

.tp-product-page {
	padding-bottom: 112px;
}

/* ---------- Breadcrumb ---------- */

.tp-crumbs ol {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 28px 0 24px;
	font-size: 14px;
	line-height: 1.4;
	list-style: none;
	color: var(--tp-muted);
}

.tp-crumbs li {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-width: 0;
}

.tp-crumbs li + li::before {
	content: "/";
	color: var(--tp-border);
}

.tp-crumbs a {
	color: var(--tp-muted);
	text-decoration: none;
}

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

.tp-crumbs [aria-current="page"] {
	overflow: hidden;
	max-width: 40ch;
	white-space: nowrap;
	text-overflow: ellipsis;
	color: var(--tp-ink);
}

/* ---------- Top: gallery + buy box ---------- */

.tp-pd {
	display: grid;
	grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
	gap: 56px;
	align-items: start;
}

.tp-pd__stage {
	position: relative;
	margin: 0;
	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-pd__stage img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: opacity 0.25s var(--tp-ease);
}

.tp-pd__stage img.is-loading {
	opacity: 0.4;
}

.tp-pd__stage .tp-card__badge {
	top: 16px;
	left: 16px;
}

.tp-pd__thumbs {
	display: flex;
	gap: 12px;
	margin-top: 12px;
	overflow-x: auto;
	scrollbar-width: none;
}

.tp-pd__thumb {
	flex: none;
	width: 96px;
	aspect-ratio: 4 / 3;
	padding: 0;
	overflow: hidden;
	background: var(--tp-surface);
	border: 0;
	border-radius: 10px;
	box-shadow: inset 0 0 0 1px var(--tp-hairline);
	cursor: pointer;
	opacity: 0.6;
	transition: opacity 0.2s var(--tp-ease), box-shadow 0.2s var(--tp-ease);
}

.tp-pd__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.tp-pd__thumb:hover {
	opacity: 1;
}

.tp-pd__thumb[aria-pressed="true"] {
	opacity: 1;
	box-shadow: 0 0 0 2px var(--tp-primary);
}

/* Buy box */
.tp-buy {
	position: sticky;
	top: 24px;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding: 32px;
	background: #fff;
	border-radius: var(--tp-r-media);
	box-shadow: inset 0 0 0 1px var(--tp-hairline), var(--tp-shadow);
}

.tp-buy__cat {
	display: inline-flex;
	padding: 4px 12px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--tp-primary);
	text-decoration: none;
	background: var(--tp-tint);
	border-radius: var(--tp-r-pill);
	transition: background-color 0.2s var(--tp-ease);
}

.tp-buy__cat:hover {
	color: var(--tp-primary);
	background: #e2eaff;
}

.tp-buy__title {
	margin: 16px 0 0;
	font-size: clamp(26px, 2.4vw, 34px);
	font-weight: 500;
	line-height: 1.18;
	letter-spacing: -0.02em;
	color: var(--tp-ink);
	text-wrap: balance;
}

.tp-buy__lead {
	margin-top: 12px;
	font-size: 15px;
	line-height: 1.6;
	color: var(--tp-muted);
}

.tp-buy__lead p {
	margin: 0;
}

.tp-buy__price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 4px 12px;
	margin-top: 24px;
	font-size: 32px;
	font-weight: 600;
	line-height: 1.1;
	color: var(--tp-ink);
}

.tp-buy__price ins {
	order: -1;
	text-decoration: none;
}

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

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

.tp-buy__actions {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
	width: 100%;
	margin-top: 24px;
}

.tp-btn--block {
	width: 100%;
}

/* Secondary: the shared add-to-cart button, full width and outlined here */
.tp-home .tp-buy__actions .tp-cart-btn {
	justify-content: center;
	min-height: 48px;
	font-size: 15px;
	box-shadow: inset 0 0 0 1px var(--tp-border);
}

.tp-home .tp-buy__actions .tp-cart-btn:hover {
	color: var(--tp-ink);
	background: var(--tp-surface);
}

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

.tp-home .tp-buy__actions .added_to_cart {
	display: none;
}

.tp-buy__soldout {
	margin: 24px 0 0;
	font-size: 15px;
	color: var(--tp-muted);
}

.tp-buy__demo {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-top: 14px;
	font-size: 15px;
	font-weight: 500;
	color: var(--tp-primary);
	text-decoration: none;
}

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

.tp-buy__perks {
	display: grid;
	gap: 12px;
	width: 100%;
	margin: 24px 0 0;
	padding: 24px 0 0;
	list-style: none;
	border-top: 1px solid var(--tp-hairline);
}

.tp-buy__perks li {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 14px;
	line-height: 1.45;
	color: var(--tp-muted);
}

.tp-buy__perks .tp-icon {
	flex: none;
	margin-top: 1px;
	font-size: 18px;
	color: var(--tp-primary);
}

/* ---------- Description + details ---------- */

.tp-pd-info {
	display: grid;
	grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
	gap: 56px;
	align-items: start;
	margin-top: 80px;
}

.tp-pd-desc .tp-h2 {
	margin-bottom: 20px;
}

.tp-prose {
	max-width: 68ch;
	font-size: 16px;
	line-height: 1.7;
	color: var(--tp-ink);
}

.tp-prose > :first-child {
	margin-top: 0;
}

.tp-prose p,
.tp-prose ul,
.tp-prose ol {
	margin: 0 0 16px;
}

.tp-prose ul,
.tp-prose ol {
	padding-left: 0;
	list-style: none;
}

.tp-prose li {
	position: relative;
	padding-left: 28px;
}

.tp-prose li + li {
	margin-top: 8px;
}

.tp-prose ul li::before {
	content: "";
	position: absolute;
	top: 0.62em;
	left: 6px;
	width: 7px;
	height: 7px;
	background: var(--tp-primary);
	border-radius: var(--tp-r-pill);
}

.tp-prose ol {
	counter-reset: tp-ol;
}

.tp-prose ol li::before {
	counter-increment: tp-ol;
	content: counter(tp-ol) ".";
	position: absolute;
	left: 0;
	font-family: var(--tp-font-num);
	font-weight: 500;
	color: var(--tp-primary);
}

.tp-prose h2,
.tp-prose h3,
.tp-prose h4 {
	margin: 32px 0 12px;
	font-size: 20px;
	font-weight: 500;
	line-height: 1.3;
}

.tp-prose a {
	color: var(--tp-primary);
	text-underline-offset: 3px;
}

.tp-prose em {
	padding: 1px 6px;
	font-style: normal;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 0.9em;
	background: var(--tp-surface);
	border-radius: 6px;
	box-shadow: inset 0 0 0 1px var(--tp-hairline);
}

.tp-prose img {
	max-width: 100%;
	height: auto;
	border-radius: var(--tp-r-media);
}

.tp-pd-details {
	padding: 28px 32px;
	background: var(--tp-surface);
	border-radius: var(--tp-r-media);
	box-shadow: inset 0 0 0 1px var(--tp-hairline);
}

.tp-pd-details__title {
	margin: 0 0 8px;
	font-size: 18px;
	font-weight: 500;
	line-height: 1.3;
}

.tp-pd-details dl {
	margin: 0;
}

.tp-pd-details__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 0;
	font-size: 15px;
	line-height: 1.4;
}

.tp-pd-details__row + .tp-pd-details__row {
	border-top: 1px solid var(--tp-hairline);
}

.tp-pd-details dt {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--tp-muted);
}

.tp-pd-details dt .tp-icon {
	font-size: 18px;
}

.tp-pd-details dd {
	margin: 0;
	font-weight: 500;
	text-align: right;
	color: var(--tp-ink);
}

/* ---------- Related ---------- */

.tp-related {
	margin-top: 96px;
	padding-top: 56px;
	border-top: 1px solid var(--tp-hairline);
}

.tp-related__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 32px;
}

.tp-related__all {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 15px;
	font-weight: 500;
	color: var(--tp-primary);
	text-decoration: none;
	white-space: nowrap;
}

.tp-related__all .tp-icon {
	transition: transform 0.2s var(--tp-ease);
}

.tp-related__all:hover .tp-icon {
	transform: translateX(3px);
}

/* ---------- Mobile buy bar (shown by product.js when the buy box is off screen) ---------- */

.tp-buybar {
	display: none;
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
	.tp-pd__gallery,
	.tp-buy {
		animation: tp-rise 0.7s var(--tp-ease) both;
	}

	.tp-buy {
		animation-delay: 0.08s;
	}
}

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

@media (max-width: 1023px) {
	.tp-pd,
	.tp-pd-info {
		grid-template-columns: 1fr;
		gap: 32px;
	}

	.tp-buy {
		position: static;
	}

	.tp-pd-info {
		margin-top: 64px;
	}
}

@media (max-width: 767px) {
	.tp-product-page {
		padding-bottom: 120px; /* room for the buy bar */
	}

	.tp-crumbs ol {
		padding: 20px 0 16px;
	}

	.tp-crumbs [aria-current="page"] {
		max-width: 22ch;
	}

	.tp-pd {
		gap: 24px;
	}

	.tp-pd__thumb {
		width: 76px;
	}

	.tp-buy {
		padding: 0;
		background: transparent;
		box-shadow: none;
	}

	.tp-buy__price {
		font-size: 28px;
	}

	.tp-pd-details {
		padding: 20px 24px;
	}

	.tp-related {
		margin-top: 64px;
		padding-top: 40px;
	}

	.tp-buybar {
		position: fixed;
		right: 12px;
		bottom: 12px;
		left: 12px;
		z-index: 90;
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 12px;
		padding: 8px 8px 8px 20px;
		background: #fff;
		border-radius: var(--tp-r-pill);
		box-shadow: inset 0 0 0 1px var(--tp-hairline), 0 12px 32px -8px rgba(31, 49, 71, 0.28);
		opacity: 0;
		visibility: hidden;
		transform: translateY(16px);
		transition: opacity 0.25s var(--tp-ease), transform 0.25s var(--tp-ease), visibility 0s linear 0.25s;
	}

	.tp-buybar.is-visible {
		opacity: 1;
		visibility: visible;
		transform: none;
		transition-delay: 0s;
	}

	.tp-buybar__text {
		display: flex;
		flex-direction: column;
		min-width: 0;
	}

	.tp-buybar__name {
		overflow: hidden;
		font-size: 13px;
		line-height: 1.3;
		white-space: nowrap;
		text-overflow: ellipsis;
		color: var(--tp-muted);
	}

	.tp-buybar__price {
		font-size: 16px;
		font-weight: 600;
		line-height: 1.3;
	}

	.tp-buybar__price del {
		display: none;
	}

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

	.tp-buybar .tp-btn {
		flex: none;
		min-height: 44px;
		padding: 10px 22px;
	}
}
