/* ==========================================================================
   Blog filters — Tags + Search left | category pills right
   Figma: nodes 52609-8117 / 52651-6019 / 52621-7886 / 52621-7583 / 52628-9344
   ========================================================================== */

/* ── Desktop / Mobile ordering ── */

.blog-top-area {
	display: flex;
	flex-direction: column;
}

@media (min-width: 768px) {
	.blog-top-area .blog-filters { order: 2; }
	.blog-top-area .post-hero    { order: 1; }
}

/* ── Wrapper ── */

.blog-filters {
	background: var(--hdr-bg, #faf4e7); /* same warm beige as the hero */
	padding: 48px 0;
}

/* ── Bar — flex row ── */

.blog-filters__bar {
	display: flex;
	align-items: center;
	gap: 10px;
	position: relative; /* anchor for the tags dropdown */
}

/* ── Pill (shared base) ── */

.blog-filters__pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 42px;
	padding: 0 16px;
	border-radius: 77px;
	background: rgba(255, 255, 255, 0.5);
	font-family: var(--font-figtree);
	font-size: 16px;
	font-weight: 500;
	line-height: 24px;
	letter-spacing: 0.032px;
	color: #475569;
	white-space: nowrap;
	flex-shrink: 0;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
	text-decoration: none;
	border: none;
}

