/*
 * woocommerce: WooCommerce shop output (spec 6.8; plan 02b-T12). Buttons, notices, form rows and fields, the
 * product page, the Cart block's product buttons, shop tables, WooCommerce Memberships' restriction notices and
 * the focus ring under .woocommerce.
 * Views: the shop, product pages, /cart/, /checkouts/checkout-page/, /my-account/ and every view whose content
 * WooCommerce Memberships restricts (inc/plugin-styles.php).
 *
 * Colours only through the preset and custom variables of contract 1.1 and 1.7: no error red, no success green
 * (1.1 rule 7). Loaded after WooCommerce's own stylesheets, whose button rules reach a specificity of six classes
 * (`.woocommerce button.button.alt:disabled[disabled]:hover`); the button rules below carry `:not(#_)`, which
 * matches every element and counts as one id, so they win without !important.
 */

/* WooCommerce's own colour variables, read by its required marker, remove link, invalid fields and form fields. */
.woocommerce {
	--wc-red: var(--wp--preset--color--ink);
	--wc-green: var(--wp--preset--color--meta-grey);
	--wc-form-border-color: var(--wp--preset--color--meta-grey);
	--wc-form-color-background: var(--wp--preset--color--white);
	--wc-form-color-text: var(--wp--preset--color--ink);
}

/* Buttons (contract 2.5): every WooCommerce button is the primary button. Gravity Forms buttons, which also carry
   the class `button`, keep their own stylesheet on views whose body has the class woocommerce; the FunnelKit
   checkout's buttons keep today's look (master ruling 55), FunnelKit's own. -------------------- */

.woocommerce :is(a.button, button.button, input.button):where(:not(.gform_wrapper *, .single-wfacp_checkout *)):not(#_),
.wc-block-grid__product-add-to-cart.wp-block-button .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	min-height: 2.625rem;
	margin: 0;
	padding: 0.625rem 1.875rem;
	border: 2px solid var(--wp--preset--color--teal-strong);
	border-radius: 999px;
	background-color: var(--wp--preset--color--teal-strong);
	background-image: none;
	color: var(--wp--preset--color--white);
	font-family: var(--wp--preset--font-family--montserrat);
	font-size: 1rem; /* 1.4 and master ruling 40: button text is a literal 1rem, 16px. */
	font-weight: 700;
	letter-spacing: 0.1875rem;
	line-height: 1.15;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
}

.woocommerce :is(a.button, button.button, input.button):where(:not(.gform_wrapper *, .single-wfacp_checkout *)):not(#_):is(:hover, :focus-visible):where(:not(.disabled, :disabled)),
.wc-block-grid__product-add-to-cart.wp-block-button .wp-block-button__link:is(:hover, :focus-visible) {
	border-color: var(--wp--preset--color--teal-strong);
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--teal-strong);
}

/* WooCommerce gives a button it will not act on yet the class disabled (add to cart, until a variation is chosen)
   and fades it, but the button stays operable and announces what is missing: it keeps its full contrast. */
.woocommerce :is(a.button, button.button, input.button).disabled:where(:not(.gform_wrapper *, .single-wfacp_checkout *)):not(#_) {
	opacity: 1;
}

/* Notices (contract 1.1 rule 7, 2.3). Information and success: the look of notice-info. Errors: the look of
   notice-warning. WooCommerce's icon stays, in the notice's own colours. -------------------------------------------- */

.woocommerce-info,
.woocommerce-message,
.woocommerce-error {
	padding: var(--wp--preset--spacing--50) var(--wp--preset--spacing--50) var(--wp--preset--spacing--50) calc(var(--wp--preset--spacing--50) * 2 + 1em);
	border-top: 0;
	color: var(--wp--preset--color--ink);
}

.woocommerce-info,
.woocommerce-message {
	border-left: 4px solid var(--wp--preset--color--deep-teal);
	background-color: var(--wp--preset--color--panel);
}

.woocommerce-error {
	border-left: 0;
	background-color: var(--wp--preset--color--sun);
}

.woocommerce-info::before,
.woocommerce-message::before,
.woocommerce-error::before {
	top: var(--wp--preset--spacing--50);
	left: var(--wp--preset--spacing--50);
}

.woocommerce-info::before,
.woocommerce-message::before {
	color: var(--wp--preset--color--deep-teal);
}

.woocommerce-error::before,
.woocommerce-error a:not(.button) {
	color: var(--wp--preset--color--ink);
}

/* Form rows, labels and fields (contract 2.7, "Form fields everywhere"). ------------------------------------------- */

.woocommerce form .form-row label,
.woocommerce form.cart .variations label {
	color: var(--wp--preset--color--heading-grey);
	font-weight: 700;
}

.woocommerce form .form-row .required {
	color: var(--wp--preset--color--ink);
	visibility: visible;
}

.woocommerce :is(input.input-text, textarea.input-text, form select),
.woocommerce form .form-row :is(.input-text, select),
.woocommerce table.cart td.actions .coupon .input-text {
	border: 1px solid var(--wp--preset--color--meta-grey);
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--ink);
}

.woocommerce form .form-row input[type="checkbox"] {
	color: var(--wp--preset--color--ink);
	accent-color: var(--wp--preset--color--teal-strong);
}

