/* browse.css — departments, section tiles, and the filter rail.
 *
 * Tokens only: this file defines no colour of its own, so the 2026-08-16 Armory reskin
 * seam (assets/css/tokens.css) still works as the single palette.
 *
 * The reference Chris gave was a BigCommerce store's tile grid — that is the STRUCTURE
 * being adopted (picture tiles, a label plate, sections above the grid, a counted
 * category tree). The skin stays this shop's: gold on void, Cinzel plates, hairline
 * rules. A blue chip on white would be a different company's storefront.
 */

/* ------------------------------------------------------------------ department grid */

.cj-deck--depts { margin-block: var(--space-xl) var(--space-2xl); }

.cj-deck-sub {
	font-size: var(--text-sm);
	color: var(--color-muted);
	margin-block-start: var(--space-2xs);
}

.cj-dept-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--space-lg);
}

.cj-dept-grid--sub {
	grid-template-columns: repeat(auto-fill, minmax(11rem, 1fr));
	gap: var(--space-md);
}

.cj-dept-link {
	display: block;
	position: relative;
	text-decoration: none;
	color: inherit;
	border: var(--rule-hair) solid var(--color-rule-2);
	background: var(--color-paper-2);
	transition: border-color var(--dur-short) var(--ease-out),
	            transform var(--dur-short) var(--ease-out);
}

.cj-dept-media {
	display: block;
	position: relative;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: var(--color-paper-3);
}

.cj-dept-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	/* The supplier photography is shot on white. On a void ground an untreated cut-out
	   reads as a bright rectangle rather than an object, so the tile is dimmed at rest
	   and comes up to full on hover — the picture is the affordance. */
	filter: saturate(0.92) brightness(0.86);
	transition: filter var(--dur-short) var(--ease-out), transform var(--dur-long) var(--ease-out);
}

/* No photograph in this department: an initial cut in the display face, not a stock image. */
.cj-dept-noimg {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	font-family: var(--font-display);
	font-size: 3.5rem;
	font-weight: 700;
	color: var(--color-accent-deep);
	background:
		repeating-linear-gradient(
			135deg,
			transparent 0 10px,
			var(--color-rule-2) 10px 11px
		);
}

/* The plate — an engraved label sitting on the picture, not a floating chip. */
.cj-dept-plate {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-sm);
	padding: var(--space-sm) var(--space-md);
	background: linear-gradient(to top, rgba(13, 11, 22, 0.94) 55%, rgba(13, 11, 22, 0));
	border-block-start: var(--rule-hair) solid var(--color-rule-2);
}

.cj-dept-name {
	font-family: var(--font-display);
	font-size: var(--text-sm);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--color-gold-hi);
	line-height: 1.2;
}

.cj-dept-count {
	font-family: var(--font-mono);
	font-size: var(--text-xs);
	font-variant-numeric: tabular-nums;
	color: var(--color-muted);
	flex: 0 0 auto;
}

.cj-dept-link:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 3px; }

@media (hover: hover) {
	.cj-dept-link:hover { border-color: var(--color-accent); }
	.cj-dept-link:hover .cj-dept-img { filter: none; transform: scale(1.03); }
}

@media (prefers-reduced-motion: reduce) {
	.cj-dept-img, .cj-dept-link { transition: none; }
	.cj-dept-link:hover .cj-dept-img { transform: none; }
}

.cj-dept--sub .cj-dept-name { font-size: var(--text-xs); }

/* ------------------------------------------------------------------ sections band */

.cj-subcats { margin-block-end: var(--space-xl); }

.cj-subcats-title {
	font-family: var(--font-display);
	font-size: var(--text-md);
	color: var(--color-gold-hi);
	letter-spacing: 0.02em;
	margin-block-end: var(--space-md);
	padding-block-end: var(--space-xs);
	border-block-end: var(--rule-hair) solid var(--color-rule);
}

/* ------------------------------------------------------------------ browse layout */

.cj-browse {
	display: grid;
	grid-template-columns: 15rem minmax(0, 1fr);
	gap: var(--space-xl);
	align-items: start;
}

.cj-browse-main { min-width: 0; }

.cj-rail { position: sticky; top: var(--space-md); }

.cj-rail-block { margin-block-end: var(--space-xl); }

.cj-rail-title {
	font-family: var(--font-display);
	font-size: var(--text-sm);
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--color-accent);
	margin-block-end: var(--space-sm);
	padding-block-end: var(--space-xs);
	border-block-end: var(--rule-hair) solid var(--color-rule);
}

.cj-facet-tree { list-style: none; margin: 0; padding: 0; }
.cj-facet-tree--sub {
	margin-inline-start: var(--space-sm);
	padding-inline-start: var(--space-sm);
	border-inline-start: var(--rule-hair) solid var(--color-rule-2);
}

