/* =========================================================
   Noiroast — WooCommerce overrides (Noir Coffee)
   Approach A: CSS-first, no template overrides (update-safe).
   Enqueued via wp_enqueue_style on WC pages + front-page.
   Relies on design tokens (--nr-*) defined in style.css :root.
   ========================================================= */

/* =========================================================
   1. Buttons — recolor default WooCommerce purple/grey → copper
   ========================================================= */

/* Primary / "alt" actions: Add to cart (single), Place order,
   Proceed to checkout, Update — copper fill. */
.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce input.button.alt,
.woocommerce #respond input#submit.alt,
.woocommerce-page a.button.alt,
.woocommerce-page button.button.alt,
.woocommerce-page input.button.alt {
	background-color: var(--nr-accent);
	color: var(--nr-bg);
	border: 1px solid var(--nr-accent);
	border-radius: var(--nr-radius);
	font-family: var(--nr-font-body);
	font-weight: 600;
	letter-spacing: 0.02em;
	text-shadow: none;
	box-shadow: none;
	transition: all 0.2s ease;
}
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover,
.woocommerce input.button.alt:hover,
.woocommerce #respond input#submit.alt:hover,
.woocommerce-page a.button.alt:hover,
.woocommerce-page button.button.alt:hover,
.woocommerce-page input.button.alt:hover {
	background-color: var(--nr-accent-2);
	border-color: var(--nr-accent-2);
	color: var(--nr-bg);
}

/* Secondary actions: View cart, loop Add to cart, Apply coupon,
   Continue shopping — copper outline (ghost). */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce-page a.button,
.woocommerce-page button.button,
.woocommerce-page input.button {
	background-color: transparent;
	color: var(--nr-accent);
	border: 1px solid var(--nr-accent);
	border-radius: var(--nr-radius);
	font-family: var(--nr-font-body);
	font-weight: 600;
	letter-spacing: 0.02em;
	text-shadow: none;
	box-shadow: none;
	transition: all 0.2s ease;
}
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce #respond input#submit:hover,
.woocommerce-page a.button:hover,
.woocommerce-page button.button:hover,
.woocommerce-page input.button:hover {
	background-color: var(--nr-accent);
	color: var(--nr-bg);
	border-color: var(--nr-accent);
}

/* Disabled / loading state — keep readable, no purple flash. */
.woocommerce a.button.disabled,
.woocommerce button.button:disabled,
.woocommerce button.button[disabled],
.woocommerce input.button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* =========================================================
   2. Block-based cart / checkout buttons (WC Blocks)
   These ship with high-specificity defaults → need !important.
   ========================================================= */
.wc-block-components-button:not(.is-link),
.wp-block-button__link.wc-block-components-button {
	background-color: var(--nr-accent) !important;
	color: var(--nr-bg) !important;
	border-radius: var(--nr-radius) !important;
	font-family: var(--nr-font-body) !important;
	font-weight: 600 !important;
}
.wc-block-components-button:not(.is-link):hover {
	background-color: var(--nr-accent-2) !important;
}
.wc-block-components-checkout-place-order-button {
	background-color: var(--nr-accent) !important;
	color: var(--nr-bg) !important;
}
.wc-block-components-checkout-place-order-button:hover {
	background-color: var(--nr-accent-2) !important;
}

/* =========================================================
   3. Shop archive (/shop/) — Noir product cards
   ========================================================= */

/* Result count + ordering bar */
.woocommerce .woocommerce-result-count {
	color: var(--nr-text-mut);
	font-family: var(--nr-font-body);
	font-size: 0.9rem;
}
.woocommerce .woocommerce-ordering select {
	background: var(--nr-bg-card);
	color: var(--nr-text);
	border: 1px solid var(--nr-line);
	border-radius: var(--nr-radius);
	padding: 0.5em 0.7em;
	font-family: var(--nr-font-body);
	font-size: 0.9rem;
}

/* Product grid — override default float/percentage layout */
.woocommerce ul.products {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: clamp(1.2rem, 3vw, 2rem);
	margin: 0;
	padding: 0;
	list-style: none;
}
.woocommerce ul.products::before,
.woocommerce ul.products::after { content: none; }

