/**
 * Quick View — trigger and modal.
 *
 * Colours and radii come from the active theme's CSS custom properties where
 * they exist, each with a fallback so the plugin still looks deliberate on a
 * store that defines none of them.
 */

.stw-qv,
.stw-qv-trigger {
	--qv-pink: var(--stw-pink, #f06292);
	--qv-pink-600: var(--stw-pink-600, #da567f);
	--qv-ink: var(--stw-ink, #111);
	--qv-grey-100: var(--stw-grey-100, #f5f5f5);
	--qv-grey-200: var(--stw-grey-200, #e5e5e5);
	--qv-grey-500: var(--stw-grey-500, #7a7a7a);
	--qv-grey-700: var(--stw-grey-700, #404040);
	--qv-star: var(--stw-star, #00b67a);
	--qv-radius-md: var(--stw-radius-md, 8px);
	--qv-radius-lg: var(--stw-radius-lg, 14px);
	--qv-radius-pill: var(--stw-radius-pill, 999px);
}

/* Several of these elements are laid out with flex/grid, which would otherwise
   win over the hidden attribute. */
.stw-qv[hidden],
.stw-qv [hidden],
.stw-qv-trigger[hidden] {
	display: none !important;
}

/* ---------------------------------------------------------------- Trigger */

/* The card's media element is the positioning and clipping context: it already
   carries overflow:hidden and a radius in stw2026, which is what lets the bar
   slide up from behind the bottom edge. */
.stw-qv-host {
	position: relative;
}

.stw-qv-trigger {
	position: absolute;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin: 0;
	border: 0;
	background: #fff;
	color: var(--qv-ink);
	cursor: pointer;
	font: inherit;
	font-weight: 800;
	letter-spacing: 0.04em;
	line-height: 1;
	text-decoration: none;
	text-transform: uppercase;
}

.stw-qv-trigger__icon {
	display: inline-flex;
}

.stw-qv-trigger__icon svg {
	width: 18px;
	height: 18px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* Touch and narrow viewports: a small pill that is always visible. A device
   without hover never reveals a hover-only control, so the trigger cannot be
   hidden behind an interaction it will never receive — and a bare icon with no
   text doesn't read as tappable at a glance, so this carries the compact
   "View" label rather than being icon-only.

   Bottom-right, not top-right: the product badge (stw2026's .stw-card__badge)
   sits top-left, and nothing else the card template renders lives inside the
   media element's bottom edge on any variant (in or out of stock, badged or
   not) — so this corner has zero collision potential with the badge, and
   there is nothing for this plugin and the theme to keep in sync. */
.stw-qv-trigger {
	right: 10px;
	bottom: 10px;
	height: 30px;
	padding: 0 12px 0 10px;
	border-radius: var(--qv-radius-pill);
	box-shadow: 0 2px 8px rgb(0 0 0 / 18%);
	font-size: 11px;
}

.stw-qv-trigger__label-compact {
	white-space: nowrap;
}

.stw-qv-trigger__label,
.stw-qv__status {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Pointer devices at or above the breakpoint: a full-width bar that slides up
   over the bottom of the image on hover or keyboard focus. */
.stw-qv-hover .stw-qv-trigger {
	top: auto;
	right: 0;
	bottom: 0;
	left: 0;
	width: auto;
	height: auto;
	padding: 12px 14px;
	border-radius: 0;
	box-shadow: none;
	font-size: 13px;
	opacity: 0;
	transform: translateY(100%);
	transition: transform 0.18s ease, opacity 0.18s ease;
}

.stw-qv-hover .stw-qv-trigger__label {
	position: static;
	width: auto;
	height: auto;
	overflow: visible;
	clip-path: none;
}

.stw-qv-hover .stw-qv-trigger__label-compact {
	display: none;
}

.stw-qv-hover .stw-qv-host:hover .stw-qv-trigger,
.stw-qv-hover .stw-qv-trigger:focus-visible {
	opacity: 1;
	transform: translateY(0);
}

.stw-qv-trigger:hover {
	color: var(--qv-pink-600);
}

.stw-qv-trigger:focus-visible {
	outline: 2px solid var(--qv-ink);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.stw-qv-hover .stw-qv-trigger {
		transition: none;
	}
}

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

.stw-qv-open {
	overflow: hidden;
}

.stw-qv {
	position: fixed;
	z-index: 100000;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	font-family: var(--stw-font, inherit);
}

.stw-qv__backdrop {
	position: absolute;
	inset: 0;
	background: rgb(0 0 0 / 55%);
}

.stw-qv__dialog {
	position: relative;
	display: flex;
	width: min(1040px, 100%);
	max-height: min(90vh, 820px);
	border-radius: var(--qv-radius-lg);
	background: #fff;
	color: var(--qv-ink);
}

.stw-qv__close {
	position: absolute;
	top: 8px;
	right: 10px;
	z-index: 3;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: var(--qv-radius-pill);
	background: #fff;
	color: var(--qv-ink);
	cursor: pointer;
	font-size: 30px;
	line-height: 1;
}

.stw-qv__close:hover {
	color: var(--qv-pink-600);
}

.stw-qv__nav {
	position: absolute;
	top: 50%;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	transform: translateY(-50%);
	border: 0;
	border-radius: var(--qv-radius-pill);
	background: #fff;
	color: var(--qv-ink);
	cursor: pointer;
	box-shadow: 0 2px 10px rgb(0 0 0 / 22%);
}

.stw-qv__nav svg {
	width: 22px;
	height: 22px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.stw-qv__nav:hover {
	color: var(--qv-pink-600);
}

.stw-qv__nav--prev {
	left: -22px;
}

.stw-qv__nav--next {
	right: -22px;
}

.stw-qv__body {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0;
	width: 100%;
	overflow-y: auto;
	border-radius: inherit;
}

.stw-qv__loader {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: inherit;
	background: rgb(255 255 255 / 80%);
}

.stw-qv__spinner {
	width: 34px;
	height: 34px;
	border: 3px solid var(--qv-grey-200);
	border-top-color: var(--qv-pink);
	border-radius: 50%;
	animation: stw-qv-spin 0.8s linear infinite;
}

@keyframes stw-qv-spin {
	to {
		transform: rotate(360deg);
	}
}

@media (prefers-reduced-motion: reduce) {
	.stw-qv__spinner {
		animation-duration: 2.4s;
	}
}

.stw-qv__error {
	grid-column: 1 / -1;
	margin: 0;
	padding: 56px 24px;
	color: var(--qv-grey-500);
	text-align: center;
}

/* ---------------------------------------------------------------- Gallery */

.stw-qv__gallery {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 20px;
	background: var(--qv-grey-100);
	border-radius: var(--qv-radius-lg) var(--qv-radius-lg) 0 0;
}

.stw-qv__gallery-main {
	position: relative;
	overflow: hidden;
	border-radius: var(--qv-radius-md);
	background: #fff;
	aspect-ratio: 1 / 1;
}

.stw-qv__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.stw-qv__badge {
	position: absolute;
	top: 12px;
	left: 12px;
	padding: 6px 12px;
	border-radius: var(--qv-radius-pill);
	background: var(--stw-yellow, #ffd93d);
	color: var(--qv-ink);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.stw-qv__thumbs {
	display: flex;
	flex: 0 0 auto;
	gap: 8px;
	overflow-x: auto;
	padding-bottom: 4px;
	scrollbar-width: thin;
}

.stw-qv__thumb {
	flex: 0 0 66px;
	width: 66px;
	height: 66px;
	padding: 0;
	overflow: hidden;
	border: 2px solid transparent;
	border-radius: var(--qv-radius-md);
	background: #fff;
	cursor: pointer;
}

.stw-qv__thumb.is-active {
	border-color: var(--qv-ink);
}

.stw-qv__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* ---------------------------------------------------------------- Summary */

.stw-qv__summary {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 22px 22px 26px;
}

.stw-qv__title {
	margin: 0;
	padding-right: 44px;
	font-size: 24px;
	font-weight: 800;
	letter-spacing: -0.015em;
	line-height: 1.2;
}

.stw-qv__title a {
	color: inherit;
	text-decoration: none;
}

.stw-qv__title a:hover {
	color: var(--qv-pink-600);
}

.stw-qv__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 8px 16px;
}

.stw-qv__price {
	font-size: 22px;
	font-weight: 800;
}

.stw-qv__price del {
	margin-right: 8px;
	color: var(--qv-grey-500);
	font-size: 16px;
	font-weight: 500;
}

.stw-qv__price ins {
	color: var(--qv-pink-600);
	text-decoration: none;
}

.stw-qv__rating {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
}

.stw-qv__stars {
	position: relative;
	display: inline-block;
	color: var(--qv-grey-200);
	font-size: 15px;
	letter-spacing: 1.5px;
	line-height: 1;
}

.stw-qv__stars-fill {
	position: absolute;
	top: 0;
	left: 0;
	overflow: hidden;
	color: var(--qv-star);
	white-space: nowrap;
}

.stw-qv__reviews {
	color: var(--qv-grey-500);
	font-size: 13px;
	font-weight: 600;
}

.stw-qv__dietary {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.stw-qv__pills {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.stw-qv__pill {
	display: inline-flex;
	padding: 6px 12px;
	border: 1.5px solid var(--qv-grey-200);
	border-radius: var(--qv-radius-pill);
	background: #fff;
	font-size: 12.5px;
	font-weight: 700;
}

.stw-qv__mix {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	font-size: 13.5px;
}

.stw-qv__mix-label {
	color: var(--qv-grey-500);
	font-weight: 800;
}

.stw-qv__mix-value {
	font-weight: 700;
}

.stw-qv__description {
	color: var(--qv-grey-700);
	font-size: 15px;
	line-height: 1.55;
}

.stw-qv__description > :last-child {
	margin-bottom: 0;
}

.stw-qv__stock {
	margin: 0;
	color: var(--qv-grey-500);
	font-size: 13px;
	font-weight: 700;
}

/* ------------------------------------------------------------ Buy controls */

.stw-qv__buy {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin-top: auto;
	padding-top: 4px;
}

.stw-qv__variations {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.stw-qv__variation {
	display: flex;
	flex-direction: column;
	gap: 5px;
}

.stw-qv__variation-label {
	color: var(--qv-grey-500);
	font-size: 12px;
	font-weight: 800;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.stw-qv__select {
	width: 100%;
	height: 44px;
	padding: 0 12px;
	border: 1.5px solid var(--qv-grey-200);
	border-radius: var(--qv-radius-md);
	background: #fff;
	color: var(--qv-ink);
	font-size: 15px;
	font-weight: 700;
}

.stw-qv__variation-status {
	margin: 0;
	color: var(--qv-grey-500);
	font-size: 13px;
	font-weight: 700;
}

.stw-qv__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 10px;
}

/* Mirrors the archive card's stepper: same −/+ shape, same 44px control
   height, so the two read as one component across the page. */
.stw-qv__qty {
	display: flex;
	flex: 0 0 auto;
	align-items: stretch;
	height: 48px;
	overflow: hidden;
	border: 2px solid var(--qv-pink);
	border-radius: var(--qv-radius-md);
	background: #fff;
}

.stw-qv__qty-btn {
	flex: 0 0 44px;
	border: 0;
	background: var(--qv-pink);
	color: #fff;
	cursor: pointer;
	font-size: 20px;
	font-weight: 800;
	line-height: 1;
}

.stw-qv__qty-btn:hover {
	background: var(--qv-pink-600);
}

.stw-qv__qty-val {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: center;
	min-width: 46px;
	font-size: 15px;
	font-weight: 800;
}

.stw-qv__add {
	display: flex;
	flex: 1 1 160px;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0 20px;
	border: 2px solid var(--qv-pink);
	border-radius: var(--qv-radius-md);
	background: var(--qv-pink);
	color: #fff;
	cursor: pointer;
	font-size: 15px;
	font-weight: 800;
	letter-spacing: 0.06em;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
}

.stw-qv__add:hover {
	background: #fff;
	color: var(--qv-ink);
}

/* WooCommerce's own loading/added states dim the button; keep it legible. */
.stw-qv__add.loading,
.stw-qv__add.added {
	opacity: 0.75;
}

/* Core appends this "View cart" link after a successful add. */
.stw-qv__buy .added_to_cart {
	align-self: center;
	padding: 2px 4px;
	color: var(--qv-pink-600);
	font-size: 14px;
	font-weight: 800;
}

.stw-qv__oos {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 12px;
	min-height: 48px;
	padding: 10px 16px;
	border-radius: var(--qv-radius-md);
	background: var(--qv-grey-100);
}

.stw-qv__oos-label {
	color: var(--qv-grey-500);
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}

.stw-qv__oos-link {
	border-bottom: 2px solid var(--qv-pink);
	color: var(--qv-pink-600);
	font-size: 13px;
	font-weight: 800;
	text-decoration: none;
}

/* Ghost-button treatment, not a plain text link: the modal has room this
   plugin's cramped mobile card face does not, and the link needs to be
   noticed rather than blend in. Matches the same border+radius+weight+case
   language as .stw-qv__add so it reads as part of the same button family —
   the unfilled/outline half of it, since this appears alongside a filled
   Add button in the default add-to-cart context (render()) and needs to
   read as secondary there, while still standing alone as a clear CTA in the
   two contexts where it replaces the Add button entirely (the 'details'
   add_mode for bundles/mix-and-match, and an unavailable variation). */
.stw-qv__details {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	align-self: flex-start;
	min-height: 44px;
	padding: 0 20px;
	border: 2px solid var(--qv-pink);
	border-radius: var(--qv-radius-md);
	background: #fff;
	color: var(--qv-ink);
	cursor: pointer;
	font-size: 14px;
	font-weight: 800;
	letter-spacing: 0.04em;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
}

.stw-qv__details:hover {
	border-color: var(--qv-pink-600);
	color: var(--qv-pink-600);
}

/* ------------------------------------------------------------- Wide layout */

/* Two columns once there is room for them; the design keeps the modal in a
   single scrolling column below this. */
@media (min-width: 760px) {
	.stw-qv__body {
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	}

	.stw-qv__gallery {
		padding: 24px;
		border-radius: var(--qv-radius-lg) 0 0 var(--qv-radius-lg);
	}

	.stw-qv__summary {
		padding: 28px 30px 32px;
		overflow-y: auto;
	}

	.stw-qv__title {
		font-size: 28px;
	}
}

/* Below the widest breakpoint the arrows would sit off-screen. */
@media (max-width: 1140px) {
	.stw-qv__nav--prev {
		left: 6px;
	}

	.stw-qv__nav--next {
		right: 6px;
	}
}
