/* Print size calculator: the pixels of a photo on one side, the largest prints drawn to scale on the other,
   and under both a table of the print sizes people order.
   ========================================================================== */

.pst-ps {
	/* The sheet of paper in the drawing: a colour of its own, apart from the prints. */
	--pst-ps-sheet: #B4541A;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: clamp(20px, 3vw, 36px);
}

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

.pst-ps__pair {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
	gap: 10px;
	align-items: end;
}

.pst-ps__between {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 52px;
	color: var(--pst-muted);
	font-family: var(--pst-display);
	font-size: 22px;
	font-weight: 700;
}

.pst-ps__typical .pst-chip {
	min-height: 40px;
	padding: 0 12px;
	font-size: 14px;
}

.pst-ps__photo {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
}

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

/* A size of one's own: two fields and what the print would need and give. */
.pst .pst-ps__custom {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-height: 3.6em;
	font-size: 15px;
}

.pst-ps__custom-need {
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.pst-ps__custom-yours {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 4px 10px;
	color: var(--pst-soft);
}

/* The largest prints at three levels of quality. */
.pst-ps__result {
	display: flex;
	flex-direction: column;
	gap: 16px;
	min-width: 0;
	padding: clamp(16px, 2vw, 24px);
	border: 1px solid var(--pst-line);
	border-radius: 16px;
	background: var(--pst-paper);
}

.pst .pst-ps__levels {
	display: flex;
	flex-direction: column;
	gap: 0;
	padding: 0;
	list-style: none;
}

.pst .pst-ps__level {
	display: grid;
	grid-template-areas: "grade size" "hint alt";
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 0 12px;
	padding: 10px 0;
	border-top: 1px solid var(--pst-line);
}

.pst .pst-ps__level::before {
	content: none;
}

.pst .pst-ps__level:first-child {
	padding-top: 0;
	border-top: 0;
}

.pst-ps__level .pst-ps__grade {
	grid-area: grade;
	align-self: start;
	padding-top: 4px;
}

.pst .pst-ps__size {
	grid-area: size;
	font-family: var(--pst-display);
	font-size: 22px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	letter-spacing: -0.01em;
	line-height: 1.25;
	text-align: right;
	white-space: nowrap;
}

.pst-ps__level:first-child .pst-ps__size {
	font-size: clamp(24px, 3vw, 30px);
}

.pst .pst-ps__alt {
	grid-area: alt;
	color: var(--pst-muted);
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	text-align: right;
	white-space: nowrap;
}

.pst .pst-ps__level .pst-hint {
	grid-area: hint;
}

/* The quality as a word with three bars. */
.pst-ps__grade {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-size: 15px;
	font-weight: 600;
	white-space: nowrap;
}

.pst-ps__bars {
	display: inline-flex;
	align-items: flex-end;
	gap: 2px;
	height: 14px;
}

.pst-ps__bars i {
	display: block;
	width: 4px;
	border-radius: 1px;
	background: var(--pst-line-strong);
}

.pst-ps__bars i:nth-child(1) { height: 6px; }
.pst-ps__bars i:nth-child(2) { height: 10px; }
.pst-ps__bars i:nth-child(3) { height: 14px; }

.pst-ps__grade--fair .pst-ps__bars i:nth-child(-n+1),
.pst-ps__grade--good .pst-ps__bars i:nth-child(-n+2),
.pst-ps__grade--best .pst-ps__bars i {
	background: var(--pst-ink);
}

.pst-ps__grade--low {
	color: #8A2A17;
}

/* The prints to scale, next to a sheet of paper everyone knows. */
.pst .pst-ps__drawing {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 0;
}

.pst-ps__drawing svg {
	display: block;
	width: 100%;
	height: auto;
	max-height: 230px;
	overflow: visible;
}

.pst-ps__print {
	stroke: var(--pst-ink);
	stroke-width: 1.5;
}

.pst-ps__print--fair {
	fill: var(--pst-white);
	stroke-dasharray: 4 4;
}

.pst-ps__print--good {
	fill: var(--pst-tint);
	stroke-dasharray: 8 3;
}

.pst-ps__print--best {
	fill: var(--pst-ink);
}

.pst-ps__sheet {
	fill: none;
	stroke: var(--pst-ps-sheet);
	stroke-width: 2;
}

.pst-ps__tag {
	fill: var(--pst-ink);
	font-family: inherit;
	font-weight: 600;
}

.pst-ps__tag--best {
	fill: var(--pst-paper);
}

.pst-ps__tag--sheet {
	fill: var(--pst-ps-sheet);
}

.pst .pst-ps__facts {
	font-size: 15px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

/* Common print sizes: the whole width of the card. */
.pst-ps__table {
	grid-column: 1 / -1;
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-width: 0;
}

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

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

.pst .pst-ps__sizes thead th {
	padding-top: 0;
	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 .pst-ps__sizes tbody th {
	font-weight: 600;
}

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

.pst-ps__print-name,
.pst-ps__print-size,
.pst-ps__need-sub {
	display: block;
}

.pst-ps__print-size,
.pst-ps__need-sub {
	color: var(--pst-muted);
	font-size: 13px;
	font-weight: 400;
}

.pst-ps__need-sub {
	display: none;
}

.pst-ps__yours {
	white-space: nowrap;
}

.pst-ps__ppi {
	display: inline-block;
	min-width: 5.2em;
	font-weight: 600;
}

.pst .pst-ps__crop {
	color: var(--pst-soft);
}

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

/* A phone: the pixels a size needs move under its name, so the table keeps to three columns. */
@container pst (max-width: 520px) {
	/* Smaller type and tighter cells, so the longest words of every language fit three columns at 360 px. */
	.pst .pst-ps__sizes {
		font-size: 14px;
	}

	.pst .pst-ps__sizes th,
	.pst .pst-ps__sizes td {
		padding: 9px 4px;
	}

	.pst .pst-ps__sizes thead th {
		font-size: 11px;
		letter-spacing: 0.02em;
	}

	.pst-ps__print-size,
	.pst-ps__need-sub {
		font-size: 12px;
	}

	/* The word of a level may go under its bars when it is long ("Zu niedrig"). */
	.pst-ps__yours .pst-ps__grade {
		align-items: flex-start;
		font-size: 13px;
		white-space: normal;
	}

	.pst-ps__yours .pst-ps__bars {
		flex: none;
		margin-top: 1px;
	}

	.pst .pst-ps__need {
		display: none;
	}

	.pst-ps__need-sub {
		display: block;
	}

	.pst-ps__yours {
		white-space: normal;
	}

	.pst-ps__ppi {
		display: block;
		min-width: 0;
	}

	/* The size and its other unit on the right, the line about the quality under both, across the whole width. */
	.pst .pst-ps__level {
		grid-template-areas: "grade size" "grade alt" "hint hint";
	}

	.pst .pst-ps__level .pst-hint {
		margin-top: 4px;
	}

	.pst .pst-ps__size {
		font-size: 19px;
	}

	.pst-ps__level:first-child .pst-ps__size {
		font-size: 22px;
	}
}

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