/**
 * Stock alerts (cs-core Shop\Stock_Alerts; Brian's cs-stock-alerts.css, 28 Oct): the sign-up row and its small
 * print on product pages, the book band's format buttons and row, and two fixes to the text option buttons
 * (Format: Hardcover, Paperback…) on product pages: they size to their label instead of wrapping, and hover is an
 * ink border while selected stays the ink fill. Colour swatches are left exactly as they are.
 *
 * Loaded only on product pages and pages with the book band, after the theme's stylesheet and core's Buttons
 * styles, so the few rules that tie with theirs on specificity win on order. Colours and type are theme.json
 * tokens; the email field's white has none.
 */

/* The sign-up replaces the quantity + Add to cart row when the chosen variation is sold out. Same height (44px),
 * radius (8px), gap (8px) and 24px top margin as the Add to cart row. */
form[data-cs-sold-out] > .wp-block-group {
	display: none;
}

/* Sold out: WooCommerce's coral "Out of stock" line stays, every time, with 16px above it and 16px between it and
 * the sign-up row (Brian's 1.2). The state is an attribute because WooCommerce redraws the form's classes. */
:where(body:not(.cs-is-coming-soon)) form[data-cs-sold-out] .wc-block-components-product-stock-indicator {
	margin: 16px 0 0;
}

.cs-stock-alert {
	margin-block-start: 24px;
}

/* After the Out of stock line, 16px (ties with the rule above on specificity; wins on order). */
:where(form[data-cs-sold-out] .wc-block-components-product-stock-indicator:not(:empty)) ~ .cs-stock-alert {
	margin-block-start: 16px;
}

.cs-stock-alert[hidden] {
	display: none;
}

.cs-stock-alert__lead {
	margin: 8px 0 0;
	color: var(--wp--preset--color--ink-muted);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--ui);
	line-height: 1.5;
}

.cs-stock-alert__row {
	display: flex;
	gap: 8px;
}

.cs-stock-alert__email {
	flex: 1 1 auto;
	min-inline-size: 0;
	block-size: 44px;
	padding-block: 0;
	padding-inline: 16px;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 8px;
	background-color: var(--wp--custom--color--field);
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--small);
}

/* A field shows focus with its own border, in ink: 2px, drawn inward so nothing moves, and no ring (Brian, 24 Nov
 * 2026; looks round item 84; cs-theme's cs-site.css §20.3 says the same for every field). It was the site's purple
 * ring. On a dark band, where this field sits on the Book page ("Want to keep going?"), it is a cream ring 2px off
 * the field instead, and the field's border stays as at rest (item 85): the theme's dark bands set the two
 * properties, and the same outline is the one or the other. */
.cs-stock-alert__email:focus {
	outline: 2px solid var(--cs-field-focus, var(--wp--preset--color--brand-black, CanvasText));
	outline-offset: var(--cs-field-focus-offset, -2px);
}

.cs-stock-alert__button {
	flex: 0 0 auto;
	block-size: 44px;
	padding-block: 0;
	padding-inline: 32px;
	border: 0;
	border-radius: 8px;
	background-color: var(--wp--preset--color--action);
	color: var(--wp--preset--color--action-ink);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	cursor: pointer;
	transition: background-color 0.15s;
}

/* Hover black like every other site button (the theme's :where() hover rule can't beat this class). */
.cs-stock-alert__button:hover {
	background-color: var(--wp--preset--color--action-hover);
}

/* After the hover rule, so a disabled button stays grey under the pointer. */
.cs-stock-alert__button:disabled {
	background-color: var(--wp--preset--color--line);
	color: var(--wp--preset--color--ink-muted);
	cursor: default;
}

@media (prefers-reduced-motion: reduce) {

	.cs-stock-alert__button {
		transition: none;
	}
}

.cs-stock-alert__msg {
	margin: 8px 0 0;
	color: var(--wp--preset--color--ink-muted);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--ui);
}

.cs-stock-alert__msg:empty {
	display: none;
}

.cs-stock-alert.is-done :where(.cs-stock-alert__row, .cs-stock-alert__lead) {
	display: none;
}

.cs-stock-alert.is-done :where(.cs-stock-alert__msg) {
	margin-block-start: 0;
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--small);
}

