/*
 * FM storefront base: shared tokens and global polish.
 * Loads on EVERY page (anonymous pages are cached), so every rule is scoped to html.fm-sf.
 * With the class absent (preview off, or no cookie) nothing here applies.
 * Cart and checkout own their own files (fm-cart.css, fm-checkout.css); we avoid their selectors
 * (form.cart, .woocommerce-cart, .woocommerce-checkout) on purpose.
 */

/* ---- 1. Tokens (single source; other files read these with var(--x, fallback)) ---- */
html.fm-sf {
	--fm-ink: #111;
	--fm-body: #2b2b2b;
	--fm-muted: #6b6b6b;
	--fm-faint: #9a9a9a;
	--fm-line: #e6e6e6;
	--fm-line-strong: #cfcfcf;
	--fm-canvas: #f6f6f4;
	--fm-card: #fff;
	--fm-primary: #111;
	--fm-primary-hover: #000;
	--fm-success: #1f7a4d;
	--fm-success-bg: #eef6f1;
	--fm-error: #b3261e;
	--fm-error-bg: #fdf1f0;
	--fm-warn-bg: #fdf6e7;
	--fm-info-bg: #f5f5f3;
	--fm-radius: 10px;
	--fm-radius-sm: 8px;
	--fm-font: 'Jost', system-ui, sans-serif;
	--fm-focus: 0 0 0 3px rgba(17, 17, 17, .12);
	scroll-padding-top: 84px;
}

/* ---- 2. Base type and colour ---- */
html.fm-sf body {
	font-family: var(--fm-font);
	font-size: 15px;
	color: var(--fm-body);
}
html.fm-sf ::selection {
	background: var(--fm-ink);
	color: #fff;
}
html.fm-sf :focus-visible {
	outline: 2px solid var(--fm-ink);
	outline-offset: 2px;
}
/* Fields show the same ring the checkout uses, instead of the browser default. */
html.fm-sf input:focus-visible,
html.fm-sf select:focus-visible,
html.fm-sf textarea:focus-visible {
	outline: none;
	border-color: var(--fm-ink);
	box-shadow: var(--fm-focus);
}
html.fm-sf input[type=checkbox],
html.fm-sf input[type=radio] {
	accent-color: var(--fm-ink);
}
/* iOS zooms the page when a focused field is under 16px. The qty stepper is owned by the cart file. */
@media (max-width: 767px) {
	html.fm-sf input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=submit]):not([type=button]):not([type=hidden]):not([type=file]):not(.qty),
	html.fm-sf select,
	html.fm-sf textarea {
		font-size: 16px !important;
	}
}
/* Motion: respect the OS setting; the storefront adds no motion of its own. */
@media (prefers-reduced-motion: reduce) {
	html.fm-sf *,
	html.fm-sf *::before,
	html.fm-sf *::after {
		transition-duration: .01ms !important;
		animation-duration: .01ms !important;
		scroll-behavior: auto !important;
	}
}

/* ---- 3. Buttons: one style, black, 48px tall, 8px radius ----
 * Excludes add-to-cart (cart file), card quick-add (below), and the cart and checkout pages. */
html.fm-sf body:not(.woocommerce-cart):not(.woocommerce-checkout) .woocommerce a.button:not(.single_add_to_cart_button):not(.add_to_cart_button),
html.fm-sf body:not(.woocommerce-cart):not(.woocommerce-checkout) .woocommerce button.button:not(.single_add_to_cart_button),
html.fm-sf body:not(.woocommerce-cart):not(.woocommerce-checkout) .woocommerce input.button:not(.single_add_to_cart_button),
html.fm-sf .thankyou_buttons,
html.fm-sf .fm-review-toggle {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 12px 22px;
	border: 1px solid var(--fm-primary);
	border-radius: var(--fm-radius-sm);
	background: var(--fm-primary);
	color: #fff;
	font-family: var(--fm-font);
	font-size: 15px;
	font-weight: 500;
	letter-spacing: .02em;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}
