/* WP Commerce7 Connect — primitives + visibility helpers.
   Themes may override the neutral --c7-* and --winery-shop-* properties. */

:root {
	--winery-shop-color-text: #0f172a;
	--winery-shop-color-muted: #475569;
	--winery-shop-color-surface: #ffffff;
	--winery-shop-color-surface-subtle: #f8fafc;
	--winery-shop-color-surface-emphasis: #e2e8f0;
	--winery-shop-color-border: #cbd5e1;
	--winery-shop-color-control-border: #64748b;
	--winery-shop-color-accent: #334155;
	--winery-shop-color-accent-hover: #1e293b;
	--winery-shop-color-accent-contrast: #ffffff;
	--winery-shop-color-focus: #2563eb;
	--winery-shop-color-sale: var(--winery-shop-color-accent);
	--winery-shop-color-success: #166534;
	--winery-shop-color-warning: #854d0e;
	--winery-shop-color-disabled: #94a3b8;
	--winery-shop-color-overlay: rgba(15, 23, 42, 0.56);
	--winery-shop-font-family-body: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	--winery-shop-font-family-heading: var(--winery-shop-font-family-body);
	--winery-shop-font-size-xs: 0.75rem;
	--winery-shop-font-size-sm: 0.875rem;
	--winery-shop-font-size-base: 1rem;
	--winery-shop-font-size-lg: 1.125rem;
	--winery-shop-font-size-xl: 1.5rem;
	--winery-shop-font-size-2xl: clamp(2rem, 5vw, 3.5rem);
	--winery-shop-font-weight-normal: 400;
	--winery-shop-font-weight-medium: 500;
	--winery-shop-font-weight-semibold: 600;
	--winery-shop-line-height-tight: 1.2;
	--winery-shop-line-height-base: 1.5;
	--winery-shop-letter-spacing-eyebrow: 0.08em;
	--winery-shop-text-transform-eyebrow: uppercase;
	--winery-shop-space-1: 0.25rem;
	--winery-shop-space-2: 0.5rem;
	--winery-shop-space-3: 0.75rem;
	--winery-shop-space-4: 1rem;
	--winery-shop-space-5: 1.5rem;
	--winery-shop-space-6: 2rem;
	--winery-shop-space-7: 3rem;
	--winery-shop-radius-sm: 0.25rem;
	--winery-shop-radius-md: 0.5rem;
	--winery-shop-radius-lg: 0.75rem;
	--winery-shop-radius-pill: 999px;
	--winery-shop-border-width: 1px;
	--winery-shop-shadow-card: 0 1px 3px rgba(15, 23, 42, 0.12);
	--winery-shop-shadow-popover: 0 16px 40px rgba(15, 23, 42, 0.18);
	--winery-shop-transition: 160ms ease;
	--winery-shop-focus-ring: 3px solid var(--winery-shop-color-focus);
	--winery-shop-control-min-height: 44px;
	--winery-shop-button-padding: 0.75rem 1rem;
	--winery-shop-inline-gutter: clamp(1rem, 4vw, 2rem);
	--winery-shop-max-width: 100rem;
	--winery-card-sale-color: var(--winery-shop-color-sale);
	--winery-sale-label-color: var(--winery-card-sale-color);
	--winery-sale-label-font-size: var(--winery-shop-font-size-xs);
	--winery-sale-was-strike-color: var(--winery-shop-color-muted);
	--winery-sale-was-strike-thickness: 1px;
	--winery-sale-savings-color: var(--winery-sale-label-color);
}

.winery-c7-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

.winery-c7-stack > * + * {
	margin-top: var(--c7-space-md, 16px);
}

.winery-c7-cluster {
	display: flex;
	flex-wrap: wrap;
	gap: var(--c7-space-sm, 12px);
	align-items: center;
}

.winery-c7-audience--pending {
	visibility: hidden;
}

.winery-c7-binding--pending {
	opacity: 0;
}

.winery-c7-binding--empty {
	display: none;
}

/* Buttons --------------------------------------------------------------- */

