/* ═══════════════════════════════════════════════════════════════
   WETRIPER — Horizontal filter bar + All-filters drawer
   Used on: tour archive, open-trip archive
   ═══════════════════════════════════════════════════════════════ */

/* Remove archive-hero bottom gap when filter bar follows */
.archive-hero--bar {
	margin-bottom: 0;
}

/* Archive shell spacing when preceded by filter bar */
.filter-bar ~ .shell {
	padding-block-start: var(--sp-7);
}

/* ── Filter bar wrapper ───────────────────────────────────────── */
.filter-bar {
	position: sticky;
	top: var(--header-h, 72px);
	z-index: 40;
	background: var(--c-surface);
	border-bottom: 1px solid var(--c-line);
}

.filter-bar__inner {
	display: flex;
	align-items: center;
	gap: var(--sp-2);
	padding-block: 10px;
	overflow-x: auto;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}
.filter-bar__inner::-webkit-scrollbar { display: none; }

/* ── Filter pill ─────────────────────────────────────────────── */
.filter-pill {
	position: relative;
	display: inline-flex;
	align-items: center;
	padding: 0.5rem 1.875rem 0.5rem 0.875rem; /* right room for chevron */
	border: 1.5px solid var(--c-line);
	border-radius: var(--r-pill);
	background: var(--c-surface);
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--c-ink);
	white-space: nowrap;
	flex-shrink: 0;
	cursor: pointer;
	transition: border-color 150ms, background 150ms, color 150ms;
}
.filter-pill:hover { border-color: var(--c-ink); }

/* Native select — invisible, covers full pill area */
.filter-pill select {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
	font-size: 16px; /* prevents iOS zoom */
}

/* Chevron via pseudo-element */
.filter-pill::after {
	content: '';
	position: absolute;
	right: 0.625rem;
	top: 50%;
	transform: translateY(-50%);
	width: 14px;
	height: 14px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23121212' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat center / contain;
	pointer-events: none;
}

/* Active state: has a selected value */
.filter-pill.is-active {
	background: var(--c-ink);
	border-color: var(--c-ink);
	color: var(--c-white);
}
.filter-pill.is-active::after {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

/* ── Separator ───────────────────────────────────────────────── */
.filter-bar__sep {
	width: 1px;
	height: 22px;
	background: var(--c-line);
	flex-shrink: 0;
	margin-inline: var(--sp-1);
}

/* ── "All filters" button ────────────────────────────────────── */
.filter-bar__all-btn {
	display: inline-flex;
	align-items: center;
	gap: var(--sp-2);
	padding: 0.5rem 0.875rem;
	border: 1.5px solid var(--c-ink);
	border-radius: var(--r-pill);
	background: var(--c-surface);
	font-size: var(--text-sm);
	font-weight: 600;
	color: var(--c-ink);
	cursor: pointer;
	white-space: nowrap;
	flex-shrink: 0;
	transition: background 150ms, color 150ms;
}
.filter-bar__all-btn i { font-size: 1rem; line-height: 1; }

.filter-bar__all-btn:hover {
	background: var(--c-ink);
	color: var(--c-white);
}
.filter-bar__all-btn:hover .filter-bar__badge {
	background: var(--c-white);
	color: var(--c-ink);
}

.filter-bar__badge {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	background: var(--c-ink);
	color: var(--c-white);
	border-radius: 999px;
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
}

/* ── Sort pill (pushed to right) ─────────────────────────────── */
.filter-bar__sort {
	margin-left: auto;
	flex-shrink: 0;
}

.filter-bar__sort select {
	appearance: none;
	-webkit-appearance: none;
	padding: 0.5rem 2rem 0.5rem 0.875rem;
	border: 1.5px solid var(--c-line);
	border-radius: var(--r-pill);
	background: var(--c-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23a6a6a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 0.625rem center;
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--c-muted);
	cursor: pointer;
	font-family: inherit;
}
.filter-bar__sort select:hover { border-color: var(--c-ink); color: var(--c-ink); }

/* ── All-filters Drawer ──────────────────────────────────────── */
.filter-drawer {
	position: fixed;
	inset: 0;
	z-index: 200;
	display: none;
}
.filter-drawer.is-open { display: block; }

.filter-drawer__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	cursor: pointer;
	animation: fb-overlay-in 250ms ease forwards;
}