html.fm-sf body:not(.woocommerce-cart):not(.woocommerce-checkout) .woocommerce a.button:not(.single_add_to_cart_button):not(.add_to_cart_button):hover,
html.fm-sf body:not(.woocommerce-cart):not(.woocommerce-checkout) .woocommerce button.button:not(.single_add_to_cart_button):hover,
html.fm-sf .thankyou_buttons:hover,
html.fm-sf .fm-review-toggle:hover {
	background: var(--fm-primary-hover);
	border-color: var(--fm-primary-hover);
	color: #fff;
}
/* Secondary (outline) variant for "Continue shopping" style actions. */
html.fm-sf .fm-btn-outline {
	background: #fff;
	color: var(--fm-ink);
}
html.fm-sf .fm-btn-outline:hover {
	background: var(--fm-ink);
	color: #fff;
}
html.fm-sf button:disabled,
html.fm-sf .button.disabled {
	opacity: .45;
	cursor: not-allowed;
}

/* ---- 4. Woo notices: success, error, info, one look ---- */
html.fm-sf .woocommerce-message,
html.fm-sf .woocommerce-info,
html.fm-sf .woocommerce-error,
html.fm-sf .woocommerce-notice {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 14px;
	margin: 0 0 16px;
	padding: 14px 16px;
	border: 1px solid var(--fm-line-strong);
	border-radius: var(--fm-radius);
	background: var(--fm-info-bg);
	color: var(--fm-body);
	font-size: 14px;
	line-height: 1.5;
	list-style: none;
}
html.fm-sf .woocommerce-message::before,
html.fm-sf .woocommerce-info::before,
html.fm-sf .woocommerce-error::before {
	content: none !important;
	display: none !important;
}
html.fm-sf .woocommerce-error {
	display: block;
	padding: 0;
	border-color: #f0c7c3;
	background: var(--fm-error-bg);
	color: var(--fm-error);
}
html.fm-sf .woocommerce-error li {
	margin: 0;
	padding: 14px 16px;
	list-style: none;
}
html.fm-sf .woocommerce-message {
	border-color: #c9e6d5;
	background: var(--fm-success-bg);
	color: var(--fm-success);
}
/* Woo's notice-- modifiers (order-received and order-pay pages) get the same three looks. */
html.fm-sf .woocommerce-notice--success {
	border-color: #c9e6d5;
	background: var(--fm-success-bg);
	color: var(--fm-success);
}
html.fm-sf .woocommerce-notice--error {
	border-color: #f0c7c3;
	background: var(--fm-error-bg);
	color: var(--fm-error);
}
html.fm-sf .woocommerce-message a:not(.button),
html.fm-sf .woocommerce-info a:not(.button),
html.fm-sf .woocommerce-error a:not(.button) {
	color: inherit;
	font-weight: 600;
	text-underline-offset: 3px;
}
/* The "View cart" / "Pay" actions inside a notice: outlined, 44px+ so they are easy to tap. */
html.fm-sf .woocommerce-message .button,
html.fm-sf .woocommerce-info .button,
html.fm-sf .woocommerce-notice .button {
	min-height: 44px;
	margin-left: auto;
	background: #fff;
	border-color: var(--fm-ink);
	color: var(--fm-ink);
}
html.fm-sf .woocommerce-message .button:hover,
html.fm-sf .woocommerce-info .button:hover,
html.fm-sf .woocommerce-notice .button:hover {
	background: var(--fm-ink);
	color: #fff;
}
/* Order-pay page (a failed or pending order): the Pay button is the main action, so it is 48px+. */
html.fm-sf body.woocommerce-order-pay #place_order,
html.fm-sf body.woocommerce-order-pay .button.pay {
	min-height: 48px;
	font-size: 16px;
}

