/* H&G Catalogue. Colours reference the site's Beaver Builder globals; fonts inherit from the theme. */

.hg-cat {
	--hg-cols: 4;
	--hg-gap: 20px;
	--hg-accent: var(--fl-global-logo-oat, #e2d3c0);
	--hg-soft: var(--fl-global-light-cafe, #f5f4f2);
	--hg-ink: #333;
	--hg-line: rgba(0, 0, 0, 0.12);
	position: relative;
	color: var(--hg-ink);
}

.hg-cat__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* ---------- Bar ---------- */

.hg-cat__form { margin: 0; }

.hg-cat__bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 12px;
	margin: 0 0 24px;
	padding: 0 0 14px;
	border-bottom: 1px solid var(--hg-line);
}

.hg-cat__btn,
.hg-cat__open {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 10px 22px;
	border: 0;
	border-radius: 100px;
	background: var(--hg-accent);
	color: var(--hg-ink);
	font: inherit;
	font-size: 14px;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.2s ease, opacity 0.2s ease;
}
.hg-cat__btn:hover,
.hg-cat__open:hover { filter: brightness(0.95); color: var(--hg-ink); text-decoration: none; }
.hg-cat__btn:focus-visible,
.hg-cat__open:focus-visible,
.hg-cat__chip:focus-visible,
.hg-cat__link:focus-visible,
.hg-cat__close:focus-visible,
.hg-cat__clear:focus-visible {
	outline: 2px solid var(--hg-ink);
	outline-offset: 2px;
}

.hg-cat__badge {
	display: inline-grid;
	place-items: center;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: 10px;
	background: var(--hg-ink);
	color: #fff;
	font-size: 11px;
}
.hg-cat__badge[hidden] { display: none; }

.hg-cat__chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	flex: 1 1 auto;
	min-width: 0;
}
.hg-cat__chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 12px;
	border: 1px solid var(--hg-line);
	border-radius: 100px;
	background: #fff;
	color: var(--hg-ink);
	font-size: 13px;
	line-height: 1.2;
	text-decoration: none;
}
.hg-cat__chip:hover { border-color: var(--hg-ink); color: var(--hg-ink); text-decoration: none; }

.hg-cat__count {
	margin: 0 0 0 auto;
	font-size: 13px;
	opacity: 0.75;
}

.hg-cat__sort select {
	appearance: none;
	-webkit-appearance: none;
	font: inherit;
	font-size: 14px;
	padding: 9px 34px 9px 14px;
	border: 1px solid var(--hg-line);
	border-radius: 100px;
	background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23333' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 14px center;
	color: var(--hg-ink);
	cursor: pointer;
	height: auto;
	margin: 0;
}

/* ---------- Grid and cards ---------- */

.hg-cat__grid {
	display: grid;
	grid-template-columns: repeat(var(--hg-cols), minmax(0, 1fr));
	gap: 32px var(--hg-gap);
	transition: opacity 0.2s ease;
}
.hg-cat.is-busy .hg-cat__grid { opacity: 0.45; pointer-events: none; }

.hg-cat__card { min-width: 0; margin: 0; }

.hg-cat .hg-cat__link {
	display: block;
	color: inherit;
	text-decoration: none;
}

.hg-cat__media {
	position: relative;
	aspect-ratio: 5 / 7;
	overflow: hidden;
	margin: 0 0 12px;
	background: var(--hg-soft);
}
.hg-cat__media img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: opacity 0.35s ease;
}
.hg-cat__alt { opacity: 0; }
@media (hover: hover) {
	.hg-cat__card:hover .hg-cat__alt.is-ready { opacity: 1; }
}
.hg-cat__card.is-oos .hg-cat__img { opacity: 0.7; }

