/* Choice Blog Grid — grade de posts com filtro, busca e paginação. */

.choice-blog {
	--cb-accent: #3399aa;
	--cb-accent-dark: #2b8092;
	--cb-accent-soft: rgba(51, 153, 170, 0.1);
	--cb-text: #2f3a45;
	--cb-muted: #7c8894;
	--cb-border: #e3e7ec;
	--cb-surface: #ffffff;
	--cb-radius: 16px;
	--cb-gap: 24px;
	--cb-columns: 4;

	box-sizing: border-box;
	color: var(--cb-text);
	container-type: inline-size;
	margin-inline: auto;
	max-width: 1240px;
	width: 100%;
}

.choice-blog *,
.choice-blog *::before,
.choice-blog *::after {
	box-sizing: inherit;
}

.cb-sr {
	border: 0;
	clip-path: inset(50%);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

/* ---------------------------------------------------------------- Toolbar */

.cb-toolbar {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 16px;
	justify-content: space-between;
	margin-bottom: 20px;
}

.cb-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	min-width: 0;
}

.cb-chip {
	background: transparent;
	border: 1px solid var(--cb-border);
	border-radius: 999px;
	color: var(--cb-muted);
	cursor: pointer;
	display: inline-block;
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.2;
	padding: 9px 18px;
	text-decoration: none;
	transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
	white-space: nowrap;
}

.cb-chip:hover {
	background: var(--cb-accent-soft);
	border-color: var(--cb-accent);
	color: var(--cb-accent-dark);
}

.cb-chip.is-active,
.cb-chip.is-active:hover {
	background: var(--cb-accent);
	border-color: var(--cb-accent);
	color: #fff;
}

.cb-search {
	flex: 0 1 320px;
	margin: 0;
	position: relative;
}

.cb-search__icon {
	fill: var(--cb-muted);
	height: 18px;
	left: 14px;
	pointer-events: none;
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 18px;
	right: 10px !important;
}

.cb-search__input {
	background: var(--cb-surface);
	border: 1px solid var(--cb-border);
	border-radius: 999px;
	color: var(--cb-text);
	font: inherit;
	font-size: 14px;
	height: 44px;
	padding: 0 40px 0 40px;
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
	width: 100%;
}

.cb-search__input::placeholder {
	color: var(--cb-muted);
}

.cb-search__input:focus {
	border-color: var(--cb-accent);
	box-shadow: 0 0 0 3px var(--cb-accent-soft);
	outline: none;
}

/* Remove o "x" nativo do type=search para não duplicar com o nosso. */
.cb-search__input::-webkit-search-cancel-button {
	-webkit-appearance: none;
	appearance: none;
}

.cb-search__clear {
	background: none;
	border: 0;
	color: var(--cb-muted);
	cursor: pointer;
	display: none;
	font-size: 22px;
	line-height: 1;
	padding: 4px 8px;
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	padding-bottom: 18px !important;
}

.cb-search__clear.is-visible {
	display: block;
}

.cb-search__clear:hover {
	color: var(--cb-text);
}

.cb-count {
	color: var(--cb-muted);
	font-size: 14px;
	margin: 0 0 16px;
}

/* ------------------------------------------------------------------ Grade */

.cb-grid {
	display: grid;
	gap: var(--cb-gap);
	grid-template-columns: repeat(var(--cb-columns), minmax(0, 1fr));
	transition: opacity 0.18s ease;
}

.cb-grid[aria-busy="true"] {
	opacity: 0.4;
	pointer-events: none;
}

