/**
 * Mobile catalogue (auron-theme/mobile-catalogue).
 *
 * Lives inside the mobile menu overlay, which is dark in both colour schemes;
 * the --auron-menu-* tokens come from that overlay (block-styles.css, "Mobile
 * menu") and the fallbacks here are the same values, for the editor preview.
 *
 * Two states:
 *   - no `.is-ready` (no JavaScript): metals stacked under headings, every
 *     row a link, every panel open beneath its row;
 *   - `.is-ready`: one metal behind the tabs, rows drill into their panel.
 */

.auron-mcat {
	--auron-mcat-fg: var(--auron-menu-fg, #F4F1EC);
	--auron-mcat-dim: var(--auron-menu-dim, #B9B3AA);
	--auron-mcat-gold: var(--auron-menu-gold, #BEA98E);
	--auron-mcat-gold-soft: var(--auron-menu-gold-soft, rgb(190 169 142 / 0.45));
	--auron-mcat-rule: var(--auron-menu-rule, rgb(190 169 142 / 0.16));

	width: 100%;
	color: var(--auron-mcat-fg);
}

/* Resets carry no specificity, so every class rule below wins over them.
   Links and buttons share one row style, so both size by their border box. */
:where(.auron-mcat),
:where(.auron-mcat) :where(*, *::before, *::after) {
	box-sizing: border-box;
}

:where(.auron-mcat) :where(ul) {
	margin: 0;
	padding: 0;
	list-style: none;
}

:where(.auron-mcat) :where(button) {
	margin: 0;
	padding: 0;
	font: inherit;
	letter-spacing: inherit;
	text-align: start;
	color: inherit;
	background: transparent;
	border: 0;
	border-radius: 0;
	cursor: pointer;
}

:where(.auron-mcat) :where(a) {
	color: inherit;
	text-decoration: none;
}

.auron-mcat a:focus-visible,
.auron-mcat button:focus-visible {
	outline: 1px solid var(--auron-mcat-gold);
	outline-offset: -1px;
}

.auron-mcat__chevron,
.auron-mcat__arrow {
	flex: none;
	width: 1rem;
	height: 1rem;
	color: var(--auron-mcat-gold);
}

/* --- metal tabs ---------------------------------------------------------- */

.auron-mcat__tabs {
	display: none;
	margin-top: 0.75rem;
	border-bottom: 1px solid var(--auron-mcat-rule);
}

.auron-mcat.is-ready .auron-mcat__tabs {
	display: flex;
}

/* Sized by their labels, not in equal thirds: "Numizmatika" is twice as long
   as "Zlato", and three equal tabs ran it into its neighbour on a phone. */
.auron-mcat__tab {
	position: relative;
	flex: 1 1 auto;
	min-height: 3rem;
	padding-inline: 0.4rem;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.1em;
	white-space: nowrap;
	text-transform: uppercase;
	text-align: center;
	color: var(--auron-mcat-dim);
	transition: color 0.2s ease;
}

.auron-mcat__tab[aria-selected="true"] {
	color: var(--auron-mcat-gold);
}

/* The selected tab's underline sits on the tab list's own rule. */
.auron-mcat__tab[aria-selected="true"]::after {
	content: "";
	position: absolute;
	inset-inline: 0;
	bottom: -1px;
	height: 2px;
	background: var(--auron-mcat-gold);
}

@media (hover: hover) {
	.auron-mcat__tab[aria-selected="false"]:hover {
		color: var(--auron-mcat-fg);
	}
}

/* --- metals -------------------------------------------------------------- */

.auron-mcat__metal-title {
	margin: 1.5rem 0 0;
	font-family: inherit;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--auron-mcat-gold);
}

.auron-mcat.is-ready .auron-mcat__metal-title {
	display: none;
}

.auron-mcat.is-ready .auron-mcat__metal:not(.is-current) {
	display: none;
}

/* --- product-type rows ----------------------------------------------------- */

.auron-mcat__type {
	border-bottom: 1px solid var(--auron-mcat-rule);
}

.auron-mcat__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	width: 100%;
	min-height: 3.25rem;
	padding-block: 0.95rem;
	font-size: 1.1875rem;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0.01em;
	color: var(--auron-mcat-fg);
	transition: color 0.2s ease;
}

.auron-mcat__row:hover {
	color: var(--auron-mcat-gold);
}

.auron-mcat__row--drill {
	display: none;
}

.auron-mcat.is-ready .has-panel > .auron-mcat__row--link {
	display: none;
}

.auron-mcat.is-ready .has-panel > .auron-mcat__row--drill {
	display: flex;
}

/* --- drill-down panel ------------------------------------------------------ */

.auron-mcat__panel {
	padding-bottom: 1.25rem;
}

.auron-mcat__back {
	display: none;
}

.auron-mcat.is-ready .auron-mcat__panel {
	display: none;
}

.auron-mcat.is-ready .auron-mcat__type.is-open > .auron-mcat__panel {
	display: block;
}

.auron-mcat.is-ready .auron-mcat__back {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	width: 100%;
	min-height: 3.25rem;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--auron-mcat-gold);
	border-bottom: 1px solid var(--auron-mcat-rule);
}

