/* Pixels to inches converter: four linked fields on one side, the resolution and the same value at other
   resolutions on the other.
   ========================================================================== */

.pst-px {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
	gap: clamp(20px, 3vw, 36px);
}

.pst-px__main {
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-width: 0;
}

/* Pixels and the main length side by side in large type, the other two lengths under them. */
.pst-px__fields {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 14px;
}

.pst-px__big .pst-input {
	height: 68px;
	padding-left: 16px;
	font-family: var(--pst-display);
	font-size: clamp(24px, 3vw, 30px);
	font-weight: 700;
	letter-spacing: -0.01em;
}

.pst-px__big .pst-unit {
	font-size: 17px;
	font-weight: 600;
}

.pst-px__big.pst-field {
	font-size: 16px;
}

/* The field the visitor typed in stands out; the fields worked out from it are quieter. */
.pst-px .pst-input {
	border-color: var(--pst-ink);
}

.pst-px .pst-input.is-result {
	border-color: var(--pst-line-strong);
	background-color: var(--pst-paper);
}

.pst-px .pst-input.is-result:hover {
	border-color: var(--pst-ink);
}

.pst-input[aria-invalid="true"] {
	border-color: #8A2A17;
	background-color: #FBEAE5;
}

/* The formula of the way the visitor went: the sum written out. */
.pst .pst-px__formula {
	padding: 12px 14px;
	border-radius: 12px;
	background: var(--pst-tint);
	font-size: 16px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	overflow-wrap: anywhere;
}

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

/* The resolution and the other resolutions. */
.pst-px__side {
	display: flex;
	flex-direction: column;
	gap: 14px;
	min-width: 0;
	padding: clamp(16px, 2vw, 24px);
	border: 1px solid var(--pst-line);
	border-radius: 16px;
	background: var(--pst-paper);
}

.pst-px__ppi {
	max-width: 220px;
}

.pst-px__presets .pst-chip {
	min-height: 40px;
	padding: 0 12px;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
}

.pst .pst-px__use {
	min-height: 1.4em;
	margin-top: -4px;
}

.pst-px__others {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin-top: 4px;
	padding-top: 16px;
	border-top: 1px solid var(--pst-line);
}

.pst .pst-px__table {
	width: 100%;
	margin: 0;
	border: 0;
	border-collapse: collapse;
	font-size: 15px;
	font-variant-numeric: tabular-nums;
}

.pst .pst-px__table th,
.pst .pst-px__table td {
	padding: 4px 8px;
	border: 0;
	border-bottom: 1px solid var(--pst-line);
	background: none;
	text-align: left;
	vertical-align: middle;
}

.pst .pst-px__table thead th {
	padding-top: 0;
	padding-bottom: 6px;
	color: var(--pst-muted);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	border-bottom-color: var(--pst-line-strong);
}

.pst-px__table tbody tr:last-child > * {
	border-bottom: 0;
}

.pst .pst-px__table td {
	text-align: right;
	font-weight: 600;
}

.pst .pst-px__table thead th:last-child {
	text-align: right;
}

/* A row is a button that sets its resolution. */
.pst .pst-px__pick {
	display: inline-flex;
	align-items: center;
	min-height: 36px;
	margin: 0 0 0 -8px;
	padding: 0 8px;
	border: 0;
	border-radius: 8px;
	background: none;
	color: var(--pst-ink);
	font: inherit;
	font-weight: 500;
	text-decoration: underline;
	text-decoration-color: var(--pst-line-strong);
	text-underline-offset: 3px;
	cursor: pointer;
}

.pst .pst-px__pick:hover {
	background: var(--pst-tint);
	text-decoration-color: currentColor;
}

.pst .pst-px__table tr.is-current > * {
	background: var(--pst-white);
}

.pst .pst-px__table tr.is-current .pst-px__pick {
	font-weight: 700;
	text-decoration: none;
}

@container pst (max-width: 760px) {
	.pst-px {
		grid-template-columns: minmax(0, 1fr);
	}
}

@container pst (max-width: 420px) {
	.pst-px__fields {
		gap: 12px 10px;
	}

	.pst-px__big .pst-input {
		height: 60px;
		padding-left: 12px;
		font-size: 20px;
	}

	.pst-px__big .pst-unit {
		right: 12px;
		font-size: 15px;
	}

	.pst .pst-px__formula {
		font-size: 15px;
	}
}

@supports not (container-type: inline-size) {
	@media (max-width: 820px) {
		.pst-px {
			grid-template-columns: minmax(0, 1fr);
		}
	}
}
