/*
 * Crow's Crafts theme layer.
 *
 * Only two kinds of rules live here:
 *  1. Styles for markup the source design never had (WooCommerce, WordPress output).
 *  2. Functional rules: reveal initial states, drawer, range slider, checkout alignment.
 *
 * Layout, spacing, colour and typography for elements that exist in the source
 * come from assets/css/app.css and the source class lists in the templates.
 */

[hidden] {
	display: none !important;
}

:root {
	--header-height: 96px;
}

@media (min-width: 768px) {
	:root {
		--header-height: 112px;
	}
}

/* -------------------------------------------------------------------------
 * Document level
 * ---------------------------------------------------------------------- */

html {
	overflow-x: hidden;
}

body {
	overflow-x: hidden;
}

body.cart-open {
	overflow: hidden;
}

/* Inner pages start below the fixed header. The homepage hero sits behind it. */
body.theme-no-hero {
	padding-top: 96px;
}

@media (min-width: 768px) {
	body.theme-no-hero {
		padding-top: 112px;
	}
}

.theme-no-hero .theme-page-wrapper,
.theme-no-hero main {
	min-width: 0;
}

.site-logo-box {
	height: var(--logo-height, 80px);
	width: calc(var(--logo-height, 80px) * 2.15);
	max-width: 46vw;
	display: block;
	flex: 0 0 auto;
}

.site-logo-box img,
img[data-theme-logo] {
	height: 100%;
	width: 100%;
	object-fit: contain;
	display: block;
}

.site-logo-wordmark {
	line-height: 1.1;
	white-space: nowrap;
}

.site-logo-text {
	line-height: 1.1;
}

/* Scroll progress bar */
.scroll-progress {
	transform: scaleX(0);
}

/* Page loader */
.theme-loader {
	transition: opacity 0.6s cubic-bezier(0.25, 0.4, 0.25, 1);
}

.theme-loader.theme-loader-hidden {
	opacity: 0;
	pointer-events: none;
}

.theme-loader-icon {
	animation: themeLoaderWobble 2.4s ease-in-out infinite;
}

.theme-loader-bar {
	animation: themeLoaderSweep 1.2s ease-in-out infinite;
}

@keyframes themeLoaderWobble {
	0%, 100% { transform: rotate(0deg); }
	25% { transform: rotate(8deg); }
	75% { transform: rotate(-8deg); }
}

@keyframes themeLoaderSweep {
	0% { transform: translateX(-100%); }
	100% { transform: translateX(100%); }
}

/* -------------------------------------------------------------------------
 * Reveal animations (framer-motion equivalents)
 * ---------------------------------------------------------------------- */

.reveal-item {
	opacity: 0;
	transform: translateY(32px);
	transition:
		opacity 0.7s cubic-bezier(0.25, 0.4, 0.25, 1),
		transform 0.7s cubic-bezier(0.25, 0.4, 0.25, 1);
	transition-delay: var(--reveal-delay, 0ms);
	will-change: opacity, transform;
}

.reveal-item.is-visible,
body.is-customizer .reveal-item,
.no-js .reveal-item {
	opacity: 1;
	transform: none;
}

.theme-hero-in {
	animation: themeHeroIn 0.8s cubic-bezier(0.25, 0.4, 0.25, 1) forwards;
	animation-delay: var(--hero-delay, 0ms);
	opacity: 0;
	transform: translateY(20px);
}

@keyframes themeHeroIn {
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.reveal-item,
	.theme-hero-in {
		opacity: 1 !important;
		transform: none !important;
		animation: none !important;
		transition: none !important;
	}
}

/* -------------------------------------------------------------------------
 * Custom projects
 * The block is at least one viewport tall. Its height follows the copy and
 * the form, so the last step is never clipped by the next section.
 * ---------------------------------------------------------------------- */

#custom-projects > .container-wide {
	height: auto;
	overflow: visible;
}

#custom-projects > .container-wide > .grid {
	flex: 1 1 auto;
	min-height: min-content;
	overflow: visible;
}

/* -------------------------------------------------------------------------
 * Header state classes and dropdown behaviour
 * ---------------------------------------------------------------------- */

[data-theme-dropdown-menu] {
	transform-origin: top left;
}

[data-theme-mobile-menu] {
	max-height: calc(100dvh - 112px);
}

/* -------------------------------------------------------------------------
 * Hero
 * ---------------------------------------------------------------------- */

.hero-description {
	max-width: 29rem;
	text-wrap: balance;
}