.blog-filters__pill:hover {
	background: var(--gray-5000, #030712);
	color: #fff;
}

/* Always-dark pills (Tags + Search toggle) */
.blog-filters__pill--dark {
	background: var(--gray-5000, #030712);
	color: #fff;
}

.blog-filters__pill--dark:hover {
	background: #1a1a2e;
}

/* Icon-only pill (Search toggle) */
.blog-filters__pill--icon {
	width: 42px;
	padding: 0;
}

/* Active category pill */
.blog-filters__pill.is-active {
	background: var(--gray-5000, #030712);
	color: #fff;
}

/* ── Tags wrap ── */

.blog-filters__tags-wrap {
	flex-shrink: 0;
}

.blog-filters__tags-count {
	display: none;
	align-items: center;
	justify-content: center;
	min-width: 20px;
	height: 20px;
	padding: 0 5px;
	border-radius: 10px;
	background: rgba(255, 255, 255, 0.25);
	color: #fff;
	font-size: 12px;
	font-weight: 600;
	line-height: 1;
}

.blog-filters__tags-count.is-visible {
	display: inline-flex;
}

.blog-filters__tags-chevron {
	display: flex;
	align-items: center;
	transition: transform 0.2s ease;
}

.blog-filters__tags-btn[aria-expanded="true"] .blog-filters__tags-chevron {
	transform: rotate(180deg);
}

/* ── Tags dropdown — wide, full-bar-width, multi-column ── */

.blog-filters__tags-dropdown {
	display: none;
	position: absolute;
	top: calc(100% + 10px);
	left: 0;
	right: 0;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 4px 6px rgba(242, 231, 207, 0.4), 0 12px 32px rgba(0, 0, 0, 0.1);
	padding: 24px;
	z-index: 300;
}

.blog-filters__tags-dropdown.is-open {
	display: block;
}

.blog-filters__tags-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 4px 16px;
}

@media (max-width: 900px) {
	.blog-filters__tags-list {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 640px) {
	.blog-filters__tags-list {
		grid-template-columns: repeat(2, 1fr);
	}
}

.blog-filters__tag-label {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 10px;
	border-radius: 6px;
	cursor: pointer;
	font-family: var(--font-figtree);
	font-size: 14px;
	font-weight: 500;
	color: var(--nav-dark, #2d4059);
	transition: background 0.15s ease;
	user-select: none;
}

.blog-filters__tag-label:hover {
	background: #f5f6f8;
}

.blog-filters__tag-cb {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

.blog-filters__tag-check {
	flex-shrink: 0;
	width: 18px;
	height: 18px;
	border-radius: 4px;
	border: 1.5px solid #cbd5e1;
	background: #fff;
	background-repeat: no-repeat;
	background-position: center;
	transition: background 0.15s ease, border-color 0.15s ease;
}

.blog-filters__tag-cb:checked + .blog-filters__tag-check {
	background-color: var(--gray-5000, #030712);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12' fill='none'%3E%3Cpath d='M2 6l3 3 5-5' stroke='%23fff' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* ── Right-side wrapper (pills + other + search overlay) ── */

.blog-filters__right {
	flex: 1;
	min-width: 0;
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
}

/* ── Category pills row ── */

.blog-filters__pills {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1;
	min-width: 0;
	overflow: hidden;
}

/* ── "Other" overflow pill + dropdown ── */

.blog-filters__other-wrap {
	flex-shrink: 0;
	position: relative;
}

.blog-filters__other-wrap[hidden] {
	display: none;
}

.blog-filters__other-btn svg {
	transition: transform 0.2s ease;
}

.blog-filters__other-btn[aria-expanded="true"] svg {
	transform: rotate(180deg);
}

.blog-filters__other-dropdown {
	display: none;
	flex-direction: column;
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	min-width: 180px;
	background: #fff;
	border-radius: 12px;
	box-shadow: 0 4px 6px rgba(242, 231, 207, 0.4), 0 12px 32px rgba(0, 0, 0, 0.1);
	padding: 8px;
	z-index: 250;
}

.blog-filters__other-dropdown.is-open {
	display: flex;
}

.blog-filters__other-item {
	display: block;
	padding: 8px 12px;
	border-radius: 8px;
	font-family: var(--font-figtree);
	font-size: 15px;
	font-weight: 500;
	color: var(--gray-5000, #030712);
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.15s ease;
}

.blog-filters__other-item:hover {
	background: #f5f6f8;
}

.blog-filters__other-item.is-active {
	background: var(--gray-5000, #030712);
	color: #fff;
	border-radius: 8px;
}

/* ── Search input — absolutely overlays the right wrapper ── */

.blog-filters__search {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 0 16px;
	border-radius: 77px;
	border: 1px solid #d0d3db;
	background: rgba(255, 255, 255, 0.95);
	overflow: hidden;

	/* Hidden: clipped from right → left reveal on open */
	clip-path: inset(0 100% 0 0 round 77px);
	pointer-events: none;

	transition: clip-path 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Search open: reveal left → right */
.blog-filters.is-search-open .blog-filters__search {
	clip-path: inset(0 0% 0 0 round 77px);
	pointer-events: auto;
}

/* Pills + Other: hide from accessibility tree when search overlays them */
.blog-filters.is-search-open .blog-filters__pills,
.blog-filters.is-search-open .blog-filters__other-wrap {
	visibility: hidden;
}

.blog-filters__search-icon {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	color: #848c97;
	cursor: pointer;
}

.blog-filters__search-input {
	flex: 1;
	min-width: 0;
	border: none;
	background: transparent;
	outline: none;
	font-family: var(--font-figtree);
	font-size: 16px;
	font-weight: 400;
	line-height: 24px;
	color: var(--nav-dark);
	height: 40px;
	-webkit-appearance: none;
	appearance: none;
}

.blog-filters__search-input::placeholder {
	color: #848c97;
}

.blog-filters__search-input::-webkit-search-cancel-button,
.blog-filters__search-input::-webkit-search-decoration {
	display: none;
}

.blog-filters__search-clear {
	display: flex;
	align-items: center;
	flex-shrink: 0;
	background: none;
	border: none;
	padding: 4px;
	color: #848c97;
	cursor: pointer;
	visibility: hidden;
	transition: color 0.15s ease;
}

.blog-filters__search-clear.is-visible {
	visibility: visible;
}

.blog-filters__search-clear:hover {
	color: var(--nav-dark);
}

/* ── Active chips row ── */

.blog-filters__chips {
	display: none;
	align-items: center;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 14px;
}

.blog-filters__chips.is-visible {
	display: flex;
}

.blog-filters__chip {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	height: 32px;
	padding: 0 12px;
	border-radius: 77px;
	border: 1.5px solid var(--nav-dark, #2d4059);
	background: transparent;
	font-family: var(--font-figtree);
	font-size: 14px;
	font-weight: 500;
	color: var(--nav-dark, #2d4059);
	cursor: pointer;
	white-space: nowrap;
	transition: background 0.15s ease;
}

.blog-filters__chip:hover {
	background: rgba(45, 64, 89, 0.06);
}

.blog-filters__chip--clear {
	display: none;
	border-color: #f53838;
	color: #f53838;
}

.blog-filters__chip--clear.is-visible {
	display: inline-flex;
}

.blog-filters__chip--clear:hover {
	background: rgba(245, 56, 56, 0.06);
}

/* ==========================================================================
   Blog results — filtered grid (populated via AJAX)
   ========================================================================== */

.blog-results__filtered {
	display: none;
	padding: 48px 0 64px;
	background: var(--hdr-bg, #faf4e7);
}

.blog-results__filtered.is-visible {
	display: block;
}

.blog-results__grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 24px;
}

.blog-results__empty {
	text-align: center;
	padding: 48px 0;
	font-family: var(--font-figtree);
	font-size: 18px;
	font-weight: 400;
	color: #848c97;
}

/* ── Spinner ── */

.blog-results__spinner {
	display: flex;
	justify-content: center;
	padding: 48px 0;
}

.blog-results__spinner-circle {
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 3px solid rgba(3, 7, 18, 0.1);
	border-top-color: var(--nav-dark, #030712);
	animation: warmy-spin 0.7s linear infinite;
}

@keyframes warmy-spin {
	to { transform: rotate(360deg); }
}

.blog-results__more {
	margin-top: 40px;
	text-align: center;
}

.blog-results__load-more {
	display: none;
	align-items: center;
	justify-content: center;
	height: 48px;
	padding: 0 32px;
	border-radius: 8px;
	border: 1.5px solid var(--nav-dark);
	background: transparent;
	font-family: var(--font-figtree);
	font-size: 16px;
	font-weight: 600;
	color: var(--nav-dark);
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}

.blog-results__load-more.is-visible {
	display: inline-flex;
}

.blog-results__load-more:hover {
	background: var(--nav-dark);
	color: #fff;
}

.blog-results__load-more:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 900px) {
	.blog-results__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 480px) {
	.blog-results__grid {
		grid-template-columns: 1fr;
	}

	.blog-filters__pill {
		font-size: 14px;
		height: 36px;
		padding: 0 12px;
	}

	.blog-filters__pill--icon {
		width: 36px;
	}
}