.cb-card {
	background: var(--cb-surface);
	border: 1px solid var(--cb-border);
	border-radius: var(--cb-radius);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	padding: 12px;
	position: relative;
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.cb-card:hover {
	border-color: rgba(51, 153, 170, 0.45);
	box-shadow: 0 14px 30px rgba(31, 45, 61, 0.1);
	transform: translateY(-4px);
}

.cb-card:focus-within {
	border-color: var(--cb-accent);
	box-shadow: 0 0 0 3px var(--cb-accent-soft);
}

.cb-card__media {
	aspect-ratio: 16 / 10;
	background: #eef1f4;
	border-radius: 10px;
	/* Nunca cresce para preencher a altura da linha do grid. */
	flex: 0 0 auto;
	overflow: hidden;
}

.cb-card__img {
	display: block;
	height: 100%;
	object-fit: cover;
	transition: transform 0.35s ease;
	width: 100%;
}

.cb-card__img--placeholder {
	background: linear-gradient(135deg, #dfe6ea 0%, #c9d6db 100%);
}

.cb-card:hover .cb-card__img {
	transform: scale(1.04);
}

.cb-card__body {
	display: flex;
	flex-direction: column;
	flex: 1;
	gap: 10px;
	padding: 14px 6px 10px;
}

.cb-pill {
	align-self: flex-start;
	background: var(--cb-accent);
	border: 0;
	border-radius: 999px;
	color: #fff;
	cursor: pointer;
	display: inline-block;
	font: inherit;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.2;
	padding: 6px 13px;
	position: relative;
	text-decoration: none;
	transition: background-color 0.18s ease;
	z-index: 2;
}

.cb-pill:hover,
.cb-pill:focus {
	background: var(--cb-accent-dark);
	color: #fff;
}

.cb-card__title {
	color: var(--cb-text);
	font-size: 15.5px;
	font-weight: 700;
	line-height: 1.35;
	margin: 0;
}

.cb-card__link {
	color: inherit;
	text-decoration: none;
}

/* Área clicável do card inteiro, sem aninhar links. */
.cb-card__link::after {
	content: "";
	inset: 0;
	position: absolute;
	z-index: 1;
}

.cb-card__link:hover {
	color: var(--cb-accent-dark);
}

.cb-card__excerpt {
	color: var(--cb-muted);
	font-size: 14px;
	line-height: 1.5;
	margin: 0;
}

.cb-card__rule {
	background: #dfe4e9;
	border-radius: 2px;
	display: block;
	height: 3px;
	margin-top: auto;
	width: 30px;
}

.cb-card__date {
	color: var(--cb-muted);
	font-size: 13px;
}

/* ------------------------------------------------------------ Sem posts */

.cb-empty {
	border: 1px dashed var(--cb-border);
	border-radius: var(--cb-radius);
	color: var(--cb-muted);
	grid-column: 1 / -1;
	padding: 56px 24px;
	text-align: center;
}

.cb-empty svg {
	fill: #c4ccd4;
	height: 40px;
	margin-bottom: 12px;
	width: 40px;
}

.cb-empty p {
	margin: 0;
}

/* ------------------------------------------------------------- Paginação */

.cb-pagination {
	align-items: center;
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	justify-content: center;
	margin-top: 36px;
}

.cb-page {
	background: var(--cb-surface);
	border: 1px solid var(--cb-border);
	border-radius: 10px;
	color: var(--cb-text);
	cursor: pointer;
	display: inline-block;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	min-width: 40px;
	padding: 11px 12px;
	text-align: center;
	text-decoration: none;
	transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

a.cb-page:hover {
	background: var(--cb-accent-soft);
	border-color: var(--cb-accent);
	color: var(--cb-accent-dark);
}

.cb-page.is-active {
	background: var(--cb-accent);
	border-color: var(--cb-accent);
	color: #fff;
	cursor: default;
}

.cb-page.is-disabled {
	cursor: default;
	opacity: 0.4;
}

.cb-page--gap {
	background: none;
	border: 0;
	color: var(--cb-muted);
	cursor: default;
}

.cb-page--nav {
	font-size: 18px;
	padding: 8px 12px;
}

/* ----------------------------------------------------------- Responsivo */

@container (max-width: 1080px) {
	.choice-blog {
		--cb-columns: 3;
	}
}

@container (max-width: 760px) {
	.choice-blog {
		--cb-columns: 2;
		--cb-gap: 16px;
	}

	.cb-toolbar {
		align-items: stretch;
		flex-direction: column;
	}

	.cb-filters {
		-webkit-overflow-scrolling: touch;
		flex-wrap: nowrap;
		overflow-x: auto;
		padding-bottom: 4px;
		scrollbar-width: none;
	}

	.cb-filters::-webkit-scrollbar {
		display: none;
	}

	.cb-search {
		flex-basis: auto;
	}
}

@container (max-width: 460px) {
	.choice-blog {
		--cb-columns: 1;
	}
}

/* Fallback para navegadores sem suporte a container queries. */
@supports not (container-type: inline-size) {
	@media (max-width: 1080px) {
		.choice-blog {
			--cb-columns: 3;
		}
	}

	@media (max-width: 760px) {
		.choice-blog {
			--cb-columns: 2;
			--cb-gap: 16px;
		}

		.cb-toolbar {
			align-items: stretch;
			flex-direction: column;
		}
	}

	@media (max-width: 460px) {
		.choice-blog {
			--cb-columns: 1;
		}
	}
}

@media (prefers-reduced-motion: reduce) {
	.choice-blog * {
		transition: none !important;
	}

	.cb-card:hover {
		transform: none;
	}

	.cb-card:hover .cb-card__img {
		transform: none;
	}
}