.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
	width: auto !important;
	float: none !important;
	margin: 0 !important;
	clear: none !important;
	background: var(--nr-bg-card);
	border: 1px solid var(--nr-line);
	border-radius: var(--nr-radius);
	padding: 1.2rem 1.2rem 1.6rem;
	text-align: left;
	display: flex;
	flex-direction: column;
	transition: border-color 0.2s ease, transform 0.2s ease;
}

/* product image */
.woocommerce ul.products li.product a img {
	margin: 0 0 1rem;
	border-radius: var(--nr-radius);
	background: var(--nr-bg-alt);
}

/* title */
.woocommerce ul.products li.product .woocommerce-loop-product__title,
.woocommerce ul.products li.product h2 {
	font-family: var(--nr-font-display);
	font-weight: 600;
	font-size: 1.15rem;
	line-height: 1.2;
	color: var(--nr-text);
	padding: 0;
	margin: 0 0 0.4rem;
}

/* star rating in copper */
.woocommerce ul.products li.product .star-rating span,
.woocommerce .star-rating span { color: var(--nr-accent); }
.woocommerce ul.products li.product .star-rating { margin: 0 0 0.5rem; }

/* push the button to the bottom of the card */
.woocommerce ul.products li.product .button {
	margin-top: auto;
	align-self: flex-start;
}

/* =========================================================
   4. Price — muted cream (calm, not shouting)
   ========================================================= */
.woocommerce ul.products li.product .price,
.woocommerce div.product p.price,
.woocommerce div.product span.price {
	color: var(--nr-text);
	font-family: var(--nr-font-body);
	font-weight: 600;
	font-size: 1rem;
}
.woocommerce ul.products li.product .price { margin: 0 0 1rem; }
/* sale prices: keep old price muted + struck, new price cream */
.woocommerce .price del { color: var(--nr-text-mut); opacity: 0.7; }
.woocommerce .price ins { color: var(--nr-text); text-decoration: none; }

/* =========================================================
   5. Single product
   ========================================================= */
.woocommerce div.product .product_title {
	font-family: var(--nr-font-display);
	color: var(--nr-text);
}
.woocommerce div.product div.images img {
	border-radius: var(--nr-radius);
}
.woocommerce div.product .woocommerce-product-rating .star-rating span { color: var(--nr-accent); }

/* quantity selector */
.woocommerce .quantity input.qty {
	background: var(--nr-bg-card);
	color: var(--nr-text);
	border: 1px solid var(--nr-line);
	border-radius: var(--nr-radius);
	padding: 0.5em;
}

/* product tabs (Description / Additional info / Reviews) */
.woocommerce div.product .woocommerce-tabs ul.tabs { padding: 0; margin: 0 0 1.5rem; }
.woocommerce div.product .woocommerce-tabs ul.tabs::before {
	border-bottom: 1px solid var(--nr-line);
}
.woocommerce div.product .woocommerce-tabs ul.tabs li {
	background: transparent;
	border: 1px solid var(--nr-line);
	border-radius: var(--nr-radius) var(--nr-radius) 0 0;
	margin: 0 0.3rem -1px 0;
}
.woocommerce div.product .woocommerce-tabs ul.tabs li::before,
.woocommerce div.product .woocommerce-tabs ul.tabs li::after { display: none; }
.woocommerce div.product .woocommerce-tabs ul.tabs li a {
	color: var(--nr-text-mut);
	font-family: var(--nr-font-body);
	font-weight: 600;
}
.woocommerce div.product .woocommerce-tabs ul.tabs li.active {
	background: var(--nr-bg-card);
	border-bottom-color: var(--nr-bg-card);
}
.woocommerce div.product .woocommerce-tabs ul.tabs li.active a { color: var(--nr-text); }
.woocommerce div.product .woocommerce-tabs .panel h2 { font-family: var(--nr-font-display); }

/* =========================================================
   6. WooCommerce notices (added-to-cart etc.) — Noir
   ========================================================= */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
	background: var(--nr-bg-card);
	border-top: 3px solid var(--nr-accent);
	color: var(--nr-text);
	border-radius: var(--nr-radius);
}
.woocommerce-message::before,
.woocommerce-info::before { color: var(--nr-accent); }

