/*
 * Hand Made Treasures Theme
 * Theme by The Free Website Guys
 *
 * Only markup with no source equivalent (WooCommerce / WordPress output),
 * functional hooks and state rules live here. Everything else comes from
 * app.css, which ships the compiled source stylesheet.
 */

:root {
	--theme-header-height: 112px;
	--theme-card-radius: 1rem;
}

[hidden] {
	display: none !important;
}

/* Screen reader helper used by WordPress core markup. */
.screen-reader-text {
	border: 0;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	height: 1px;
	margin: -1px;
	overflow: hidden;
	padding: 0;
	position: absolute !important;
	width: 1px;
	word-wrap: normal !important;
}

/* -------------------------------------------------------------------------
 * Logo sizing (single definition for header, footer and mobile drawer)
 * ---------------------------------------------------------------------- */

/* Logo height is driven by the source utility classes and the logo_height
 * Customizer value; no WooCommerce cascade can reach it now. */
.site-logo-img {
	display: block;
	max-height: none;
}

.site-logo-text {
	display: block;
}

/* -------------------------------------------------------------------------
 * Header states (source class strings are swapped in main.js)
 * ---------------------------------------------------------------------- */

.site-header .site-logo-link {
	display: inline-flex;
}

/* -------------------------------------------------------------------------
 * Price range slider (dual overlapping inputs on one track)
 * ---------------------------------------------------------------------- */

.theme-range-input {
	position: absolute;
	left: 0;
	top: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	background: transparent;
	-webkit-appearance: none;
	appearance: none;
	pointer-events: none;
	outline: none;
}

.theme-range-input::-webkit-slider-runnable-track {
	height: 100%;
	background: transparent;
	border: none;
}

.theme-range-input::-moz-range-track {
	height: 100%;
	background: transparent;
	border: none;
}

.theme-range-input::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	pointer-events: auto;
	width: 1.25rem;
	height: 1.25rem;
	margin-top: 0.1rem;
	border-radius: 9999px;
	border: 2px solid hsl(var(--primary));
	background: hsl(var(--background));
	box-shadow: 0 1px 3px hsl(var(--foreground) / 0.2);
	cursor: pointer;
}

.theme-range-input::-moz-range-thumb {
	pointer-events: auto;
	width: 1.25rem;
	height: 1.25rem;
	border-radius: 9999px;
	border: 2px solid hsl(var(--primary));
	background: hsl(var(--background));
	cursor: pointer;
}

.theme-range-input[data-price-min] {
	z-index: 4;
}

.theme-range-input[data-price-max] {
	z-index: 3;
}

/* -------------------------------------------------------------------------
 * Cart drawer open / close
 * ---------------------------------------------------------------------- */

#theme-cart-overlay {
	position: fixed;
	inset: 0;
	z-index: 40;
	background: hsl(var(--foreground) / 0.3);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
}

body.cart-open #theme-cart-overlay {
	opacity: 1;
	visibility: visible;
}

#theme-cart-drawer {
	position: fixed;
	inset: 0;
	z-index: 50;
	pointer-events: none;
	visibility: hidden;
}

body.cart-open #theme-cart-drawer {
	visibility: visible;
}

#theme-cart-drawer > * {
	pointer-events: auto;
	transform: translateX(100%);
	transition: transform 0.35s cubic-bezier(0.25, 0.4, 0.25, 1);
}

body.cart-open #theme-cart-drawer > * {
	transform: translateX(0);
}

#theme-cart-drawer.is-updating > * > * {
	opacity: 0.6;
	pointer-events: none;
}

/* Hide the badge when the cart is empty (matches the source). */
.theme-cart-count:empty {
	display: none;
}

/* Hide the "View cart" link WooCommerce appends after an AJAX add. */
body a.added_to_cart.wc-forward,
.woocommerce-page a.added_to_cart.wc-forward,
.single-product a.added_to_cart.wc-forward {
	display: none !important;
}

/* Theme button lock state. */
.ajax_add_to_cart.theme-btn-loading,
.theme-ajax-add.theme-btn-loading {
	opacity: 0.6 !important;
	pointer-events: none !important;
	cursor: wait !important;
}

.ajax_add_to_cart.loading::after,
.single-product .single_add_to_cart_button.loading::after {
	display: none !important;
}

/* -------------------------------------------------------------------------
 * Add-to-cart button: disabled state
 * ---------------------------------------------------------------------- */

