/* Author index component
 *
 * The design is the Breakdance template's, carried across: an A–Z chip strip
 * over five columns of names, three at tablet and one on a phone. What has
 * changed is that the hardcoded #999/#eee/#ddd greys are the theme's tokens,
 * and none of it needs !important any more — there is no builder specificity
 * left to fight.
 */

.wc-brand-list {
	margin-block: var(--wp--preset--spacing--40);
	font-family: var(--wp--preset--font-family--sans);
	font-size: var(--wp--preset--font-size--sm);
}

/* --- The A–Z strip --- */

.wc-brand-list .brands_index {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--20);
	margin: 0 0 var(--wp--preset--spacing--50);
	padding: 0;
	list-style: none;
}

.wc-brand-list .brands_index li {
	margin: 0;
	/* WooCommerce's own brands.css floats these. It does not load here, but
	   it would the moment someone put the shortcode in post_content. */
	float: none;
}

.wc-brand-list .brands_index a,
.wc-brand-list .brands_index span {
	display: block;
	float: none;
	min-width: 2rem;
	padding: 0.4rem 0.6rem;
	border: 1px solid var(--wp--preset--color--rule);
	line-height: 1;
	text-align: center;
	text-decoration: none;
	color: inherit;
}

/* A letter nobody is filed under: present, so the strip keeps its shape, and
   visibly not a link. */
.wc-brand-list .brands_index span {
	color: var(--wp--preset--color--muted);
	opacity: 0.45;
}

.wc-brand-list .brands_index a:hover,
.wc-brand-list .brands_index a:focus-visible {
	border-color: var(--wp--preset--color--foreground);
}

/* --- The names --- */

.wc-brand-list .brands {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--20) var(--wp--preset--spacing--40);
	margin: 0 0 var(--wp--preset--spacing--60);
	padding: 0;
	list-style: none;
}

/* The last list ends the page, and the footer sets the gap after it. It is
   not the list's last child — the hidden Back to top link follows it — so the
   page shell's trim in layout.css does not reach it. */
.wc-brand-list .brands:last-of-type {
	margin-block-end: 0;
}

@media (max-width: 64rem) {
	.wc-brand-list .brands {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 37.5rem) {
	.wc-brand-list .brands {
		grid-template-columns: minmax(0, 1fr);
	}
}

.wc-brand-list .brands li {
	margin: 0;
	padding: 0;
	float: none;
	list-style: none;
}

.wc-brand-list .brands li.letter {
	grid-column: 1 / -1;
	margin-block: var(--wp--preset--spacing--40) var(--wp--preset--spacing--20);
	padding-block-end: var(--wp--preset--spacing--20);
	border-block-end: 1px solid var(--wp--preset--color--rule);
}

.wc-brand-list .brands li.letter h3 {
	margin: 0;
	font-family: var(--wp--preset--font-family--sans);
	font-size: var(--wp--preset--font-size--sm);
	font-weight: 600;
	letter-spacing: var(--wp--custom--tracking--caps);
	color: var(--wp--preset--color--muted);
}

/* Names, so the same two greys as every other author name on the site:
   mid grey dimming to light grey, no underline. */
.wc-brand-list .brands a {
	color: var(--wp--preset--color--muted);
	text-decoration: none;
	line-height: 1.4;
}

.wc-brand-list .brands a:hover,
.wc-brand-list .brands a:focus-visible {
	color: var(--wp--preset--color--light);
}

/* The shortcode emits a "↑ Top" link after every letter group. The redesign
   hid it — 25 of them down the page is noise, and the A–Z strip is the way
   back. Kept reachable for anyone navigating by keyboard or screen reader. */
.wc-brand-list a.top {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

.wc-brand-list a.top:focus {
	position: static;
	width: auto;
	height: auto;
	clip-path: none;
	display: inline-block;
	margin-block-end: var(--wp--preset--spacing--40);
	padding: 0.25rem 0.5rem;
	border: 1px solid var(--wp--preset--color--rule);
}
