/*
 * Core CSS shared broadly across many library patterns/templates, plus
 * generic WooCommerce element compatibility fixes — NOT tied to one
 * specific pattern, so it stays always-loaded here rather than going
 * through the per-pattern conditional system (see WPL_Pattern_Styles).
 * Moved out of aconi-theme (2026-10-04) so it ships through this plugin's
 * own update mechanism instead of needing a manual rsync to every site
 * not wired to the theme's CI deploy.
 */

/*
 * woocommerce/product-filter-price-slider: the min/max amount <input
 * type="text"> fields render with zero WooCommerce styling applied (the
 * block library's own ".text input[type=text]" rule - meant to cap them at
 * 60px - never matches here, cause unconfirmed, possibly a split-CSS-bundle
 * gap in this WC version), so they fall back to the browser's unstyled
 * native width (~170px each). The slider's wrapper is CSS Grid with
 * "auto 1fr auto" columns (inputs auto-sized, track gets the 1fr leftover)
 * - two ~170px inputs alone exceed most container widths, which is the
 * single root cause behind three different-looking symptoms: the whole
 * component overflowing a narrow sidebar column or drawer, AND (inline
 * variant, e.g. the topbar pattern) the middle 1fr track column being
 * squeezed to 0px, making the slider completely undraggable. Constraining
 * the inputs ourselves fixes all three at once.
 */
.wc-block-product-filter-price-slider__left input,
.wc-block-product-filter-price-slider__right input {
	width: 70px;
	max-width: 70px;
	min-width: 0;
	box-sizing: border-box;
	padding: 8px;
	border: 1px solid currentColor;
	border-radius: 4px;
	font-size: 0.875em;
}

/*
 * woocommerce/product-collection has no registered spacing.margin support,
 * so a raw style attribute on it would fail block validation — these are
 * the escape hatch, used by several category-view-* patterns and the
 * theme's own archive-product.html.
 */
.aconi-mt-medium { margin-top: var(--wp--preset--spacing--medium); }
/*
 * !important because WooCommerce Blocks' own CSS also sets a margin-bottom
 * on this exact element (in a way that beat a plain override here even at
 * equal/higher specificity — likely emitted inside a cascade layer, which
 * always loses to layered rules declared later regardless of specificity,
 * but can also win over a later, unlayered rule depending on layer order;
 * not worth fully diagnosing when deliberately overriding a framework
 * default is exactly what !important is for).
 */
.aconi-mb-large { margin-bottom: var(--wp--preset--spacing--large) !important; }

/* Keeps the sticky header above hero/product imagery while scrolling. */
.aconi-header { z-index: 2; }

/*
 * Header search field: the global button padding (theme.json
 * elements.button) makes the search button — and with it the whole
 * button-inside search bar — too tall/imposing. Amazon-style search bars
 * are noticeably more compact; trim just this instance rather than
 * shrinking buttons site-wide.
 */
.aconi-header-search .wp-block-search__input,
.aconi-header-search .wp-block-search__button {
	padding-top: 0.4rem;
	padding-bottom: 0.4rem;
	font-size: 0.875rem;
}
/*
 * In "button-inside" layout, the visible bordered box is the shared
 * .wp-block-search__inside-wrapper, not the input/button themselves (those
 * already get border-radius from the block's own style attribute, but sit
 * borderless inside the wrapper — rounding them individually does nothing
 * visible). Round the wrapper that actually draws the border, and clip its
 * corners so the button doesn't poke a square edge past the rounded corner.
 */
.aconi-header-search .wp-block-search__inside-wrapper {
	border-radius: var(--wp--custom--aconi-radius--sm);
	overflow: hidden;
}

/*
 * WooCommerce's catalog-sorting block AND its classic variation-picker
 * table (table.variations select, used by the add-to-cart form on any
 * variable product) both render a bare native <select> with zero theme CSS
 * applied — browser-default font/border/padding. Give both the same look
 * as the rest of the design system plus a custom chevron since
 * appearance:none also removes the native dropdown arrow.
 */
