/* MemoryPrinted Print Studio — inherits the MemoryPrinted theme tokens, with fallbacks for any theme. */

.mp-studio {
	--s-ink: var(--mp-ink, #23284a);
	--s-ink-soft: var(--mp-ink-2, #3a4070);
	--s-paper: var(--mp-paper, #f4efe6);
	--s-paper-2: var(--mp-paper-2, #ebe4d6);
	--s-plaster: var(--mp-plaster, #fbf9f4);
	--s-line: var(--mp-line, #ddd4c3);
	--s-muted: var(--mp-muted, #6f6a61);
	--s-accent: var(--mp-cinnabar, #c4472b);
	--s-good: #3d7a57;
	--s-warn: #a8781f;
	--s-font: var(--mp-font-sans, "Outfit", system-ui, sans-serif);
	--s-display: var(--mp-font-display, "Fraunces", Georgia, serif);
	--s-mono: var(--mp-font-mono, "DM Mono", ui-monospace, monospace);
	--s-radius: 22px;
	position: relative;
	font-family: var(--s-font);
	color: var(--s-ink);
	line-height: 1.5;
}

.mp-studio *,
.mp-studio *::before,
.mp-studio *::after {
	box-sizing: border-box;
}

.mp-studio .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* Boot */
.mp-studio__boot {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 14px;
	min-height: 360px;
	color: var(--s-muted);
}
.mp-studio__boot-ring {
	width: 28px;
	height: 28px;
	border-radius: 50%;
	border: 3px solid var(--s-line);
	border-top-color: var(--s-ink);
	animation: mp-spin 0.9s linear infinite;
}
@keyframes mp-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Product tabs */
.mp-studio__tabs {
	display: flex;
	gap: 10px;
	overflow-x: auto;
	padding: 4px 2px 18px;
	margin-bottom: 8px;
	scrollbar-width: thin;
	scroll-snap-type: x proximity;
}
.mp-studio__tab {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 12px;
	padding: 12px 18px 12px 14px;
	border: 1px solid var(--s-line);
	border-radius: 999px;
	background: var(--s-plaster);
	color: var(--s-ink);
	font: inherit;
	cursor: pointer;
	scroll-snap-align: start;
	transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.mp-studio__tab:hover {
	border-color: var(--s-ink);
	transform: translateY(-1px);
}
.mp-studio__tab:focus-visible {
	outline: 2px solid var(--s-accent);
	outline-offset: 2px;
}
.mp-studio__tab.is-active {
	background: var(--s-ink);
	border-color: var(--s-ink);
	color: var(--s-plaster);
}
.mp-studio__tab-icon {
	display: grid;
	place-items: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--s-paper);
	color: var(--s-ink);
}
.mp-studio__tab.is-active .mp-studio__tab-icon {
	background: rgba(255, 255, 255, 0.12);
	color: var(--s-plaster);
}
.mp-studio__tab-text {
	display: flex;
	flex-direction: column;
	text-align: left;
	line-height: 1.2;
}
.mp-studio__tab-name {
	font-weight: 600;
	font-size: 0.95rem;
}
.mp-studio__tab-price {
	font-family: var(--s-mono);
	font-size: 0.72rem;
	letter-spacing: 0.02em;
	opacity: 0.75;
}

/* Layout */
.mp-studio__main {
	display: grid;
	grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
	gap: clamp(20px, 3vw, 44px);
	align-items: start;
}

.mp-studio__stage-wrap {
	position: sticky;
	top: calc(var(--mp-header-h, 80px) + 16px);
}

.mp-studio__stage {
	position: relative;
	border-radius: 30px;
	overflow: hidden;
	background: var(--s-paper-2);
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 30px 60px -40px rgba(35, 40, 74, 0.45);
}
/* Printer's crop marks around the proof */
.mp-studio__stage-wrap::before {
	content: "";
	position: absolute;
	inset: -14px;
	pointer-events: none;
	background:
		linear-gradient(var(--s-ink), var(--s-ink)) left 14px top 0 / 1px 10px,
		linear-gradient(var(--s-ink), var(--s-ink)) left 0 top 14px / 10px 1px,
		linear-gradient(var(--s-ink), var(--s-ink)) right 14px top 0 / 1px 10px,
		linear-gradient(var(--s-ink), var(--s-ink)) right 0 top 14px / 10px 1px;
	background-repeat: no-repeat;
	opacity: 0.35;
}

.mp-studio__canvas {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	touch-action: none;
	cursor: default;
	outline: none;
}
.mp-studio__canvas:focus-visible {
	box-shadow: inset 0 0 0 3px var(--s-accent);
}

.mp-studio__drop {
	position: absolute;
	inset: 14px;
	display: grid;
	place-items: center;
	border: 2px dashed var(--s-accent);
	border-radius: 22px;
	background: rgba(251, 249, 244, 0.82);
	color: var(--s-ink);
	font-weight: 600;
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.15s ease;
}
.mp-studio__stage.is-dragover .mp-studio__drop {
	opacity: 1;
}

.mp-studio__stage-bar {
	display: flex;
	justify-content: center;
	margin-top: 14px;
	min-height: 40px;
}
.mp-studio__hint {
	margin: 10px 0 0;
	text-align: center;
	font-size: 0.85rem;
	color: var(--s-muted);
}

/* Segmented control */
.mp-seg {
	display: inline-flex;
	padding: 4px;
	gap: 4px;
	border-radius: 999px;
	background: var(--s-paper-2);
}
.mp-seg__btn {
	border: 0;
	border-radius: 999px;
	padding: 8px 16px;
	background: transparent;
	color: var(--s-ink);
	font: inherit;
	font-size: 0.88rem;
	font-weight: 500;
	cursor: pointer;
}
.mp-seg__btn.is-on {
	background: var(--s-plaster);
	box-shadow: 0 1px 3px rgba(35, 40, 74, 0.18);
}
.mp-seg__btn:focus-visible {
	outline: 2px solid var(--s-accent);
	outline-offset: 1px;
}

/* Panel */
.mp-studio__panel {
	background: var(--s-plaster);
	border: 1px solid var(--s-line);
	border-radius: 30px;
	padding: clamp(20px, 2.6vw, 34px);
}
.mp-panel__eyebrow {
	margin: 0 0 8px;
	font-family: var(--s-mono);
	font-size: 0.74rem;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--s-accent);
}
.mp-panel__title {
	margin: 0;
	font-family: var(--s-display);
	font-weight: 500;
	font-size: clamp(1.7rem, 2.4vw, 2.3rem);
	line-height: 1.08;
	letter-spacing: -0.01em;
}
.mp-panel__short {
	margin: 10px 0 0;
	color: var(--s-muted);
}
.mp-panel__price {
	margin-top: 14px;
	font-size: 1.5rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}
.mp-panel__proof {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	margin: 14px 0 0;
	padding: 12px 14px;
	border-radius: 14px;
	background: var(--s-paper);
	font-size: 0.88rem;
	color: var(--s-ink);
}
.mp-panel__proof::before {
	content: "";
	flex: 0 0 18px;
	height: 18px;
	margin-top: 1px;
	border-radius: 50%;
	background: radial-gradient(circle, var(--s-accent) 0 3px, transparent 3.5px), radial-gradient(circle, transparent 0 6px, var(--s-accent) 6.5px 7.5px, transparent 8px);
}

/* Steps */
.mp-step {
	margin-top: 22px;
	padding-top: 20px;
	border-top: 1px solid var(--s-line);
}
.mp-step[hidden] {
	display: none;
}
.mp-step__title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0 0 14px;
	font-family: var(--s-font);
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: 0;
}
.mp-step__num {
	font-family: var(--s-mono);
	font-size: 0.72rem;
	font-weight: 500;
	padding: 3px 8px;
	border-radius: 999px;
	border: 1px solid var(--s-ink);
}

/* Artwork slots */
.mp-slot {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr) auto;
	gap: 14px;
	align-items: center;
	padding: 10px;
	border: 1px solid var(--s-line);
	border-radius: 18px;
	background: #fff;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.mp-slot + .mp-slot {
	margin-top: 10px;
}
.mp-slot.is-active {
	border-color: var(--s-ink);
	box-shadow: 0 0 0 3px rgba(35, 40, 74, 0.08);
}
.mp-slot__thumb {
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	padding: 0;
	border: 1.5px dashed var(--s-line);
	border-radius: 14px;
	background: var(--s-paper);
	color: var(--s-ink);
	cursor: pointer;
	overflow: hidden;
}
.mp-slot.has-art .mp-slot__thumb {
	border-style: solid;
}
.mp-slot__thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.mp-slot__meta {
	display: flex;
	flex-direction: column;
	min-width: 0;
	gap: 2px;
}
.mp-slot__label {
	font-weight: 600;
	font-size: 0.92rem;
}
.mp-slot__name {
	font-size: 0.8rem;
	color: var(--s-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.mp-slot__status {
	font-size: 0.78rem;
	color: var(--s-muted);
}
.mp-slot__status.is-done {
	color: var(--s-good);
}
.mp-slot__status.is-error {
	color: var(--s-accent);
}
.mp-slot__actions {
	display: flex;
	gap: 10px;
	align-items: center;
}
.mp-slot__actions--row {
	margin-top: 12px;
	justify-content: flex-start;
}
.mp-slot__actions--row .mp-slot__name {
	flex: 1;
}

.mp-progress {
	display: block;
	width: 120px;
	height: 5px;
	margin-top: 6px;
	border-radius: 99px;
	background: var(--s-paper-2);
	overflow: hidden;
}
.mp-progress > span {
	display: block;
	height: 100%;
	background: var(--s-ink);
	transition: width 0.2s ease;
}

/* Magnets */
.mp-magnets__head,
.mp-photos__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 12px;
	font-size: 0.9rem;
}
.mp-magnets {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
	gap: 10px;
}
.mp-magnets__cell {
	aspect-ratio: 1;
	padding: 0;
	border: 1.5px dashed var(--s-line);
	border-radius: 12px;
	background: var(--s-paper);
	color: var(--s-ink);
	font-size: 1.3rem;
	cursor: pointer;
	overflow: hidden;
}
.mp-magnets__cell img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.mp-magnets__cell.is-active {
	border: 2px solid var(--s-ink);
}

/* Album photos */
.mp-photos {
	margin-top: 16px;
	padding: 14px;
	border-radius: 18px;
	background: var(--s-paper);
}
.mp-photos__hint {
	margin: 0 0 10px;
	font-size: 0.8rem;
	color: var(--s-muted);
}
.mp-photos__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
	gap: 8px;
}
.mp-photos__cell {
	position: relative;
	aspect-ratio: 1;
	border-radius: 10px;
	overflow: hidden;
	background: var(--s-paper-2);
}
.mp-photos__cell img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.mp-photos__cell.is-uploading img {
	opacity: 0.55;
}
.mp-photos__cell.is-error {
	outline: 2px solid var(--s-accent);
}
.mp-photos__cell.is-over {
	opacity: 0.35;
}
.mp-photos__name {
	display: block;
	padding: 6px;
	font-size: 0.65rem;
	word-break: break-all;
}
.mp-photos__remove {
	position: absolute;
	top: 4px;
	right: 4px;
	width: 22px;
	height: 22px;
	border: 0;
	border-radius: 50%;
	background: rgba(35, 40, 74, 0.8);
	color: #fff;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
}

/* Controls */
.mp-row {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-bottom: 12px;
}
.mp-row__label {
	flex: 0 0 92px;
	font-size: 0.88rem;
	color: var(--s-muted);
}
.mp-range {
	flex: 1;
	accent-color: var(--s-ink);
}
.mp-btn-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.mp-btn,
.mp-studio a.mp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 18px;
	border: 1px solid var(--s-ink);
	border-radius: 999px;
	background: var(--s-ink);
	color: var(--s-plaster);
	font: inherit;
	font-size: 0.88rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}
.mp-btn:hover {
	background: var(--s-ink-soft);
}
.mp-btn--small {
	padding: 7px 14px;
	font-size: 0.82rem;
}
.mp-btn--ghost {
	background: transparent;
	color: var(--s-ink);
	border-color: var(--s-line);
	font-weight: 500;
}
.mp-btn--ghost:hover {
	background: var(--s-paper);
	border-color: var(--s-ink);
}
.mp-link {
	padding: 0;
	border: 0;
	background: none;
	color: var(--s-ink);
	font: inherit;
	font-size: 0.85rem;
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}
.mp-link--muted {
	color: var(--s-muted);
	font-weight: 500;
}
.mp-btn:focus-visible,
.mp-link:focus-visible,
.mp-slot__thumb:focus-visible,
.mp-magnets__cell:focus-visible {
	outline: 2px solid var(--s-accent);
	outline-offset: 2px;
}

.mp-check {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	margin-top: 14px;
	font-size: 0.86rem;
	color: var(--s-muted);
	cursor: pointer;
}
.mp-check input {
	margin-top: 3px;
	accent-color: var(--s-ink);
}

.mp-quality {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 6px 0 0;
	font-size: 0.84rem;
}
.mp-quality::before {
	content: "";
	width: 9px;
	height: 9px;
	border-radius: 50%;
	background: currentColor;
}
.mp-quality--great {
	color: var(--s-good);
}
.mp-quality--good {
	color: var(--s-warn);
}
.mp-quality--low {
	color: var(--s-accent);
}
.mp-quality[hidden] {
	display: none;
}

/* Attributes */
.mp-attr {
	margin: 0 0 16px;
	padding: 0;
	border: 0;
	min-width: 0;
}
.mp-attr__legend {
	display: flex;
	gap: 8px;
	align-items: baseline;
	margin-bottom: 10px;
	padding: 0;
	font-size: 0.9rem;
	font-weight: 600;
}
.mp-attr__current {
	font-weight: 400;
	color: var(--s-muted);
}
.mp-attr__options {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.mp-attr__input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	pointer-events: none;
}
.mp-attr__option {
	display: inline-flex;
	align-items: center;
	padding: 9px 15px;
	border: 1px solid var(--s-line);
	border-radius: 999px;
	background: #fff;
	font-size: 0.86rem;
	cursor: pointer;
	transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.mp-attr__option:hover {
	border-color: var(--s-ink);
}
.mp-attr__input:checked + .mp-attr__option {
	background: var(--s-ink);
	border-color: var(--s-ink);
	color: var(--s-plaster);
}
.mp-attr__input:focus-visible + .mp-attr__option {
	outline: 2px solid var(--s-accent);
	outline-offset: 2px;
}
.mp-attr--swatch .mp-attr__option {
	padding: 3px;
	border-radius: 50%;
	background: transparent;
}
.mp-attr--swatch .mp-attr__input:checked + .mp-attr__option {
	background: transparent;
	border-color: var(--s-ink);
	box-shadow: 0 0 0 2px var(--s-ink);
}
.mp-swatch {
	display: block;
	width: 30px;
	height: 30px;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12);
}

.mp-notes {
	width: 100%;
	min-height: 84px;
	padding: 12px 14px;
	border: 1px solid var(--s-line);
	border-radius: 14px;
	background: #fff;
	color: var(--s-ink);
	font: inherit;
	font-size: 0.9rem;
	resize: vertical;
}
.mp-notes:focus {
	outline: 2px solid var(--s-ink);
	outline-offset: 1px;
}

/* Buy */
.mp-buy {
	margin-top: 24px;
	padding-top: 20px;
	border-top: 1px solid var(--s-line);
}
.mp-buy__row {
	display: flex;
	gap: 12px;
	align-items: stretch;
}
.mp-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--s-line);
	border-radius: 999px;
	background: #fff;
}
.mp-qty__btn {
	width: 40px;
	height: 100%;
	min-height: 54px;
	border: 0;
	background: none;
	color: var(--s-ink);
	font-size: 1.2rem;
	cursor: pointer;
}
.mp-qty__input {
	width: 44px;
	border: 0;
	background: none;
	text-align: center;
	font: inherit;
	font-weight: 600;
	color: var(--s-ink);
	-moz-appearance: textfield;
}
.mp-qty__input::-webkit-outer-spin-button,
.mp-qty__input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}
.mp-buy__btn {
	flex: 1;
	min-height: 56px;
	padding: 0 22px;
	border: 0;
	border-radius: 999px;
	background: var(--s-ink);
	color: var(--s-plaster);
	font: inherit;
	font-size: 1rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	cursor: pointer;
	transition: background 0.2s ease, transform 0.2s ease;
}
.mp-buy__btn:hover:not(:disabled) {
	background: var(--s-ink-soft);
	transform: translateY(-1px);
}
.mp-buy__btn:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}
.mp-buy__btn:focus-visible {
	outline: 3px solid var(--s-accent);
	outline-offset: 2px;
}
.mp-buy__msg {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	min-height: 0;
	margin-top: 12px;
	font-size: 0.9rem;
}
.mp-buy__msg:empty {
	margin: 0;
}
.mp-buy__msg[data-kind="error"] {
	color: var(--s-accent);
}
.mp-buy__msg[data-kind="success"] {
	color: var(--s-good);
	font-weight: 600;
}
.mp-buy__help {
	margin: 14px 0 0;
	font-size: 0.84rem;
}
.mp-buy__help a {
	color: var(--s-muted);
}

