/* =========================================================================
   M50 Single Product
   Recreates the M50 Elementor single-product layout as a self-contained,
   Interactivity-API-driven widget.
   ========================================================================= */

.m50-sp {
	--m50-sp-text: #111111;
	--m50-sp-muted: #555555;
	--m50-sp-line: #e2e2e2;
	--m50-sp-bg: #ffffff;
	--m50-sp-tile-bg: #f4f4f4;
	--m50-sp-accent: #111111;
	--m50-sp-accent-text: #ffffff;
	--m50-sp-in-stock: #1a7f37;
	--m50-sp-out-stock: #b42318;
	--m50-sp-max-width: 1440px;
	--m50-sp-font: "Larsseit", "Helvetica Neue", Arial, sans-serif;

	max-width: var(--m50-sp-max-width);
	margin: 0 auto;
	padding: 24px 16px;
	font-family: var(--m50-sp-font);
	color: var(--m50-sp-text);
	box-sizing: border-box;
}

/* [m50_product_images]: the slider alone fills its container. */
.m50-sp--images-only {
	max-width: none;
	padding: 0;
}

.m50-sp *,
.m50-sp *::before,
.m50-sp *::after {
	box-sizing: border-box;
}

.m50-sp [hidden] {
	display: none !important;
}

.m50-sp__grid {
	display: grid;
	grid-template-columns: minmax(0, 60fr) minmax(0, 40fr);
	gap: 48px;
	align-items: start;
}

/* ---- Media (2×2 grid) -------------------------------------------------- */

.m50-sp__gallery {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 12px;
	/* Tiles keep each image's natural height, so align to the top rather than
	   stretching rows to a common height. */
	align-items: start;
}

.m50-sp__tile {
	position: relative;
	display: block;
	padding: 0;
	margin: 0;
	border: 0;
	background: var(--m50-sp-tile-bg);
	cursor: pointer;
	overflow: hidden;
	border-radius: 4px;
	/* Reserve the image's real ratio (set inline per image) before it loads,
	   so the grid doesn't reflow. */
	aspect-ratio: var(--m50-sp-ratio, auto);
}

.m50-sp__tile--single {
	grid-column: 1 / -1;
}

.m50-sp__tile-img {
	width: 100%;
	height: auto; /* retain the original image aspect ratio (no cropping). */
	display: block;
	transition: transform 0.4s ease;
}

.m50-sp__tile:hover .m50-sp__tile-img,
.m50-sp__tile:focus-visible .m50-sp__tile-img {
	transform: scale(1.04);
}

.m50-sp__tile:focus-visible {
	outline: 2px solid var(--m50-sp-accent);
	outline-offset: 2px;
}

/* "+N more" overlay on the last visible tile. */
.m50-sp__more {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	color: #ffffff;
	background: rgba(17, 17, 17, 0.55);
	backdrop-filter: blur(1px);
	transition: background-color 0.3s ease;
}

.m50-sp__tile:hover .m50-sp__more {
	background: rgba(17, 17, 17, 0.65);
}

.m50-sp__more-count {
	font-size: 28px;
	font-weight: 600;
	line-height: 1;
}

.m50-sp__more-text {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.m50-sp__media-empty {
	aspect-ratio: 1 / 1;
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--m50-sp-tile-bg);
	color: var(--m50-sp-muted);
	border-radius: 4px;
}

/* ---- Media (slider) ---------------------------------------------------- */

.m50-sp__slider {
	/* Row height of the filmstrip; images keep their natural proportion and are
	   never taller than this. */
	--m50-sp-slider-h: 600px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	/* Left edge bleeds to the viewport edge; the exact margin/width are measured
	   and applied inline by callbacks.initSliderBleed (see view.js). */
}

/* Horizontal scroller: images sit in a row and the viewport scrolls through
   however many fit. Native scroll drives touch/trackpad; mouse gets click-drag
   (see actions.sliderDragStart). The scrollbar is hidden — the progress bar and
   thumbnails stand in for it. */