select.orderby,
table.variations select {
	appearance: none;
	-webkit-appearance: none;
	font-family: inherit;
	font-size: 0.875rem;
	color: var(--wp--preset--color--text-primary);
	background-color: var(--wp--preset--color--bg-primary);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--aconi-radius--sm);
	padding: 0.5rem 2rem 0.5rem 0.875rem;
	/*
	 * Neutral gray, not a style token: an embedded data-URI SVG is
	 * rendered as opaque external content, so it can't pick up
	 * currentColor/custom-property values from the page.
	 */
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' stroke='%23767676' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
	background-size: 0.75rem;
	cursor: pointer;
}

/*
 * The classic quantity <input> WooCommerce's add-to-cart form uses is
 * another bare native control that never picked up any theme styling.
 */
input.qty {
	font-family: inherit;
	color: var(--wp--preset--color--text-primary);
	/*
	 * Explicit background, not just text color: for a dark-background
	 * style, text-primary is a LIGHT color (correct for that style's own
	 * dark bg-primary) — but without setting bg-primary here too, this
	 * <input> inherits the browser's native white background, pairing
	 * light-on-white and making the number nearly invisible.
	 */
	background-color: var(--wp--preset--color--bg-primary);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--aconi-radius--sm);
	padding: 0.5rem 0.75rem;
}

/*
 * WooCommerce fades the variable-product add-to-cart button to 50% opacity
 * until a valid attribute combination is selected — on an already fairly
 * muted accent color this reads as barely-there rather than a clear "pick
 * an option first" cue. The button stays functionally inert either way
 * (WooCommerce's own JS blocks the add-to-cart request until a valid
 * variation is selected), so keeping it at full color is purely cosmetic.
 */
.single_add_to_cart_button.disabled,
.single_add_to_cart_button.wc-variation-selection-needed {
	/* !important: outranks WooCommerce's own higher-specificity
	   ".woocommerce button.button.disabled" opacity rule. */
	opacity: 1 !important;
}

/*
 * The classic product-tabs widget (Description / Additional information /
 * Reviews) ships with its own hardcoded 4px corner radius and plain gray
 * active-tab text — replace both with the active style's own radius/accent
 * tokens so it doesn't look like a foreign, un-themed component.
 *
 * .woocommerce div.product prefix matches WooCommerce's own core CSS
 * specificity exactly — without it, WC's own same-property rule (loaded
 * after ours but with higher specificity) silently wins regardless of
 * enqueue order.
 *
 * WooCommerce's own tabs also ship margin-right:-5px between tabs (a
 * genuine, deliberate 5px overlap in their default CSS) and a flat
 * hardcoded gray/lavender background+border on inactive tabs — replaced
 * with a small positive gap and a semi-transparent tint mixed from the
 * style's own text color instead of a fixed gray, so it reads as "subtly
 * present" on any background (light OR dark) rather than looking dated.
 */
.woocommerce div.product .woocommerce-tabs ul.tabs li {
	margin-right: 3px;
	border: none;
	background: color-mix(in srgb, var(--wp--preset--color--text-primary) 8%, transparent);
	border-radius: var(--wp--custom--aconi-radius--sm) var(--wp--custom--aconi-radius--sm) 0 0;
}
/*
 * Each tab also carries its own 5x5px ::before/::after "corner notch"
 * pseudo-elements — a pre-border-radius-era WooCommerce technique for
 * faking a curved tab edge. With real border-radius now doing that job,
 * these just show up as small wrong-colored squares at the base of each
 * tab — removed outright rather than recolored.
 */
.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.active {
	background: var(--wp--preset--color--bg-primary);
	box-shadow: inset 0 2px 0 0 var(--wp--preset--color--cta);
}
.woocommerce div.product .woocommerce-tabs ul.tabs li.active a {
	color: var(--wp--preset--color--cta);
}
/*
 * The underline running below the whole tab row is a separate hardcoded
 * light gray drawn by WooCommerce's own ul.tabs::before pseudo-element —
 * on a dark style that reads as a bright, out-of-place line. !important:
 * the exact winning WC rule wasn't worth fully tracking down (matches
 * multiple long, near-identical WC selector lists).
 */