.cj-facet-link {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: var(--space-sm);
	padding: 5px 0;
	text-decoration: none;
	color: var(--color-ink-2);
	font-size: var(--text-sm);
	line-height: 1.35;
}

.cj-facet-count {
	font-family: var(--font-mono);
	font-size: var(--text-xs);
	font-variant-numeric: tabular-nums;
	color: var(--color-muted);
	flex: 0 0 auto;
}

.cj-facet-node.is-current > .cj-facet-link { color: var(--color-gold-hi); font-weight: 700; }
.cj-facet-node.is-current > .cj-facet-link .cj-facet-count { color: var(--color-accent); }

@media (hover: hover) {
	.cj-facet-link:hover { color: var(--color-accent); }
}
.cj-facet-link:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

.cj-rail-reset { margin-block-start: var(--space-sm); font-size: var(--text-xs); }
.cj-rail-reset a { color: var(--color-muted); }

/* ----------------------------------------------------------------- colour facet */

/*
 * A colour list, not a colour grid. Bare swatches look tidy and are unusable here:
 * "Stormy Gray" and "Silver" are two greys a shopper cannot tell apart at 14px, and
 * the count is what tells them whether a colour is worth clicking. So each row is
 * ink + name + count, and the ink is the supporting detail rather than the whole
 * control. Same row grammar as the department tree directly above it.
 */

.cj-facet-colors { list-style: none; margin: 0; padding: 0; }

.cj-facet-color {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	padding: 5px 0;
	text-decoration: none;
	color: var(--color-ink-2);
	font-size: var(--text-sm);
	line-height: 1.35;
}

.cj-facet-color-ink {
	inline-size: 13px;
	block-size: 13px;
	flex: 0 0 auto;
	border-radius: 50%;
	/* Anodized aluminium is shiny; a flat disc reads as a paint chip. */
	box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.35), inset 0 1px 1px rgb(255 255 255 / 0.28);
}

.cj-facet-color-name { flex: 1 1 auto; min-inline-size: 0; }

.cj-facet-color-count {
	font-family: var(--font-mono);
	font-size: var(--text-xs);
	font-variant-numeric: tabular-nums;
	color: var(--color-muted);
	flex: 0 0 auto;
}

.cj-facet-color.is-on { color: var(--color-gold-hi); font-weight: 700; }
.cj-facet-color.is-on .cj-facet-color-count { color: var(--color-accent); }
.cj-facet-color.is-on .cj-facet-color-ink { box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.35), 0 0 0 2px var(--color-accent); }

@media (hover: hover) {
	.cj-facet-color:hover { color: var(--color-accent); }
}
.cj-facet-color:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* ------------------------------------------------------------------ price facet */

.cj-facet-hint {
	font-size: var(--text-xs);
	color: var(--color-muted);
	margin-block-end: var(--space-sm);
	line-height: 1.4;
}

.cj-facet-range { display: flex; align-items: center; gap: var(--space-xs); }

.cj-facet-range input {
	inline-size: 100%;
	min-inline-size: 0;
	padding: 6px 8px;
	font-family: var(--font-mono);
	font-size: var(--text-xs);
	font-variant-numeric: tabular-nums;
	color: var(--color-ink);
	background: var(--color-paper);
	border: var(--rule-hair) solid var(--color-rule-strong);
	border-radius: var(--radius-sm);
}

.cj-facet-range label { flex: 1 1 0; min-inline-size: 0; }
.cj-facet-dash { color: var(--color-muted); flex: 0 0 auto; }

.cj-facet-check {
	display: flex;
	align-items: center;
	gap: var(--space-xs);
	margin-block-start: var(--space-sm);
	font-size: var(--text-sm);
	color: var(--color-ink-2);
	cursor: pointer;
}

.cj-facet-actions {
	display: flex;
	align-items: center;
	gap: var(--space-md);
	margin-block-start: var(--space-md);
}

.cj-facet-clear { font-size: var(--text-xs); color: var(--color-muted); }

/* ------------------------------------------------------------------ responsive */

@media (max-width: 64rem) {
	.cj-dept-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.cj-browse { grid-template-columns: 1fr; gap: var(--space-lg); }
	.cj-rail { position: static; }
	/* On a phone the rail is a preamble, not a sidebar — the tree stays useful but the
	   product grid must not be pushed a full screen down, so the tree lies flat. */
	.cj-facet-tree { display: flex; flex-wrap: wrap; gap: var(--space-xs) var(--space-md); }
	.cj-facet-tree--sub { inline-size: 100%; border-inline-start: 0; margin-inline-start: 0; padding-inline-start: 0; }
	.cj-facet-price { max-inline-size: 22rem; }
}

@media (max-width: 40rem) {
	.cj-dept-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-md); }
	.cj-dept-grid--sub { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.cj-dept-name { font-size: var(--text-xs); }
}