.single_add_to_cart_button.button:disabled,
.single_add_to_cart_button.button.disabled,
.add_to_cart_button.button:disabled,
.add_to_cart_button.button.disabled {
	cursor: not-allowed !important;
	opacity: 0.4 !important;
	pointer-events: none !important;
}

.single_add_to_cart_button.button:disabled:hover,
.single_add_to_cart_button.button.disabled:hover,
.add_to_cart_button.button:disabled:hover,
.add_to_cart_button.button.disabled:hover {
	opacity: 0.4 !important;
}

/* -------------------------------------------------------------------------
 * Quantity control (source has no native WooCommerce equivalent)
 * ---------------------------------------------------------------------- */

.theme-quantity-wrapper {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid hsl(var(--border));
	border-radius: 9999px;
	overflow: hidden;
	background: hsl(var(--background));
}

.theme-quantity-wrapper .theme-qty-minus,
.theme-quantity-wrapper .theme-qty-plus {
	width: 2.75rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-family: var(--font-body);
	font-size: 1rem;
	color: hsl(var(--foreground));
	background: transparent;
	transition: background-color 0.2s ease;
}

.theme-quantity-wrapper .theme-qty-minus:hover,
.theme-quantity-wrapper .theme-qty-plus:hover {
	background: hsl(var(--secondary));
}

.theme-quantity-wrapper .theme-qty-input {
	width: 3.25rem;
	border: 0;
	background: transparent;
	text-align: center;
	font-family: var(--font-body);
	font-size: 0.875rem;
	color: hsl(var(--foreground));
	-moz-appearance: textfield;
	appearance: textfield;
}

.theme-quantity-wrapper .theme-qty-input::-webkit-outer-spin-button,
.theme-quantity-wrapper .theme-qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.theme-quantity-wrapper .theme-qty-input:focus {
	outline: none;
}

/* -------------------------------------------------------------------------
 * Single product page
 * ---------------------------------------------------------------------- */

.single-product-page {
	--product-header-height: 112px;
}

.theme-product-layout,
.theme-product-gallery,
.theme-product-info {
	min-width: 0;
	max-width: 100%;
}

.theme-product-thumbnails {
	flex-wrap: wrap;
	max-width: 100%;
}

.theme-add-to-cart-area {
	display: flex;
	align-items: stretch;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.theme-add-to-cart-area .single_add_to_cart_button {
	flex: 1 1 auto;
	min-width: 160px;
}

.single-product-page .woocommerce-product-details__short-description,
.single-product-page .woocommerce-variation-description,
.single-product-page .posted_in {
	overflow-wrap: break-word;
	word-break: break-word;
}

/* Variations table: the pills live in the info column; hide the native table. */
.theme-attr-select-hidden {
	display: none !important;
}

.single-product-page .variations-wrap {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

.single-product-page .variations {
	width: 100%;
	border: 0;
	margin: 0;
}

.single-product-page .variations tbody,
.single-product-page .variations tbody tr,
.single-product-page .variations tbody td {
	display: block;
	width: 100%;
	border: 0;
	padding: 0;
}

.single-product-page .reset_variations {
	font-family: var(--font-body);
	font-size: 0.75rem;
	color: hsl(var(--accent));
	text-decoration: underline;
	text-underline-offset: 4px;
	margin-top: 0.5rem;
	display: inline-block;
}

.single-product-page .single_variation_wrap {
	margin-top: 0;
}

.single-product-page .woocommerce-variation-price,
.single-product-page .woocommerce-variation-availability {
	display: none;
}

/* Zoom lens image is positioned in JS; keep it inside the ring. */
[data-zoom-lens] {
	width: 190px;
	height: 190px;
}

/* -------------------------------------------------------------------------
 * WooCommerce notices (styled where no drawer feedback exists)
 * ---------------------------------------------------------------------- */

.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
	font-family: var(--font-body);
	font-size: 0.875rem;
	border: 1px solid hsl(var(--border));
	border-radius: 1rem;
	padding: 1rem 1.25rem;
	margin: 0 0 1.5rem;
	list-style: none;
	background: hsl(var(--secondary) / 0.6);
	color: hsl(var(--foreground));
}

.woocommerce-error {
	border-color: hsl(var(--destructive));
	color: hsl(var(--destructive));
}

.single-product .woocommerce-message,
.single-product .woocommerce-info {
	display: none;
}

#theme-cart-drawer .woocommerce-message {
	display: none;
}

/* -------------------------------------------------------------------------
 * Checkout block (the one page allowed to differ from the source design)
 * ---------------------------------------------------------------------- */