.m50-sp__slider-viewport {
	position: relative;
	overflow-x: auto;
	overflow-y: hidden;
	/* At either end, don't hand the rest of a swipe to the page (which would
	   pan it sideways, or trigger browser back/forward navigation). */
	overscroll-behavior-x: contain;
	border-radius: 4px;
	background: var(--m50-sp-tile-bg);
	touch-action: pan-x;
	cursor: grab;
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* IE/Edge */
	-webkit-overflow-scrolling: touch;
}

.m50-sp__slider-viewport::-webkit-scrollbar {
	display: none; /* Chrome/Safari */
}

.m50-sp__slider-viewport.is-dragging {
	cursor: grabbing;
}

.m50-sp__slider-track {
	display: flex;
	/* No gutter between images. */
	gap: 0;
	width: max-content;
	height: var(--m50-sp-slider-h, 600px);
}

.m50-sp__slide-cell {
	position: relative;
	flex: 0 0 auto;
	height: 100%;
	padding: 0;
	margin: 0;
	border: 0;
	background: var(--m50-sp-tile-bg);
	cursor: pointer;
	overflow: hidden;
}

.m50-sp__slide-cell-img {
	/* Uniform row height, natural width — keeps each image's proportion with no
	   cropping and no gutter between neighbours. */
	height: 100% !important;
	width: auto;
	max-width: none;
	display: block;
	user-select: none;
	-webkit-user-drag: none;
}

/* Progress bar (mirrors the product slider): a scrollbar-style thumb whose
   width is the visible fraction, positioned by the scroll offset. */
.m50-sp__slider-progress {
	position: relative;
	height: 3px;
	background: var(--m50-sp-line);
	border-radius: 3px;
	overflow: hidden;
}

.m50-sp__slider-progress-bar {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 100%;
	background: var(--m50-sp-accent);
	border-radius: 3px;
}

/* Thumbnail strip. */
.m50-sp__slider-thumbs {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding-bottom: 4px;
	scrollbar-width: thin;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
}

.m50-sp__slider-thumb {
	flex: 0 0 auto;
	width: 110px;
	height: 110px;
	padding: 0;
	border: 1px solid var(--m50-sp-line);
	border-radius: 4px;
	background: var(--m50-sp-tile-bg);
	cursor: pointer;
	overflow: hidden;
	opacity: 0.55;
	scroll-snap-align: center;
	transition: opacity 0.2s ease, border-color 0.2s ease;
}

.m50-sp__slider-thumb:hover {
	opacity: 0.85;
}

.m50-sp__slider-thumb.is-active {
	opacity: 1;
	border-color: var(--m50-sp-accent);
}

.m50-sp__slider-thumb:focus-visible {
	outline: 2px solid var(--m50-sp-accent);
	outline-offset: 2px;
}

.m50-sp__slider-thumb-img {
	width: 100% !important;
	height: 100% !important;
	object-fit: cover !important;
	display: block;
}

/* ---- Media (images-only shortcode) -------------------------------------
   [m50_product_images]: the same filmstrip as the full widget's slider
   (many images side by side at a uniform height), except that no single
   image may be wider than the container — an oversized one is scaled down
   to fit whole — and the thumbnails sit centred under the strip. */

.m50-sp--images-only .m50-sp__slider {
	container-type: inline-size;
}

.m50-sp--images-only .m50-sp__slide-cell-img {
	max-width: 100cqw;
	object-fit: contain;
}

/* Centre the thumbnails; auto margins (unlike justify-content: center) keep
   the first thumbs reachable when the strip overflows and scrolls. */
.m50-sp--images-only .m50-sp__slider-thumb:first-child {
	margin-left: auto;
}

.m50-sp--images-only .m50-sp__slider-thumb:last-child {
	margin-right: auto;
}

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

.m50-sp__summary-inner {
	display: flex;
	flex-direction: column;
	gap: 18px;
}

.m50-sp__title {
	font-size: 30px;
	line-height: 1.15;
	font-weight: 500;
	margin: 0;
}

