/* Signature Digitiser: the Signature tab of the Image Tools page (tools/image.html, assets/js/signature-page.js).
   Same look as the Spectrum Toolkit: white cards, coral #f56565, a dashed drop area, pill buttons. */

/* The site's button style sets display, which would override the browser's "hidden" switch */
.sig-app [hidden] { display: none !important; }

/* The site styles every <button> as a large uppercase outline button; these are plain controls */
.sig-app button {
	box-shadow: none;
	font-family: "Open Sans", sans-serif;
	height: auto;
	letter-spacing: 0;
	line-height: 1.45;
	text-transform: none;
	white-space: normal;
}
.sig-intro { max-width: 46em; }

/* ---------- 1. Start: the drop area, tips and the privacy line ---------- */
.sig-start { display: flex; flex-wrap: wrap; gap: 1em 1.5em; align-items: stretch; }
.sig-drop {
	align-items: center;
	border: 1.5px dashed rgba(245, 101, 101, 0.55);
	border-radius: 10px;
	color: #3d4449;
	cursor: pointer;
	display: flex;
	flex: 2 1 24em;
	flex-direction: column;
	gap: 0.35em;
	justify-content: center;
	margin: 0;
	min-height: 12em;
	padding: 1.5em 1.2em;
	text-align: center;
	transition: background-color 0.2s, border-color 0.2s;
}
.sig-drop:hover, .sig-drop:focus-within, .sig-drop.is-over { background: rgba(245, 101, 101, 0.05); border-color: #f56565; }
.sig-drop-icon { color: #f56565; font-size: 2em; }
.sig-drop-text { font-size: 1.05em; }
.sig-drop-text u { color: #f56565; }
.sig-drop-formats { color: #7f888f; font-size: 0.75em; }
.sig-start-side { display: flex; flex: 1 1 16em; flex-direction: column; gap: 0.8em; justify-content: center; }
.sig-tips, .sig-privacy { color: #7f888f; font-size: 0.8em; line-height: 1.45; margin: 0; }
.sig-tips .icon, .sig-privacy .icon { color: #f56565; margin-right: 0.3em; }

/* ---------- 2. The work area: photo and result, side by side (stacked on phones) ---------- */
.sig-panes { display: grid; gap: 1.2em; grid-template-columns: 1fr 1fr; }
@media screen and (max-width: 980px) { .sig-panes { grid-template-columns: 1fr; } }
.sig-pane {
	background: #fff;
	border: solid 1px rgba(210, 215, 217, 0.75);
	border-radius: 10px;
	display: flex;
	flex-direction: column;
	margin: 0;
	min-width: 0;
	padding: 0.8em;
}
.sig-pane figcaption {
	align-items: baseline;
	color: #3d4449;
	display: flex;
	flex-wrap: wrap;
	font-size: 0.85em;
	font-weight: 600;
	gap: 0.2em 0.8em;
	margin-bottom: 0.6em;
}
.sig-box-hint, .sig-result-info { color: #7f888f; font-size: 0.9em; font-weight: 400; }
.sig-stage-wrap { align-items: center; display: flex; flex: 1; justify-content: center; min-height: 10em; }

/* the photo and the box drawn on it: the stage is exactly as large as the photo shown */
.sig-stage { cursor: crosshair; margin: auto; position: relative; touch-action: none; user-select: none; -webkit-user-select: none; width: fit-content; }
.sig-stage img { display: block; max-height: 55vh; max-width: 100%; pointer-events: none; }
.sig-box { background: rgba(245, 101, 101, 0.12); border: 2px solid #f56565; border-radius: 3px; box-sizing: border-box; position: absolute; }
.sig-no-preview { color: #7f888f; font-size: 0.85em; margin: 0; padding: 1em; text-align: center; }

/* the result on grey-and-white squares, the usual sign for "transparent" */
.sig-result {
	align-items: center;
	background-color: #fff;
	background-image:
		linear-gradient(45deg, #e6e8ea 25%, transparent 25%, transparent 75%, #e6e8ea 75%),
		linear-gradient(45deg, #e6e8ea 25%, transparent 25%, transparent 75%, #e6e8ea 75%);
	background-position: 0 0, 10px 10px;
	background-size: 20px 20px;
	border-radius: 6px;
	display: flex;
	flex: 1;
	justify-content: center;
	min-height: 10em;
	padding: 1em;
	position: relative;
}
.sig-result img { display: block; max-height: 55vh; max-width: 100%; transition: opacity 0.3s ease; }
.sig-result.is-busy img { opacity: 0.35; }
.sig-working {
	align-items: center;
	background: rgba(255, 255, 255, 0.85);
	border-radius: 999px;
	color: #3d4449;
	display: flex;
	font-size: 0.85em;
	gap: 0.6em;
	left: 50%;
	padding: 0.5em 1em;
	position: absolute;
	top: 50%;
	transform: translate(-50%, -50%);
}
.sig-spinner {
	animation: sig-turn 0.8s linear infinite;
	border: 2px solid rgba(245, 101, 101, 0.25);
	border-radius: 50%;
	border-top-color: #f56565;
	display: inline-block;
	height: 1em;
	width: 1em;
}
@keyframes sig-turn { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .sig-spinner { animation-duration: 3s; } }

/* messages: errors in coral, notes in grey */
.sig-message { border-radius: 8px; font-size: 0.9em; margin: 0 0 1em; padding: 0.7em 1em; }
.sig-message.is-error { background: rgba(245, 101, 101, 0.08); color: #c53030; }
.sig-message.is-note { background: rgba(127, 136, 143, 0.08); color: #3d4449; }
.sig-turnstile { margin-top: 0.8em; }
.sig-turnstile:empty { margin: 0; }

/* ---------- 3. Settings and download (the Spectrum Toolkit's controls) ---------- */
.sig-controls { border-top: solid 1px rgba(210, 215, 217, 0.75); margin-top: 1.2em; padding-top: 1.2em; }
.sig-settings { display: grid; gap: 0.2em 2em; grid-template-columns: repeat(auto-fill, minmax(15em, 1fr)); }
.sig-app input[type="number"], .sig-pop input[type="number"], .sig-pop input[type="text"] {
	appearance: textfield;
	background: #fff;
	border: solid 1px rgba(210, 215, 217, 0.75);
	border-radius: 0.375em;
	color: inherit;
	padding: 0 0.6em;
}
.sig-app input[type="number"]:focus, .sig-pop input:focus { border-color: #f56565; box-shadow: 0 0 0 1px #f56565; outline: none; }
.sig-app input.is-bad, .sig-pop input.is-bad { border-color: #f56565; }
.sig-app input[type="range"], .sig-pop input[type="range"] { accent-color: #f56565; }

/* One setting: a dot once changed (click it: back to the default), the name, an (i), then the control */
.sig-row { margin: 0 0 0.85em; }
.sig-row-head { align-items: baseline; display: flex; gap: 0.5em; margin-bottom: 0.3em; }
.sig-row-head label { color: #3d4449; font-size: 0.8em; font-weight: 600; margin: 0; }
.sig-reset { background: transparent; border: 0; border-radius: 50%; box-shadow: none; cursor: pointer; flex: 0 0 auto; height: 0.5em !important;
	line-height: 0 !important; margin: 0 0.1em 0 -0.75em; padding: 0 !important; visibility: hidden; width: 0.5em; }
.sig-row.is-changed .sig-reset { background: #f56565; visibility: visible; }
.sig-row.is-changed .sig-reset:hover { box-shadow: 0 0 0 3px rgba(245, 101, 101, 0.25); }
/* (i): opens the setting's explanation */
.sig-info { align-items: center; background: none; border: 1px solid #d2d7d9; border-radius: 50%; box-shadow: none; color: #9aa1a6 !important; cursor: help;
	display: inline-flex; flex: 0 0 auto; font: italic 700 0.6em Georgia, serif; height: 1.35em !important; justify-content: center; line-height: 1 !important;
	padding: 0 !important; width: 1.35em; }
.sig-info:hover { border-color: #f56565; color: #f56565 !important; }
.sig-bubble { background: #fff; border: 1px solid #e3e6e8; border-radius: 8px; box-shadow: 0 6px 18px rgba(61, 68, 73, 0.14); color: #5f676d; font-size: 0.74em;
	line-height: 1.45; max-width: 18em; padding: 0.55em 0.75em; position: absolute; z-index: 60; }

/* a slider with a box to type the value */
.sig-numrow { align-items: center; display: flex; gap: 0.45em; min-width: 0; }
.sig-numrow input[type="range"] { flex: 1 1 auto; min-width: 3em; }
/* the slider drawn as on the Spectrum Toolkit: a thin grey track and a coral knob */
.sig-numrow input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; height: 1.3em; padding: 0; width: 100%; }
.sig-numrow input[type="range"]::-webkit-slider-runnable-track { background: #e3e6e8; border-radius: 2px; height: 4px; }
.sig-numrow input[type="range"]::-moz-range-track { background: #e3e6e8; border-radius: 2px; height: 4px; }
.sig-numrow input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none; appearance: none; background: #f56565; border: 2px solid #fff; border-radius: 50%;
	box-shadow: 0 1px 4px rgba(61, 68, 73, 0.35); height: 16px; margin-top: -6px; width: 16px;
}
.sig-numrow input[type="range"]::-moz-range-thumb { background: #f56565; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 1px 4px rgba(61, 68, 73, 0.35); height: 12px; width: 12px; }
.sig-numrow input[type="range"]:focus-visible { outline: none; }
.sig-numrow input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px rgba(245, 101, 101, 0.3); }
.sig-num { -moz-appearance: textfield; flex: 0 0 4.3em; font-size: 0.74em !important; height: 1.95em !important; text-align: right; width: 4.3em; }
.sig-num::-webkit-inner-spin-button, .sig-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.sig-unit { color: #7f888f; font-size: 0.75em; font-variant-numeric: tabular-nums; }

/* Segmented choice (a few options side by side) */
.sig-seg { background: #f5f6f7; border-radius: 999px; display: flex; padding: 3px; }
.sig-seg button {
	background: none !important;
	border: 0 !important;
	border-radius: 999px;
	color: #5f676d !important;
	cursor: pointer;
	flex: 1;
	font-size: 0.76em !important;
	font-weight: 600;
	padding: 0.3em 0.4em !important;
	transition: background-color 0.2s, color 0.2s;
}
.sig-seg button[aria-pressed="true"] { background: #fff !important; box-shadow: 0 1px 4px rgba(61, 68, 73, 0.15); color: #f56565 !important; }

/* On / off switch */
.sig-switch { align-items: center; cursor: pointer; display: flex; justify-content: space-between; margin: 0; }
.sig-switch span { color: #3d4449; font-size: 0.8em; font-weight: 600; }
/* the site hides checkboxes (it draws its own); this one is drawn as a switch, so it must show */
.sig-switch input[type="checkbox"] { display: block; float: none; margin: 0; opacity: 1; z-index: auto; }
.sig-switch input { appearance: none; background: #d2d7d9; border-radius: 999px; cursor: pointer; flex: 0 0 2.2em; height: 1.25em; margin: 0; opacity: 1; position: relative; transition: background-color 0.2s; width: 2.2em; }
.sig-switch input::after { background: #fff; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,.2); content: ""; height: 0.95em; left: 0.15em; position: absolute; top: 0.15em; transition: transform 0.2s; width: 0.95em; }
.sig-switch input:checked { background: #f56565; }
.sig-switch input:checked::after { transform: translateX(0.95em); }

/* The colour swatch: the colour (with its opacity) on squares, and its code beside it */
.sig-swatch {
	background-color: #fff !important;
	background-image: linear-gradient(45deg, #e3e6e8 25%, transparent 25%, transparent 75%, #e3e6e8 75%),
		linear-gradient(45deg, #e3e6e8 25%, transparent 25%, transparent 75%, #e3e6e8 75%) !important;
	background-position: 0 0, 4px 4px !important;
	background-size: 8px 8px !important;
	border: 1px solid rgba(210, 215, 217, 0.9) !important;
	border-radius: 6px;
	cursor: pointer;
	flex: 0 0 auto;
	height: 2.2em !important;
	line-height: 0 !important;
	padding: 3px !important;
	width: 3.2em;
}
.sig-swatch:hover, .sig-swatch:focus-visible { border-color: #f56565 !important; outline: none; }
.sig-swatch-fill { border-radius: 3px; display: block; height: 100%; width: 100%; }
.sig-swatch-fill.is-ink, .sig-auto-ink { background: conic-gradient(#000, #1a3d8f, #b03050, #000); }
.sig-auto-black { background: #000; }

/* The colour pop-up: Colours, Custom, Opacity */
.sig-pop {
	background: #fff; border: 1px solid rgba(210, 215, 217, 0.9); border-radius: 12px; box-shadow: 0 16px 40px rgba(38, 51, 77, 0.22);
	color: #3d4449; padding: 0.7em 0.8em 0.75em; position: absolute; width: 17.5em; z-index: 60;
	animation: sig-pop-in 0.3s ease both;
}
@keyframes sig-pop-in { from { opacity: 0; transform: translateY(-4px); } }
.sig-pop button { box-shadow: none; font-family: "Open Sans", sans-serif; height: auto; letter-spacing: 0; line-height: 1.4; text-transform: none; }
.sig-pop-head { align-items: center; display: flex; justify-content: space-between; margin-bottom: 0.5em; }
.sig-pop-head strong { font-family: "Roboto Slab", serif; font-size: 0.85em; }
.sig-pop-close { background: none !important; border: 0 !important; color: #9aa1a6 !important; cursor: pointer; font-size: 1.1em !important; padding: 0 0.2em !important; }
.sig-pop-close:hover { color: #f56565 !important; }
.sig-pop-tabs { margin-bottom: 0.65em; }
.sig-pop .sig-seg button { align-items: center; display: inline-flex; justify-content: center; padding: 0.35em 0.2em !important; }
.sig-pop-label { align-items: baseline; color: #7f888f; display: flex; font-size: 0.68em; font-weight: 700; gap: 0.4em; letter-spacing: 0.04em; margin: 0.55em 0 0.3em; }
.sig-pop-label output { color: #3d4449; font-weight: 600; letter-spacing: 0; }
.sig-pop-hint { color: #9aa1a6; font-size: 0.68em; line-height: 1.4; margin: 0.6em 0 0; }
.sig-pop .sig-link { font-size: 0.72em !important; margin-top: 0.6em; }
.sig-theme { display: grid; gap: 3px; grid-template-columns: repeat(10, 1fr); }
.sig-theme-pens { grid-template-columns: repeat(10, 1fr); }
.sig-sw {
	aspect-ratio: 1; border: 1px solid rgba(0, 0, 0, 0.12) !important; border-radius: 3px; cursor: pointer; display: block; height: auto !important;
	padding: 0 !important; transition: transform 0.12s, box-shadow 0.12s; width: 100%;
}
.sig-sw:hover, .sig-sw:focus-visible { box-shadow: 0 0 0 2px #fff, 0 0 0 3px #f56565 !important; outline: none; position: relative; transform: scale(1.18); z-index: 1; }
.sig-sw.is-on { box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px #3d4449 !important; }
.sig-auto {
	align-items: center; background: #f5f6f7 !important; border: 1px solid rgba(210, 215, 217, 0.75) !important; border-radius: 6px; color: #3d4449 !important;
	cursor: pointer; display: flex !important; font-size: 0.74em !important; font-weight: 600; gap: 0.6em; margin-bottom: 0.3em; padding: 0.35em 0.6em !important; width: 100%;
}
.sig-auto i { border-radius: 2px; display: block; height: 0.9em; width: 1.6em; }
.sig-auto.is-on, .sig-auto:hover { border-color: #f56565 !important; }
.sig-custom { align-items: center; display: flex; gap: 0.5em; }
.sig-custom input[type="color"] { background: none; border: 1px solid rgba(210, 215, 217, 0.9); border-radius: 6px; cursor: pointer; flex: 0 0 3.2em; height: 2.3em; padding: 2px; }
.sig-custom input[type="text"] { flex: 1; font-family: monospace; font-size: 0.85em; height: 2.3em; }

/* Download and "another photo" */
.sig-actions { align-items: center; display: flex; flex-wrap: wrap; gap: 0.5em 1.2em; justify-content: flex-end; margin-top: 0.4em; }
.sig-download[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }
.sig-link {
	background: none !important;
	border: 0 !important;
	color: #f56565 !important;
	cursor: pointer;
	font-size: 0.85em !important;
	padding: 0 !important;
}
.sig-link:hover { text-decoration: underline; }

/* phones: the download takes the full width */
@media screen and (max-width: 736px) {
	.sig-actions { justify-content: stretch; }
	.sig-download { flex: 1; }
}