.hg-cat__flag {
	position: absolute;
	top: 10px;
	left: 10px;
	padding: 4px 10px;
	border-radius: 100px;
	background: #fff;
	font-size: 11px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.hg-cat .hg-cat__title {
	margin: 0 0 4px;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.4;
	letter-spacing: 0;
	text-transform: uppercase;
	color: var(--hg-ink);
}

.hg-cat__price { font-size: 12px; color: #000; }
.hg-cat__price del { opacity: 0.6; margin-right: 4px; }
.hg-cat__price ins { text-decoration: none; }

/* ---------- Empty and Load more ---------- */

.hg-cat__empty {
	padding: 48px 0;
	text-align: center;
}
.hg-cat__empty[hidden] { display: none; }
.hg-cat__empty p { margin: 0 0 16px; }

.hg-cat__more {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	margin: 48px 0 8px;
	text-align: center;
}
.hg-cat__more:empty { display: none; }
.hg-cat__progress-text { margin: 0; font-size: 13px; opacity: 0.75; }
.hg-cat__progress {
	position: relative;
	width: 200px;
	max-width: 60%;
	height: 2px;
	background: var(--hg-line);
}
.hg-cat__progress span {
	position: absolute;
	inset: 0 auto 0 0;
	background: var(--hg-ink);
}
.hg-cat__load { min-width: 180px; margin-top: 4px; }
.hg-cat__load.is-loading { opacity: 0.6; pointer-events: none; }

/* ---------- Drawer ---------- */

html.hg-cat-lock,
html.hg-cat-lock body { overflow: hidden; }

.hg-cat__drawer {
	position: fixed;
	top: 0;
	left: 0;
	bottom: 0;
	z-index: 100000;
	display: flex;
	flex-direction: column;
	width: min(380px, 88vw);
	background: #fff;
	box-shadow: 2px 0 18px rgba(0, 0, 0, 0.15);
	transform: translateX(-102%);
	visibility: hidden;
	transition: transform 0.3s ease, visibility 0s linear 0.3s;
}
.hg-cat.is-open .hg-cat__drawer {
	transform: none;
	visibility: visible;
	transition: transform 0.3s ease, visibility 0s;
}
.admin-bar .hg-cat__drawer { top: 32px; }
@media (max-width: 782px) { .admin-bar .hg-cat__drawer { top: 46px; } }

.hg-cat__scrim {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(0, 0, 0, 0.35);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}
.hg-cat.is-open .hg-cat__scrim { opacity: 1; pointer-events: auto; }

.hg-cat__drawer-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 14px 20px;
	border-bottom: 1px solid var(--hg-line);
}
.hg-cat__drawer-title {
	margin: 0;
	font-size: 15px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}
.hg-cat__close {
	padding: 2px 8px;
	border: 0;
	background: none;
	color: var(--hg-ink);
	font-size: 30px;
	line-height: 1;
	cursor: pointer;
	box-shadow: none;
}
.hg-cat .hg-cat__close:hover,
.hg-cat .hg-cat__close:focus,
.hg-cat .hg-cat__close:active {
	background: none;
	color: var(--hg-ink);
	border: 0;
	box-shadow: none;
}

.hg-cat__drawer-body {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 4px 20px 20px;
}

.hg-cat__search { display: block; margin: 12px 0 4px; }
.hg-cat__search input {
	width: 100%;
	box-sizing: border-box;
	font: inherit;
	font-size: 16px; /* stops iOS zooming on focus */
	padding: 10px 16px;
	border: 1px solid var(--hg-line);
	border-radius: 100px;
	background: #fff;
	color: var(--hg-ink);
	margin: 0;
	height: auto;
}

.hg-cat__drawer-foot {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 20px;
	border-top: 1px solid var(--hg-line);
	background: #fff;
}
.hg-cat__clear {
	margin-right: auto;
	color: var(--hg-ink);
	font-size: 14px;
	text-decoration: underline;
}
.hg-cat__clear.hg-cat__btn { margin-right: 0; text-decoration: none; }

/* ---------- Facets ---------- */

.hg-cat__facet { border-bottom: 1px solid var(--hg-line); }
.hg-cat__facet summary {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 15px 0;
	list-style: none;
	cursor: pointer;
	font-size: 13px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}
.hg-cat__facet summary::-webkit-details-marker { display: none; }
.hg-cat__facet summary::after {
	content: "+";
	margin-left: auto;
	font-size: 18px;
	line-height: 1;
}
.hg-cat__facet[open] summary::after { content: "\2212"; }
.hg-cat__sel {
	display: inline-grid;
	place-items: center;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	border-radius: 9px;
	background: var(--hg-accent);
	font-size: 11px;
	letter-spacing: 0;
}

.hg-cat__facet fieldset {
	min-width: 0;
	margin: 0;
	padding: 0 0 16px;
	border: 0;
}

.hg-cat__opts--scroll {
	max-height: 260px;
	overflow-y: auto;
	padding-right: 6px;
	scrollbar-width: thin;
}

.hg-cat__opt {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 0;
	margin: 0;
	font-size: 14px;
	font-weight: 400;
	cursor: pointer;
}
.hg-cat__opt input {
	flex: none;
	width: 18px;
	height: 18px;
	margin: 0;
	accent-color: var(--hg-ink);
}
.hg-cat__lbl { flex: 1; min-width: 0; }
.hg-cat__n { font-size: 12px; opacity: 0.55; }

/* Colour swatches */
.hg-cat__opts--swatch {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 14px;
}
.hg-cat__opt--swatch input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}
.hg-cat__swatch {
	flex: none;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	border: 1px solid rgba(0, 0, 0, 0.15);
	background-size: cover;
	background-position: center;
}
.hg-cat__opt--swatch input:checked + .hg-cat__swatch { box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--hg-ink); }
.hg-cat__opt--swatch input:checked ~ .hg-cat__lbl { font-weight: 600; }
.hg-cat__opt--swatch input:focus-visible + .hg-cat__swatch { outline: 2px solid var(--hg-ink); outline-offset: 4px; }

