/*
 * The size-guide block: a row of brand tabs over one table.
 *
 * No script. Each panel follows its own radio, so `:checked + label + section`
 * decides what is on screen; the row of tabs is flex order pulling every label
 * ahead of every panel. Adding a table to the library adds a tab here without
 * touching this file.
 */

.ps-size-guide-block {
	margin-block: var(--ps-space-6);
}

.ps-size-guide-block__title {
	margin: 0 0 var(--ps-space-4);
	font-size: clamp(20px, 2.2vw, 26px);
	letter-spacing: -.02em;
}

.ps-size-guide-block__set {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ps-space-2) var(--ps-space-5);
	margin: 0;
	padding: 0;
	border: 0;
}

/*
 * Off-screen rather than `display: none`: a hidden radio is not focusable, and
 * the arrow keys moving between tabs are the radio group's own behaviour.
 */
.ps-size-guide-block__radio {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	border: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.ps-size-guide-block__tab {
	order: 1;
	position: relative;
	padding: var(--ps-space-2) 0;
	border-bottom: 2px solid transparent;
	color: var(--ps-color-text-muted);
	font-size: clamp(14px, 1.5vw, 17px);
	font-weight: 800;
	letter-spacing: .04em;
	text-transform: uppercase;
	white-space: nowrap;
	cursor: pointer;
	transition: color var(--ps-transition-fast), border-color var(--ps-transition-fast);
}

@media (hover: hover) {
	.ps-size-guide-block__tab:hover {
		color: var(--ps-color-ink);
	}
}

.ps-size-guide-block__radio:checked + .ps-size-guide-block__tab {
	border-bottom-color: var(--ps-color-brand-600);
	color: var(--ps-color-ink);
}

.ps-size-guide-block__radio:focus-visible + .ps-size-guide-block__tab {
	outline: 2px solid var(--ps-color-brand-600);
	outline-offset: 3px;
	border-radius: 2px;
}

/*
 * Every panel occupies the same slot in the flex row — full width, after the
 * tabs — so switching cannot move anything above it.
 */
.ps-size-guide-block__panel {
	order: 2;
	flex: 0 0 100%;
	display: none;
	margin-block-start: var(--ps-space-4);
}

.ps-size-guide-block__radio:checked + .ps-size-guide-block__tab + .ps-size-guide-block__panel {
	display: block;
}

.ps-size-guide-block__panel .ps-size-table-wrap {
	margin-bottom: 0;
}

.ps-size-guide-block__note {
	margin: var(--ps-space-4) 0 0;
	color: var(--ps-color-text-muted);
	font-size: 14px;
}

/* The tabs become a single scrolling row before they start wrapping raggedly. */
@media (max-width: 640px) {
	.ps-size-guide-block__set {
		column-gap: var(--ps-space-4);
	}

	.ps-size-guide-block__tab {
		font-size: 13px;
		letter-spacing: .02em;
	}
}
