/* LZ Signature for Gravity Forms
   Themes can restyle via the custom properties on .lzsig. */

.lzsig {
	--lzsig-ink: #1f1d22;
	--lzsig-bg: #ffffff;
	--lzsig-border: #c9c4cf;
	--lzsig-accent: #2563eb;
	--lzsig-muted: #6b7280;
	--lzsig-error: #b42318;
	--lzsig-radius: 8px;
	--lzsig-ratio: 5 / 2;
}

.lzsig__pad {
	position: relative;
	width: 100%;
	aspect-ratio: var(--lzsig-ratio);
	min-height: 150px;
	max-height: 280px;
	overflow: hidden;
	background: var(--lzsig-bg);
	border: 1px dashed var(--lzsig-border);
	border-radius: var(--lzsig-radius);
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.lzsig__pad:hover,
.lzsig.is-drawing .lzsig__pad {
	border-color: var(--lzsig-accent);
	border-style: solid;
}

.lzsig.is-signed .lzsig__pad {
	border-style: solid;
}

/* touch-action: none stops the page scrolling while signing on touch screens. */
.lzsig__canvas {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: block;
	width: 100%;
	height: 100%;
	touch-action: none;
	cursor: crosshair;
	-webkit-user-select: none;
	user-select: none;
	-webkit-tap-highlight-color: transparent;
}

/* Above the canvas: a restored signature is an opaque white image that
   would otherwise hide the guideline. pointer-events: none keeps it from
   blocking the pen. */
.lzsig__line,
.lzsig__hint {
	z-index: 2;
}

.lzsig__line {
	position: absolute;
	left: 7%;
	right: 7%;
	bottom: 26%;
	border-bottom: 1px solid var(--lzsig-border);
	pointer-events: none;
}

.lzsig__hint {
	position: absolute;
	left: 7%;
	bottom: calc(26% + 0.5rem);
	font-size: 0.9rem;
	color: var(--lzsig-muted);
	pointer-events: none;
	transition: opacity 0.15s ease;
}

.lzsig.is-signed .lzsig__hint,
.lzsig.is-drawing .lzsig__hint {
	opacity: 0;
}

.lzsig__actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;
	margin-top: 0.5rem;
}

.lzsig__status {
	font-size: 0.85rem;
	color: var(--lzsig-muted);
}

.gform_wrapper .lzsig__clear {
	flex: 0 0 auto;
	margin: 0 0 0 auto;
	padding: 0.45rem 1rem;
	font: inherit;
	font-size: 0.875rem;
	line-height: 1.2;
	color: var(--lzsig-ink);
	background: transparent;
	border: 1px solid var(--lzsig-border);
	border-radius: 999px;
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease;
}

.gform_wrapper .lzsig__clear:hover:not(:disabled) {
	color: var(--lzsig-accent);
	border-color: var(--lzsig-accent);
}

.gform_wrapper .lzsig__clear:disabled {
	opacity: 0.45;
	cursor: default;
}

.gfield_error .lzsig__pad {
	border-color: var(--lzsig-error);
	border-style: solid;
}

@media (prefers-reduced-motion: reduce) {
	.lzsig__pad,
	.lzsig__hint,
	.gform_wrapper .lzsig__clear {
		transition: none;
	}
}