/* Size pills */
.hg-cat__opts--pill { display: flex; flex-wrap: wrap; gap: 8px; }
.hg-cat__pill { position: relative; margin: 0; cursor: pointer; }
.hg-cat__pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.hg-cat__pill span {
	display: inline-block;
	min-width: 44px;
	padding: 8px 12px;
	border: 1px solid var(--hg-line);
	border-radius: 100px;
	font-size: 13px;
	line-height: 1.2;
	text-align: center;
	transition: border-color 0.15s ease, background 0.15s ease;
}
.hg-cat__pill:hover span { border-color: var(--hg-ink); }
.hg-cat__pill input:checked + span { background: var(--hg-ink); border-color: var(--hg-ink); color: #fff; }
.hg-cat__pill input:focus-visible + span { outline: 2px solid var(--hg-ink); outline-offset: 2px; }

/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
	.hg-cat { --hg-cols: 3 !important; }
}
@media (max-width: 768px) {
	.hg-cat { --hg-cols: 2 !important; --hg-gap: 12px; }
	.hg-cat__grid { row-gap: 24px; }
	.hg-cat__bar { gap: 10px; margin-bottom: 18px; }
	.hg-cat__chips { order: 3; flex-basis: 100%; }
	.hg-cat__chips:empty { display: none; }
	.hg-cat__count { order: 2; margin: 0 0 0 auto; }
	.hg-cat__sort { order: 1; }
	.hg-cat__open { order: 0; }
	.hg-cat__sort select { font-size: 13px; padding: 9px 30px 9px 12px; }
	.hg-cat .hg-cat__title { font-size: 12px; }
	.hg-cat__drawer-foot { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
}
@media (max-width: 400px) {
	.hg-cat__count { display: none; }
}

/* ---------- No JavaScript: show filters inline ---------- */

.hg-cat--nojs .hg-cat__open,
.hg-cat--nojs .hg-cat__close,
.hg-cat--nojs .hg-cat__scrim { display: none; }
.hg-cat--nojs .hg-cat__drawer {
	position: static;
	width: auto;
	transform: none;
	visibility: visible;
	box-shadow: none;
	margin: 0 0 24px;
	border: 1px solid var(--hg-line);
}

/* Anything in the page template that should disappear when the grid has nothing to show. */
html.hg-cat-empty .hg-cat-hide-when-empty { display: none !important; }