.woocommerce div.product .woocommerce-tabs ul.tabs::before {
	border-bottom-color: var(--wp--preset--color--line) !important;
}
/*
 * WooCommerce's own tab-content callbacks always print a redundant
 * "<h2>Beschreibung</h2>" as the first thing inside each panel — the
 * clickable tab above it already shows that exact same label.
 */
.woocommerce-tabs .panel > h2:first-child {
	display: none;
}

/*
 * The product-card group (image, title, rating, price, swatches, button
 * stacked vertically) never sets its own blockGap, so it falls back to
 * theme.json's global default blockGap — sized for spacing between full
 * sections of a page, not between five stacked elements inside one small
 * card. Give it its own compact gap instead. The zero-specificity
 * :where() selector core uses for the layout-support default gap means a
 * plain class selector like this reliably wins without needing !important.
 */
.is-style-product-card {
	/*
	 * display/flex-direction here too (not just gap/align-items): when
	 * this markup comes from the block editor's own
	 * "layout":{"type":"flex","orientation":"vertical"} attribute,
	 * WordPress auto-adds "is-layout-flex" classes that carry the actual
	 * display:flex from core's own generic layout CSS. Hand-rendered
	 * markup that only sets the "is-style-product-card" class never gets
	 * those classes, so without an explicit display:flex here it silently
	 * fell back to block layout.
	 */
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--xsmall);
	align-items: stretch;
}
/*
 * The block-rendered product-image is a <div>; a hand-rendered equivalent
 * is a plain <a>, which defaults to display:inline — enough for an <img>
 * inside it to visually escape normal block flow.
 */
a.wp-block-woocommerce-product-image {
	display: block;
	position: relative;
}
/*
 * $product->get_image() outputs a fixed-pixel-size <img> (the registered
 * "woocommerce_thumbnail" dimensions), not a responsive one. object-fit:cover
 * on a full-width, fixed-aspect box makes it fill the card at any column
 * width (and crops gracefully if a future thumbnail size isn't square).
 */
a.wp-block-woocommerce-product-image img {
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	object-fit: cover;
	display: block;
}
/*
 * WooCommerce Blocks only enqueues its own CSS for this sale-badge class
 * when a real woocommerce/product-image block is present on the page — a
 * hand-rendered badge (same class names, for a gettext override to keep
 * applying identically either way) has no block on the page to trigger
 * that. Kept unconditional as a safety net in case that asset ever fails
 * to load for the real block too.
 */
.wc-block-components-product-sale-badge {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	z-index: 1;
	background: var(--wp--preset--color--bg-primary, #fff);
	border: 1px solid var(--wp--preset--color--line, currentColor);
	border-radius: var(--wp--custom--aconi-radius--sm, 2px);
	padding: 0.15em 0.6em;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	text-decoration: none;
}
.aconi-product-card-footer {
	width: 100%;
}

/*
 * Real customers won't upload a profile photo, but WooCommerce's account
 * block overlays a Gravatar on top of the icon for any logged-in user
 * whose email happens to resolve to one — always show just the plain
 * account icon instead.
 */
.wc-block-customer-account__avatar { display: none; }

/*
 * WooCommerce's own mini-cart item-count bubble ships with a hardcoded
 * dark-green background — not derived from any theme token. !important is
 * required: WC Blocks sets this color via an inline style attribute from
 * JS, which a plain class selector can't outrank.
 */
.wc-block-mini-cart__badge {
	background-color: var(--wp--preset--color--cta) !important;
	color: var(--wp--preset--color--cta-text) !important;
}

.wp-block-button.is-style-quick-add .wp-block-button__link {
	position: relative;
	width: 2.25rem;
	height: 2.25rem;
	padding: 0;
	border-radius: 9999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	line-height: 1;
	overflow: hidden;
	color: transparent;
}
.wp-block-button.is-style-quick-add .wp-block-button__link::after {
	content: "+";
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 1.25rem;
	color: var(--wp--preset--color--cta-text, #fff);
}