.auron-mcat.is-ready .auron-mcat__back .auron-mcat__chevron {
	margin-inline-start: -0.125rem;
}

/* One type open: its panel takes the list's place. */
.auron-mcat.is-drilled .auron-mcat__type:not(.is-open),
.auron-mcat.is-drilled .auron-mcat__type.is-open > .auron-mcat__row,
.auron-mcat.is-drilled .auron-mcat__metal-all {
	display: none;
}

.auron-mcat.is-drilled .auron-mcat__type.is-open {
	border-bottom: 0;
}

.auron-mcat__all {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	min-height: 3.25rem;
	padding-block: 0.75rem;
	font-size: 1.0625rem;
	font-weight: 500;
	color: var(--auron-mcat-fg);
	border-bottom: 1px solid var(--auron-mcat-rule);
	transition: color 0.2s ease;
}

.auron-mcat__all > span:first-child {
	flex: 1 1 auto;
}

.auron-mcat__all:hover {
	color: var(--auron-mcat-gold);
}

.auron-mcat__count {
	flex: none;
	font-size: 0.875rem;
	font-weight: 400;
	font-variant-numeric: tabular-nums;
	color: var(--auron-mcat-dim);
}

.auron-mcat__facet-title {
	margin: 1.375rem 0 0.625rem;
	font-family: inherit;
	font-size: 0.75rem;
	font-weight: 600;
	line-height: 1.4;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--auron-mcat-dim);
}

/* Weights: short labels, so a grid of chips reads at a glance and keeps the
   whole range on one screen. */
.auron-mcat__chips {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(4.75rem, 1fr));
	gap: 0.5rem;
}

.auron-mcat__chips a {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 2.75rem;
	padding: 0.25rem 0.5rem;
	font-size: 0.9375rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	color: var(--auron-mcat-fg);
	border: 1px solid var(--auron-mcat-gold-soft);
	transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.auron-mcat__chips a:hover {
	color: var(--auron-mcat-gold);
	border-color: var(--auron-mcat-gold);
	background: rgb(190 169 142 / 0.08);
}

/* Makers and series: names with the number of products beside them. */
.auron-mcat__list a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	min-height: 2.875rem;
	padding-block: 0.5rem;
	font-size: 1rem;
	color: var(--auron-mcat-fg);
	border-bottom: 1px solid var(--auron-mcat-rule);
	transition: color 0.2s ease;
}

.auron-mcat__list li:last-child a {
	border-bottom: 0;
}

.auron-mcat__list a:hover {
	color: var(--auron-mcat-gold);
}

/* --- "the whole metal" link ------------------------------------------------ */

.auron-mcat__metal-all {
	display: flex;
	align-items: center;
	gap: 0.625rem;
	min-height: 3rem;
	padding-block: 0.75rem;
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--auron-mcat-gold);
	border-bottom: 1px solid var(--auron-mcat-rule);
}

.auron-mcat__metal-all:hover {
	color: var(--auron-mcat-fg);
}

/* --- motion ---------------------------------------------------------------- */

@media not (prefers-reduced-motion) {
	.auron-mcat.is-ready .auron-mcat__type.is-open > .auron-mcat__panel {
		animation: auron-mcat-in 0.28s cubic-bezier(0.2, 0.7, 0.2, 1) both;
	}

	.auron-mcat.is-ready .auron-mcat__metal.is-current {
		animation: auron-mcat-fade 0.2s ease-out both;
	}
}

@keyframes auron-mcat-in {
	from {
		opacity: 0;
		transform: translateX(1.5rem);
	}

	to {
		opacity: 1;
		transform: none;
	}
}

@keyframes auron-mcat-fade {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}