.theme-single-product .container-wide,
.theme-page-wrapper .container-wide {
	min-width: 0;
}

/* -------------------------------------------------------------------------
 * Price filter (Radix style dual handle slider)
 * ---------------------------------------------------------------------- */

.theme-price-panel {
	max-height: 0;
	opacity: 0;
	transition: max-height 0.3s cubic-bezier(0.25, 0.4, 0.25, 1), opacity 0.3s cubic-bezier(0.25, 0.4, 0.25, 1);
}

.theme-price-panel.is-open {
	max-height: 320px;
	opacity: 1;
}

.theme-range {
	position: relative;
}

.theme-range .rounded-full {
	position: relative;
	overflow: hidden;
}

.theme-range [data-theme-range-fill] {
	position: absolute;
	height: 100%;
	background-color: hsl(var(--primary));
	left: 0;
	width: 100%;
}

.theme-range-thumb {
	position: absolute;
	left: 0;
	top: 50%;
	width: 100%;
	height: 1.25rem;
	margin: 0;
	transform: translateY(-50%);
	-webkit-appearance: none;
	appearance: none;
	background: transparent;
	pointer-events: none;
	outline: none;
}

.theme-range-thumb::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	pointer-events: auto;
	height: 1.25rem;
	width: 1.25rem;
	border-radius: 9999px;
	border: 2px solid hsl(var(--primary));
	background-color: hsl(var(--background));
	cursor: grab;
	transition: box-shadow 0.2s ease;
}

.theme-range-thumb::-webkit-slider-thumb:focus-visible {
	box-shadow: 0 0 0 3px hsl(var(--ring) / 0.35);
}

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

.theme-range-thumb-max {
	z-index: 3;
}

.theme-range-thumb {
	z-index: 4;
}

.theme-range-thumb-max:only-of-type {
	z-index: 4;
}

/* -------------------------------------------------------------------------
 * Product cards
 * ---------------------------------------------------------------------- */

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

.theme-product-card-wrap > .theme-card-link {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: auto;
	border-radius: 1rem;
}

.theme-product-card-wrap *:not(.theme-card-link):not(.add_to_cart_button) {
	pointer-events: none;
}

.theme-product-card-wrap .theme-card-media {
	position: relative;
	z-index: 2;
}

.theme-product-card-wrap .add_to_cart_button {
	position: absolute;
	z-index: 3;
	pointer-events: auto;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	text-decoration: none;
}

/* The single product CTA fills its column like the source button. */
.single-product .single_add_to_cart_button {
	display: flex;
	width: 100%;
	justify-content: center;
}

.theme-product-card-wrap .theme-card-media {
	position: relative;
	overflow: hidden;
	min-height: 0;
	transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.theme-product-card-wrap:hover .theme-card-media {
	transform: translateY(-3px);
}

@media (prefers-reduced-motion: reduce) {
	.theme-product-card-wrap .theme-card-media,
	.theme-product-card-wrap:hover .theme-card-media {
		transform: none;
	}
}

.theme-product-card-wrap .theme-card-media img.theme-card-img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
}

.theme-product-card-wrap .theme-card-media .shimmer-loading {
	z-index: 0;
}

.theme-product-card-wrap .theme-card-media img.theme-card-img {
	z-index: 1;
}

.theme-product-card-wrap .theme-card-media > span {
	z-index: 4;
}

.theme-product-card-wrap > div:last-child {
	flex: 1;
}

.theme-product-card-wrap .add_to_cart_button {
	position: absolute;
}

/* Add to cart lock states */
.ajax_add_to_cart.theme-btn-loading {
	opacity: 0.6 !important;
	pointer-events: none !important;
	cursor: wait !important;
}

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

.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;
}

/* WooCommerce injects this link after an AJAX add. It is not part of the design. */
.woocommerce-page a.added_to_cart.wc-forward,
.single-product a.added_to_cart.wc-forward,
body a.added_to_cart.wc-forward {
	display: none !important;
}

/* -------------------------------------------------------------------------
 * Side cart drawer
 * ---------------------------------------------------------------------- */

#theme-cart-overlay {
	position: fixed;
	inset: 0;
	background-color: hsl(var(--foreground) / 0.2);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
	z-index: 49;
}

body.cart-open #theme-cart-overlay {
	opacity: 1;
	pointer-events: auto;
}