/* ---- 5. Sale badge and out-of-stock tag: small tags that do not cover product names ---- */
html.fm-sf .woocommerce span.onsale,
html.fm-sf li.product .ast-onsale-card,
html.fm-sf .woocommerce-product-gallery span.onsale {
	top: 8px;
	left: 8px;
	right: auto;
	width: auto;
	height: auto;
	min-width: 0;
	min-height: 0;
	margin: 0;
	padding: 3px 7px;
	border-radius: 4px;
	background: var(--fm-ink);
	color: #fff;
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: .08em;
	line-height: 1.3;
	text-transform: uppercase;
	box-shadow: none;
}
html.fm-sf .woocommerce p.stock.out-of-stock,
html.fm-sf .woocommerce .out-of-stock-tag {
	display: inline-block;
	margin: 0 0 8px;
	padding: 4px 10px;
	border-radius: 4px;
	background: #efefed;
	color: var(--fm-muted);
	font-size: 12px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
}

/* ---- 6. Prices: struck MRP, then the sale price in ink ---- */
html.fm-sf li.product .price,
html.fm-sf .woocommerce div.product p.price {
	color: var(--fm-ink);
}
html.fm-sf li.product .price del,
html.fm-sf .woocommerce div.product p.price del {
	color: var(--fm-faint);
	font-weight: 400;
	opacity: 1;
}
html.fm-sf li.product .price ins,
html.fm-sf .woocommerce div.product p.price ins {
	color: var(--fm-ink);
	font-weight: 600;
	text-decoration: none;
}

/* ---- 7. Header: 44px touch areas, icons unchanged ----
 * The cart icon is also styled in fm-cart.css. The rules here are the same, so either order works. */
/* A pseudo-element widens the tap area without changing the icon's box, so the header height does not move. */
html.fm-sf .ast-mobile-header-wrap button.main-header-menu-toggle,
html.fm-sf .ast-mobile-header-wrap a.slide-search,
html.fm-sf .ast-mobile-header-wrap a.ast-header-account-link,
html.fm-sf .ast-mobile-header-wrap a.cart-container {
	position: relative;
}
html.fm-sf .ast-mobile-header-wrap button.main-header-menu-toggle::after,
html.fm-sf .ast-mobile-header-wrap a.slide-search::after,
html.fm-sf .ast-mobile-header-wrap a.ast-header-account-link::after,
html.fm-sf .ast-mobile-header-wrap a.cart-container::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: max(44px, 100%);
	height: max(44px, 100%);
	transform: translate(-50%, -50%);
}
/* The "Download the App" strip stays above the header (not sticky) and is compact on mobile. */
@media (max-width: 921px) {
	html.fm-sf .ast-above-header-bar {
		max-height: 36px;
	}
	html.fm-sf .ast-above-header-bar a {
		font-size: 12.5px;
		/* The whole strip height is the tap area for the store link (the strip is 36px). */
		display: inline-flex;
		align-items: center;
		min-height: 36px;
	}
}

/* ---- 8. Product cards (shop, category, home, related) ---- */
html.fm-sf ul.products li.product .woocommerce-loop-product__title {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.7em;
	margin: 8px 0 2px;
	color: var(--fm-ink);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.35;
}
html.fm-sf ul.products li.product .price {
	font-size: 14px;
	font-weight: 500;
}
/* Consistent artwork box: real Woo thumbnails are 480x579 (about 4:5), so the box never reflows as images load. */
html.fm-sf ul.products li.product .astra-shop-thumbnail-wrap img {
	aspect-ratio: 480 / 579;
	object-fit: cover;
}
/* Quick-add: a 44px hit area around the same 30px icon. Its accessible name comes from storefront.php. */
html.fm-sf ul.products li.product a.ast-on-card-button.add_to_cart_button::after,
html.fm-sf ul.products li.product a.ast-select-options-trigger::after {
	content: "";
	position: absolute;
	top: 50%;
	left: 50%;
	width: max(44px, 100%);
	height: max(44px, 100%);
	transform: translate(-50%, -50%);
}
/* Astra reveals the quick-add on hover only, so on touch screens it is hidden (opacity 0, visibility hidden)
 * and cannot be tapped. Touch screens get a visible white circle over the artwork; hover screens keep Astra's reveal. */