/* =========================================================
   7. Hover — peek-overlay (V1, CSS) + pointer-tilt base (V2)
   Shared by front-page cards (.nr-card) and shop-loop cards
   (li.product; image wrapped in .nr-loop-media via PHP hook).
   The tilt rotation itself is applied inline by js/card-tilt.js.
   ========================================================= */

/* Shop-loop card → parity with the landing card (lift + copper border).
   Front-page .nr-card already has lift+border in its scoped styles. */
.woocommerce ul.products li.product {
	transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.woocommerce ul.products li.product:hover {
	border-color: var(--nr-accent);
	transform: translateY(-4px);
}
.nr-card:hover,
.woocommerce ul.products li.product:hover {
	box-shadow: 0 12px 32px -14px rgba(200, 137, 90, 0.40);
}

/* Media frame — isolates the image so zoom + overlay stay clipped */
.nr-card__media,
.woocommerce ul.products li.product .nr-loop-media {
	position: relative;
	overflow: hidden;
	border-radius: var(--nr-radius);
}
.woocommerce ul.products li.product .nr-loop-media { margin-bottom: 1rem; }
.woocommerce ul.products li.product .nr-loop-media img { margin: 0; }

/* Image zoom on hover */
.nr-card__media img,
.woocommerce ul.products li.product .nr-loop-media img {
	transition: transform 0.35s ease;
}
.nr-card:hover .nr-card__media img,
.woocommerce ul.products li.product:hover .nr-loop-media img {
	transform: scale(1.06);
}

/* Copper veil rising from the bottom of the image */
.nr-card__media::after,
.woocommerce ul.products li.product .nr-loop-media::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient( to top, rgba(26, 19, 16, 0.55), rgba(26, 19, 16, 0) 60% );
	opacity: 0;
	transition: opacity 0.3s ease;
	pointer-events: none;
	z-index: 1;
}
.nr-card:hover .nr-card__media::after,
.woocommerce ul.products li.product:hover .nr-loop-media::after {
	opacity: 1;
}

/* Centered copper "peek" glyph */
.nr-card__media::before,
.woocommerce ul.products li.product .nr-loop-media::before {
	content: "\2197"; /* north-east arrow */
	position: absolute;
	top: 50%;
	left: 50%;
	width: 44px;
	height: 44px;
	line-height: 44px;
	text-align: center;
	border-radius: 50%;
	background: var(--nr-accent);
	color: var(--nr-bg);
	font-family: var(--nr-font-body);
	font-size: 1.15rem;
	font-weight: 700;
	opacity: 0;
	transform: translate(-50%, -50%) scale(0.8);
	transition: opacity 0.3s ease, transform 0.3s ease;
	pointer-events: none;
	z-index: 2;
}
.nr-card:hover .nr-card__media::before,
.woocommerce ul.products li.product:hover .nr-loop-media::before {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

/* Reduced motion: drop zoom/lift transitions (peek veil/glyph still fade) */
@media (prefers-reduced-motion: reduce) {
	.woocommerce ul.products li.product,
	.nr-card__media img,
	.woocommerce ul.products li.product .nr-loop-media img { transition: none !important; }
}

/* =========================================================
   8. Responsive grid
   ========================================================= */
@media (max-width: 900px) {
	.woocommerce ul.products { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
	.woocommerce ul.products { grid-template-columns: 1fr; }
}

/* =========================================================
   9. Block checkout — floating-label contrast fix
   The label sits INSIDE the white input when resting → it must
   be dark to be readable. When the field is focused or filled
   (WC Blocks adds .is-active) the label floats up onto the dark
   page background → it stays light cream. WC Blocks ship with
   high-specificity defaults, hence !important (same approach as
   section 2). Active rule outranks the resting rule by specificity.
   ========================================================= */

/* Resting state: label overlaps the white field → dark, muted hint */
.wc-block-components-text-input label,
.wc-block-components-combobox label {
	color: rgba(26, 19, 16, 0.6) !important;
}

/* Active state (focused or filled): label floated onto the dark
   page background → light cream, readable */
.wc-block-components-text-input.is-active label,
.wc-block-components-combobox.is-active label {
	color: var(--nr-text) !important;
}
