/* Choc Product Showcase — card styles
   Palette: deep cocoa #3C2415, milk chocolate #8C4A2B, caramel #C77B3B,
            berry-red #8E1F3B, leaf-green #4B6B3A, cream #F4E9DC

   NOTE: selectors are namespaced under .choc-showcase and several
   interactive-element AND image rules carry !important. This is
   intentional — WooCommerce/WoodMart ship broad resets (for "button",
   "svg", "a", and notably "img { height: auto }" on product listings)
   that otherwise clobber this component's sizing/positioning. The
   product photo specifically must win against a theme's own
   `height: auto` rule, or it renders at its own intrinsic aspect ratio
   instead of filling the card — showing cropped/short on some images
   and leaving mismatched gaps around others.
*/

.choc-showcase,
.choc-showcase *,
.choc-showcase *::before,
.choc-showcase *::after {
	box-sizing: border-box;
}

.choc-showcase {
	--choc-radius: 16px;
	--choc-ink: #2A1B12;
	max-width: 1300px;
	margin: 32px auto;
	padding: 0 20px;
	width: 100%;
	max-width: min(1300px, 100%);
	overflow-x: hidden;
	/* Lets the breakpoints below react to the actual width this
	   shortcode is given (an Elementor column, a narrow sidebar, a
	   theme container) rather than only the browser viewport — a
	   shortcode embedded in a narrower column would otherwise ignore
	   viewport-based breakpoints and overflow even on a wide screen. */
	container-type: inline-size;
	container-name: choc-showcase;
}

.choc-showcase__heading {
	font-size: clamp(24px, 3vw, 34px);
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -0.01em;
	color: var(--choc-ink);
	margin: 0;
}