body.woocommerce-checkout .site-main {
	padding-top: 0;
	padding-bottom: 3rem;
}

body.woocommerce-checkout .page-title {
	font-family: var(--font-display);
	font-size: 2.25rem;
	line-height: 1.15;
	color: hsl(var(--foreground));
	margin: 0 0 2rem;
}

@media (min-width: 768px) {
	body.woocommerce-checkout .wc-block-components-sidebar-layout.wc-block-checkout.is-large {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 2rem;
		align-items: start;
	}

	body.woocommerce-checkout .wc-block-checkout__sidebar {
		order: 1;
	}

	body.woocommerce-checkout .wc-block-checkout__main {
		order: 2;
	}
}

/* Pending journal shipping: hide "$0 / Free" amounts; cost is confirmed manually. */
body.woocommerce-checkout .wc-block-components-shipping-rates-control .wc-block-formatted-money-amount,
body.woocommerce-checkout .wc-block-components-totals-shipping .wc-block-formatted-money-amount,
body.woocommerce-checkout .wc-block-components-totals-footer-item.shipping .wc-block-formatted-money-amount {
	display: none !important;
}

body.woocommerce-checkout .wc-block-checkout {
	display: block;
}

body.woocommerce-checkout .wc-block-checkout__main,
body.woocommerce-checkout .wc-block-checkout__sidebar {
	min-width: 0;
	width: 100%;
	max-width: none;
}

body.woocommerce-checkout .wc-block-components-text-input input,
body.woocommerce-checkout .wc-block-components-select select,
body.woocommerce-checkout .wc-blocks-components-select__select,
body.woocommerce-checkout .wc-block-components-textarea textarea,
body.woocommerce-checkout .woocommerce-checkout .form-row .input-text,
body.woocommerce-checkout .woocommerce-checkout .form-row select {
	width: 100% !important;
	max-width: none !important;
	font-family: var(--font-body) !important;
	font-size: 0.875rem !important;
	color: hsl(var(--foreground)) !important;
	background-color: hsl(var(--background)) !important;
	border: 1px solid hsl(var(--border)) !important;
	border-radius: 1rem !important;
}

body.woocommerce-checkout .wc-block-components-text-input input:focus,
body.woocommerce-checkout .wc-block-components-select select:focus,
body.woocommerce-checkout .wc-blocks-components-select__select:focus,
body.woocommerce-checkout .wc-block-components-textarea textarea:focus {
	border-color: hsl(var(--primary)) !important;
	box-shadow: 0 0 0 1px hsl(var(--primary)) !important;
	outline: none !important;
}

body.woocommerce-checkout .wc-block-checkout__sidebar {
	background-color: hsl(var(--secondary) / 0.4);
	border-radius: 1.5rem;
	padding: 2rem;
}

body.woocommerce-checkout .wc-block-components-checkout-place-order-button,
body.woocommerce-checkout .wc-block-components-button:not(.is-link) {
	font-family: var(--font-body) !important;
	font-size: 0.75rem !important;
	letter-spacing: 0.28em !important;
	text-transform: uppercase !important;
	background-color: hsl(var(--accent)) !important;
	color: hsl(var(--accent-foreground)) !important;
	border: 1px solid hsl(var(--accent)) !important;
	border-radius: 9999px !important;
	height: 3.5rem !important;
	justify-content: center !important;
}

body.woocommerce-checkout .wc-block-components-checkout-place-order-button:hover {
	background-color: hsl(var(--primary)) !important;
	color: hsl(var(--primary-foreground)) !important;
}

body.woocommerce-checkout .wc-block-components-notice-banner {
	font-family: var(--font-body) !important;
	border-radius: 1rem !important;
}

body.woocommerce-checkout .wc-block-cart-items {
	border-radius: 1rem !important;
}

body.woocommerce-checkout .wc-block-components-sidebar-layout h2,
body.woocommerce-checkout .wc-block-components-sidebar-layout h3,
body.woocommerce-checkout .wc-block-checkout__main h2 {
	font-family: var(--font-display) !important;
	color: hsl(var(--foreground)) !important;
}

/* Cart / account / thank you width parity. */
body.woocommerce-cart .entry-content,
body.theme-wc-account .entry-content,
body.theme-thankyou-page .entry-content {
	max-width: 100%;
}

body.theme-thankyou-page {
	overflow-x: hidden;
}

