/* Laser File Pricer uploader (spec 5). Plain CSS, no build step. */

/* Scoped reset. Most themes ship a global border-box rule, but this shortcode
   drops into arbitrary themes and the full-bleed width is set in pixels by JS -
   under content-box the padding is added on top of it and the block overflows
   the viewport by exactly the padding. Do not rely on the theme for this. */
.lfp,
.lfp *,
.lfp *::before,
.lfp *::after {
	box-sizing: border-box;
}

/* The UA rule for [hidden] is a bare `display: none`, so any class here that
   sets display (.lfp-empty is flex) outranks it and the element stays visible
   even after hidden is set. Scoped !important is the standard answer. */
.lfp [hidden] {
	display: none !important;
}

.lfp {
	--lfp-line: #d9d9de;
	--lfp-bg: #fafafc;
	--lfp-ink: #1c1c1e;
	--lfp-muted: #6b6b70;
	--lfp-accent: #0a84ff;
	--lfp-cut: #ff2d55;
	--lfp-radius: 10px;
	color: var(--lfp-ink);
	font-size: 15px;
	line-height: 1.45;
}

/* ---------------------------------------------------------------- full bleed */

/* Most themes cap the content column at 700-900px, which squeezes the preview
   into a strip when the design is the whole point.

   The breakout is applied by bleed() in uploader.js, which measures where the
   theme's column actually sits. The tempting CSS-only version —
     width: 100vw; margin-left: calc(50% - 50vw);
   — only lands correctly when the column is *centred* in the viewport. This
   theme left-aligns it, and that exact rule dragged the photobook editor 601px
   off-screen at 1920px; see the same note in the DTF/DTG plugin. 100vw also
   counts the scrollbar, adding overflow. Measuring sidesteps both.

   So this CSS fallback deliberately does nothing but sit inside the column:
   narrower than ideal if the script fails, but never clipped.

   width="page" on the shortcode opts out of the breakout entirely. */
.lfp-full {
	width: auto;
	max-width: none;
	margin: 0;
	padding-inline: clamp(14px, 2.5vw, 48px);
}

/* ---------------------------------------------------------------- layout */

.lfp-main {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 340px;
	gap: 20px;
	margin-top: 20px;
	align-items: start;
}

@media (max-width: 860px) {
	.lfp-main { grid-template-columns: minmax(0, 1fr); }
}

/* With the full page to work with, the preview deserves more of the screen. */
.lfp-full .lfp-canvas { height: min(74vh, 720px); }

.lfp-busy { opacity: .6; pointer-events: none; }

/* ---------------------------------------------------------------- stage */

.lfp-stage {
	border: 1px solid var(--lfp-line);
	border-radius: var(--lfp-radius);
	overflow: hidden;
	background: #fff;
}

.lfp-toolbar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
	border-bottom: 1px solid var(--lfp-line);
	background: var(--lfp-bg);
}

.lfp-toolbar select { min-width: 150px; }
.lfp-toolbar input[type="range"] { flex: 1 1 110px; min-width: 90px; }
.lfp-hint { margin-left: auto; font-size: 11px; color: var(--lfp-muted); white-space: nowrap; }

.lfp-toolbar output { min-width: 4.5ch; font-variant-numeric: tabular-nums; color: var(--lfp-muted); }