.choc-showcase__heading-underline {
	display: block;
	width: 56px;
	height: 4px;
	border-radius: 4px;
	background: linear-gradient(90deg, #C77B3B, #8C4A2B);
}

.choc-showcase__grid {
	display: grid;
	/* minmax(0, 1fr) — NOT plain 1fr — is what actually prevents the
	   overflow: a bare `1fr` track has an implicit minimum width equal
	   to its content's natural size, so a track can be forced wider
	   than the available space (a "grid blowout") and the whole row
	   spills past the container, which also silently disables the
	   text-ellipsis truncation on product names since their box never
	   actually gets constrained. minmax(0, 1fr) lets every track
	   shrink to fit, however narrow the container is. */
	grid-template-columns: repeat(var(--choc-columns, 4), minmax(0, 1fr));
	gap: 22px;
	width: 100%;
	max-width: 100%;
}

.choc-showcase[data-columns="1"] .choc-showcase__grid { --choc-columns: 1; }
.choc-showcase[data-columns="2"] .choc-showcase__grid { --choc-columns: 2; }
.choc-showcase[data-columns="3"] .choc-showcase__grid { --choc-columns: 3; }
.choc-showcase[data-columns="4"] .choc-showcase__grid { --choc-columns: 4; }
.choc-showcase[data-columns="5"] .choc-showcase__grid { --choc-columns: 5; }
.choc-showcase[data-columns="6"] .choc-showcase__grid { --choc-columns: 6; }

/* Fallback for browsers without container query support — keyed to
   the browser viewport. Modern browsers get the more accurate
   container-query rules further below, which win when both apply. */
@media (max-width: 900px) {
	.choc-showcase__grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@media (max-width: 640px) {
	/* Below this width the grid becomes a swipeable, one-card carousel
	   instead of a plain vertical stack of full-width cards. */
	.choc-showcase__grid {
		display: flex !important;
		grid-template-columns: none !important;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		scroll-padding-left: 14px;
		gap: 14px;
		padding: 2px 14px 10px;
		margin: 0 -14px;
		scrollbar-width: none;
		-ms-overflow-style: none;
	}
	.choc-showcase__grid::-webkit-scrollbar { display: none; height: 0; }
	.choc-showcase__grid .choc-card {
		flex: 0 0 86%;
		max-width: 86%;
		scroll-snap-align: start;
	}
	.choc-showcase { padding: 0 14px; }
}

/* Real, container-aware breakpoints — react to the showcase's own
   rendered width, so it collapses correctly whether it's full-page,
   a half-width Elementor column, or a sidebar widget. */
@container choc-showcase (max-width: 900px) {
	.choc-showcase__grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}
@container choc-showcase (max-width: 640px) {
	.choc-showcase__grid {
		display: flex !important;
		grid-template-columns: none !important;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		-webkit-overflow-scrolling: touch;
		scroll-padding-left: 14px;
		gap: 14px;
		padding: 2px 14px 10px;
		margin: 0 -14px;
		scrollbar-width: none;
		-ms-overflow-style: none;
	}
	.choc-showcase__grid::-webkit-scrollbar { display: none; height: 0; }
	.choc-showcase__grid .choc-card {
		flex: 0 0 86%;
		max-width: 86%;
		scroll-snap-align: start;
	}
	.choc-showcase { padding: 0 14px; }
}

/* Header row: title + carousel arrows (arrows only render/show once
   the grid above has switched into carousel mode) */
.choc-showcase__head {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin: 0 0 26px;
}

.choc-showcase__heading-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	margin: 0 auto;
	text-align: center;
}

.choc-showcase__nav {
	display: none;
	gap: 8px;
	flex: none;
	position: absolute;
	right: 0;
	top: 50%;
	transform: translateY(-50%);
}

@media (max-width: 640px) { .choc-showcase__nav { display: flex; } }
@container choc-showcase (max-width: 640px) { .choc-showcase__nav { display: flex; } }

.choc-showcase__nav-btn {
	all: unset;
	box-sizing: border-box !important;
	width: 30px !important;
	height: 30px !important;
	border-radius: 50% !important;
	border: 1.5px solid #e4dcd3 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	color: var(--choc-ink) !important;
	cursor: pointer !important;
	font-size: 16px;
	line-height: 1 !important;
}

.choc-showcase__nav-btn:active { background: #f4e9dc !important; }

.choc-card {
	position: relative !important;
	display: flex;
	flex-direction: column;
	background: transparent;
	border-radius: 0;
	min-width: 0;
	max-width: 100%;
}

.choc-card__media {
	position: relative !important;
	aspect-ratio: 4 / 5;
	background: var(--choc-bg, #3C2415);
	border-radius: var(--choc-radius);
	overflow: hidden !important;
	width: 100%;
	max-width: 100%;
}

.choc-card__link {
	position: absolute !important;
	inset: 0;
	display: block;
	z-index: 1;
}

.choc-card__slides {
	position: absolute !important;
	inset: 0 !important;
	width: auto !important;
	height: auto !important;
}

/* Every product photo — whether it's the featured image or a gallery
   shot — fills the panel edge to edge, full-bleed, no card/mat behind
   it. Forcing these with !important is what fixes the "image looks
   short / cropped on one card but fine on another" bug: without it, a
   theme's own `img{height:auto}` rule wins and each image falls back
   to its own intrinsic aspect ratio instead of filling the frame
   consistently. object-fit: contain keeps the whole product visible
   (including transparent cutouts) rather than cropping it — the
   colour panel shows through any transparent area, which is the
   intended look for a cutout PNG. */
.choc-slide {
	position: absolute !important;
	top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
	width: 100% !important;
	height: 100% !important;
	max-width: 100% !important;
	object-fit: contain !important;
	object-position: center center !important;
	opacity: 0;
	transform: scale(1);
	transition: opacity 0.35s ease, transform 0.5s ease;
	pointer-events: none;
	z-index: 1;
	padding: 22px;
}

.choc-slide.is-active {
	opacity: 1;
	pointer-events: auto;
}

/* gentle zoom on the active photo on hover — the modern-catalogue
   touch, replaces the old whole-card lift/shadow */
.choc-card__media:hover .choc-slide.is-active {
	transform: scale(1.045);
}

/* prev / next arrows, appear on hover */
.choc-card__nav {
	all: unset;
	box-sizing: border-box !important;
	position: absolute !important;
	top: 50% !important;
	transform: translateY(-50%);
	z-index: 5 !important;
	width: 30px !important;
	height: 30px !important;
	min-width: 30px !important;
	border-radius: 50% !important;
	background: rgba(255, 255, 255, 0.9) !important;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
	color: #2A1B12 !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	cursor: pointer !important;
	opacity: 0;
	transition: opacity 0.2s ease, background 0.2s ease;
}

.choc-card__nav svg { display: block !important; width: 16px !important; height: 16px !important; }

.choc-card__media:hover .choc-card__nav { opacity: 1; }

.choc-card__nav--prev { left: 8px !important; right: auto !important; }
.choc-card__nav--next { right: 8px !important; left: auto !important; }
.choc-card__nav:hover { background: #fff !important; }

@media (max-width: 768px) {
	/* always show nav on touch devices, hover doesn't exist */
	.choc-card__nav { opacity: 0.9; }
}

/* dot navigation, bottom of media */
.choc-card__dots {
	position: absolute !important;
	bottom: 10px !important;
	left: 0;
	right: 0;
	z-index: 5 !important;
	display: flex !important;
	justify-content: center !important;
	gap: 6px;
}

.choc-dot {
	width: 5px;
	height: 5px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.5);
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
}

.choc-dot.is-active {
	background: #fff;
	transform: scale(1.4);
}

/* footer: name, price, buttons — plain, no card boundary, sits
   directly below the image like a caption */
.choc-card__footer {
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 16px 2px 0;
}

.choc-card__info { min-width: 0; }

.choc-card__name {
	display: block;
	font-size: 16px;
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--choc-ink);
	text-decoration: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color 0.15s ease;
}

.choc-card__name:hover { color: #3C2415; }

.choc-card__price {
	font-size: 15px;
	font-weight: 600;
	color: #8C4A2B;
	margin-top: 4px;
	letter-spacing: 0.01em;
}

.choc-card__price ins { text-decoration: none; color: #8C4A2B; font-weight: 700; }
.choc-card__price del { opacity: 0.55; margin-right: 6px; font-weight: 500; color: #9a8b7d; }

/* ---------------- action buttons: Add to Cart + Buy Now ---------------- */

.choc-card__actions {
	display: flex !important;
	gap: 8px;
	width: 100%;
}

.choc-card__btn {
	all: unset;
	box-sizing: border-box !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	gap: 6px;
	flex: 1 1 0;
	min-width: 0;
	height: 42px !important;
	padding: 0 10px !important;
	border-radius: 999px !important;
	font-size: 12.5px;
	font-weight: 700;
	letter-spacing: 0.01em;
	text-align: center;
	white-space: nowrap;
	cursor: pointer !important;
	text-decoration: none;
	transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}

.choc-card__btn span {
	overflow: hidden;
	text-overflow: ellipsis;
}

.choc-card__btn-icon { flex: none; display: block !important; }

/* Add to Cart — quiet, outlined */
.choc-card__btn--cart {
	border: 1.5px solid #e4dcd3 !important;
	background: #fff !important;
	color: var(--choc-ink) !important;
}

.choc-card__btn--cart:hover {
	border-color: #3C2415 !important;
	color: #3C2415 !important;
	transform: translateY(-1px);
}

.choc-card__btn--cart.is-loading { opacity: 0.6; pointer-events: none; }
.choc-card__btn--cart.is-added {
	background: #4B6B3A !important;
	border-color: #4B6B3A !important;
	color: #fff !important;
}

/* Buy Now — the confident, filled action. Fixed chocolate brown so it
   always stays readable, regardless of how light a card's own
   --choc-bg happens to be (e.g. white/cream product cards). */
.choc-card__btn--buy {
	background: linear-gradient(135deg, #5a3320, #3C2415) !important;
	color: #fff !important;
	box-shadow: 0 6px 16px -6px rgba(60, 36, 21, 0.55);
}

.choc-card__btn--buy:hover {
	transform: translateY(-1px);
	filter: brightness(1.12);
	box-shadow: 0 10px 20px -6px rgba(60, 36, 21, 0.6);
}

.choc-card__btn--buy:active,
.choc-card__btn--cart:active { transform: translateY(0) scale(0.98); }

.choc-card__btn--buy.is-loading { opacity: 0.65; pointer-events: none; }

/* Out of stock — single full-width "View Product" pill */
.choc-card__btn--view {
	width: 100% !important;
	flex: none;
	border: 1.5px solid #e4dcd3 !important;
	background: #fff !important;
	color: var(--choc-ink) !important;
	height: 42px !important;
}

.choc-card__btn--view:hover {
	border-color: #3C2415 !important;
	color: #3C2415 !important;
}

@media (max-width: 360px) {
	.choc-card__btn { font-size: 11.5px; padding: 0 6px !important; }
}

/* ---------------- toast / popup ---------------- */

.choc-toast-stack {
	position: fixed !important;
	bottom: 20px;
	right: 20px;
	z-index: 999999 !important;
	display: flex;
	flex-direction: column;
	gap: 10px;
	align-items: flex-end;
}

.choc-toast {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #fff;
	color: #2A1B12;
	border-radius: 10px;
	padding: 10px 14px;
	box-shadow: 0 8px 24px rgba(42, 27, 18, 0.2);
	max-width: 280px;
	transform: translateX(20px);
	opacity: 0;
	transition: transform 0.25s ease, opacity 0.25s ease;
	font-size: 13px;
}

.choc-toast.is-visible { transform: translateX(0); opacity: 1; }

.choc-toast__icon {
	flex: none;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
}

.choc-toast__icon svg { width: 12px !important; height: 12px !important; display: block !important; }

.choc-toast--cart .choc-toast__icon { background: #4B6B3A; }
.choc-toast--error .choc-toast__icon { background: #b3261e; }

.choc-toast__text { flex: 1; line-height: 1.35; }
.choc-toast__title { font-weight: 600; display: block; }
.choc-toast__meta { color: #7a6a5d; font-size: 12px; }

.choc-toast__link {
	font-size: 12px;
	color: #8C4A2B;
	text-decoration: underline;
	white-space: nowrap;
}
