/**
 * Live name preview.
 *
 * Light palette only, and every block that sets a background sets a colour too,
 * so a client that forces a dark ground cannot produce unreadable text.
 *
 * Two placements share one set of rules: inline (as the server rendered it) and
 * absolutely positioned over the product gallery (where preview.js moves it).
 * The geometry is the same either way — four custom properties written by PHP,
 * as percentages of the image box.
 */

.mimus-preview {
	position: relative;
	display: block;
	margin: 0 0 1rem;
	background: transparent;
	color: #2f2a26;
}

.mimus-preview__image {
	display: block;
	width: 100%;
	height: auto;
}

.mimus-preview__layer {
	position: absolute;
	left: var(--mimus-preview-x, 0%);
	top: var(--mimus-preview-y, 0%);
	width: var(--mimus-preview-w, 100%);
	height: var(--mimus-preview-h, 100%);
	display: flex;
	align-items: center;
	justify-content: center;
	pointer-events: none;
	/*
	 * İ's dot sits above cap height and ş/ç cedillas descend below the baseline,
	 * so the line box needs room and the box must not clip what it cannot fit.
	 */
	line-height: 1.25;
	overflow: visible;
}

.mimus-preview--left .mimus-preview__layer {
	justify-content: flex-start;
}

.mimus-preview--right .mimus-preview__layer {
	justify-content: flex-end;
}

.mimus-preview__text {
	display: block;
	max-width: 100%;
	color: var(--mimus-preview-color, #222222);
	text-shadow: 0 1px 2px var(--mimus-preview-halo, transparent);
	white-space: nowrap;
	/*
	 * Never text-transform: uppercase. CSS maps i to I, not İ — the same
	 * near-miss that would ship a wrongly engraved name.
	 */
	text-transform: none;
}

.mimus-preview--sans .mimus-preview__text {
	font-family: "Helvetica Neue", Arial, sans-serif;
}

.mimus-preview--serif .mimus-preview__text {
	font-family: Georgia, "Times New Roman", serif;
}

.mimus-preview--script .mimus-preview__text {
	font-family: "Segoe Script", "Brush Script MT", cursive;
}

/* An optional wash behind the text, off unless the merchant asked for it. */
.mimus-preview--scrim .mimus-preview__layer::before {
	content: "";
	position: absolute;
	inset: -6%;
	border-radius: 4px;
	background: rgba(255, 255, 255, 0.35);
}

.mimus-preview.is-empty .mimus-preview__layer::before {
	opacity: 0;
}

/* Positioned over the gallery: preview.js writes left/top/width/height in px. */
.mimus-preview--over-gallery {
	position: absolute;
	margin: 0;
	pointer-events: none;
	z-index: 2;
}

.mimus-preview--over-gallery .mimus-preview__image {
	/*
	 * The gallery is already showing the photograph; ours is only there to give
	 * the layer something to be measured against.
	 */
	visibility: hidden;
}

.mimus-preview.is-hidden {
	display: none;
}