.m50-sp__price {
	font-size: 22px;
	font-weight: 500;
}

.m50-sp__price del {
	color: var(--m50-sp-muted);
	font-weight: 400;
	margin-right: 8px;
}

.m50-sp__availability {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 14px;
	font-weight: 500;
	color: var(--m50-sp-muted);
}

.m50-sp__availability::before {
	content: "";
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: currentColor;
	flex: 0 0 auto;
}

.m50-sp__availability.is-in-stock {
	color: var(--m50-sp-in-stock);
}

.m50-sp__availability.is-out-of-stock {
	color: var(--m50-sp-out-stock);
}

.m50-sp__excerpt {
	color: var(--m50-sp-muted);
	font-size: 15px;
	line-height: 1.6;
}

.m50-sp__excerpt p {
	margin: 0 0 0.75em;
}

/* ---- Variation selector ------------------------------------------------ */

.m50-sp__variations {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.m50-sp__variation-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin-bottom: 8px;
}

.m50-sp__options {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.m50-sp__option {
	min-width: 46px;
	padding: 10px 16px;
	border: 1px solid var(--m50-sp-line);
	background: var(--m50-sp-bg);
	color: var(--m50-sp-text);
	font-family: inherit;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	border-radius: 4px;
	transition: border-color 0.2s ease, background-color 0.2s ease,
		color 0.2s ease;
}

.m50-sp__option:hover:not([disabled]) {
	border-color: var(--m50-sp-accent);
}

.m50-sp__option.is-selected {
	background: var(--m50-sp-accent);
	color: var(--m50-sp-accent-text);
	border-color: var(--m50-sp-accent);
}

/* Combinations with no stock: greyed out and struck through. */
.m50-sp__option.is-unavailable,
.m50-sp__option[disabled] {
	color: #b8b8b8;
	border-color: #ececec;
	background:
		linear-gradient(
			to top left,
			transparent calc(50% - 1px),
			#e0e0e0 calc(50% - 1px),
			#e0e0e0 calc(50% + 1px),
			transparent calc(50% + 1px)
		);
	cursor: not-allowed;
}

.m50-sp__clear {
	align-self: flex-start;
	padding: 0;
	border: 0;
	background: none;
	color: var(--m50-sp-muted);
	font-family: inherit;
	font-size: 13px;
	text-decoration: underline;
	cursor: pointer;
}

/* ---- Quantity selector (inline with add-to-cart) ----------------------- */

.m50-sp__qty {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: stretch;
	border: 1px solid var(--m50-sp-line);
	border-radius: 4px;
	overflow: hidden;
}

.m50-sp__qty-btn {
	width: 44px;
	border: 0;
	background: var(--m50-sp-bg);
	color: var(--m50-sp-text);
	font-size: 20px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.m50-sp__qty-btn:hover:not([disabled]) {
	background: var(--m50-sp-tile-bg);
}

.m50-sp__qty-btn[disabled] {
	color: #c4c4c4;
	cursor: not-allowed;
}

.m50-sp__qty-input {
	flex: 0 0 60px;
	width: 60px;
	min-width: 60px;
	max-width: 60px;
	box-sizing: border-box;
	border: 0;
	border-left: 1px solid var(--m50-sp-line);
	border-right: 1px solid var(--m50-sp-line);
	background: var(--m50-sp-bg);
	color: var(--m50-sp-text);
	font-family: inherit;
	font-size: 15px;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

.m50-sp__qty-input::-webkit-outer-spin-button,
.m50-sp__qty-input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.m50-sp__qty-input:focus-visible {
	outline: 2px solid var(--m50-sp-accent);
	outline-offset: -2px;
}

/* ---- Actions (quantity + add-to-cart on one full-width row) ------------ */

.m50-sp__actions {
	display: flex;
	align-items: stretch;
	gap: 12px;
	width: 100%;
	margin-top: 4px;
}

.m50-sp__add-to-cart {
	position: relative;
	overflow: hidden;
	flex: 1 1 auto;
	min-width: 0;
	appearance: none;
	border: 0;
	padding: 12px 32px;
	background: var(--m50-sp-accent);
	color: var(--m50-sp-accent-text);
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	border-radius: 4px;
	cursor: pointer;
	transition: opacity 0.2s ease, background-color 0.2s ease;
}

/* Underlined label, kept above the shimmer sweep. */
.m50-sp__add-to-cart-label {
	position: relative;
	z-index: 1;
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
}

/* Light shimmer that sweeps across on hover. */
.m50-sp__add-to-cart::before {
	content: "";
	position: absolute;
	top: 0;
	left: -150%;
	width: 60%;
	height: 100%;
	background: linear-gradient(
		120deg,
		transparent 0%,
		rgba(255, 255, 255, 0.35) 50%,
		transparent 100%
	);
	transform: skewX(-20deg);
	pointer-events: none;
}

.m50-sp__add-to-cart:hover:not([disabled]) {
	opacity: 0.92;
}

.m50-sp__add-to-cart:hover:not([disabled])::before {
	animation: m50-sp-shimmer 0.9s ease;
}

@media (prefers-reduced-motion: reduce) {
	.m50-sp__add-to-cart:hover:not([disabled])::before {
		animation: none;
	}
}

@keyframes m50-sp-shimmer {
	from {
		left: -150%;
	}
	to {
		left: 150%;
	}
}

.m50-sp__add-to-cart[disabled] {
	background: #cfcfcf;
	cursor: not-allowed;
}

.m50-sp__add-to-cart.is-added {
	background: var(--m50-sp-in-stock);
}

.m50-sp__add-to-cart[aria-busy="true"] {
	opacity: 0.7;
	cursor: progress;
}

.m50-sp__view-cart {
	display: inline-block;
	margin-top: 12px;
	font-size: 14px;
	color: var(--m50-sp-text);
	text-decoration: underline;
	text-underline-offset: 3px;
}

.m50-sp__error {
	color: var(--m50-sp-out-stock);
	font-size: 14px;
	margin: 0;
}

/* ---- Long description (below add-to-cart) ------------------------------ */

.m50-sp__description {
	margin-top: 20px;
	padding-top: 24px;
	border-top: 1px solid var(--m50-sp-line);
}

.m50-sp__description-title {
	font-size: 16px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin: 0 0 12px;
}

.m50-sp__description-content {
	color: var(--m50-sp-muted);
	font-size: 15px;
	line-height: 1.7;
}

.m50-sp__description-content > :first-child {
	margin-top: 0;
}

.m50-sp__description-content > :last-child {
	margin-bottom: 0;
}

.m50-sp__description-content img {
	max-width: 100%;
	height: auto;
}

.m50-sp__description-content a {
	color: var(--m50-sp-text);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ---- Care instructions (below description) ----------------------------- */

.m50-sp__care {
	margin-top: 20px;
	padding-top: 24px;
	border-top: 1px solid var(--m50-sp-line);
}

.m50-sp__care-title {
	font-size: 16px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin: 0 0 12px;
}

.m50-sp__care-content {
	color: var(--m50-sp-muted);
	font-size: 15px;
	line-height: 1.7;
}

.m50-sp__care-content > :first-child {
	margin-top: 0;
}

.m50-sp__care-content > :last-child {
	margin-bottom: 0;
}

.m50-sp__care-content img {
	max-width: 100%;
	height: auto;
}

.m50-sp__care-content a {
	color: var(--m50-sp-text);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ---- Brand (pwb-brand, below description) ------------------------------ */

.m50-sp__brands {
	margin-top: 20px;
	padding-top: 20px;
	border-top: 1px solid var(--m50-sp-line);
}

.m50-sp__brands-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--m50-sp-muted);
	margin-bottom: 12px;
}

.m50-sp__brands-list {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
}

.m50-sp__brand {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	color: var(--m50-sp-text);
	text-decoration: none;
}

.m50-sp__brand-logo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	padding: 8px;
	border: 1px solid var(--m50-sp-line);
	border-radius: 4px;
	background: var(--m50-sp-bg);
	flex: 0 0 auto;
	transition: border-color 0.2s ease;
}

.m50-sp__brand:hover .m50-sp__brand-logo {
	border-color: var(--m50-sp-accent);
}

.m50-sp__brand-logo-img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
}

.m50-sp__brand-name {
	font-size: 15px;
	font-weight: 500;
}

.m50-sp__brand:hover .m50-sp__brand-name {
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ---- Lightbox ---------------------------------------------------------- */

.m50-sp__lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
}

.m50-sp__lightbox-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(10, 10, 10, 0.92);
}