/* Toast */
.mp-studio__toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 9999;
	max-width: min(92vw, 460px);
	padding: 12px 18px;
	border-radius: 14px;
	background: var(--s-ink);
	color: var(--s-plaster);
	font-size: 0.9rem;
	box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.5);
	transform: translate(-50%, 140%);
	opacity: 0;
	transition: transform 0.25s ease, opacity 0.25s ease;
	pointer-events: none;
}
.mp-studio__toast.is-on {
	transform: translate(-50%, 0);
	opacity: 1;
}
.mp-studio__toast.is-error {
	background: var(--s-accent);
}

.mp-studio-empty {
	padding: 24px;
	border: 1px dashed var(--mp-line, #ddd4c3);
	border-radius: 18px;
	background: var(--mp-plaster, #fbf9f4);
}

/* Responsive */
@media (max-width: 960px) {
	.mp-studio__main {
		grid-template-columns: minmax(0, 1fr);
	}
	.mp-studio__stage-wrap {
		position: relative;
		top: auto;
	}
	.mp-studio__stage {
		max-width: min(100%, 72vh);
		margin: 0 auto;
	}
	.mp-buy {
		position: sticky;
		bottom: 0;
		z-index: 5;
		margin: 24px calc(-1 * clamp(20px, 2.6vw, 34px)) calc(-1 * clamp(20px, 2.6vw, 34px));
		padding: 14px clamp(20px, 2.6vw, 34px) 18px;
		background: var(--s-plaster);
		border-radius: 0 0 30px 30px;
		box-shadow: 0 -12px 24px -18px rgba(35, 40, 74, 0.35);
	}
}

@media (max-width: 960px) {
	/* Keep toasts above the sticky buy bar. */
	.mp-studio__toast {
		bottom: 110px;
	}
}

@media (max-width: 520px) {
	.mp-buy__row {
		gap: 8px;
	}
	.mp-qty__btn {
		width: 32px;
		min-height: 50px;
	}
	.mp-qty__input {
		width: 30px;
	}
	.mp-buy__btn {
		min-height: 50px;
		padding: 0 14px;
		font-size: 0.92rem;
		white-space: nowrap;
	}
	.mp-studio__tab {
		padding: 10px 14px 10px 10px;
	}
	.mp-studio__tab-icon {
		width: 32px;
		height: 32px;
	}
	.mp-slot {
		grid-template-columns: 56px minmax(0, 1fr);
	}
	.mp-slot__thumb {
		width: 56px;
		height: 56px;
	}
	.mp-slot__actions {
		grid-column: 1 / -1;
	}
	.mp-row__label {
		flex-basis: 76px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mp-studio *,
	.mp-studio *::before,
	.mp-studio *::after {
		transition: none !important;
		animation: none !important;
	}
}
