/* IB Filters front end. Uses the shop's own custom properties (Core Framework) with fallbacks; no framework. */
.ibf-panel,
.ibf-active,
.ibf-controls,
.ibf-loadmore,
.ibf-drawer,
.ibf-drawer-btn {
	--ibf-primary: var(--primary, #b80000);
	--ibf-surface: var(--bg-surface, #fff);
	--ibf-body: var(--bg-body, #f7f7f7);
	--ibf-text: var(--text-body, #404040);
	--ibf-title: var(--text-title, #1f1f1f);
	--ibf-line: var(--border-primary, #e2e2e2);
	/* A fixed grey, not the shop's --dark-50 (a half-transparent black, about 3.9:1 on white): 7:1 on white, 6.4:1 on the body grey. */
	--ibf-muted: #595959;
	/* The site's own green: `--tertiary`, the colour of the shop's primary buttons («Create your flag»), rgb(54, 99, 54); white on it is 7.6:1. */
	--ibf-green: var(--tertiary, #366336);
	--ibf-gap: var(--space-s, 1rem);
	--ibf-gap-s: var(--space-xs, 0.5rem);
	--ibf-radius: var(--radius-s, 6px);
	--ibf-font: var(--text-m, 1rem);
	--ibf-font-s: var(--text-s, 0.875rem);
	color: var(--ibf-text);
	font-size: var(--ibf-font);
}

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

/* Layout the template may use: panel on the left, bar and results on the right. */
.ibf-layout {
	display: grid;
	width: 100%;
	grid-template-columns: minmax(14rem, 18rem) minmax(0, 1fr);
	gap: var(--space-m, 1.5rem);
	align-items: start;
}

.ibf-layout > * {
	min-width: 0;
}

.ibf-side {
	display: block;
}

.ibf-main,
.ibf-results {
	display: block;
	width: 100%;
}

@media (max-width: 767px) {
	.ibf-layout {
		grid-template-columns: minmax(0, 1fr);
	}
}

/* Panel */
.ibf-panel {
	background: var(--ibf-surface);
	border: 1px solid var(--ibf-line);
	border-radius: var(--ibf-radius);
	padding: var(--ibf-gap);
}

.ibf-panel__title {
	margin: 0 0 var(--ibf-gap-s);
	font-size: var(--text-l, 1.25rem);
	color: var(--ibf-title);
}

.ibf-group {
	border-top: 1px solid var(--ibf-line);
	padding: var(--ibf-gap-s) 0;
}

.ibf-group > summary {
	cursor: pointer;
	font-weight: 600;
	color: var(--ibf-title);
	padding: 0.25rem 0;
	min-height: 24px;
}

.ibf-picked {
	color: var(--ibf-primary);
	font-weight: 400;
}

.ibf-facet {
	border: 0;
	margin: 0;
	padding: 0;
	min-width: 0;
}

.ibf-values {
	display: grid;
	gap: 0.125rem;
	margin-top: 0.25rem;
}

.ibf-opt {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	min-height: 28px;
	cursor: pointer;
	font-size: var(--ibf-font-s);
}

.ibf-opt input {
	width: 1.1rem;
	height: 1.1rem;
	margin: 0;
	flex: none;
	accent-color: var(--ibf-primary);
}

.ibf-label {
	flex: 1 1 auto;
}

/* Drawn symbols (Shape, Design, Symbols): flat, one ink colour, decorative. The label stays text. */
.ibf-panel,
.ibf-drawer {
	--ibf-icon-ink: #2b4a7a;
	--ibf-icon-tint: #d8e0ee;
}

.ibf-icon {
	display: inline-flex;
	flex: none;
	width: 1.75rem;
	height: 1.75rem;
	color: var(--ibf-icon-ink);
}

.ibf-icon .ibf-i {
	width: 100%;
	height: 100%;
	display: block;
}

.ibf-i-tint {
	fill: var(--ibf-icon-tint);
}

@media (prefers-color-scheme: dark) {
	.ibf-panel,
	.ibf-drawer {
		--ibf-icon-ink: #c9d6ee;
		--ibf-icon-tint: #3a4a68;
	}
}

@media (forced-colors: active) {
	.ibf-icon {
		color: CanvasText;
	}

	.ibf-i-tint {
		fill: Canvas;
	}

	.ibf-swatch--panel {
		forced-color-adjust: none;
	}
}

/* Colour: round swatch before the name. */
.ibf-swatch--panel {
	width: 1.25rem;
	height: 1.25rem;
	margin: 0;
	flex: none;
}

.ibf-detail {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: 0.25rem 0 0.5rem;
	font-size: var(--ibf-font-s);
	cursor: pointer;
}

.ibf-detail[hidden] {
	display: none;
}

.ibf-detail input {
	width: 1.1rem;
	height: 1.1rem;
	margin: 0;
	accent-color: var(--ibf-primary);
}

/* Groups inside Type, Design and Symbols: a real button per group, with the number of flags. */
.ibf-sub {
	border-top: 1px solid var(--ibf-line);
}

.ibf-sub:first-of-type {
	border-top: 0;
}

.ibf-subtoggle {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	width: 100%;
	min-height: 36px;
	padding: 0.25rem 0;
	background: none;
	border: 0;
	color: var(--ibf-title);
	font: inherit;
	font-size: var(--ibf-font-s);
	font-weight: 600;
	text-align: left;
	cursor: pointer;
}

.ibf-subtitle {
	flex: 0 1 auto;
}

.ibf-subcount {
	color: var(--ibf-muted);
	font-weight: 400;
	font-variant-numeric: tabular-nums;
}

.ibf-subpicked {
	color: var(--ibf-primary);
	font-weight: 400;
}

.ibf-chevron {
	display: inline-block;
	flex: none;
	margin-left: auto;
	width: 0.5rem;
	height: 0.5rem;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.15s;
}

.ibf-subtoggle[aria-expanded="true"] .ibf-chevron {
	transform: rotate(-135deg);
}

.ibf-subpanel[hidden] {
	display: none;
}

.ibf-subpanel {
	display: grid;
	gap: 0.125rem;
	padding-bottom: 0.25rem;
}

.ibf-count {
	color: var(--ibf-muted);
	font-variant-numeric: tabular-nums;
}

.ibf-zero {
	color: var(--ibf-muted);
	cursor: default;
}

.ibf-find {
	width: 100%;
	box-sizing: border-box;
	margin: 0.25rem 0;
	padding: 0.35rem 0.5rem;
	border: 1px solid var(--ibf-line);
	border-radius: var(--ibf-radius);
	font: inherit;
}

.ibf-all {
	margin-top: 0.25rem;
	padding: 0;
	background: none;
	border: 0;
	color: var(--ibf-primary);
	text-decoration: underline;
	cursor: pointer;
	font: inherit;
	font-size: var(--ibf-font-s);
	min-height: 24px;
}

.ibf-long.ibf-collapsed:not(.ibf-searching) .ibf-extra {
	display: none;
}

.ibf-actions {
	display: flex;
	align-items: center;
	gap: var(--ibf-gap);
	margin-top: var(--ibf-gap);
}

.ibf-clear,
.ibf-clear-all {
	color: var(--ibf-primary);
	text-decoration: underline;
	cursor: pointer;
}

/* The coarse-pointer rule below gives these `display`, which would beat the `hidden` attribute: «Clear all» must go while no filter is on. */
.ibf-active--list .ibf-clear-all[hidden] {
	display: none;
}

/* The list title is for the phone only. */
.ibf-list-title {
	display: none;
}

/* Active filters and sort */
.ibf-active {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ibf-gap-s) var(--ibf-gap);
	margin-bottom: var(--ibf-gap);
}

.ibf-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ibf-chip {
	display: inline-flex;
	align-items: center;
	min-height: 28px;
	padding: 0 0.75rem;
	border: 1px solid var(--ibf-line);
	border-radius: var(--radius-full, 999px);
	background: var(--ibf-surface);
	color: var(--ibf-title);
	text-decoration: none;
	font-size: var(--ibf-font-s);
}

.ibf-chip:hover,
.ibf-chip:focus-visible {
	border-color: var(--ibf-primary);
}

.ibf-total {
	margin: 0;
	font-weight: 600;
	color: var(--ibf-title);
}

.ibf-sort {
	margin-left: auto;
}

.ibf-sort select {
	font: inherit;
	padding: 0.25rem 0.5rem;
	border: 1px solid var(--ibf-line);
	border-radius: var(--ibf-radius);
}

/* Results */
.ibf-controls {
	margin-top: var(--ibf-gap);
	text-align: center;
}

.ibf-pager ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ibf-pager a,
.ibf-pager span {
	display: inline-block;
	min-width: 24px;
	padding: 0.4rem 0.7rem;
	border: 1px solid var(--ibf-line);
	border-radius: var(--ibf-radius);
	text-decoration: none;
	color: var(--ibf-title);
}

.ibf-pager .current {
	border-color: var(--ibf-title);
}

.ibf-empty {
	padding: var(--space-m, 1.5rem) 0;
}

.ibf-empty__title {
	font-weight: 600;
	color: var(--ibf-title);
}

/* One «Load more...» everywhere: a small grey count line above a centred grey text link (no button, no red). */
.ibf-loadmore {
	display: none;
	margin: var(--ibf-gap) auto 0;
	text-align: center;
}

.ibf-loadmore__count {
	margin: 0;
	font-size: var(--ibf-font-s);
	color: var(--ibf-muted);
}

a.ibf-more {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 0 1rem;
	font-size: 1.4rem;
	line-height: 1.3;
	/* About 75% of the body text on the body grey: 4.8:1 (the 60% of the first sketch would be 3.2:1, under the 4.5:1 floor). */
	color: color-mix(in srgb, var(--ibf-text) 75%, var(--ibf-body));
	background: none;
	border: 0;
	text-decoration: none;
}

a.ibf-more:hover {
	color: var(--ibf-text);
	text-decoration: underline;
}

/* The shop's own pager inside the list is replaced by ours (real links, same state) on the filter pages. */
/* (the pager of the Oxygen repeater; the other categories keep it, and hide it only while `assets/ibf-loadmore.js` runs) */
body:not(.ibf-archive-lm) .oxy-dynamic-list .oxy-repeater-pages-wrap,
.ibf-lm-js .oxy-repeater-pages-wrap {
	display: none;
}

/* With the script: no Apply button, «Load more» instead of the pager. */
.ibf-js .ibf-apply,
.ibf-js .ibf-nojs {
	display: none;
}

.ibf-js .ibf-loadmore:not([hidden]),
.ibf-lm-js .ibf-loadmore--archive:not([hidden]) {
	display: block;
}

.ibf-js .ibf-pager {
	display: none;
}

.ibf-js [aria-busy="true"] {
	opacity: 0.6;
	transition: opacity 0.15s;
}

/* Phone */
.ibf-drawer-btn {
	display: none;
}

/* The theme's `.btn` colours the text dark on the red background; white on the shop red is 6.9:1. */
button.ibf-drawer-btn.btn,
button.ibf-drawer-btn.btn:hover,
button.ibf-drawer-btn.btn:focus-visible {
	background: var(--ibf-primary, #b80000);
	color: #fff;
	-webkit-text-fill-color: #fff;
}

/* In the list bar (every page) it is outlined in the shop red instead; the red on white is 6.9:1. */
.ibf-active--list > button.ibf-drawer-btn.btn,
.ibf-active--list > button.ibf-drawer-btn.btn:hover,
.ibf-active--list > button.ibf-drawer-btn.btn:focus-visible {
	background: var(--ibf-surface, #fff);
	color: var(--ibf-primary, #b80000);
	-webkit-text-fill-color: var(--ibf-primary, #b80000);
	border: 1px solid var(--ibf-primary, #b80000);
	box-shadow: none;
	font-family: inherit;
	font-weight: 600;
	text-transform: none;
	letter-spacing: 0;
	/* «Filters (N)» is one piece of text: no flex gap between the word and the number. */
	gap: 0;
}

.ibf-drawer-btn .ibf-n {
	display: inline;
}

@media (max-width: 767px) {
	.ibf-drawer-btn:not([hidden]) {
		display: inline-flex;
		margin-bottom: var(--ibf-gap);
	}

	.ibf-js .ibf-panel:not(.ibf-in-dialog) {
		display: none;
	}

	/* The area between the tiles and the list is ONE block: a line, the title with the count, one row of two equal
	   buttons (Filters, Sort), the chips, «Clear all» only while a filter is on. The script moves the Filters button in. */
	.ibf-js .ibf-layout:has(.ibf-active--list) {
		row-gap: 0;
	}

	.ibf-active--list {
		display: grid;
		grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
		align-items: center;
		gap: var(--ibf-gap-s);
		margin: 0 0 var(--ibf-gap-s);
		padding-top: var(--ibf-gap-s);
		border-top: 1px solid var(--ibf-line);
	}

	.ibf-active--list .ibf-list-title {
		display: block;
		grid-column: 1;
		grid-row: 1;
		margin: 0;
		font-size: var(--text-l, 1.25rem);
		font-weight: 700;
		line-height: 1.3;
		color: var(--ibf-title);
	}

	.ibf-active--list .ibf-total {
		grid-column: 2;
		grid-row: 1;
		justify-self: end;
		font-weight: 400;
		color: var(--ibf-muted);
	}

	.ibf-active--list > .ibf-drawer-btn {
		grid-column: 1;
		grid-row: 2;
		justify-content: center;
		align-items: center;
		box-sizing: border-box;
		width: 100%;
		min-height: 44px;
		height: 44px;
		margin: 0;
		padding: 0 0.75rem;
		border-radius: var(--ibf-radius);
	}

	.ibf-active--list .ibf-sort {
		grid-column: 1 / -1;
		grid-row: 2;
		margin: 0;
	}

	.ibf-active--list.ibf-has-btn .ibf-sort {
		grid-column: 2;
	}

	.ibf-active--list .ibf-sort label {
		display: block;
		margin: 0;
	}

	/* «Sort by» stays for screen readers; the select reads as a button next to «Filters». */
	.ibf-active--list .ibf-sort__label {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.ibf-active--list .ibf-sort select {
		display: block;
		appearance: none;
		-webkit-appearance: none;
		box-sizing: border-box;
		width: 100%;
		min-height: 44px;
		height: 44px;
		margin: 0;
		padding: 0 1.75rem 0 0.6rem;
		font-size: var(--ibf-font-s);
		border: 1px solid var(--ibf-line);
		border-radius: var(--ibf-radius);
		background-color: var(--ibf-surface);
		background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
		background-position: calc(100% - 1rem) 50%, calc(100% - 0.7rem) 50%;
		background-size: 0.3rem 0.3rem;
		background-repeat: no-repeat;
		color: var(--ibf-title);
		font-family: inherit;
		font-weight: 600;
		text-overflow: ellipsis;
	}

	.ibf-active--list .ibf-chips {
		grid-column: 1 / -1;
		grid-row: 3;
	}

	.ibf-active--list .ibf-chips:empty {
		display: none;
	}

	.ibf-active--list > .ibf-clear-all {
		grid-column: 1 / -1;
		grid-row: 4;
		justify-self: start;
	}
}

.ibf-drawer {
	width: 100%;
	max-width: none;
	height: 100%;
	max-height: none;
	margin: 0;
	padding: var(--ibf-gap);
	box-sizing: border-box;
	border: 0;
	overflow: auto;
	background: var(--ibf-surface);
}

.ibf-drawer .ibf-panel {
	border: 0;
	padding: 0;
}

.ibf-drawer-close {
	position: absolute;
	top: 0.5rem;
	right: 0.5rem;
	width: 44px;
	height: 44px;
	border: 0;
	background: none;
	font-size: 2rem;
	line-height: 1;
	cursor: pointer;
	color: var(--ibf-title);
}

.ibf-show {
	position: sticky;
	bottom: 0;
	width: 100%;
	margin-top: var(--ibf-gap);
}

/* «Show N flags» is the site's green with white text (phone and desktop drawer alike); the theme's `.btn` would colour the text dark. */
button.ibf-show.btn,
button.ibf-show.btn:hover,
button.ibf-show.btn:focus-visible {
	background: var(--ibf-green);
	color: #fff;
	-webkit-text-fill-color: #fff;
	border-color: var(--ibf-green);
	font-family: inherit;
	font-size: var(--ibf-font);
	font-weight: 600;
	text-transform: none;
	letter-spacing: 0;
	/* The panel scrolls behind the sticky button: a surface-coloured halo keeps its text from showing through. */
	box-shadow: 0 0 0 0.75rem var(--ibf-surface);
}

/* From 768 px the drawer slides in from the left over the page: no layout shift, the page behind is dimmed. */
.ibf-drawer::backdrop {
	background: rgba(0, 0, 0, 0.45);
}

@keyframes ibf-slide-in {
	from {
		transform: translateX(-100%);
	}
}

@media (min-width: 768px) {
	.ibf-drawer {
		width: 380px;
		max-width: 100%;
		margin: 0 auto 0 0;
		box-shadow: 0 0 24px rgba(0, 0, 0, 0.25);
	}

	.ibf-drawer[open] {
		animation: ibf-slide-in 0.2s ease-out;
	}

	/* The list takes the whole width and the panel lives in the drawer; the list bar is one row: count left, Filters and Sort right. */
	.ibf-js .ibf-layout:has(.ibf-has-btn) {
		grid-template-columns: minmax(0, 1fr);
		row-gap: 0;
	}

	.ibf-js .ibf-layout:has(.ibf-has-btn) .ibf-panel:not(.ibf-in-dialog) {
		display: none;
	}

	.ibf-active--list.ibf-has-btn {
		display: grid;
		grid-template-columns: minmax(0, 1fr) auto auto;
		align-items: center;
		gap: var(--ibf-gap-s);
		margin: 0 0 var(--ibf-gap);
	}

	.ibf-active--list.ibf-has-btn .ibf-total {
		grid-column: 1;
		grid-row: 1;
		margin: 0;
		font-size: var(--text-l, 1.25rem);
		font-weight: 700;
		line-height: 1.3;
		color: var(--ibf-title);
	}

	.ibf-active--list.ibf-has-btn > .ibf-drawer-btn {
		display: inline-flex;
		grid-column: 2;
		grid-row: 1;
		justify-content: center;
		align-items: center;
		box-sizing: border-box;
		height: 40px;
		margin: 0;
		padding: 0 1rem;
		border-radius: var(--ibf-radius);
		font-size: var(--ibf-font-s);
	}

	.ibf-active--list.ibf-has-btn .ibf-sort {
		grid-column: 3;
		grid-row: 1;
		margin: 0;
	}

	.ibf-active--list.ibf-has-btn .ibf-sort label {
		display: block;
		margin: 0;
	}

	.ibf-active--list.ibf-has-btn .ibf-sort__label {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		overflow: hidden;
		clip: rect(0 0 0 0);
		white-space: nowrap;
	}

	.ibf-active--list.ibf-has-btn .ibf-sort select {
		display: block;
		appearance: none;
		-webkit-appearance: none;
		box-sizing: border-box;
		height: 40px;
		margin: 0;
		padding: 0 1.75rem 0 0.75rem;
		font-size: var(--ibf-font-s);
		border: 1px solid var(--ibf-line);
		border-radius: var(--ibf-radius);
		background-color: var(--ibf-surface);
		background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
		background-position: calc(100% - 1rem) 50%, calc(100% - 0.7rem) 50%;
		background-size: 0.3rem 0.3rem;
		background-repeat: no-repeat;
		color: var(--ibf-title);
		font-family: inherit;
		font-weight: 600;
	}

	.ibf-active--list.ibf-has-btn .ibf-chips {
		grid-column: 1 / -1;
		grid-row: 2;
	}

	.ibf-active--list.ibf-has-btn .ibf-chips:empty {
		display: none;
	}

	.ibf-active--list.ibf-has-btn > .ibf-clear-all {
		grid-column: 1 / -1;
		grid-row: 3;
		justify-self: start;
	}
}

/* Keyboard: every interactive element shows where the focus is. */
.ibf-panel :is(input, button, a, summary, select):focus-visible,
.ibf-active :is(input, button, a, summary, select):focus-visible,
.ibf-controls :is(input, button, a, summary, select):focus-visible,
.ibf-drawer :is(input, button, a, summary, select):focus-visible,
.ibf-drawer-btn:focus-visible,
.ibf-chip:focus-visible,
a.ibf-more:focus-visible,
.ibf-all:focus-visible,
.ibf-show:focus-visible,
.ibf-drawer-close:focus-visible,
.ibf-pager a:focus-visible,
.oxy-dynamic-list a:focus-visible {
	outline: 2px solid var(--ibf-primary, #b80000);
	outline-offset: 2px;
}

/* A focus move made by script after a tap or a click paints no ring (iOS draws a blue box around the heading or the card);
   after a key press the ring above stays. The focus still moves, so screen readers follow it. */
html[data-ibf-input="pointer"] body [data-ibf-moved]:focus,
html[data-ibf-input="pointer"] body [data-ibf-moved]:focus-visible {
	outline: none;
}

/* Touch: targets of at least 44 x 44 px where the pointer is coarse. */
@media (pointer: coarse) {
	.ibf-opt,
	.ibf-subtoggle,
	.ibf-detail,
	.ibf-group > summary,
	.ibf-chip,
	.ibf-all,
	.ibf-clear,
	.ibf-clear-all,
	a.ibf-more,
	.ibf-drawer-btn,
	.ibf-apply,
	.ibf-sort select,
	.ibf-find {
		min-height: 44px;
	}

	.ibf-group > summary,
	.ibf-all,
	.ibf-clear,
	.ibf-clear-all {
		display: inline-flex;
		align-items: center;
	}

	.ibf-group > summary {
		display: flex;
	}

	.ibf-opt input {
		width: 1.6rem;
		height: 1.6rem;
	}

	.ibf-pager a,
	.ibf-pager span {
		min-width: 44px;
		min-height: 44px;
		box-sizing: border-box;
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}
}

/* Motion: nothing animates for people who asked for less. */
@media (prefers-reduced-motion: reduce) {
	.ibf-js [aria-busy="true"] {
		transition: none;
	}

	.ibf-chevron {
		transition: none;
	}

	.ibf-panel,
	.ibf-active,
	.ibf-controls,
	.ibf-drawer,
	.ibf-drawer * {
		transition: none !important;
		animation: none !important;
		scroll-behavior: auto !important;
	}
}