@keyframes fb-overlay-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.filter-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(480px, 100vw);
	background: var(--c-surface);
	display: flex;
	flex-direction: column;
	animation: fb-panel-in 280ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
	overflow: hidden;
}

@keyframes fb-panel-in {
	from { transform: translateX(100%); }
	to   { transform: translateX(0); }
}

.filter-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--sp-5) var(--sp-6);
	border-bottom: 1px solid var(--c-line);
	flex-shrink: 0;
}

.filter-drawer__head h2 {
	font-size: var(--text-xl);
	font-weight: 700;
	letter-spacing: -0.04em;
	margin: 0;
}

.filter-drawer__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 1.5px solid var(--c-line);
	border-radius: 50%;
	background: none;
	cursor: pointer;
	color: var(--c-ink);
	font-size: 1rem;
	flex-shrink: 0;
	line-height: 1;
	transition: background 150ms;
}
.filter-drawer__close:hover { background: var(--c-surface-2); }

.filter-drawer__body {
	flex: 1;
	overflow-y: auto;
	scrollbar-gutter: stable; /* reserves scrollbar space so layout doesn't jump */
	padding: var(--sp-5) var(--sp-6);
	display: flex;
	flex-direction: column;
	gap: var(--sp-6);
}

.filter-drawer__group { display: grid; gap: var(--sp-3); }

.filter-drawer__group-title {
	font-size: var(--text-xs);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--c-muted);
	margin: 0;
}

.filter-drawer__opts {
	display: flex;
	flex-wrap: wrap;
	gap: var(--sp-2);
}

/* Radio / checkbox pill options */
/*
 * position: relative on the label anchors the hidden input inside the label.
 * Without this the input floats to the drawer-panel origin (top:0, left:0),
 * so when the radio is focused the browser scrolls the body back to y=0,
 * which looks like the footer "jumps up".
 */
.filter-drawer__opt { display: inline-flex; cursor: pointer; position: relative; }

.filter-drawer__opt input {
	/* Fill the label so the focused element is already on-screen — no scroll jump */
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
	margin: 0;
}

.filter-drawer__opt span {
	display: inline-flex;
	padding: 0.45rem 0.875rem;
	border: 1.5px solid var(--c-line);
	border-radius: var(--r-pill);
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--c-ink);
	transition: border-color 150ms, background 150ms, color 150ms;
}
.filter-drawer__opt:hover span { border-color: var(--c-ink); }
.filter-drawer__opt:has(input:checked) span {
	background: var(--c-ink);
	border-color: var(--c-ink);
	color: var(--c-white);
	/* No font-weight change — avoids text reflow that would push the footer */
}

/* Drawer footer */
.filter-drawer__foot {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: var(--sp-4) var(--sp-6);
	border-top: 1px solid var(--c-line);
	flex-shrink: 0;
}

.filter-drawer__clear {
	font-size: var(--text-sm);
	font-weight: 500;
	color: var(--c-muted);
	text-decoration: underline;
	cursor: pointer;
}
.filter-drawer__clear:hover { color: var(--c-ink); }

/* Body scroll lock when drawer open */
body.drawer-open { overflow: hidden; }

/* ── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
	.filter-pill { padding: 0.45rem 1.75rem 0.45rem 0.7rem; font-size: var(--text-xs); }
	.filter-bar__all-btn { padding: 0.45rem 0.7rem; font-size: var(--text-xs); }
	.filter-bar__sort select { font-size: var(--text-xs); }
	.filter-drawer__panel { width: 100vw; }
	.filter-drawer__body { padding: var(--sp-4) var(--sp-5); gap: var(--sp-5); }
	.filter-drawer__head, .filter-drawer__foot { padding-inline: var(--sp-5); }
}

/* ── Tour archive grid ──────────────────────────────────────── */
.tour-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--sp-5);
}

@media (max-width: 1024px) {
	.tour-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
	.tour-grid { grid-template-columns: 1fr; }
}
