/**
 * EWEB CF7 Signature - front-end styles.
 *
 * Everything is namespaced under `.eweb-sig` and driven by custom properties,
 * so a theme can restyle the pad without touching this file.
 *
 * @package EWEB_CF7_Signature
 */

.eweb-sig {
	--eweb-sig-border: #d1d5db;
	--eweb-sig-muted: #6b7280;
	--eweb-sig-focus: #2563eb;
	--eweb-sig-radius: 12px;
	--eweb-sig-gap: 10px;
	--eweb-sig-bg: #ffffff;
	--eweb-sig-pen: #111827;

	display: flex;
	flex-direction: column;
	gap: var(--eweb-sig-gap);
	width: 100%;
	max-width: 420px;
	margin: 0;
}

.eweb-sig__frame {
	position: relative;
	width: 100%;
	max-width: 420px;
	height: 135px;
	aspect-ratio: 400 / 130;
	border: 1px solid #94a3b8;
	border-radius: 8px;
	background-color: #ffffff;
	background-image: url('https://interpretertranslation.com/wp-content/uploads/2024/02/AEG-Rewards-canvas-background.jpg');
	background-repeat: no-repeat;
	background-position: center center;
	background-size: 100% 100%;
	overflow: hidden;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.eweb-sig__frame:focus-within {
	border-color: var(--eweb-sig-focus);
	box-shadow: 0 0 0 3px rgb(37 99 235 / 20%);
}

.eweb-sig__canvas {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	border: 0;
	padding: 0;
	background: transparent;
	cursor: crosshair;
	touch-action: none;
	overscroll-behavior: none;
	-webkit-user-select: none;
	user-select: none;
	-webkit-touch-callout: none;
}

.eweb-sig__empty {
	display: none !important;
}

.eweb-sig__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--eweb-sig-gap);
}

.eweb-sig__clear {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 0;
	padding: 6px 18px;
	border: 1px solid #cbd5e1;
	border-radius: 20px;
	background-color: #ffffff;
	color: #475569;
	font-weight: 600;
	font-size: 13px;
	line-height: 1.2;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.eweb-sig__clear:hover {
	background-color: #f8fafc;
	border-color: #94a3b8;
	color: #0f172a;
}

.eweb-sig__clear:focus-visible {
	outline: 2px solid var(--eweb-sig-focus);
	outline-offset: 2px;
}

.eweb-sig__hint,
.eweb-sig__noscript {
	margin: 0;
	color: var(--eweb-sig-muted);
	font-size: 0.8125rem;
	line-height: 1.35;
}

.eweb-sig__noscript {
	padding: 8px 10px;
	border: 1px dashed var(--eweb-sig-border);
	border-radius: 8px;
}

/* The hidden input is never visible: it only carries the payload. */
.eweb-sig__value {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	border: 0;
	white-space: nowrap;
}

.eweb-sig .wpcf7-form-control-wrap {
	display: block;
}

.eweb-sig .wpcf7-not-valid-tip {
	color: #b32d2e;
	font-size: 0.875em;
}

/* Proportional fallback for engines without `aspect-ratio` support. */
@supports not (aspect-ratio: 1 / 1) {
	.eweb-sig__frame {
		height: 0;
		padding-bottom: calc(100% / var(--eweb-sig-ratio, 2.5));
	}

	.eweb-sig__canvas {
		position: absolute;
		inset: 0;
	}
}

@media (prefers-color-scheme: dark) {
	.eweb-sig {
		--eweb-sig-border: #4b5563;
		--eweb-sig-muted: #9ca3af;
	}

	.eweb-sig__clear:hover {
		background-color: rgb(255 255 255 / 8%);
	}
}

@media (forced-colors: active) {
	.eweb-sig__frame {
		border-color: CanvasText;
	}

	.eweb-sig__clear {
		border-color: ButtonBorder;
		color: ButtonText;
	}
}

@media (prefers-reduced-motion: reduce) {
	.eweb-sig__frame,
	.eweb-sig__empty,
	.eweb-sig__clear {
		transition: none;
	}
}

@media (max-width: 480px) {
	.eweb-sig {
		--eweb-sig-gap: 8px;
	}
}

@media print {
	.eweb-sig__actions,
	.eweb-sig__empty,
	.eweb-sig__noscript {
		display: none;
	}
}

/* Background guide line image from original design */
.style-Signature .eweb-sig,
.eweb-sig {
	width: 100%;
	max-width: 400px;
	box-sizing: border-box;
}

.style-Signature .eweb-sig__frame,
.eweb-sig__frame {
	width: 100%;
	max-width: 100%;
	height: 130px;
	aspect-ratio: 400 / 130;
	box-sizing: border-box;
	background-image: url('https://interpretertranslation.com/wp-content/uploads/2024/02/AEG-Rewards-canvas-background.jpg');
	background-repeat: no-repeat;
	background-position: center;
	background-size: 100% 100%;
	border: 1px solid #94a3b8;
	border-radius: 8px;
}


.style-Signature .eweb-sig__empty,
.eweb-sig__empty {
	display: none;
}

.style-Signature .eweb-sig__clear,
.eweb-sig__clear {
	margin-top: 8px;
	padding: 6px 18px;
	border: 1px solid #cbd5e1;
	border-radius: 20px;
	background-color: #ffffff;
	color: #475569;
	font-weight: 600;
	font-size: 13px;
	cursor: pointer;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.style-Signature .eweb-sig__clear:hover,
.eweb-sig__clear:hover {
	background-color: #f8fafc;
	border-color: #94a3b8;
	color: #0f172a;
}