@media (max-width: 480px) {

	.cs-stock-alert__row {
		flex-direction: column;
	}

	.cs-stock-alert__button {
		inline-size: 100%;
	}
}

/* Coming soon pieces: colour and size stay; quantity + Add to cart and the stock line never show, even before the
 * script runs. */
.cs-is-coming-soon :where(form.wc-block-add-to-cart-with-options) > .wp-block-group,
.cs-is-coming-soon :where(form.wc-block-add-to-cart-with-options) .wc-block-components-product-stock-indicator {
	display: none;
}

/* Text option buttons (Format: Hardcover, Paperback…) size to their label. The theme fixes every option button
 * at 44px wide with no padding (.cs-product__summary .wc-block-product-filter-chips__item), which breaks words
 * onto two lines. Colour swatches (.is-style-swatch) are left exactly as they are. */
.cs-product__summary :where(.wc-block-product-filter-chips:not(.is-style-swatch)) .wc-block-product-filter-chips__item {
	inline-size: auto;
	min-inline-size: 44px;
	padding-inline: 16px;
	white-space: nowrap;
}

/* Hover vs selected on text option buttons: hover = ink border, selected = ink fill, so a change is always
 * visible, even when unselecting while the pointer is still on the button. Swatches unchanged. The fill under the
 * pointer is the button's own white, not the page's cream (Brian, Nov 23; D912, D1115; the theme's app.css makes
 * the button white at rest). */
@media (hover: hover) {

	:where(.cs-product__summary .wc-block-product-filter-chips:not(.is-style-swatch)) button.wc-block-product-filter-chips__item:where(:not([aria-checked="true"])):hover {
		border-color: var(--wp--preset--color--ink);
		background-color: var(--wp--custom--color--field);
		color: var(--wp--preset--color--ink);
	}
}

/* The plugin's own form (it still renders on simple products) is replaced by ours everywhere. */
.single-product .cwginstock-subscribe-form {
	display: none;
}

/* Book band (book-band.js): square format buttons, one row of buttons, small print. A format button is white with
 * the almond line until picked, as the option buttons on product pages (Brian, Nov 23; D912, D1115); it was the
 * page's cream. On the Book page's black band the theme gives it its own see-through fill (cs-site.css §18 T4). */
.cs-band-buy .cs-pill-group {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	min-inline-size: 0;
	margin: 0 0 16px;
	padding: 0;
	border: 0;
}

.cs-band-chip {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	block-size: 44px;
	min-inline-size: 44px;
	margin: 0;
	padding-block: 0;
	padding-inline: 16px;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 0;
	background-color: var(--wp--custom--color--field);
	color: var(--wp--preset--color--ink);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
}

@media (hover: hover) {

	.cs-band-chip:hover {
		border-color: var(--wp--preset--color--ink);
	}
}

.cs-band-chip:has(input:checked) {
	border-color: var(--wp--preset--color--ink);
	background-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--base);
}

.cs-band-chip:has(input:focus-visible) {
	outline: 2px solid var(--wp--preset--color--focus);
	outline-offset: 2px;
}

.cs-band-chip input {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	margin: 0;
	opacity: 0;
	pointer-events: none;
}

.cs-band-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin: 0;
}

.cs-band-actions .cs-stock-alert__email {
	flex: 1 1 200px;
}

/* Ties with core's `.wp-block-buttons > .wp-block-button` and wins on order (this sheet loads after it). */
.cs-band-actions [hidden] {
	display: none;
}

/* The thank-you line: 16px under the row, the note straight under it. The theme gives the note a fixed 1rem top
 * margin, so the line takes it back with its own bottom margin rather than overriding the theme. */
.cs-band-small {
	margin: 16px 0 0;
	color: var(--wp--preset--color--ink-muted);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--wp--preset--font-size--ui);
	font-weight: 400;
	line-height: 1.6;
}

.cs-band-small:has(+ .cs-feature-band__note) {
	margin-block-end: -1rem;
}

.cs-band-small[hidden] {
	display: none;
}

.cs-band-done {
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--small);
}

.cs-band-cover {
	position: relative;
	display: inline-block;
	max-inline-size: 100%;
	line-height: 0;
}

.cs-band-ask :where(.wp-block-button__link):disabled {
	background-color: var(--wp--preset--color--line);
	color: var(--wp--preset--color--ink-muted);
	cursor: default;
}
