/*
 * NDV Variation Engine - grid hover-lift, 50/50 modal layout, mobile fallback.
 */

:root {
	--ndv-color-text-primary: #333333;
	--ndv-color-accent: #c5a059;
	--ndv-color-bg: #fafafa;
	--ndv-color-error: #d9534f;
	--ndv-color-muted: #8c6f5d;

	--ndv-font-heading: 'Cormorant Garamond', serif;
	--ndv-font-body: 'Montserrat', sans-serif;

	--ndv-letter-spacing-label: 1px;

	--ndv-border-radius-btn: 0;
	--ndv-box-shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.08);

	--ndv-space-xs: 8px;
	--ndv-space-sm: 16px;
	--ndv-space-md: 24px;
	--ndv-space-lg: 32px;
}

/* Shared utility. */
.ndv-is-hidden {
	display: none !important;
}

/* ==========================================================
 * Grid & hover engine
 * ========================================================== */

.ndv-grid-container {
	display: grid;
	grid-template-columns: repeat(var(--ndv-per-row, 3), 1fr);
	gap: var(--ndv-space-lg);
	margin: var(--ndv-space-lg) 0;
}

@media (max-width: 900px) {
	.ndv-grid-container {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 600px) {
	.ndv-grid-container {
		grid-template-columns: 1fr;
	}
}

.ndv-card {
	position: relative;
	background: transparent;
	border: none;
	overflow: hidden;
	text-align: left;
	text-decoration: none;
}

.ndv-card .ndv-card-image {
	position: relative;
	overflow: hidden;
	width: 100%;
	aspect-ratio: 340 / 420;
	background-color: #e5d6d3;
}

.ndv-card .ndv-card-image img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.ndv-card:hover .ndv-card-image img {
	transform: scale(1.06);
}

.ndv-card .hover-box {
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	background-color: #ffffff;
	text-align: center;
	padding: 15px 0;
	font-size: 14px;
	color: var(--ndv-color-text-primary);
	z-index: 2;
	transform: translateY(100%);
	transition: transform 0.4s ease;
	box-sizing: border-box;
}

.ndv-card:hover .hover-box,
.ndv-card:focus-within .hover-box {
	transform: translateY(0);
}

.ndv-card-content {
	margin-top: 18px;
	font-size: 14px;
	line-height: 1.5;
	padding: 0;
}

.ndv-card-title {
	margin: 0;
	color: var(--ndv-color-text-primary);
	font-family: var(--ndv-font-body);
	font-size: 12px;
}

.ndv-card-title span {
	color: #888888;
}

.ndv-card-price {
	margin: 6px 0 0;
	color: var(--ndv-color-text-primary);
	font-family: var(--ndv-font-body);
	font-size: 12px;
	font-weight: bold;
	display: block;
}

.ndv-trigger-btn {
	background: var(--ndv-color-btn, #4a4541);
	color: #ffffff;
	border: var(--ndv-btn-border, none);
	border-radius: var(--ndv-border-radius-btn);
	padding: var(--ndv-space-sm) var(--ndv-space-md);
	font-family: var(--ndv-font-body);
	text-transform: uppercase;
	letter-spacing: var(--ndv-letter-spacing-label);
	font-size: 12px;
	cursor: pointer;
	transition: background 0.3s ease;
	width: 100%;
	max-width: 200px;
}

.ndv-trigger-btn:hover {
	background: var(--ndv-color-btn-hover, #332f2c);
}

.ndv-card .hover-box .ndv-trigger-btn {
	background: transparent;
	color: #000000;
	font-size: 12px;
	padding: 0;
	border: none;
	box-shadow: none;
	text-transform: uppercase;
	font-family: var(--ndv-font-body);
	cursor: pointer;
	width: 100%;
	max-width: none;
}

.ndv-card .hover-box .ndv-trigger-btn:hover {
	background: transparent;
	color: #000000;
}

.ndv-card .hover-box .ndv-trigger-btn:focus-visible,
.ndv-modal-close:focus-visible,
.ndv-no-products {
	font-family: var(--ndv-font-body);
	color: var(--ndv-color-text-primary);
}

/* Touch devices cannot hover, so the action is always visible. */
@media (hover: none) {
	.ndv-card .hover-box {
		transform: translateY(0);
	}
}

/* ==========================================================
 * Modal (50/50 split)
 * ========================================================== */

body.ndv-modal-open {
	overflow: hidden;
}

.ndv-modal-overlay {
	display: none;
	position: fixed;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: rgba(0, 0, 0, 0.6);
	z-index: 99999;
	align-items: center;
	justify-content: center;
}

.ndv-modal-overlay.is-open {
	display: flex;
}

.ndv-modal-wrapper {
	background: var(--ndv-color-bg);
	width: 90%;
	max-width: 900px;
	height: 80vh;
	max-height: 600px;
	position: relative;
	box-shadow: var(--ndv-box-shadow-hover);
	display: flex;
	overflow: hidden;
	outline: none;
}

.ndv-modal-close {
	position: absolute;
	top: var(--ndv-space-sm);
	right: var(--ndv-space-sm);
	background: transparent;
	border: none;
	font-size: 28px;
	color: #000000;
	cursor: pointer;
	z-index: 10;
	line-height: 1;
	padding: 0;
	margin: 0;
}

.ndv-modal-close:hover {
	color: #000000;
	background: transparent;
}

.ndv-modal-content {
	display: flex;
	width: 100%;
	height: 100%;
}

.ndv-modal-left {
	flex: 1;
	background: #e0e0e0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ndv-modal-left img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ndv-modal-right {
	flex: 1;
	padding: var(--ndv-space-lg);
	overflow-y: auto;
	background: #ffffff;
	display: flex;
	flex-direction: column;
}

.ndv-modal-top-label {
	display: block;
	margin-bottom: var(--ndv-space-sm);
	font-family: var(--ndv-font-body);
	font-size: 14px;
	text-transform: uppercase;
	letter-spacing: var(--ndv-letter-spacing-label);
	color: #000000;
}

.ndv-modal-main-heading {
	margin: 0 0 var(--ndv-space-xs);
	font-family: var(--ndv-font-heading);
	font-size: 62px;
	font-style: italic;
	line-height: 1.1;
	font-weight: normal;
	color: #000000;
}

.ndv-modal-variation-name {
	margin: 0 0 var(--ndv-space-lg);
	font-family: var(--ndv-font-body);
	font-size: 16px;
	font-style: italic;
	color: var(--ndv-color-muted);
	font-weight: normal;
	min-height: 1em;
}

.ndv-loader {
	font-family: var(--ndv-font-body);
	font-size: 14px;
	color: var(--ndv-color-text-primary);
	margin-bottom: var(--ndv-space-sm);
}

.ndv-modal-attributes {
	margin-bottom: var(--ndv-space-md);
}

.ndv-var-field {
	margin-bottom: 15px;
}

.ndv-var-label {
	display: block;
	margin-bottom: 4px;
	font-family: var(--ndv-font-body);
	font-size: 14px;
	color: #555555;
	font-weight: normal;
}

.ndv-modal-right .ndv-custom-fields-wrapper {
	margin-bottom: var(--ndv-space-lg);
}

.ndv-modal-field {
	margin-bottom: var(--ndv-space-md);
}

.ndv-modal-field:last-child {
	margin-bottom: 0;
}

.ndv-modal-content select,
.ndv-modal-content input {
	border: none;
	border-bottom: 1px solid #dddddd;
	border-radius: 0;
	padding-left: 0;
	width: 100%;
	box-sizing: border-box;
	font-family: var(--ndv-font-body);
	font-size: 14px;
	background: transparent;
	box-shadow: none;
	outline: none;
}

.ndv-modal-content select {
	appearance: auto;
}

.ndv-modal-content input[type="file"] {
	border: 1px dashed #d9b38c;
	padding: 25px;
	width: 100%;
}

.ndv-modal-content select:focus,
.ndv-modal-content input:focus {
	border-bottom-color: var(--ndv-color-accent);
}

.ndv-modal-content input.ndv-field-error,
.ndv-modal-content input[type="file"].ndv-field-error,
.ndv-modal-content select.ndv-field-error {
	border: 1px solid var(--ndv-color-error);
}

.ndv-footnote {
	text-align: center;
	font-size: 14px;
	color: var(--ndv-color-text-primary);
	font-family: var(--ndv-font-body);
	font-weight: normal;
	margin: 0;
}

/* Personalisation fields inside the modal. */
.ndv-custom-fields-wrapper {
	margin-bottom: 20px;
}

/* Wrapper around the upload plugin's own widget; its styling stays its own. */
.ndv-modal-upload {
	margin-top: 16px;
}

@media (max-width: 768px) {
	.ndv-modal-content {
		flex-direction: column;
	}

	.ndv-modal-left {
		display: none;
	}

	.ndv-modal-wrapper {
		height: 90vh;
		max-height: none;
	}

	/* 62px overflows narrow screens once the image half is hidden. */
	.ndv-modal-main-heading {
		font-size: 38px;
	}
}

/* ==========================================================
 * Toast notification
 * ========================================================== */

.ndv-toast {
	position: fixed;
	bottom: 20px;
	right: 20px;
	background: var(--ndv-color-text-primary);
	color: #ffffff;
	padding: var(--ndv-space-sm) var(--ndv-space-md);
	border-radius: var(--ndv-border-radius-btn);
	box-shadow: var(--ndv-box-shadow-hover);
	font-family: var(--ndv-font-body);
	font-size: 14px;
	z-index: 100000;
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 0.3s ease, transform 0.3s ease;
	pointer-events: none;
}

.ndv-toast.show {
	opacity: 1;
	transform: translateY(0);
}

.ndv-toast.error {
	background: var(--ndv-color-error);
}

@media (prefers-reduced-motion: reduce) {
	.ndv-card .ndv-card-image img,
	.ndv-card .hover-box,
	.ndv-trigger-btn,
	.ndv-toast {
		transition: none;
	}
}

/* Shown while the upload plugin's button is held shut. */
.ndv-upload-gate {
	margin: 0 0 10px;
	padding: 8px 12px;
	border-left: 3px solid var(--ndv-accent, #c5a059);
	background: #faf7f1;
	color: #6b5a38;
	font-family: var(--ndv-font-body);
	font-size: 12px;
	line-height: 1.5;
}

.ndv-modal-upload #cpiu-open-upload-modal[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Administrator-only explanation when the upload widget cannot render. */
.ndv-upload-widget-notice {
	margin: 0;
	padding: 10px 12px;
	border-left: 3px solid #d9534f;
	background: #fdf3f3;
	color: #8a2a26;
	font-family: var(--ndv-font-body);
	font-size: 12px;
	line-height: 1.5;
}

.ndv-submit-btn {
	width: 100%;
	max-width: 100%;
	font-size: 14px;
	padding: 16px;
	margin-bottom: var(--ndv-space-sm);
	font-family: var(--ndv-font-body);
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.ndv-success-state {
	text-align: center;
	padding: 20px 0;
}

.ndv-success-message {
	font-family: var(--ndv-font-body);
	font-size: 16px;
	margin-bottom: 15px;
	color: #1e7e34;
}

.ndv-view-cart-btn:focus-visible {
	outline: 2px solid var(--ndv-color-accent);
	outline-offset: 2px;
}

.ndv-view-cart-btn {
	display: inline-block;
	box-sizing: border-box;
	text-decoration: none;
	text-align: center;
	width: 100%;
	max-width: 100%;
	font-size: 14px;
	padding: 16px;
	font-family: var(--ndv-font-body);
	letter-spacing: 0.1em;
	text-transform: uppercase;
	border-radius: var(--ndv-border-radius-btn);
	background: #000000;
	color: #ffffff;
}

.ndv-view-cart-btn:hover,
.ndv-view-cart-btn:focus {
	color: #ffffff;
}