#theme-cart-drawer {
	transform: translateX(100%);
	visibility: hidden;
	transition: transform 0.35s cubic-bezier(0.25, 0.4, 0.25, 1), visibility 0.35s;
	z-index: 50;
	background-color: hsl(var(--background));
}

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

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

#theme-cart-drawer[data-drawer-instant] {
	transition: none !important;
}

.theme-cart-count[hidden],
.theme-cart-count[data-theme-badge-count="0"] {
	display: none !important;
}

#theme-cart-drawer .animate-slide-up {
	animation: none;
}

#theme-cart-drawer [data-cart-qty-update],
#theme-cart-drawer [data-cart-remove],
#theme-cart-drawer [data-cart-empty],
#theme-cart-drawer [data-cart-close] {
	pointer-events: auto;
}

/* -------------------------------------------------------------------------
 * Contact modal
 * ---------------------------------------------------------------------- */

.theme-modal-root[hidden] {
	display: none !important;
}

.theme-modal-panel {
	animation: themeModalIn 0.2s ease-out;
	width: min(32rem, calc(100vw - 2rem));
}

#theme-contact-title {
	font-family: Fraunces, serif;
	font-size: 1.875rem;
	line-height: 2.25rem;
	letter-spacing: 0.025em;
	text-transform: uppercase;
	font-weight: 400;
}

.theme-modal-overlay {
	animation: themeFadeIn 0.2s ease-out;
}

@keyframes themeModalIn {
	from { opacity: 0; transform: translate(-50%, -48%) scale(0.95); }
	to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@keyframes themeFadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

/* -------------------------------------------------------------------------
 * WooCommerce markup that has no source equivalent
 * ---------------------------------------------------------------------- */

.theme-attr-select-hidden {
	display: none !important;
}

.theme-quantity-wrapper {
	display: inline-flex;
	align-items: center;
	width: fit-content;
	max-width: 100%;
	flex: 0 0 auto;
	align-self: flex-start;
}

.theme-quantity-wrapper input[type="number"] {
	-moz-appearance: textfield;
	appearance: textfield;
	width: 2.75rem !important;
	min-width: 2.75rem;
	max-width: 2.75rem;
	flex: 0 0 2.75rem;
	padding-left: 0;
	padding-right: 0;
	margin: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	text-align: center;
}

.theme-quantity-wrapper input[type="number"]::-webkit-outer-spin-button,
.theme-quantity-wrapper input[type="number"]::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.theme-add-to-cart-area {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0.75rem;
	width: 100%;
}

.theme-add-to-cart-area .single_add_to_cart_button {
	flex: 0 0 auto;
	width: 100%;
	min-width: 0;
}

/* Variations table: label above control, native labels hidden because pills carry them. */
.single-product .variations,
.single-product .variations tbody,
.single-product .variations tbody tr,
.single-product .variations tbody td {
	display: block;
	width: 100%;
}

.single-product .variations td.label,
.single-product .variations .label {
	display: none;
}

.single-product .variations tbody td.value {
	padding: 0;
}

.single-product .variations tbody tr {
	margin: 0;
}

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

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

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


.single-product .variation-pill-active,
.single-product [data-theme-attr-pill].is-active {
	background-color: hsl(var(--foreground));
	color: hsl(var(--background));
	border-color: hsl(var(--foreground));
}

/* WooCommerce notices, styled to the design system, kept visible where needed. */
.woocommerce-notices-wrapper:empty {
	display: none;
}

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

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

.woocommerce-message .button,
.woocommerce-info .button,
.woocommerce-error .button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 9999px;
	padding: 0.5rem 1.25rem;
	font-size: 0.8125rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	text-decoration: none;
}

/* Notices hidden only where the drawer already reports the result. */
.single-product .woocommerce-message,
.single-product .woocommerce-info,
#theme-cart-drawer .woocommerce-message {
	display: none;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* -------------------------------------------------------------------------
 * Archive + pagination
 * ---------------------------------------------------------------------- */

.woocommerce-pagination ul,
.wc-block-pagination {
	display: flex;
	gap: 0.5rem;
	justify-content: center;
	list-style: none;
	padding: 0;
}

.woocommerce-pagination .page-numbers,
.wc-block-pagination-page {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.5rem;
	height: 2.5rem;
	border-radius: 9999px;
	border: 1px solid hsl(var(--border));
	font-family: var(--font-body);
	font-size: 0.875rem;
	text-decoration: none;
	color: hsl(var(--foreground));
}

