/* Blur image: the picture as it will be saved, with the areas the visitor marks drawn over it, on one side;
   what to blur, the effect, its strength and the download on the other.
   The layout of the two sides is the shared one of the photo tools (.pst-photo in assets/css/tools.css).
   ========================================================================== */

/* The whole picture, fitted into the box whatever its shape. */
.pst-blur__view {
	--pst-blur-tall: 440px;
	display: grid;
	place-items: center;
	min-height: 240px;
	padding: 14px;
	border-radius: 20px;
	background: var(--pst-ink);
	overflow: hidden;
}

/* The picture and, exactly over it, the layer the areas sit in. The script sets the shape of the picture. */
.pst-blur__frame {
	position: relative;
	width: min(100%, calc(var(--pst-blur-tall) * var(--pst-blur-ratio, 1.5)));
	aspect-ratio: var(--pst-blur-ratio, 1.5);
}

.pst-blur__frame canvas {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 6px;
	/* A see-through picture shows the usual grey squares behind it. */
	background: #FFFFFF repeating-conic-gradient(#D9DDE4 0 25%, transparent 0 50%) 0 0 / 16px 16px;
}

.pst-blur__areas {
	position: absolute;
	inset: 0;
	border-radius: 6px;
	cursor: crosshair;
	/* A finger on the picture draws and moves areas: it does not scroll the page. */
	touch-action: none;
	-webkit-user-select: none;
	user-select: none;
}

/* An area: a light dashed outline with a dark one around it, so it shows on any picture. */
.pst-blur__area {
	position: absolute;
	border: 2px dashed #FFFFFF;
	box-shadow: 0 0 0 1px rgba(15, 27, 51, 0.6), inset 0 0 0 1px rgba(15, 27, 51, 0.6);
	cursor: move;
}

.pst-blur__area[data-shape="oval"] {
	border-radius: 50%;
}

.pst-blur__area.is-on {
	border-style: solid;
}

.pst .pst-blur__area:focus-visible {
	outline: 3px solid #FFFFFF;
	outline-offset: 3px;
}

/* The corners of the area that is worked on: small dots with a larger place to grab around them. */
.pst-blur__handle {
	position: absolute;
	display: none;
	width: 16px;
	height: 16px;
	border: 2px solid var(--pst-ink);
	border-radius: 50%;
	background: #FFFFFF;
}

.pst-blur__area.is-on .pst-blur__handle {
	display: block;
}

.pst-blur__handle::after {
	content: "";
	position: absolute;
	inset: -13px;
}

.pst-blur__handle[data-corner="nw"] { top: -9px; left: -9px; cursor: nwse-resize; }
.pst-blur__handle[data-corner="ne"] { top: -9px; right: -9px; cursor: nesw-resize; }
.pst-blur__handle[data-corner="se"] { right: -9px; bottom: -9px; cursor: nwse-resize; }
.pst-blur__handle[data-corner="sw"] { bottom: -9px; left: -9px; cursor: nesw-resize; }

/* "Show original": a switch that looks pressed while the original is shown. */
.pst .pst-blur__compare[aria-pressed="true"] {
	padding: 0 12px;
	border-radius: 10px;
	background: var(--pst-ink);
	color: var(--pst-paper);
	text-decoration: none;
}

.pst .pst-blur__hint {
	min-height: 3.1em;
}

/* The group about areas is there only while areas are used. */
.pst .pst-blur__parts[hidden] {
	display: none;
}

/* Under the picture: one line of small print, then the two buttons in a row. */
.pst .pst-blur__status {
	flex: 1 1 100%;
}

/* The buttons for one more area and one less, side by side. */
.pst-blur__row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0 20px;
}

/* The shape buttons carry a small picture of the shape. */
.pst-blur__glyph {
	flex: none;
	width: 16px;
	height: 13px;
	border: 2px solid currentColor;
	border-radius: 3px;
}

.pst-blur__glyph--oval {
	border-radius: 50%;
}

/* The slider with its number at the end. */
.pst-blur__strength {
	display: flex;
	align-items: center;
	gap: 12px;
}

.pst-blur__strength output {
	flex: none;
	min-width: 2.2em;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.pst-blur .pst-drop {
	flex: none;
}

@container pst (max-width: 450px) {
	.pst-blur__view {
		--pst-blur-tall: 340px;
		min-height: 180px;
		padding: 10px;
	}

	.pst .pst-blur__hint {
		min-height: 4.65em;
	}
}