.lfp-canvas {
	position: relative;
	height: min(62vh, 520px);
	background-color: #fff;
	background-image:
		linear-gradient(45deg, #f4f4f6 25%, transparent 25%),
		linear-gradient(-45deg, #f4f4f6 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #f4f4f6 75%),
		linear-gradient(-45deg, transparent 75%, #f4f4f6 75%);
	background-size: 18px 18px;
	background-position: 0 0, 0 9px, 9px -9px, -9px 0;
	cursor: grab;
	touch-action: none;
	overflow: hidden;
}

.lfp-canvas.lfp-grabbing { cursor: grabbing; }
.lfp-canvas svg { display: block; width: 100%; height: 100%; }
.lfp-canvas.lfp-over { outline: 2px dashed var(--lfp-accent); outline-offset: -8px; }

/* Empty canvas doubles as the upload target; once a file loads it becomes a
   drag surface, so the affordance has to change with it. */
.lfp-empty {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 4px;
	padding: 24px;
	text-align: center;
	cursor: pointer;
}

.lfp-empty strong { font-size: 17px; }
.lfp-empty span { color: var(--lfp-muted); }
.lfp-empty small { margin-top: 8px; max-width: 46ch; color: var(--lfp-muted); font-size: 12px; }

.lfp:not(.lfp-has-file) .lfp-canvas { cursor: pointer; }
.lfp:not(.lfp-has-file) .lfp-toolbar { opacity: .45; pointer-events: none; }

/* ---------------------------------------------------------------- resize */

.lfp-size-row {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-bottom: 6px;
}

.lfp-size-row label { color: var(--lfp-muted); font-size: 13px; }
.lfp-size-row input[type="number"] { width: 100%; min-width: 0; }
.lfp-size-row input[type="range"] { flex: 1 1 auto; min-width: 0; }
.lfp-size-row output { min-width: 4.5ch; font-size: 13px; color: var(--lfp-muted); font-variant-numeric: tabular-nums; }
.lfp-unit { color: var(--lfp-muted); font-size: 13px; }

/* ---------------------------------------------------------------- after add */

.lfp-after {
	margin-top: 12px;
	padding: 14px;
	border: 1px solid var(--lfp-line);
	border-radius: 8px;
	background: var(--lfp-bg);
}

.lfp-after p { margin: 0 0 10px; font-size: 14px; }
.lfp-after .lfp-btn { margin-bottom: 8px; }

.lfp-btn-ghost {
	background: transparent;
	color: var(--lfp-accent);
	border: 1px solid var(--lfp-accent);
	text-align: center;
	text-decoration: none;
	line-height: 1.4;
}

.lfp-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 14px;
	padding: 8px 10px;
	border-top: 1px solid var(--lfp-line);
	font-size: 12px;
	color: var(--lfp-muted);
}

.lfp-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lfp-sw { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.lfp-sw-raster { background: repeating-linear-gradient(45deg, #8e8e93 0 2px, #d1d1d6 2px 4px); }

/* ---------------------------------------------------------------- panel */

.lfp-panel {
	border: 1px solid var(--lfp-line);
	border-radius: var(--lfp-radius);
	padding: 16px;
	background: #fff;
}

.lfp-filename {
	margin: 0 0 12px;
	font-weight: 600;
	word-break: break-all;
}

.lfp-field {
	border: 0;
	padding: 0;
	margin: 0 0 14px;
}

.lfp-field legend {
	padding: 0;
	margin-bottom: 4px;
	font-size: 13px;
	font-weight: 600;
	color: var(--lfp-muted);
}

.lfp-field select,
.lfp-field input[type="number"],
.lfp-field textarea,
.lfp-field input[type="color"] {
	width: 100%;
	box-sizing: border-box;
}

.lfp-field input[type="color"] { height: 38px; margin-top: 6px; padding: 2px; }

.lfp-stats {
	display: grid;
	grid-template-columns: auto auto;
	gap: 2px 12px;
	margin: 0 0 14px;
	padding: 12px 0;
	border-top: 1px solid var(--lfp-line);
	border-bottom: 1px solid var(--lfp-line);
	font-size: 13px;
}

.lfp-stats dt { color: var(--lfp-muted); }
.lfp-stats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.lfp-price {
	margin-bottom: 12px;
	font-size: 26px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.lfp-btn {
	display: block;
	width: 100%;
	padding: 12px 16px;
	border: 0;
	border-radius: 8px;
	background: var(--lfp-accent);
	color: #fff;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.lfp-btn[disabled] { background: #c7c7cc; cursor: not-allowed; }
.lfp-btn-plain { background: none; border: 0; color: var(--lfp-accent); cursor: pointer; padding: 0 4px; }

.lfp-msg { margin: 10px 0 0; font-size: 13px; min-height: 1.2em; }
.lfp-msg-error { color: var(--lfp-cut); }
.lfp-msg-ok { color: #1a7f37; }

.lfp-notices {
	margin: 10px 0 0;
	padding-left: 18px;
	font-size: 12px;
	color: var(--lfp-muted);
}

.lfp-notices li { margin-bottom: 4px; }

@media (prefers-color-scheme: dark) {
	.lfp {
		--lfp-line: #3a3a3c;
		--lfp-bg: #1c1c1e;
		--lfp-ink: #f2f2f7;
		--lfp-muted: #98989d;
	}
	.lfp-stage, .lfp-panel, .lfp-canvas { background-color: #141416; }
	.lfp-canvas { background-image: none; }
	.lfp-canvas.lfp-over { outline-color: var(--lfp-accent); }
}