body.theme-thankyou-page .woocommerce-order-details table {
	width: 100%;
	table-layout: fixed;
}

body.theme-thankyou-page .woocommerce-order-details tfoot th {
	text-align: left;
}

body.theme-thankyou-page .woocommerce-order-details tfoot td {
	text-align: right;
}

body.theme-thankyou-page .woocommerce-customer-details {
	display: flex;
	flex-direction: column;
	gap: 1.5rem;
}

body.theme-thankyou-page .woocommerce-customer-details address {
	max-width: 480px;
	overflow-wrap: break-word;
}

body.theme-thankyou-page .woocommerce-order h2,
body.theme-thankyou-page .woocommerce-order-details__title {
	font-family: var(--font-display);
	color: hsl(var(--foreground));
	padding: 0 0 1rem 0;
}

/* Generic WooCommerce tables/forms outside the checkout block. */
.woocommerce table.shop_table {
	border: 1px solid hsl(var(--border));
	border-radius: 1rem;
	font-family: var(--font-body);
}

.woocommerce .woocommerce-breadcrumb {
	font-family: var(--font-body);
	font-size: 0.75rem;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	color: hsl(var(--muted-foreground));
}

.woocommerce nav.woocommerce-pagination ul {
	border: 0;
	display: flex;
	gap: 0.5rem;
	justify-content: center;
}

.woocommerce nav.woocommerce-pagination ul li {
	border: 0;
}

.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
	font-family: var(--font-body);
	font-size: 0.75rem;
	letter-spacing: 0.2em;
	text-transform: uppercase;
	border: 1px solid hsl(var(--border));
	border-radius: 9999px;
	width: 2.5rem;
	height: 2.5rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: hsl(var(--foreground));
}

.woocommerce nav.woocommerce-pagination ul li span.current {
	background: hsl(var(--accent));
	border-color: hsl(var(--accent));
	color: hsl(var(--accent-foreground));
}

/* -------------------------------------------------------------------------
 * Product card wrappers: equal-height grid cells
 * ---------------------------------------------------------------------- */

.theme-product-card-wrap {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-width: 0;
}

.theme-product-card-wrap > a {
	display: flex;
	flex-direction: column;
	height: 100%;
}

.theme-product-card-wrap > a > div:first-child {
	width: 100%;
}

/* -------------------------------------------------------------------------
 * Testimonial transition (framer-motion variant equivalent)
 * ---------------------------------------------------------------------- */

@keyframes testimonialFade {
	from {
		opacity: 0;
		transform: translateY(12px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.testimonial-figure {
		animation: none !important;
	}
}

/* -------------------------------------------------------------------------
 * Hero: initial state for the entrance animation is handled by app.css
 * (animate-slide-up). Give it a reduced-motion opt-out.
 * ---------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	[data-hero-frame] {
		animation: none !important;
		opacity: 1 !important;
		transform: none !important;
	}
}

/* -------------------------------------------------------------------------
 * Mobile menu panel
 * ---------------------------------------------------------------------- */

.mobile-menu {
	pointer-events: auto;
}

@media (min-width: 1024px) {
	.mobile-menu {
		display: none !important;
	}
}

/* -------------------------------------------------------------------------
 * Customizer preview: never leave content invisible in the editor
 * ---------------------------------------------------------------------- */

body.is-customizer .animate-slide-up,
body.is-customizer .animate-fade-in,
body.is-customizer .testimonial-figure {
	animation: none !important;
	opacity: 1 !important;
	transform: none !important;
}

/* -------------------------------------------------------------------------
 * Archive / search helpers
 * ---------------------------------------------------------------------- */

.shop-archive .page-numbers {
	font-family: var(--font-body);
}

.entry-content > .wp-block-woocommerce-checkout,
.entry-content > .wp-block-woocommerce-cart {
	max-width: 100%;
}

/* Build Your Own: visible CTA lives outside the Woo variation form. */
body.product-build-your-own .variations_form .theme-add-to-cart-area {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.theme-availability-banner {
	border-bottom: 1px solid hsl(var(--border) / 0.35);
}

body.woocommerce-checkout .theme-checkout-shipping-promise {
	max-width: 42rem;
	margin-left: auto;
	margin-right: auto;
	padding-left: 1rem;
	padding-right: 1rem;
}

.theme-line-preview {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
}

.theme-line-preview__cover,
.theme-line-preview__paper {
	border-radius: 0.5rem;
	object-fit: cover;
	border: 1px solid hsl(var(--border));
}
