/* Header — materials library chrome */

.bm-topbar {
	background: var(--bm-surface);
	border-bottom: 1px solid var(--bm-line);
	font-size: 0.8125rem;
	color: var(--bm-muted);
}

.bm-topbar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	width: var(--bm-container);
	margin-inline: auto;
	min-height: 2.25rem;
	padding-block: 0.35rem;
}

.bm-topbar__left,
.bm-topbar__right {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 0.75rem 1rem;
	min-width: 0;
}

.bm-topbar__right {
	justify-content: flex-end;
	margin-left: auto;
}

.bm-topbar__widget {
	display: inline-flex;
	align-items: center;
}

.bm-topbar__label {
	font-weight: 700;
	color: var(--bm-ink);
}

.bm-topbar a {
	font-weight: 600;
	color: inherit;
}

.bm-topbar a:hover {
	color: var(--bm-brand-deep);
}

.bm-topbar .widget ul {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.bm-topbar .widget li {
	margin: 0;
}

.bm-promo {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	min-height: 2.25rem;
	padding: 0.45rem 1rem;
	background: var(--bm-ink);
	color: var(--bm-surface);
	font-size: 0.875rem;
	font-weight: 600;
	text-align: center;
	letter-spacing: 0.01em;
}

.bm-promo__close {
	color: inherit;
	opacity: 0.85;
}

.bm-header {
	position: sticky;
	top: 0;
	z-index: 40;
	background: var(--bm-header);
	backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--bm-line);
}

.bm-header__inner {
	display: grid;
	grid-template-columns: auto auto minmax(0, 1fr) auto;
	align-items: center;
	gap: 1rem;
	width: var(--bm-container);
	margin-inline: auto;
	min-height: var(--bm-header-h);
}

.bm-logo {
	display: inline-flex;
	align-items: center;
	font-family: var(--bm-font-heading);
	font-weight: 700;
	font-size: 1.35rem;
	letter-spacing: -0.03em;
	color: var(--bm-ink);
	text-decoration: none;
}

.bm-logo img {
	display: block;
	max-height: 2.25rem;
	width: auto;
}

.bm-cats-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	min-height: 2.5rem;
	padding: 0 0.9rem;
	border: 1px solid var(--bm-line);
	border-radius: var(--bm-radius-sm);
	background: var(--bm-surface);
	color: var(--bm-ink);
	font-weight: 650;
}

.bm-cats-btn:hover,
.bm-cats-btn[aria-expanded="true"] {
	border-color: var(--bm-brand);
	color: var(--bm-brand-deep);
}

.bm-header__cats {
	position: relative;
}

.bm-cats-panel {
	position: absolute;
	top: calc(100% + 0.5rem);
	left: 0;
	z-index: 50;
	min-width: 16rem;
	padding: 0.75rem;
	background: var(--bm-surface);
	border: 1px solid var(--bm-line);
	border-radius: var(--bm-radius);
	box-shadow: var(--bm-shadow);
}

.bm-cat-menu__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.bm-cat-menu__list a {
	display: block;
	padding: 0.55rem 0.65rem;
	border-radius: var(--bm-radius-sm);
	font-weight: 600;
	color: var(--bm-ink);
}

.bm-cat-menu__list a:hover {
	background: var(--bm-brand-soft);
	color: var(--bm-brand-deep);
}

.bm-search {
	display: flex;
	align-items: stretch;
	min-height: 2.75rem;
	border: 1px solid var(--bm-line);
	border-radius: var(--bm-radius);
	background: var(--bm-surface);
	overflow: hidden;
	transition: border-color 0.2s var(--bm-ease), box-shadow 0.2s var(--bm-ease);
}

.bm-search:focus-within {
	border-color: var(--bm-brand);
	box-shadow: 0 0 0 3px var(--bm-brand-soft);
}

.bm-search__input {
	flex: 1;
	min-width: 0;
	border: 0;
	background: transparent;
	padding: 0 1rem;
	font: inherit;
	color: var(--bm-ink);
}

.bm-search__submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 3rem;
	border: 0;
	background: var(--bm-brand);
	color: var(--bm-white);
}

.bm-search__submit:hover {
	background: var(--bm-brand-deep);
}

.bm-header__tools {
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

.bm-tool {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	gap: 0.15rem;
	min-width: 3.25rem;
	padding: 0.35rem;
	color: var(--bm-ink);
	font-size: 0.68rem;
	font-weight: 650;
	text-decoration: none;
}

.bm-tool:hover {
	color: var(--bm-brand-deep);
}

.bm-cart {
	position: relative;
}

.bm-cart__count {
	position: absolute;
	top: 0;
	right: 0.15rem;
	min-width: 1.1rem;
	height: 1.1rem;
	padding: 0 0.25rem;
	border-radius: var(--bm-radius-pill);
	background: var(--bm-amazon);
	color: var(--bm-amazon-ink);
	font-size: 0.65rem;
	font-weight: 800;
	line-height: 1.1rem;
	text-align: center;
}

@media (max-width: 900px) {
	.bm-header__inner {
		grid-template-columns: auto 1fr auto;
		gap: 0.65rem;
	}

	.bm-header__cats {
		display: none;
	}

	.bm-tool__label {
		display: none;
	}
}