@media (hover: none) {
	html.fm-sf ul.products li.product a.ast-on-card-button.add_to_cart_button,
	html.fm-sf ul.products li.product a.ast-select-options-trigger {
		opacity: 1 !important;
		visibility: visible !important;
		width: 36px;
		height: 36px;
		display: flex;
		align-items: center;
		justify-content: center;
		border-radius: 50%;
		background: #fff !important;
		box-shadow: 0 1px 4px rgba(0, 0, 0, .22);
		color: var(--fm-ink) !important;
	}
}

/* ---- 9. PDP: title, swatches, trust rows, gallery overflow ---- */
html.fm-sf .woocommerce div.product .product_title,
html.fm-sf .woocommerce div.product h1.entry-title {
	font-family: var(--fm-font);
	font-size: 22px;
	font-weight: 500;
	line-height: 1.25;
	letter-spacing: -.005em;
	color: var(--fm-ink);
}
@media (min-width: 768px) {
	html.fm-sf .woocommerce div.product .product_title,
	html.fm-sf .woocommerce div.product h1.entry-title {
		font-size: 26px;
	}
}
/* Variation swatches (woo-variation-swatches): one shape for every type.
 * Woo sets border-radius:100% on swatches, which turns non-square pills into ovals, so text pills
 * (colour names and sizes) get a fixed 10px radius. Only true colour dots (.color-variable-item)
 * are round. Every swatch is at least 44x44 and keeps the same 1px border; the selected state is
 * a black border plus a 1px ring, and out-of-stock is dimmed with a diagonal strike. */
