/*
 * MarbLayer AI Wall Visualiser — front-end styles.
 * Namespaced with .mlv- to avoid conflicts with the MarbLayer theme.
 */

.mlv-visualiser {
	--mlv-charcoal: #1D1D1F;
	--mlv-structural-grey: #3E3F43;
	--mlv-warm-stone: #D3CAC0;
	--mlv-marble-white: #F9F4F2;
	--mlv-marble-black: #161819;
	--mlv-warm-taupe: #A89D92;
	--mlv-soft-taupe: #C9BFB4;

	--mlv-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

	/* Break out of the theme's 760px .ml-content column while staying aligned
	 * with the main MarbLayer page container. */
	width: min(1160px, calc(100vw - 80px));
	max-width: none;
	margin: 0;
	padding: 2.75rem 0 4rem;
	font-family: var(--mlv-font);
	color: var(--mlv-charcoal);
	box-sizing: border-box;
}

.mlv-visualiser *,
.mlv-visualiser *::before,
.mlv-visualiser *::after {
	box-sizing: inherit;
}

/* Align the WordPress page title with the visualiser instead of letting the
 * theme place it flush against the viewport edge on small screens. */
.mlv-host-page-title {
	width: min(1160px, calc(100vw - 80px));
	max-width: none;
	margin-left: auto !important;
	margin-right: auto !important;
	box-sizing: border-box;
}

.mlv-visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.mlv-heading {
	font-size: 2rem;
	font-weight: 500;
	letter-spacing: -0.01em;
	margin: 0 0 0.5rem;
	color: var(--mlv-charcoal);
}

.mlv-heading--secondary {
	font-size: 1.35rem;
	margin-top: 0;
}

.mlv-subheading {
	font-size: 1rem;
	line-height: 1.6;
	color: var(--mlv-structural-grey);
	margin: 0 0 2rem;
	max-width: 46ch;
}

.mlv-intro {
	margin-bottom: 2.5rem;
}

.mlv-eyebrow {
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--mlv-warm-taupe);
	margin: 0 0 0.75rem;
}

.mlv-intro .mlv-heading {
	margin-bottom: 0.6rem;
}

.mlv-intro .mlv-subheading {
	margin-bottom: 0;
}

.mlv-step {
	margin-bottom: 2.25rem;
}

.mlv-panel {
	background: var(--mlv-marble-white);
	border: 1px solid var(--mlv-soft-taupe);
	border-radius: 6px;
	padding: 1.75rem;
	margin-bottom: 2.25rem;
}

.mlv-panel .mlv-step {
	margin-bottom: 1.5rem;
}

.mlv-panel .mlv-step:last-child {
	margin-bottom: 0;
}

/* Upload */

.mlv-dropzone {
	border: 1px solid var(--mlv-soft-taupe);
	background: var(--mlv-marble-white);
	border-radius: 4px;
	padding: 2.5rem 1.5rem;
	text-align: center;
	cursor: pointer;
	transition: border-color 0.2s ease, background 0.2s ease;
	position: relative;
}

.mlv-dropzone:hover,
.mlv-dropzone:focus-visible,
.mlv-dropzone.mlv-is-dragover {
	border-color: var(--mlv-warm-taupe);
	background: #fdfbfa;
}

.mlv-dropzone:focus-visible {
	outline: 2px solid var(--mlv-charcoal);
	outline-offset: 3px;
}

.mlv-dropzone__icon {
	color: var(--mlv-warm-taupe);
	margin-bottom: 0.75rem;
}

.mlv-dropzone__content p {
	margin: 0.25rem 0;
	color: var(--mlv-structural-grey);
}

.mlv-dropzone__hint {
	font-size: 0.85rem;
	color: var(--mlv-warm-taupe);
}

.mlv-dropzone__preview img {
	max-width: 100%;
	max-height: 320px;
	border-radius: 3px;
	display: block;
	margin: 0 auto 1rem;
	object-fit: contain;
}

.mlv-link-button {
	background: none;
	border: none;
	padding: 0;
	color: var(--mlv-charcoal);
	text-decoration: underline;
	font-size: 0.9rem;
	cursor: pointer;
}

/* Concepts */

.mlv-concept-grid {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 22px;
}

@media (max-width: 680px) {
	.mlv-concept-grid {
		grid-template-columns: 1fr;
	}
}

.mlv-concept-card {
	border: 1px solid var(--mlv-soft-taupe);
	border-radius: 6px;
	background: var(--mlv-marble-white);
	padding: 0;
	text-align: left;
	cursor: pointer;
	overflow: hidden;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
	color: inherit;
	font-family: inherit;
	display: flex;
	flex-direction: column;
}

.mlv-concept-card:hover {
	border-color: var(--mlv-warm-taupe);
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(29, 29, 31, 0.08);
}

.mlv-concept-card:focus-visible {
	outline: 2px solid var(--mlv-charcoal);
	outline-offset: 2px;
}