.m50-sp__lightbox-stage {
	position: relative;
	z-index: 1;
	max-width: min(92vw, 1100px);
	max-height: 86vh;
	display: flex;
	align-items: center;
	justify-content: center;
}

.m50-sp__slide {
	margin: 0;
}

.m50-sp__slide-img {
	max-width: min(92vw, 1100px);
	max-height: 86vh;
	object-fit: contain;
	display: block;
}

.m50-sp__lightbox-close,
.m50-sp__lightbox-nav {
	position: absolute;
	z-index: 2;
	border: 0;
	background: rgba(255, 255, 255, 0.1);
	color: #ffffff;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background-color 0.2s ease;
}

.m50-sp__lightbox-close:hover,
.m50-sp__lightbox-nav:hover {
	background: rgba(255, 255, 255, 0.22);
}

.m50-sp__lightbox-close {
	top: 20px;
	right: 24px;
	width: 44px;
	height: 44px;
	font-size: 30px;
	line-height: 1;
	border-radius: 50%;
}

.m50-sp__lightbox-nav {
	top: 50%;
	transform: translateY(-50%);
	width: 52px;
	height: 52px;
	font-size: 34px;
	line-height: 1;
	border-radius: 50%;
}

.m50-sp__lightbox-prev {
	left: 24px;
}