.woocommerce-pagination .page-numbers.current,
.wc-block-pagination-page.wc-block-pagination-page--active {
	background-color: hsl(var(--primary));
	border-color: hsl(var(--primary));
	color: hsl(var(--primary-foreground));
}

/* -------------------------------------------------------------------------
 * Checkout block
 * ---------------------------------------------------------------------- */

body.woocommerce-checkout .site-main,
body.theme-checkout-page .site-main {
	padding-top: 2rem;
	padding-bottom: 4rem;
}

body.woocommerce-checkout .entry-content,
body.theme-checkout-page .entry-content {
	max-width: 100%;
}

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;
}

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

	body.woocommerce-checkout .wc-block-checkout.is-large > .wc-block-checkout__main {
		grid-column: 1;
	}

	body.woocommerce-checkout .wc-block-checkout.is-large > .wc-block-checkout__sidebar {
		grid-column: 2;
	}
}

body.woocommerce-checkout .wc-block-components-notice-banner,
body.woocommerce-checkout .wc-block-components-notices {
	grid-column: 1 / -1;
}

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

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 {
	width: 100% !important;
	max-width: none !important;
	border: 1px solid hsl(var(--border)) !important;
	border-radius: calc(var(--radius) - 2px) !important;
	background-color: hsl(var(--background)) !important;
	color: hsl(var(--foreground)) !important;
	font-family: var(--font-body) !important;
	font-size: 1rem !important;
	box-shadow: none !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(--foreground)) !important;
	outline: 2px solid hsl(var(--ring) / 0.35) !important;
	outline-offset: 0 !important;
}

body.woocommerce-checkout .wc-block-components-text-input input::placeholder,
body.woocommerce-checkout .wc-block-components-textarea textarea::placeholder {
	color: hsl(var(--muted-foreground)) !important;
}

body.woocommerce-checkout .wc-block-components-checkout-place-order-button {
	background-color: hsl(var(--primary)) !important;
	color: hsl(var(--primary-foreground)) !important;
	border: 1px solid hsl(var(--primary)) !important;
	border-radius: 9999px !important;
	font-family: var(--font-body) !important;
	font-size: 0.875rem !important;
	letter-spacing: 0.22em !important;
	text-transform: uppercase !important;
	font-weight: 600 !important;
	padding: 0.875rem 1.5rem !important;
}

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

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

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

body.woocommerce-checkout .wc-block-cart-items {
	border-color: hsl(var(--border)) !important;
}

/* Thank you page */
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-order h2,
body.theme-thankyou-page .woocommerce-order-details__title {
	font-family: var(--font-display);
	padding: 0 0 1rem 0;
}

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-overview {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5rem;
	list-style: none;
	padding: 0;
	margin: 0 0 2rem;
	font-family: var(--font-body);
}

body.theme-thankyou-page .woocommerce-order-overview li {
	border-right: 1px solid hsl(var(--border));
	padding-right: 1.5rem;
	font-size: 0.875rem;
}

body.theme-thankyou-page .woocommerce-order-overview li:last-child {
	border-right: 0;
}

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

body.woocommerce-cart .site-main,
body.woocommerce-account .site-main {
	padding-top: 1rem;
	padding-bottom: 4rem;
}

.page-title {
	/* inherits the source heading typography from app.css utility classes */
	margin-bottom: 2rem;
}

/* -------------------------------------------------------------------------
 * Forms inside WordPress content
 * ---------------------------------------------------------------------- */

.entry-content form input[type="text"],
.entry-content form input[type="email"],
.entry-content form input[type="tel"],
.entry-content form textarea,
.entry-content form select {
	width: 100%;
	padding: 0.75rem;
	border: 1px solid hsl(var(--border));
	border-radius: calc(var(--radius) - 2px);
	background-color: hsl(var(--background));
	font-family: var(--font-body);
	font-size: 1rem;
}

.entry-content form button,
.entry-content form input[type="submit"] {
	border-radius: 9999px;
	padding: 0.75rem 1.75rem;
	background-color: hsl(var(--primary));
	color: hsl(var(--primary-foreground));
	font-family: var(--font-body);
	font-size: 0.875rem;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	font-weight: 600;
	border: 1px solid hsl(var(--primary));
}

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

@media (max-width: 1023px) {
	.theme-cart-desktop-only {
		display: none;
	}
}

@media (max-width: 767px) {
	body.woocommerce-checkout .wc-block-checkout__sidebar {
		padding: 1.25rem;
	}
}
