/**
 * Colour chips and the colour index.
 *
 * Kept in its own file rather than in hj-site.css so it can be loaded only where
 * a chip is actually drawn, and so it stays out of the way of the rest of the
 * theme's stylesheets.
 */

.hj-colour-chip {
	--hj-colour-size: 22px;

	position: relative;
	display: inline-block;
	flex: 0 0 auto;
	box-sizing: border-box;
	width: var(--hj-colour-size);
	height: var(--hj-colour-size);
	border-radius: 50%;
	border: 1px solid rgba(0, 0, 0, .18);
	background-color: transparent;
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	vertical-align: middle;
	/* A real swatch is a rounded photograph; the inner shading keeps it from
	   reading as a flat sticker sitting on top of the page. */
	box-shadow: inset 0 1px 2px rgba(255, 255, 255, .28), inset 0 -2px 4px rgba(0, 0, 0, .18);
}

.hj-colour-chip--sm {
	--hj-colour-size: 16px;
}

.hj-colour-chip--lg {
	--hj-colour-size: 46px;
}

/* Undefined: a hatch, never a grey fill. A flat grey chip looks like a colour
   called grey, which is a wrong answer. Hatching reads as "no answer yet". */
.hj-colour-chip--pending {
	background-image: repeating-linear-gradient(
		45deg,
		#f2f0ed,
		#f2f0ed 3px,
		#d8d3cb 3px,
		#d8d3cb 6px
	);
	border-style: dashed;
	border-color: rgba(0, 0, 0, .28);
	box-shadow: none;
}

.hj-colour-chip__code {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: calc(var(--hj-colour-size) * .34);
	font-weight: 700;
	line-height: 1;
	letter-spacing: -.02em;
	color: #5a5148;
	background: rgba(255, 255, 255, .72);
	border-radius: 50%;
}

/* The code is unreadable at grid size — the hatch alone carries the meaning. */
.hj-colour-chip--sm .hj-colour-chip__code {
	display: none;
}

/* Product page: the Colour row of the spec sheet. */
.hj-colour-spec {
	display: inline-flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.hj-colour-spec__name {
	font-weight: 600;
}

.hj-colour-spec__pending {
	font-size: .82em;
	font-style: italic;
	color: #7a7169;
}

.hj-colour-spec__link {
	font-size: .82em;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* Shop grid: sits between the title and the price. */
.hj-colour-loop {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin: 2px 0 4px;
	font-size: .78em;
	line-height: 1.3;
	color: #6b625a;
}

.hj-colour-loop__name {
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 14em;
}

/* [hj_colours] */
.hj-colours {
	margin: 24px 0;
}

.hj-colours__title {
	margin: 0 0 14px;
	font-size: 1.25em;
}

.hj-colours__list {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.hj-colours__item {
	margin: 0;
	padding: 0;
	list-style: none;
}

.hj-colours__link {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 12px;
	padding: 12px 14px;
	border: 1px solid rgba(0, 0, 0, .1);
	border-radius: 10px;
	background: #fff;
	color: inherit;
	text-decoration: none;
	transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

a.hj-colours__link:hover,
a.hj-colours__link:focus-visible {
	border-color: #d9a441;
	box-shadow: 0 4px 14px rgba(0, 0, 0, .08);
	transform: translateY(-1px);
}

.hj-colours__name {
	display: block;
	font-weight: 600;
	line-height: 1.25;
}

.hj-colours__count {
	display: block;
	margin-top: 2px;
	font-size: .8em;
	color: #7a7169;
}

/* The name and count stack; the chip stays on the left. */
.hj-colours__link > .hj-colour-chip + .hj-colours__name {
	flex: 1 1 auto;
	min-width: 0;
}

.hj-colours__link .hj-colours__count {
	flex: 0 0 100%;
	margin-left: 58px;
	margin-top: -6px;
}

@media (max-width: 480px) {
	.hj-colours__list {
		grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
	}
}