/* Swatch lists: a fixed 8px gap between pills, wrapping on narrow screens. */
html.fm-sf .woocommerce div.product form.variations_form ul.variable-items-wrapper {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 2px 0;
}
html.fm-sf .woocommerce div.product form.variations_form .variable-items-wrapper .variable-item {
	box-sizing: border-box;
	box-shadow: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: auto;
	min-width: 44px;
	height: 44px;
	min-height: 44px;
	margin: 0;
	padding: 0 16px;
	border: 1px solid var(--fm-line-strong);
	border-radius: var(--fm-radius) !important;
	background: #fff;
	color: var(--fm-ink);
	font-family: var(--fm-font);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	white-space: nowrap;
}
html.fm-sf .woocommerce div.product form.variations_form .variable-items-wrapper .variable-item.color-variable-item {
	width: 44px;
	padding: 0;
	border-radius: 50% !important;
}
/* Woo fixes the label box to the swatch size; let it take the label's width so nothing is clipped. */
html.fm-sf .woocommerce div.product form.variations_form .variable-items-wrapper .variable-item .variable-item-contents,
html.fm-sf .woocommerce div.product form.variations_form .variable-items-wrapper .variable-item:not(.radio-variable-item) .variable-item-span {
	width: auto !important;
	height: auto;
	overflow: visible !important;
	border-radius: 0 !important;
	background: transparent;
	color: inherit;
	line-height: 1.2;
	white-space: nowrap;
}
html.fm-sf .woocommerce div.product form.variations_form .variable-items-wrapper .variable-item.selected {
	border-color: var(--fm-ink);
	box-shadow: 0 0 0 1px var(--fm-ink);
}
html.fm-sf .woocommerce div.product form.variations_form .variable-items-wrapper .variable-item.disabled,
html.fm-sf .woocommerce div.product form.variations_form .variable-items-wrapper .variable-item.out-of-stock,
html.fm-sf .woocommerce div.product form.variations_form .variable-items-wrapper .variable-item.variation-out-of-stock {
	opacity: .45;
	color: var(--fm-muted);
	background-image: linear-gradient(to top right, transparent calc(50% - .6px), var(--fm-muted) 50%, transparent calc(50% + .6px));
}
/* Attribute label ("Color") and the chosen value ("Size : S") share one style. */
html.fm-sf .woocommerce div.product form.variations_form th.label label {
	color: var(--fm-ink);
	font-size: 14px;
	font-weight: 500;
}
html.fm-sf .woocommerce div.product form.variations_form .woo-selected-variation-item-name {
	color: var(--fm-muted);
	font-size: 14px;
	font-weight: 400;
}
/* Size Chart and Return & Exchange: same radius, hairline border, 48px, ink text. */
html.fm-sf .size_guide {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 48px;
	padding: 12px 18px;
	border: 1px solid var(--fm-line-strong);
	border-radius: var(--fm-radius);
	background: #fff;
	color: var(--fm-ink);
	font-family: var(--fm-font);
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color .15s ease;
}
html.fm-sf .size_guide:hover {
	border-color: var(--fm-ink);
}
/* Trust rows under the cart form ("7 Days Return", "Dispatched in 24 hours"): a tidy list, inline SVG icons. */
html.fm-sf .ast-single-product-extras ul {
	display: grid;
	gap: 10px;
	margin: 14px 0 0;
	padding: 0;
	list-style: none;
}
html.fm-sf .ast-single-product-extras li {
	position: relative;
	margin: 0;
	padding: 0 0 0 28px;
	color: var(--fm-body);
	font-size: 14px;
	line-height: 1.4;
}
/* Astra places the icon absolutely; pin it to the row's centre line so the text never sits under it. */
html.fm-sf .ast-single-product-extras li .ahfb-svg-iconset {
	position: absolute;
	left: 0;
	top: 50%;
	display: inline-flex;
	width: 18px;
	height: 18px;
	transform: translateY(-50%);
	align-items: center;
	justify-content: center;
}
html.fm-sf .ast-single-product-extras li svg {
	width: 16px;
	height: 16px;
	fill: var(--fm-ink);
}
/* Product gallery thumbnails slide sideways inside their own box. Without this clip the strip widens the whole page. */
html.fm-sf .woocommerce-product-gallery {
	overflow-x: clip;
}
/* Reviews: quieter list typography (the widget is heavy on a mobile PDP). */
html.fm-sf #reviews .cr-reviews-ajax-comments,
html.fm-sf #reviews .cr-reviews-ajax-comments .comment-text,
html.fm-sf #reviews .cr-reviews-ajax-comments p {
	font-size: 14px;
	font-weight: 400;
	color: var(--fm-muted);
}
/* Reviews form, when a product has no reviews: hidden until the "Write a review" button opens it (storefront.php). */
html.fm-sf .fm-review-collapsed {
	display: none !important;
}
html.fm-sf .fm-review-toggle {
	width: 100%;
	margin: 6px 0 12px;
}
html.fm-sf .fm-review-toggle[aria-expanded="true"] {
	background: #fff;
	color: var(--fm-ink);
}
html.fm-sf .fm-review-toggle[aria-expanded="true"]:hover {
	background: var(--fm-ink);
	color: #fff;
}

/* ---- 10. Account and login surfaces: type and inputs only (fm-sso keeps its own flow) ---- */
html.fm-sf .woocommerce-form input.input-text,
html.fm-sf .woocommerce-Input,
html.fm-sf .woocommerce form .form-row input.input-text {
	min-height: 44px;
	box-sizing: border-box;
}
html.fm-sf body.woocommerce-account .woocommerce-form-login,
html.fm-sf body.woocommerce-account .woocommerce-form-register {
	max-width: 100%;
	box-sizing: border-box;
}
html.fm-sf .woocommerce-products-header__title,
html.fm-sf .page-title {
	font-weight: 500;
	color: var(--fm-ink);
}
html.fm-sf .related.products > h2,
html.fm-sf .up-sells > h2 {
	font-size: 18px;
	font-weight: 500;
	color: var(--fm-ink);
}
