/* Logo Preview — front end. Themeable via --lp-accent / --lp-accent-2 / --lp-radius / --lp-font. */
:root {
	--lp-accent: var(--lp-accent-default, #111);
	--lp-accent-2: var(--lp-accent);
	--lp-grad: linear-gradient(100deg, var(--lp-accent), var(--lp-accent-2));
	--lp-ink: #1d1626;
	--lp-soft: #666071;
	--lp-line: rgba(29, 22, 38, .12);
	--lp-bg2: #f7f6f9;
	--lp-radius: 18px;
}
html.lp-lock { overflow: hidden; }

/* Trigger button on the product page */
.lp-trigger {
	display: flex; align-items: center; gap: 14px; width: 100%;
	margin: 6px 0 18px; padding: 14px 16px; text-align: left; cursor: pointer;
	border: 1.5px dashed color-mix(in srgb, var(--lp-accent) 45%, transparent); border-radius: var(--lp-radius);
	background: color-mix(in srgb, var(--lp-accent) 5%, #fff); color: var(--lp-ink); font: inherit;
	transition: border-color .25s, background .25s, transform .25s;
}
.lp-trigger:hover { border-color: var(--lp-accent); background: color-mix(in srgb, var(--lp-accent) 9%, #fff); transform: translateY(-1px); }
.lp-trigger__icon, .lp-trigger__thumb {
	flex-shrink: 0; width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center;
	background: var(--lp-grad); color: #fff; object-fit: cover;
}
.lp-trigger__thumb { background: #fff; border: 1px solid var(--lp-line); }
.lp-trigger__text { display: grid; gap: 2px; flex: 1; min-width: 0; }
.lp-trigger__text strong { font-size: 15.5px; font-weight: 700; line-height: 1.3; }
.lp-trigger__text em { font-style: normal; font-size: 13px; color: var(--lp-soft); }
.lp-trigger.is-attached .lp-trigger__text em { color: #24663f; font-weight: 600; }
.lp-trigger__arrow { font-size: 18px; color: var(--lp-accent); transition: transform .25s; }
.lp-trigger:hover .lp-trigger__arrow { transform: translateX(3px); }

/* Modal */
.lp-modal { position: fixed; inset: 0; z-index: 100000; display: grid; place-items: center; padding: 18px; }
.lp-modal[hidden] { display: none; }
.lp-modal__backdrop { position: absolute; inset: 0; background: rgba(20, 14, 28, .6); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); opacity: 0; transition: opacity .22s; }
.lp-modal__panel {
	position: relative; display: flex; flex-direction: column; width: min(1040px, 100%); max-height: calc(100vh - 36px);
	border-radius: 22px; background: #fff; overflow: hidden; color: var(--lp-ink);
	box-shadow: 0 40px 90px -30px rgba(30, 15, 45, .55);
	opacity: 0; transform: translateY(14px) scale(.985); transition: opacity .22s, transform .28s cubic-bezier(.22, .8, .24, 1);
}
.lp-modal.is-open .lp-modal__backdrop { opacity: 1; }
.lp-modal.is-open .lp-modal__panel { opacity: 1; transform: none; }
.lp-modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--lp-line); }
.lp-modal__head h2 { margin: 0; font-size: 19px; font-weight: 800; letter-spacing: -.02em; }
.lp-icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; display: grid; place-items: center; background: var(--lp-bg2); color: var(--lp-ink); cursor: pointer; }
.lp-icon-btn:hover { background: var(--lp-ink); color: #fff; }
.lp-modal__body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, .75fr); min-height: 0; overflow: auto; }

/* Stage */
.lp-stage { position: relative; background: var(--lp-bg2); display: grid; place-items: center; padding: 16px; min-height: 360px; }
.lp-canvas { display: block; width: 100%; height: auto; max-height: calc(100vh - 220px); object-fit: contain; border-radius: 14px; background: #fff; }
.lp-canvas.has-logo { cursor: grab; touch-action: none; }
.lp-canvas.is-dragging { cursor: grabbing; }
.lp-drop {
	position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
	width: min(320px, calc(100% - 40px)); display: grid; justify-items: center; gap: 8px; text-align: center;
	padding: 26px 22px; border-radius: 18px; cursor: pointer;
	background: rgba(255, 255, 255, .94); border: 1.5px dashed color-mix(in srgb, var(--lp-accent) 55%, transparent);
	box-shadow: 0 20px 50px -24px rgba(30, 15, 45, .45); transition: transform .2s, border-color .2s;
}
.lp-drop[hidden] { display: none; }
.lp-drop:hover, .lp-drop.is-over { border-color: var(--lp-accent); transform: translate(-50%, -50%) scale(1.02); }
.lp-drop__icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--lp-grad); color: #fff; }
.lp-drop strong { font-size: 16px; font-weight: 700; }
.lp-drop span:last-child { font-size: 12.5px; color: var(--lp-soft); line-height: 1.45; }
.lp-hint { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); margin: 0; padding: 6px 12px; border-radius: 999px; background: rgba(29, 22, 38, .72); color: #fff; font-size: 12px; white-space: nowrap; pointer-events: none; }

/* Controls */
.lp-controls { display: grid; align-content: start; gap: 18px; padding: 20px; border-left: 1px solid var(--lp-line); }
.lp-controls[hidden] { display: none; }
.lp-ctrl { display: grid; gap: 8px; }
.lp-ctrl__label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--lp-ink); }
.lp-ctrl__label output { font-weight: 600; color: var(--lp-soft); }
.lp-ctrl input[type=range] { width: 100%; accent-color: var(--lp-accent); }
.lp-seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.lp-seg button {
	display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; cursor: pointer;
	border: 1px solid var(--lp-line); background: #fff; color: var(--lp-ink); font: inherit; font-size: 13.5px; font-weight: 600; text-align: left;
}
.lp-seg button.is-active { border-color: var(--lp-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--lp-accent) 18%, transparent); }
.lp-swatch { width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; border: 1px solid var(--lp-line); }
.lp-swatch--color { background: conic-gradient(#e63946, #f4a261, #2a9d8f, #457b9d, #8338ec, #e63946); }
.lp-swatch--engrave { background: linear-gradient(135deg, #f2f3f5, #b9bec6 55%, #e6e8eb); }
.lp-swatch--white { background: #fff; }
.lp-swatch--black { background: #151515; }
.lp-check { display: flex; align-items: center; gap: 10px; font-size: 13.5px; font-weight: 500; cursor: pointer; }
.lp-check input { width: 18px; height: 18px; accent-color: var(--lp-accent); }
.lp-link { justify-self: start; padding: 0; border: 0; background: none; color: var(--lp-soft); font: inherit; font-size: 13px; text-decoration: underline; cursor: pointer; }
.lp-note { margin: 0; font-size: 12px; line-height: 1.5; color: var(--lp-soft); }

/* Footer */
.lp-modal__foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 14px 20px; border-top: 1px solid var(--lp-line); background: #fff; }
.lp-modal__foot[hidden] { display: none; }
.lp-status { margin: 0 auto 0 0; font-size: 13.5px; font-weight: 600; }
.lp-status.is-ok { color: #24663f; }
.lp-status.is-err { color: #a51f2e; }
.lp-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 20px; border-radius: 999px; font: inherit; font-size: 14.5px; font-weight: 700; cursor: pointer; transition: transform .2s, box-shadow .2s, background .2s; }
.lp-btn--primary { border: 0; background: var(--lp-grad); color: #fff; box-shadow: 0 12px 26px -14px color-mix(in srgb, var(--lp-accent) 70%, transparent); }
.lp-btn--primary:hover { transform: translateY(-1px); }
.lp-btn--primary:disabled { opacity: .6; cursor: wait; }
.lp-btn--ghost { border: 1px solid var(--lp-line); background: #fff; color: var(--lp-ink); }
.lp-btn--ghost:hover { border-color: var(--lp-accent); color: var(--lp-accent); }
.lp-btn--sm { min-height: 38px; padding: 0 14px; font-size: 13px; justify-self: start; }

/* Mobile: full-screen sheet, photo on top, controls scroll, actions pinned */
@media (max-width: 820px) {
	.lp-modal { padding: 0; place-items: stretch; }
	.lp-modal__panel { width: 100%; max-height: none; height: 100%; border-radius: 0; transform: translateY(24px); }
	.lp-modal__body { grid-template-columns: minmax(0, 1fr); flex: 1; }
	.lp-stage { padding: 10px; min-height: 0; }
	.lp-canvas { max-height: 52vh; }
	.lp-controls { border-left: 0; border-top: 1px solid var(--lp-line); padding: 16px; gap: 14px; }
	.lp-modal__foot { position: sticky; bottom: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
	.lp-modal__foot .lp-btn { flex: 1 1 140px; min-height: 48px; }
	.lp-status { flex-basis: 100%; }
	.lp-hint { bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) { .lp-modal__panel, .lp-modal__backdrop, .lp-trigger { transition: none; } }

/* v1.0.1 polish: hint at the top, mobile stage fixed + controls scroll */
.lp-hint { top: 22px; bottom: auto; }
@media (max-width: 820px) {
	.lp-modal__body { display: flex; flex-direction: column; overflow: hidden; }
	.lp-stage { flex: 0 0 auto; }
	.lp-canvas { max-height: 46vh; width: auto; max-width: 100%; }
	.lp-controls { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; }
	.lp-hint { top: 16px; }
}

/* v1.1: position pad (hold to repeat) */
.lp-pad { display: grid; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(3, 48px); gap: 6px; justify-content: start; }
.lp-pad__btn { display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--lp-line); background: #fff; color: var(--lp-ink); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; transition: background .15s, border-color .15s, color .15s; }
.lp-pad__btn:hover { border-color: var(--lp-accent); color: var(--lp-accent); }
.lp-pad__btn:active { background: var(--lp-grad); color: #fff; border-color: transparent; }
.lp-pad__up { grid-column: 2; grid-row: 1; } .lp-pad__left { grid-column: 1; grid-row: 2; } .lp-pad__center { grid-column: 2; grid-row: 2; background: var(--lp-bg2); } .lp-pad__right { grid-column: 3; grid-row: 2; } .lp-pad__down { grid-column: 2; grid-row: 3; }
@media (max-width: 820px) { .lp-pad { grid-template-columns: repeat(3, 52px); grid-template-rows: repeat(3, 44px); justify-content: center; } }

/* v1.1 layout: pad + sliders side by side, tools row, compact mobile */
.lp-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 18px; align-items: start; }
.lp-sliders { display: grid; gap: 16px; padding-top: 2px; }
.lp-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding-top: 4px; border-top: 1px solid var(--lp-line); padding-top: 14px; }
.lp-tools .lp-check { flex-basis: 100%; }
.lp-link { color: var(--lp-accent); font-weight: 600; text-decoration: none; }
.lp-link:hover { text-decoration: underline; }
.lp-pad { grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 44px); }

@media (max-width: 820px) {
	/* Photo gets the room; controls are one compact screen. */
	.lp-modal__head { padding: 10px 14px; }
	.lp-modal__head h2 { font-size: 17px; }
	.lp-icon-btn { width: 38px; height: 38px; }
	.lp-stage { padding: 8px 8px 6px; }
	.lp-canvas { max-height: 42vh; border-radius: 12px; }
	.lp-controls { gap: 12px; padding: 12px 14px 16px; }
	.lp-ctrl { gap: 6px; }
	.lp-ctrl__label { font-size: 12.5px; }

	/* Effects: one row of 4 */
	.lp-seg { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
	.lp-seg button { flex-direction: column; justify-content: center; gap: 5px; padding: 8px 4px; font-size: 11.5px; text-align: center; border-radius: 12px; min-height: 58px; }
	.lp-swatch { width: 20px; height: 20px; }

	/* Pad left, sliders right */
	.lp-row { grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; }
	.lp-ctrl--pad .lp-ctrl__label { display: none; }
	.lp-pad { grid-template-columns: repeat(3, 42px); grid-template-rows: repeat(3, 42px); gap: 5px; justify-content: start; }
	.lp-pad__btn { border-radius: 11px; }
	.lp-sliders { gap: 12px; }
	.lp-ctrl input[type=range] { height: 28px; }

	.lp-tools { gap: 8px 16px; padding-top: 10px; }
	.lp-tools .lp-check { font-size: 13px; }
	.lp-note { font-size: 11.5px; }
	.lp-modal__foot { gap: 8px; }
	.lp-modal__foot .lp-btn { font-size: 13.5px; padding: 0 12px; }
	.lp-modal__foot [data-lp-download] { flex: 0 0 auto; }
	.lp-modal__foot [data-lp-use] { flex: 1 1 0; }
	.lp-drop { padding: 20px 16px; }
}
@media (max-width: 360px) {
	.lp-pad { grid-template-columns: repeat(3, 38px); grid-template-rows: repeat(3, 38px); }
	.lp-seg button { font-size: 10.5px; }
}

/* v1.2: background panel */
.lp-bgpanel { display: grid; gap: 10px; padding: 14px; border-radius: 14px; background: var(--lp-bg2); }
.lp-seg--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.lp-seg--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.lp-seg--2 button, .lp-seg--3 button { justify-content: center; text-align: center; padding: 9px 8px; }
.lp-bgnote { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--lp-soft); padding: 8px 10px; border-radius: 10px; background: #fff; border: 1px solid var(--lp-line); }
.lp-bgnote[hidden], [data-lp-tolwrap][hidden], [data-lp-shapewrap][hidden], [data-lp-unpick][hidden] { display: none; }
.lp-pick { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; align-items: center; }
.lp-thumb {
	width: 84px; height: 84px; object-fit: contain; border-radius: 10px; cursor: crosshair; border: 1px solid var(--lp-line);
	background: #fff repeating-conic-gradient(#e9e7ee 0 25%, #fff 0 50%) 0 0 / 12px 12px;
}
.lp-pick__text { display: grid; gap: 3px; font-size: 12.5px; color: var(--lp-soft); line-height: 1.4; }
.lp-pick__text strong { font-size: 13px; color: var(--lp-ink); }
.lp-pick__text .lp-link { justify-self: start; font-size: 12.5px; }
.lp-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.lp-chips:empty { display: none; }
.lp-chip { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--lp-line); }
@media (max-width: 820px) {
	.lp-bgpanel { padding: 10px; gap: 8px; }
	.lp-pick { grid-template-columns: 64px minmax(0, 1fr); gap: 10px; }
	.lp-thumb { width: 64px; height: 64px; }
	.lp-bgnote { font-size: 11.5px; }
}

/* v1.4: photo switcher under the preview */
.lp-thumbs { display: flex; gap: 8px; width: 100%; justify-content: center; overflow-x: auto; padding: 12px 2px 2px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.lp-thumb-btn { flex: 0 0 auto; width: 58px; height: 58px; padding: 3px; border-radius: 12px; border: 1.5px solid var(--lp-line); background: #fff; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .15s; }
.lp-thumb-btn img { display: block; width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.lp-thumb-btn:hover { border-color: color-mix(in srgb, var(--lp-accent) 60%, transparent); transform: translateY(-1px); }
.lp-thumb-btn.is-on { border-color: var(--lp-accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--lp-accent) 22%, transparent); }
.lp-thumb-btn:focus-visible { outline: 2px solid var(--lp-accent); outline-offset: 2px; }
@media (max-width: 820px) {
	.lp-thumbs { justify-content: flex-start; padding-top: 8px; gap: 6px; }
	.lp-thumb-btn { width: 48px; height: 48px; border-radius: 10px; }
}