.winery-c7-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5em;
	min-height: 44px;
	padding: var(--c7-btn-padding-y, 12px) var(--c7-btn-padding-x, 24px);
	border: var(--c7-border-width, 1px) solid var(--c7-color-primary, #1d2327);
	border-radius: var(--c7-radius, 4px);
	background: var(--c7-color-primary, #1d2327);
	color: var(--c7-color-primary-text, #ffffff);
	font-family: var(--c7-font-body, inherit);
	font-size: var(--c7-font-size-base, 1rem);
	font-weight: var(--c7-btn-font-weight, 500);
	letter-spacing: var(--c7-letter-spacing-button, 0.02em);
	line-height: 1.2;
	text-decoration: none;
	text-transform: var(--c7-btn-text-transform, none);
	cursor: pointer;
	transition: background var(--c7-transition-base, 200ms ease),
		color var(--c7-transition-base, 200ms ease),
		border-color var(--c7-transition-base, 200ms ease);
}

.winery-c7-btn:hover,
.winery-c7-btn:focus-visible {
	background: var(--c7-color-primary-hover, #135e96);
	border-color: var(--c7-color-primary-hover, #135e96);
}

.winery-c7-btn:focus-visible {
	outline: var(--c7-focus-ring, 2px solid #2271b1);
	outline-offset: 2px;
}

.winery-c7-btn[disabled],
.winery-c7-btn[aria-disabled="true"] {
	opacity: 0.5;
	cursor: not-allowed;
}

.winery-c7-btn--secondary {
	background: transparent;
	color: var(--c7-color-primary, #1d2327);
}

.winery-c7-btn--secondary:hover,
.winery-c7-btn--secondary:focus-visible {
	background: var(--c7-color-primary, #1d2327);
	color: var(--c7-color-primary-text, #ffffff);
}

.winery-c7-btn--ghost {
	background: transparent;
	border-color: transparent;
	color: var(--c7-color-primary, #1d2327);
	padding: 0.5em 0;
	min-height: 0;
}

.winery-c7-btn--ghost:hover,
.winery-c7-btn--ghost:focus-visible {
	background: transparent;
	color: var(--c7-color-primary-hover, #135e96);
	text-decoration: underline;
}

.winery-c7-btn--block {
	display: flex;
	width: 100%;
}

/*
 * Restore the HTML `hidden` attribute for buttons. The author `.winery-c7-btn`
 * `display` rules override the UA-stylesheet `[hidden] { display: none }`
 * (author beats UA regardless of specificity), so a server-rendered
 * `hidden` CTA — e.g. the allocation "Claim Allocation" member buy CTA that is
 * revealed client-side off the customer bus — would otherwise paint for
 * anonymous/non-member visitors and defeat the cache-safe member gate. The
 * attribute-qualified selector outranks the bare `.winery-c7-btn` display rule.
 */
.winery-c7-btn[hidden] {
	display: none;
}

/* Availability badges --------------------------------------------------- */

.winery-c7-availability-badge {
	position: absolute;
	inset-block-start: var(--c7-space-sm, 12px);
	inset-inline-start: var(--c7-space-sm, 12px);
	z-index: 1;
	display: inline-flex;
	align-items: center;
	min-height: 28px;
	padding: 0.35em 0.7em;
	border-radius: var(--c7-radius, 4px);
	background: var(--c7-color-primary, #1d2327);
	color: var(--c7-color-primary-text, #ffffff);
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.1;
	text-transform: uppercase;
}

.winery-c7-availability-badge--low {
	background: var(--c7-color-warning, #8a5a00);
}

.winery-c7-availability-badge--out {
	background: var(--c7-color-error, #8a2424);
}

.winery-c7-availability-badge--soon {
	background: var(--c7-color-info, #1f5f74);
}

.winery-c7-availability-badge--allocation {
	background: var(--c7-color-accent, #6f4e1f);
}

/* Member-aware allocation CTA ------------------------------------------- */

/*
 * Allocation wines/bundles render a member-claim CTA. The non-member
 * "Join to Claim" element (and its disabled-button fallback) carries the
 * `__cta--join` marker and is the cache-safe default; it is hidden once
 * wine-card-view.js stamps the card as a club member. The member
 * "Claim Allocation" buy CTA is revealed off the same customer bus. This keys
 * on the existing `data-winery-c7-customer-state` hook the reveal already
 * sets, so no new JS-driven attribute is introduced.
 */
[data-winery-c7-customer-state="club-member"] .winery-c7-wine-card__cta--join,
[data-winery-c7-customer-state="club-member"] .winery-c7-bundle-card__cta--join {
	display: none;
}

/*
 * Minimal pre-theme legibility for the join CTA so the allocation scarcity
 * register reads even before a theme styles it (parity with the v0.49.0
 * default badge style). Reuses the accent token shared with the allocation
 * badge so the surface coheres.
 */
.winery-c7-wine-card__cta--join,
.winery-c7-bundle-card__cta--join {
	border-color: var(--c7-color-accent, #6f4e1f);
	color: var(--c7-color-accent, #6f4e1f);
}

/* Form fields ----------------------------------------------------------- */

.winery-c7-field {
	display: block;
	margin: 0 0 var(--c7-space-md, 16px);
}

/*
 * Grouped radio/checkbox fields render as <fieldset class="winery-c7-field">
 * (see class-forms.php). Without this reset the browser-default fieldset
 * chrome (border, padding, min-inline-size: min-content) paints a stray box
 * and indent on exactly those fields, breaking the shared field layout. The
 * <legend class="winery-c7-field__label"> is intentionally left visible and
 * in the a11y tree -- only the fieldset's own chrome is stripped.
 */
fieldset.winery-c7-field {
	min-inline-size: 0;
	border: 0;
	padding: 0;
}

.winery-c7-field__label {
	display: block;
	margin-bottom: var(--c7-space-xs, 6px);
	font-size: var(--c7-font-size-base, 1rem);
	font-weight: 500;
	color: var(--c7-color-text, inherit);
}

.winery-c7-field__help {
	display: block;
	margin-top: var(--c7-space-xs, 6px);
	font-size: 0.875em;
	color: var(--c7-color-text-muted, #6c757d);
}

.winery-c7-field__error {
	display: block;
	margin-top: var(--c7-space-xs, 6px);
	font-size: 0.875em;
	color: var(--c7-color-error, #b32d2e);
}

.winery-c7-field--required > .winery-c7-field__label::after {
	content: " *";
	color: var(--c7-color-error, #b32d2e);
}

.winery-c7-input,
.winery-c7-textarea,
.winery-c7-select {
	display: block;
	width: 100%;
	min-height: 44px;
	padding: var(--c7-input-padding-y, 10px) var(--c7-input-padding-x, 14px);
	background: var(--c7-input-bg, #ffffff);
	color: var(--c7-color-text, inherit);
	border: var(--c7-border-width, 1px) solid var(--c7-input-border-color, #c3c4c7);
	border-radius: var(--c7-input-radius, 4px);
	font-family: var(--c7-font-body, inherit);
	font-size: var(--c7-font-size-base, 1rem);
	line-height: 1.4;
	transition: border-color var(--c7-transition-base, 200ms ease),
		box-shadow var(--c7-transition-base, 200ms ease);
	box-sizing: border-box;
}

.winery-c7-textarea {
	min-height: 120px;
	resize: vertical;
}

.winery-c7-select {
	appearance: none;
	background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
		linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: calc(100% - 18px) center, calc(100% - 12px) center;
	background-size: 6px 6px;
	background-repeat: no-repeat;
	padding-right: 36px;
}

.winery-c7-input:focus,
.winery-c7-textarea:focus,
.winery-c7-select:focus {
	outline: none;
	border-color: var(--c7-color-primary, #2271b1);
	box-shadow: 0 0 0 3px var(--c7-input-focus-ring, rgba(34, 113, 177, 0.25));
}

.winery-c7-input[aria-invalid="true"],
.winery-c7-textarea[aria-invalid="true"],
.winery-c7-select[aria-invalid="true"] {
	border-color: var(--c7-color-error, #b32d2e);
}

/* Checkbox / radio ------------------------------------------------------ */

.winery-c7-checkbox,
.winery-c7-radio {
	display: inline-flex;
	align-items: flex-start;
	gap: var(--c7-space-sm, 10px);
	cursor: pointer;
	font-size: var(--c7-font-size-base, 1rem);
	color: var(--c7-color-text, inherit);
}

.winery-c7-checkbox input,
.winery-c7-radio input {
	margin-top: 0.18em;
	accent-color: var(--c7-color-primary, #2271b1);
	flex: 0 0 auto;
}

/* Stepper (numeric +/-) ------------------------------------------------- */

.winery-c7-stepper {
	display: inline-flex;
	align-items: stretch;
	border: var(--c7-border-width, 1px) solid var(--c7-input-border-color, #c3c4c7);
	border-radius: var(--c7-input-radius, 4px);
	overflow: hidden;
	background: var(--c7-input-bg, #ffffff);
}

.winery-c7-stepper__btn {
	width: 44px;
	background: transparent;
	border: 0;
	font-size: 1.25em;
	color: var(--c7-color-text, inherit);
	cursor: pointer;
}

.winery-c7-stepper__btn:hover,
.winery-c7-stepper__btn:focus-visible {
	background: var(--c7-color-surface, #f6f7f7);
}

.winery-c7-stepper__value {
	min-width: 44px;
	padding: 0 0.75em;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-variant-numeric: tabular-nums;
}

/* Modal ----------------------------------------------------------------- */

.winery-c7-modal-overlay {
	position: fixed;
	inset: 0;
	background: var(--c7-modal-overlay-bg, rgba(0, 0, 0, 0.55));
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--c7-space-lg, 24px);
	z-index: 99999;
}

.winery-c7-modal-dialog {
	max-width: var(--c7-modal-max-width, 520px);
	width: 100%;
	max-height: 90vh;
	overflow: auto;
	background: var(--c7-modal-bg, #ffffff);
	color: var(--c7-color-text, inherit);
	border-radius: var(--c7-modal-radius, 8px);
	padding: var(--c7-space-lg, 32px);
	box-shadow: var(--c7-modal-shadow, 0 30px 60px rgba(0, 0, 0, 0.35));
}

.winery-c7-modal-dialog:focus-visible {
	outline: var(--c7-focus-ring, 2px solid #2271b1);
	outline-offset: 4px;
}

/* Picture wrapper transparency for Rhinory's WebP filter compatibility -- */

.winery-c7-picture {
	display: contents;
}

.winery-c7-cart-add--busy {
	cursor: progress;
	opacity: 0.65;
}

/* Keep the live region in the accessibility tree without an empty flex gap. */
.winery-c7-cart-add-status:empty {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
}