.mlv-concept-card[aria-checked="true"] {
	border-color: var(--mlv-charcoal);
	box-shadow: 0 0 0 2px var(--mlv-charcoal);
}

.mlv-concept-card__media {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--mlv-warm-stone);
}

/* The parent MarbLayer theme adds margins and border-radius to .ml-content img.
 * Override those rules so concept images fully cover the card media area. */
.mlv-visualiser .mlv-concept-card__media > .mlv-concept-card__image {
	position: absolute;
	inset: 0;
	display: block;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	border-radius: 0 !important;
	object-fit: cover !important;
}

.mlv-concept-card__badge {
	position: absolute;
	top: 0.65rem;
	right: 0.65rem;
	display: none;
	align-items: center;
	padding: 0.3rem 0.65rem;
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--mlv-marble-white);
	background: var(--mlv-charcoal);
	border-radius: 2px;
}

.mlv-concept-card[aria-checked="true"] .mlv-concept-card__badge {
	display: inline-flex;
}

.mlv-concept-card__body {
	display: flex;
	flex-direction: column;
	gap: 9px;
	padding: 19px;
}

.mlv-concept-card__name {
	font-weight: 700;
	font-size: 1.15rem;
	margin: 0;
	color: var(--mlv-charcoal);
}

.mlv-concept-card__desc {
	font-size: 0.92rem;
	line-height: 1.5;
	color: var(--mlv-structural-grey);
	margin: 0;
}


/* Keep the visualiser inside the viewport on tablets and phones, where the
 * theme content column already expands to the available width. */
@media (max-width: 899px) {
	.mlv-visualiser {
		width: min(100%, calc(100vw - 48px)) !important;
		max-width: min(100%, calc(100vw - 48px)) !important;
		margin-left: auto !important;
		margin-right: auto !important;
		padding: 2rem 0 3rem;
		overflow-x: clip;
	}

	.mlv-visualiser .mlv-intro,
	.mlv-visualiser .mlv-step,
	.mlv-visualiser .mlv-panel,
	.mlv-visualiser .mlv-result {
		max-width: 100%;
		margin-left: 0;
		margin-right: 0;
	}
}

/* On wide screens, let the finish library use the full plugin width while
 * keeping the intro/upload/generation controls comfortable to read. */
@media (min-width: 900px) {
	.mlv-intro,
	.mlv-step--upload,
	.mlv-panel {
		max-width: 920px;
	}

	.mlv-concept-card__body {
		min-height: 122px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mlv-concept-card {
		transition: none;
	}

	.mlv-concept-card:hover {
		transform: none;
	}
}

/* Wall instruction */

.mlv-label {
	display: block;
	font-size: 0.9rem;
	font-weight: 600;
	margin-bottom: 0.5rem;
}

.mlv-optional-tag {
	font-weight: 400;
	color: var(--mlv-warm-taupe);
	text-transform: none;
}

.mlv-text-input {
	width: 100%;
	padding: 0.75rem 0.9rem;
	border: 1px solid var(--mlv-soft-taupe);
	border-radius: 3px;
	font-size: 0.95rem;
	font-family: inherit;
	background: var(--mlv-marble-white);
	color: var(--mlv-charcoal);
}

.mlv-text-input:focus-visible {
	outline: 2px solid var(--mlv-charcoal);
	outline-offset: 1px;
}

.mlv-field-help {
	margin: 0.55rem 0 0;
	font-size: 0.82rem;
	line-height: 1.5;
	color: var(--mlv-warm-taupe);
}

/* Buttons */

.mlv-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	padding: 0.9rem 1.75rem;
	font-size: 0.95rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	border-radius: 3px;
	border: 1px solid transparent;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
	font-family: inherit;
	text-decoration: none;
}

.mlv-btn--primary {
	background: var(--mlv-charcoal);
	color: var(--mlv-marble-white);
}

.mlv-btn--primary:hover:not(:disabled) {
	background: var(--mlv-marble-black);
}

.mlv-btn--primary:disabled {
	background: var(--mlv-soft-taupe);
	cursor: not-allowed;
}

.mlv-btn--secondary {
	background: transparent;
	color: var(--mlv-charcoal);
	border-color: var(--mlv-charcoal);
}

.mlv-btn--secondary:hover {
	background: var(--mlv-marble-white);
}

.mlv-btn:focus-visible {
	outline: 2px solid var(--mlv-charcoal);
	outline-offset: 2px;
}

/* Loading */

.mlv-loading {
	text-align: center;
	padding: 2.5rem 1rem;
}

.mlv-loading__spinner {
	width: 34px;
	height: 34px;
	margin: 0 auto 1.1rem;
	border: 2px solid var(--mlv-soft-taupe);
	border-top-color: var(--mlv-charcoal);
	border-radius: 50%;
	animation: mlv-spin 0.9s linear infinite;
}

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

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

.mlv-loading p {
	color: var(--mlv-structural-grey);
	font-size: 0.95rem;
}

/* Errors */

.mlv-error {
	color: #8a2f22;
	font-size: 0.88rem;
	margin-top: 0.75rem;
}

