/**
 * Custom Elementor Product Grid — quick view trigger, inline variations,
 * and the short description / USPs block.
 * Loaded alongside product-grid.css, which owns the shared card styling.
 */

/*
 * Single_Product_Picker (PHP) renders the variation picker directly into a
 * theme's single-product template — outside .cepg-products entirely — so,
 * like .cepg-modal, it needs its own copy of the base tokens every
 * variation/add-button/pill/dropdown rule falls back to.
 */
.cepg-single-picker {
	--cepg-orange: #ff6b00;
	--cepg-obsidian: #0d0f12;
	--cepg-dark: #3f3f46;
	--cepg-muted: #71717a;
	--cepg-border: #e5e7eb;
	--cepg-surface: #ffffff;
	--cepg-neutral: #f4f5f7;
	--cepg-font: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	/*
	 * Fully-rounded pills AND Add to Cart button, scoped to the product page
	 * only — Quick View/the grid keep the plugin's normal defaults (12px
	 * pills via the bare var(--cepg-pill-radius, 12px) fallback below, 10px
	 * button via var(--cepg-btn-radius, 10px) in product-buttons.css) since
	 * merchants confirmed that picker is correct as-is.
	 */
	--cepg-pill-radius: 999px;
	--cepg-btn-radius: 999px;

	font-family: var(--cepg-font);
}

/* ---------------------------------------------------------- Quick view */

