/* Compress image to KB: the compressed photo on one side; the size, the result 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 new file at its own size (never blown up), fitted into the box when it is larger. */
.pst-kb__view {
	--pst-kb-tall: 440px;
	position: relative;
	display: grid;
	place-items: center;
	min-height: 240px;
	padding: 14px;
	border-radius: 20px;
	background: var(--pst-ink);
	overflow: hidden;
}

.pst-kb__frame {
	width: min(100%, var(--pst-kb-w, 600px), calc(var(--pst-kb-tall) * var(--pst-kb-ratio, 1.5)));
	aspect-ratio: var(--pst-kb-ratio, 1.5);
}

.pst-kb__frame img,
.pst-kb__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;
}

/* While the tool tries qualities: a veil with a turning ring. */
.pst-kb__busy {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	margin: 0;
	background: rgba(15, 27, 51, 0.62);
	color: #FFFFFF;
	font-weight: 600;
}

.pst-kb__spinner {
	width: 20px;
	height: 20px;
	border: 2.5px solid rgba(255, 255, 255, 0.35);
	border-top-color: #FFFFFF;
	border-radius: 50%;
	animation: pst-kb-turn 0.8s linear infinite;
}

@keyframes pst-kb-turn {
	to {
		transform: rotate(1turn);
	}
}

@media (prefers-reduced-motion: reduce) {
	.pst-kb__spinner {
		animation-duration: 2.4s;
	}
}

.pst .pst-kb__compare[aria-pressed="true"] {
	padding: 0 12px;
	border-radius: 10px;
	background: var(--pst-ink);
	color: var(--pst-paper);
	text-decoration: none;
}

.pst .pst-kb__status {
	flex: 1 1 100%;
}

/* The size: a number and its unit side by side, the quick sizes under them. */
.pst-kb__size {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 8px;
	align-items: stretch;
}

.pst-kb__size .pst-input {
	font-size: 20px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.pst-kb__units .pst-seg__btn {
	min-width: 52px;
}

.pst-kb__quick .pst-chip {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.pst .pst-hint.is-bad {
	color: #8A2A17;
	font-weight: 600;
}

/* The result: the original weight, an arrow and the new one, with the change in per cent. */
.pst-kb__result {
	display: grid;
	gap: 8px;
	padding: 14px 16px;
	border-radius: 16px;
	background: var(--pst-tint);
}

.pst-kb__weights {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 6px 12px;
}

.pst .pst-kb__weight {
	display: grid;
	gap: 0;
	margin: 0;
	line-height: 1.2;
}

.pst-kb__weight span {
	color: var(--pst-muted);
	font-size: 13px;
}

.pst-kb__weight strong {
	font-size: 22px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.pst-kb__weight--new strong {
	font-size: 28px;
}

.pst-kb__arrow {
	align-self: flex-end;
	padding-bottom: 6px;
	color: var(--pst-muted);
	line-height: 0;
}

.pst-kb__change {
	align-self: flex-end;
	margin-left: auto;
	margin-bottom: 4px;
	padding: 3px 10px;
	border-radius: 999px;
	background: var(--pst-white);
	font-size: 14px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.pst-kb__change.is-down {
	background: #D7F5E3;
	color: #0B5A33;
}

.pst .pst-kb__verdict {
	margin: 0;
	font-size: 15px;
}

.pst .pst-kb__verdict.is-ok {
	font-weight: 600;
}

.pst .pst-kb__verdict.is-bad {
	color: #8A2A17;
	font-weight: 600;
}

.pst .pst-kb__keep {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.pst-kb__sides .pst-chip {
	font-variant-numeric: tabular-nums;
}

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

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

	.pst-kb__weight--new strong {
		font-size: 24px;
	}
}