/* Result / compare slider */

.mlv-compare__frame {
	position: relative;
	width: 100%;
	overflow: hidden;
	border-radius: 4px;
	background: var(--mlv-marble-black);
	touch-action: none;
	user-select: none;
	line-height: 0;
}

.mlv-compare__image {
	display: block;
	width: 100%;
	height: auto;
}

.mlv-compare__image--before {
	width: 100%;
}


.mlv-visualiser .mlv-compare__image {
	max-width: none !important;
	margin: 0 !important;
	border-radius: 0 !important;
	object-fit: fill;
}

.mlv-compare__after-wrap {
	position: absolute;
	top: 0;
	right: 0;
	left: auto;
	height: 100%;
	width: 50%;
	overflow: hidden;
}

.mlv-compare__after-wrap .mlv-compare__image--after {
	position: absolute;
	top: 0;
	right: 0;
	left: auto;
	height: 100%;
	width: auto;
	max-width: none;
}

.mlv-compare__labels {
	position: absolute;
	top: 0.75rem;
	left: 0;
	right: 0;
	display: flex;
	justify-content: space-between;
	padding: 0 0.9rem;
	pointer-events: none;
}

.mlv-compare__label {
	font-size: 0.72rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--mlv-marble-white);
	background: rgba(22, 24, 25, 0.55);
	padding: 0.3rem 0.6rem;
	border-radius: 2px;
}

.mlv-compare__handle {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 2px;
	background: var(--mlv-marble-white);
	cursor: ew-resize;
	transform: translateX(-1px);
}

.mlv-compare__handle:focus-visible {
	outline: 2px solid var(--mlv-marble-white);
	outline-offset: 3px;
}

.mlv-compare__handle-grip {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 40px;
	height: 40px;
	transform: translate(-50%, -50%);
	background: var(--mlv-marble-white);
	border-radius: 50%;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.mlv-compare__handle-grip::before,
.mlv-compare__handle-grip::after {
	content: "";
	position: absolute;
	top: 50%;
	width: 0;
	height: 0;
	border-top: 6px solid transparent;
	border-bottom: 6px solid transparent;
}

.mlv-compare__handle-grip::before {
	left: 10px;
	border-right: 7px solid var(--mlv-charcoal);
	transform: translateY(-50%);
}

.mlv-compare__handle-grip::after {
	right: 10px;
	border-left: 7px solid var(--mlv-charcoal);
	transform: translateY(-50%);
}

.mlv-disclaimer {
	font-size: 0.82rem;
	color: var(--mlv-structural-grey);
	margin: 1rem 0 1.5rem;
	line-height: 1.5;
}

.mlv-result__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.mlv-cta-btn {
	background: var(--mlv-charcoal);
	color: var(--mlv-marble-white) !important;
	padding: 0.9rem 1.75rem;
	border-radius: 3px;
	font-weight: 600;
	font-size: 0.95rem;
}

@media (max-width: 560px) {
	.mlv-heading {
		font-size: 1.6rem;
	}

	.mlv-result__actions {
		flex-direction: column;
	}

	.mlv-result__actions .mlv-btn,
	.mlv-result__actions .mlv-cta-btn {
		width: 100%;
	}
}


@media (max-width: 680px) {
	.mlv-visualiser {
		width: calc(100vw - 48px) !important;
		max-width: calc(100vw - 48px) !important;
		margin-inline: auto !important;
	}

	.mlv-host-page-title {
		width: calc(100vw - 48px) !important;
		max-width: calc(100vw - 48px) !important;
		margin-left: auto !important;
		margin-right: auto !important;
	}

	.mlv-intro {
		padding-inline: 2px;
	}

	.mlv-heading {
		max-width: 100%;
		font-size: clamp(1.75rem, 8vw, 2.2rem);
		line-height: 1.12;
		letter-spacing: -0.02em;
	}

	.mlv-heading--secondary {
		font-size: 1.35rem;
		line-height: 1.2;
	}

	.mlv-subheading {
		font-size: 1rem;
		line-height: 1.55;
	}

	.mlv-panel,
	.mlv-dropzone {
		padding-left: 1rem;
		padding-right: 1rem;
	}

	.mlv-concept-grid {
		gap: 16px;
	}

	.mlv-concept-card__body {
		padding: 17px;
	}

	.mlv-concept-card__name {
		font-size: 1.08rem;
	}

	.mlv-result__actions {
		flex-direction: column;
	}

	.mlv-result__actions .mlv-btn,
	.mlv-result__actions .mlv-cta-btn {
		width: 100%;
	}
}

/* v1.0.6: keep concept references crisp and prevent optimisation/lazy-load
 * plugins from leaving low-resolution placeholders stretched inside cards. */
.mlv-visualiser .mlv-concept-card__image {
	filter: none !important;
	backdrop-filter: none !important;
	image-rendering: auto !important;
	transform: none !important;
	backface-visibility: visible !important;
	-webkit-font-smoothing: auto;
}