.cepg-quickview-trigger {
	position: absolute;
	top: 10px;
	right: 10px;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	padding: 0;
	background: rgba(255, 255, 255, 0.95);
	border: 0;
	border-radius: 50%;
	box-shadow: 0 2px 8px rgba(13, 15, 18, 0.15);
	color: var(--cepg-obsidian);
	cursor: pointer;
	opacity: 0;
	transform: translateY(-4px);
	transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

/* Right-aligned badges already occupy this corner on sale items — drop below them. */
.cepg-card__badges--right ~ .cepg-quickview-trigger {
	top: 48px;
}

.cepg-card:hover .cepg-quickview-trigger,
.cepg-card:focus-within .cepg-quickview-trigger,
.cepg-quickview-trigger:focus-visible {
	opacity: 1;
	transform: translateY(0);
}

.cepg-quickview-trigger:hover,
.cepg-quickview-trigger:focus-visible {
	background: var(--cepg-orange);
	color: #ffffff;
}

.cepg-quickview-trigger:focus-visible {
	outline: 2px solid var(--cepg-obsidian);
	outline-offset: 2px;
}

.cepg-quickview-trigger svg {
	width: 17px;
	height: 17px;
}

@media (hover: none) {
	/* No hover on touch — keep the trigger reachable without a gesture. */
	.cepg-quickview-trigger {
		opacity: 1;
		transform: none;
		background: rgba(255, 255, 255, 0.85);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cepg-quickview-trigger {
		transition: none;
	}
}

/* 34px reads fine at cursor distance; mobile needs the full 44px touch target. */
@media (max-width: 767px) {
	.cepg-quickview-trigger {
		width: 44px;
		height: 44px;
	}
}

/* ---------------------------------------------------- Floating quick-add */

/*
 * Bottom-right of the media, opposite the eye icon (top-right) so the two
 * never collide. A sibling of .cepg-card__media, not a descendant — sized
 * to sit flush against its bottom-right corner instead. The bottom-right
 * corner radius matches .cepg-card__media's own 8px so the block nests
 * into the image's rounded corner rather than square-overhanging it; the
 * top-left corner gets its own, larger radius purely for the pill-like
 * aesthetic where it doesn't touch the image edge. Collapsed to a 44px
 * square at rest; on hover/focus the max-width cap is raised left-to-right
 * so the "+ Add to cart" label (opacity-faded in) has room to reveal —
 * max-width, not width, is what's transitioned, since animating to
 * width:auto doesn't interpolate in any browser. Speed is merchant-
 * editable (--cepg-fab-speed, a plain ms number from the Card Hover CTA
 * Transition Speed control).
 */
.cepg-fab {
	position: absolute;
	right: 0;
	bottom: 0;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	width: max-content;
	max-width: var(--cepg-fab-size, 44px);
	height: var(--cepg-fab-size, 44px);
	padding: 0;
	overflow: hidden;
	background: var(--cepg-fab-bg, var(--cepg-obsidian));
	border: 0;
	border-radius: 10px 0 8px 0;
	color: var(--cepg-fab-icon-color, #ffffff);
	cursor: pointer;
	transition: max-width calc(var(--cepg-fab-speed, 300) * 1ms) ease, background-color 0.2s ease;
}

/* Expanded width scales with the button's own base size, so a smaller/larger icon still expands proportionally rather than always to a flat 220px. */
.cepg-fab:hover,
.cepg-fab:focus-visible {
	max-width: calc(var(--cepg-fab-size, 44px) + 176px);
	background: var(--cepg-fab-hover-bg, var(--cepg-orange));
}

.cepg-fab:focus-visible {
	outline: 2px solid var(--cepg-obsidian);
	outline-offset: -2px;
}

.cepg-fab__icon {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--cepg-fab-size, 44px);
	height: var(--cepg-fab-size, 44px);
	color: var(--cepg-fab-icon-color, #ffffff);
}

.cepg-fab__icon .cepg-add__glyph {
	width: calc(var(--cepg-fab-size, 44px) * 0.4);
	height: calc(var(--cepg-fab-size, 44px) * 0.4);
}

.cepg-fab__label {
	flex: 0 0 auto;
	padding-right: 16px;
	color: var(--cepg-fab-text-color, #ffffff);
	font-family: var(--cepg-font);
	font-size: var(--cepg-fab-label-size, 12px);
	font-weight: 700;
	letter-spacing: 0.03em;
	white-space: nowrap;
	opacity: 0;
	transition: opacity 0.15s ease;
}

.cepg-fab:hover .cepg-fab__label,
.cepg-fab:focus-visible .cepg-fab__label {
	opacity: 1;
}

/* Out of stock: static, no hover-expand, no add-to-cart behaviour. */
.cepg-fab--oos {
	max-width: var(--cepg-fab-size, 44px);
	background: var(--cepg-dark, #3f3f46);
	cursor: pointer;
}

.cepg-fab--oos:hover,
.cepg-fab--oos:focus-visible {
	max-width: var(--cepg-fab-size, 44px);
	background: var(--cepg-dark, #3f3f46);
}

/* Loading/success states, mirroring product-buttons.css's .cepg-add treatment. */
.cepg-fab.loading {
	pointer-events: none;
}

.cepg-fab.loading .cepg-fab__icon,
.cepg-fab.loading .cepg-fab__label {
	visibility: hidden;
}

.cepg-fab.loading::after {
	content: "";
	position: absolute;
	left: 50%;
	top: 50%;
	width: 16px;
	height: 16px;
	margin: -8px 0 0 -8px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: var(--cepg-fab-icon-color, #ffffff);
	border-radius: 50%;
	animation: cepg-spin 0.6s linear infinite;
}

.cepg-fab.added .cepg-fab__icon,
.cepg-fab.added .cepg-fab__label {
	visibility: hidden;
}

.cepg-fab.added::after {
	content: "\2713";
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	color: var(--cepg-fab-icon-color, #ffffff);
	font-size: 18px;
	line-height: 1;
}

@media (hover: none) {
	/* No hover on touch — the label would otherwise never reveal itself. */
	.cepg-fab:not(.cepg-fab--oos) {
		max-width: calc(var(--cepg-fab-size, 44px) + 176px);
	}

	.cepg-fab:not(.cepg-fab--oos) .cepg-fab__label {
		opacity: 1;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cepg-fab,
	.cepg-fab__label,
	.cepg-fab.loading::after {
		transition: none;
		animation-duration: 1.6s;
	}
}

/* ------------------------------------------------------------ Containment */

/*
 * Defensive reset, not routine styling: forces border/outline/shadow off on
 * the variation picker at a specificity theme or plugin CSS loaded after
 * this file can't casually beat. Deliberately unscoped by .cepg-products —
 * these elements only ever render inside the Quick-Add drawer now, which is
 * appended to <body> outside any widget wrapper, so a .cepg-products
 * ancestor selector would never match. The select's own transparent border
 * is restored immediately after, since removing it entirely would shift its
 * box size by 2px (box-sizing: border-box is set globally in product-grid.css).
 */
.cepg-variations,
.cepg-variation-field,
.cepg-variation-select {
	border: 0 !important;
	outline: 0 !important;
	box-shadow: none !important;
}

.cepg-variation-select {
	border: 1px solid transparent !important;
}

.cepg-variation-select:focus-visible {
	border-color: var(--cepg-orange) !important;
}

/* ------------------------------------------------------------ Variations */

.cepg-variations {
	display: flex;
	flex-direction: column;
	gap: 14px;
	width: 100%;
}

/*
 * No visible label on the dropdown variant — the select floats clean and
 * minimal on its own, with the attribute name (Flavour, Size, etc.) carried
 * as an aria-label on the <select> itself instead, for screen readers only.
 * The pills variant (below) does show a label, since a row of pills reads
 * ambiguously without one.
 */
.cepg-variation-field {
	width: 100%;
}

.cepg-variation-select {
	width: 100%;
	/* Meets the 44px minimum touch target on every breakpoint, not just mobile. */
	height: 44px;
	padding: 0 12px;
	background: var(--cepg-neutral);
	border: 1px solid transparent;
	border-radius: 8px;
	color: var(--cepg-obsidian);
	font-family: var(--cepg-font);
	font-size: 14px;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230d0f12' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 10px center;
	background-size: 16px;
	padding-right: 32px;
	transition: border-color 0.2s ease;
}

/* The hidden shadow select behind a pill group never needs its own chrome. */
.cepg-variation-select--shadow {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	overflow: hidden;
	background: none;
}

.cepg-variation-select:focus-visible {
	border-color: var(--cepg-orange);
	outline: none;
}

.cepg-variation-select:disabled {
	background-color: var(--cepg-neutral);
	color: #a3a3a8;
	cursor: not-allowed;
}

/* ------------------------------------------------------------------ Pills */

.cepg-variation-field--pills {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.cepg-variation-field__label {
	color: var(--cepg-field-label-color, var(--cepg-muted));
	font-size: var(--cepg-field-label-size, 12px);
	font-weight: var(--cepg-field-label-weight, 600);
	letter-spacing: var(--cepg-field-label-letterspacing, 0.06em);
	text-transform: var(--cepg-field-label-transform, uppercase);
}

/*
 * Filled rounded boxes (evenly-sized, auto-filling the row), not outlined
 * capsule pills — matches the merchant's reference layout. auto-fill lets
 * however many boxes fit per row reflow naturally on a narrower drawer/
 * mobile viewport, no separate breakpoint needed.
 */
.cepg-pill-group {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(var(--cepg-pill-min-width, 100px), 1fr));
	gap: var(--cepg-pill-gap, 10px);
}

.cepg-pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: var(--cepg-pill-min-height, 44px);
	max-width: 100%;
	padding: var(--cepg-pill-padding-v, 10px) var(--cepg-pill-padding-h, 12px);
	overflow: hidden; /* clip, don't let a long name bleed into the next pill */
	background: var(--cepg-neutral);
	border: 1.5px solid transparent;
	border-radius: var(--cepg-pill-radius, 12px);
	color: var(--cepg-pill-inactive-color, var(--cepg-obsidian));
	font-family: var(--cepg-pill-font-family, var(--cepg-font));
	font-size: var(--cepg-pill-font-size, 13px);
	font-weight: var(--cepg-pill-font-weight, 600);
	text-align: center;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.cepg-pill .cepg-swatch {
	width: 16px;
	height: 16px;
}

/*
 * min-width: 0 is what actually lets this shrink below its text's natural
 * width inside the pill's flex layout — without it, a long name like "Fizzy
 * Cola Bottles" overflowed the pill and got visually masked by the next
 * pill's opaque background. No line clamp: a flavour name always renders in
 * full (the pill grows to fit it, and CSS Grid's default stretch alignment
 * matches every other pill in that row to it) — merchandising copy never
 * gets truncated. overflow-wrap only breaks mid-word as a last resort, once
 * a single word genuinely can't fit at the pill's own width.
 *
 * white-space: normal is the fix that actually makes the above true — .cepg-pill
 * is a <button>, and browsers default buttons to white-space: nowrap, which
 * this <span> silently inherited (white-space is an inherited property) with
 * nothing here ever resetting it back. That meant multi-word flavour names
 * never actually wrapped at all; they just overflowed and got clipped by
 * .cepg-pill's own `overflow: hidden`, invisibly, until a name was long
 * enough (e.g. "Big Juicy Watermelon") for the truncation to be obvious.
 */
.cepg-pill__label {
	min-width: 0;
	overflow-wrap: break-word;
	white-space: normal;
}

/*
 * Flavour swatch — a variation's own image, a manually-mapped color, or an
 * algorithmically-guessed one (Card_Swatch::resolve_flavour_swatch(), PHP),
 * shared by pills and the custom dropdown.
 */
.cepg-swatch {
	flex: 0 0 auto;
	width: 14px;
	height: 14px;
	background-size: cover;
	background-position: center;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px rgba(13, 15, 18, 0.12);
}

.cepg-pill:disabled .cepg-swatch,
.cepg-pill.is-disabled .cepg-swatch {
	filter: grayscale(60%);
}

.cepg-pill:hover:not(:disabled):not(.is-active) {
	/*
	 * Rest-state background (--cepg-neutral) stays as-is on hover, per
	 * explicit request — the border + text turning accent-orange is the
	 * hover signal on its own, without also darkening the fill.
	 *
	 * color: explicit here (not just left to inherit .cepg-pill's own
	 * color) because a generic sitewide `button:hover { color: #fff }`
	 * reset rule (reset.css) was otherwise winning on this property —
	 * .cepg-pill's own base rule sets color but not on :hover, so nothing
	 * with equal-or-higher specificity was overriding that reset, and every
	 * pill's text silently went white on hover instead of staying legible.
	 */
	background: var(--cepg-neutral);
	border-color: var(--cepg-orange) !important;
	color: var(--cepg-orange) !important;
}

.cepg-pill.is-active {
	background: var(--cepg-pill-active-bg, var(--cepg-obsidian));
	border-color: var(--cepg-pill-active-bg, var(--cepg-obsidian));
	color: #ffffff;
}

.cepg-pill:disabled,
.cepg-pill.is-disabled {
	color: var(--cepg-pill-oos-color, var(--cepg-muted));
	opacity: 0.5;
	cursor: not-allowed;
	text-decoration: line-through;
}

/*
 * A notify-capable pill (Flavour attribute — see Card_Pills::render_pill_group())
 * stays a real, clickable <button> even while unavailable, so the Back In
 * Stock Notifier popup can still open on click — a true `disabled` attribute
 * would block that click entirely. This class is the visual-only stand-in
 * for :disabled on exactly those pills; product-variations.js toggles it
 * (never the native `disabled` property) on any pill carrying
 * data-cepg-notify-capable. cursor stays pointer (not not-allowed) and the
 * strike-through line is removed — the click is genuinely actionable here
 * (opens the notify popup), so it shouldn't read as visually "dead" the way
 * a truly unselectable pill (e.g. Size) does.
 */
.cepg-pill.is-disabled[data-cepg-notify-capable] {
	cursor: pointer;
	text-decoration: none;
}

.cepg-pill:focus-visible {
	outline: 2px solid var(--cepg-orange);
	outline-offset: 2px;
}

/*
 * Armed and ready (server pre-selects the first purchasable, in-stock
 * variation, so this is the button's default rest state) needs no override
 * here — it just inherits the uniform Obsidian/Orange treatment every
 * .cepg-add--full button already gets from product-buttons.css. Only the
 * not-yet-resolved state below is variable-specific.
 */
:is(.cepg-card, .cepg-quickview, .cepg-single-picker) .cepg-add--variable[aria-disabled="true"] {
	background: var(--cepg-neutral);
	color: #a3a3a8;
	cursor: not-allowed;
}

@media (prefers-reduced-motion: reduce) {
	.cepg-variation-select,
	.cepg-pill {
		transition: none;
	}
}

/*
 * iOS Safari auto-zooms the page on focusing any form control under 16px
 * font-size — the base rule's 14px triggers it. Covers the visible
 * dropdown variant AND .cepg-variation-select--shadow (same class, same
 * rule): product-variations.js can programmatically .focus() the shadow
 * select to keep it in sync after a pill click, which is enough to
 * trigger Safari's zoom even though a shopper never taps its 1x1px area
 * directly.
 */
@media (max-width: 640px) {
	.cepg-variation-select {
		font-size: 16px;
	}
}

/*
 * Notify Me popup ("Back In Stock Notifier for WooCommerce", a SweetAlert2
 * modal) already has a dedicated, more specific restyle block in the
 * theme's own woocommerce/product-page.css (search "Back In Stock
 * Notifier") — rules here would only fight that one on specificity, so
 * deliberately nothing is added for it in this file. See that block for
 * any further Notify Me popup styling changes.
 */