.m50-sp__lightbox-next {
	right: 24px;
}

.m50-sp__lightbox-counter {
	position: absolute;
	z-index: 2;
	bottom: 24px;
	left: 50%;
	transform: translateX(-50%);
	color: #ffffff;
	font-size: 14px;
	letter-spacing: 0.05em;
}

/* Lock body scroll while the lightbox is open. */
html.m50-sp-lightbox-open,
html.m50-sp-lightbox-open body {
	overflow: hidden;
}

/* ---- Responsive -------------------------------------------------------- */

@media (max-width: 900px) {
	.m50-sp__grid {
		grid-template-columns: 1fr;
		gap: 28px;
	}

	.m50-sp__slider {
		--m50-sp-slider-h: 60vh;
	}

	.m50-sp__title {
		font-size: 24px;
	}

	.m50-sp__qty-btn {
		width: 38px;
	}

	.m50-sp__add-to-cart {
		padding: 15px 18px;
	}

	.m50-sp__lightbox-nav {
		width: 44px;
		height: 44px;
		font-size: 28px;
	}
}

/* =========================================================================
   Admin debug bar (administrators only) — mirrors m50-product-slider.
   ========================================================================= */

.m50-sp-debug {
	margin: 0 0 16px;
	padding: 12px 16px;
	background: var(--c-admin-rose, #F0D5DA);
	border-radius: 10px;
	color: #5c2230;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	font-size: 13px;
	line-height: 1.5;
}

.m50-sp-debug__title {
	margin: 0 0 6px;
	font-size: 14px;
	font-weight: 700;
}

.m50-sp-debug__meta {
	margin: 0;
	padding: 0;
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.m50-sp-debug__meta code {
	padding: 1px 5px;
	border-radius: 4px;
	background: rgba(92, 34, 48, 0.1);
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
	word-break: break-word;
}

.m50-sp-debug__note {
	margin: 8px 0 0;
	font-size: 11px;
	font-style: italic;
	opacity: 0.75;
}