.woocommerce :is(input.input-text, textarea.input-text)::placeholder {
	color: var(--wp--preset--color--meta-grey);
	opacity: 1;
}

.woocommerce :is(form.login, form.register, form.checkout_coupon, form.lost_reset_password) {
	border-color: var(--wp--preset--color--mist);
}

/* The product page. -------------------------------------------------------------------------------------------- */

.woocommerce div.product :is(p.price, span.price),
.woocommerce ul.products li.product .price {
	color: var(--wp--preset--color--ink);
}

.woocommerce div.product :is(p.price, span.price) {
	font-size: var(--wp--preset--font-size--large);
	font-weight: 700;
}

/* The variation choice: a white field as wide as its cell, so that a long option does not widen the page; the
   Clear link goes below it. */
.woocommerce div.product form.cart .variations select {
	width: 100%;
	margin-right: 0;
	padding: 0.5em 2.5em 0.5em 0.5em;
	background-color: var(--wp--preset--color--white);
	font-size: inherit;
}

.woocommerce div.product .stock {
	color: var(--wp--preset--color--ink);
}

/* A product without a picture shows WooCommerce's placeholder in a mist frame. */
.woocommerce ul.products li.product .woocommerce-placeholder,
.woocommerce div.product div.images .woocommerce-product-gallery__image--placeholder,
.wc-block-grid__products .wc-block-grid__product-image img[alt=""] {
	border-color: var(--wp--preset--color--mist);
}

.woocommerce span.onsale {
	background-color: var(--wp--preset--color--teal-strong);
	color: var(--wp--preset--color--white);
}

/* The gallery fills its column; its zoom button is drawn in ink on white. */
.woocommerce div.product div.images .woocommerce-product-gallery__image img {
	width: 100%;
}

.woocommerce div.product div.images .woocommerce-product-gallery__trigger {
	background-color: var(--wp--preset--color--white);
}

.woocommerce div.product div.images .woocommerce-product-gallery__trigger::before {
	border-color: var(--wp--preset--color--ink);
}

.woocommerce div.product div.images .woocommerce-product-gallery__trigger::after {
	background-color: var(--wp--preset--color--ink);
}

/* Tabs: mist rules, panel at rest, white when open; the tab names are links. */
.woocommerce div.product .woocommerce-tabs ul.tabs::before,
.woocommerce div.product .woocommerce-tabs ul.tabs li,
.woocommerce div.product .woocommerce-tabs ul.tabs li::before,
.woocommerce div.product .woocommerce-tabs ul.tabs li::after {
	border-color: var(--wp--preset--color--mist);
}

.woocommerce div.product .woocommerce-tabs ul.tabs li {
	background-color: var(--wp--preset--color--panel);
	color: var(--wp--preset--color--heading-grey);
}

.woocommerce div.product .woocommerce-tabs ul.tabs li::before {
	box-shadow: 2px 2px 0 var(--wp--preset--color--panel);
}

.woocommerce div.product .woocommerce-tabs ul.tabs li::after {
	box-shadow: -2px 2px 0 var(--wp--preset--color--panel);
}

.woocommerce div.product .woocommerce-tabs ul.tabs li.active {
	border-bottom-color: var(--wp--preset--color--white);
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--heading-grey);
}

.woocommerce div.product .woocommerce-tabs ul.tabs li.active::before {
	box-shadow: 2px 2px 0 var(--wp--preset--color--white);
}

.woocommerce div.product .woocommerce-tabs ul.tabs li.active::after {
	box-shadow: -2px 2px 0 var(--wp--preset--color--white);
}

.woocommerce div.product .woocommerce-tabs ul.tabs li a,
.woocommerce div.product .woocommerce-tabs ul.tabs li a:hover {
	color: var(--wp--preset--color--deep-teal);
}

/* Shop tables: 1px mist rules, heading-grey heads. ------------------------------------------------------------- */

.woocommerce table.shop_table {
	border: 1px solid var(--wp--preset--color--mist);
}

.woocommerce table.shop_table :is(td, tbody th, tfoot td, tfoot th) {
	border-top-color: var(--wp--preset--color--mist);
}

.woocommerce table.shop_table thead th {
	color: var(--wp--preset--color--heading-grey);
}

/* Focus ring (contract 1.7, rule 1), repeated under the wrapper WooCommerce prints, <div class="woocommerce">,
   so that it beats WooCommerce's `box-shadow: none` on its buttons. The body of a WooCommerce view also carries
   the class woocommerce; under it only WooCommerce's buttons get the ring again, so that fields in dark places
   (the newsletter band, the drawer) keep the swapped ring of rule 3. ------------------------------------------------- */

:not(body).woocommerce a:focus-visible,
:not(body).woocommerce button:focus-visible,
:not(body).woocommerce input:focus-visible,
:not(body).woocommerce select:focus-visible,
:not(body).woocommerce textarea:focus-visible,
:not(body).woocommerce summary:focus-visible,
:not(body).woocommerce [tabindex]:not([tabindex="-1"]):focus-visible,
.woocommerce :is(a.button, button.button, input.button):focus-visible {
	outline: var(--wp--custom--focus--ring-width) solid var(--wp--custom--focus--ring-outer);
	outline-offset: var(--wp--custom--focus--ring-width);
	box-shadow: 0 0 0 var(--wp--custom--focus--ring-width) var(--wp--custom--focus--ring-inner);
}
