/**
 * Grid Posts — Elementor Custom Widgets (layout "magazine")
 * Prefixo: ecw-pg
 *
 * A cor de destaque usa a cor primária global do Elementor (se existir)
 * e faz fallback para o terracota #632921.
 */

.ecw-pg {
	--ecw-pg-accent: var(--e-global-color-primary, #632921);
	--ecw-pg-cols: 4;
	--ecw-pg-gap: 28px;

	width: 100%;
}

.ecw-pg__heading {
	margin: 0 0 clamp(1.5rem, 3vw, 2.5rem);
}

/* Grelha */
.ecw-pg .ecw-pg__grid {
	display: grid;
	grid-template-columns: repeat(var(--ecw-pg-cols), minmax(0, 1fr));
	gap: var(--ecw-pg-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.ecw-pg .ecw-pg__item {
	margin: 0;
	padding: 0;
	min-width: 0;
}

/* Cartão */
.ecw-pg__card {
	position: relative; /* âncora do link esticado */
	display: flex;
	flex-direction: column;
	height: 100%;
}

.ecw-pg__media {
	position: relative;
	overflow: hidden;
	aspect-ratio: 5 / 4;
	background: var(--ecw-pg-accent);
}

/* Sobrepõe as regras globais de img do Elementor/tema */
.ecw-pg .ecw-pg__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	transition: transform .6s cubic-bezier(.22, .61, .36, 1);
}

.ecw-pg__card:hover .ecw-pg__img {
	transform: scale(1.04);
}

/* Placeholder (artigo sem imagem de destaque) */
.ecw-pg__placeholder {
	position: absolute;
	inset: 0;
	background:
		linear-gradient(160deg, rgba(255, 255, 255, .14), transparent 55%),
		var(--ecw-pg-accent);
}

.ecw-pg__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding-top: 16px;
}

/* Categoria */
.ecw-pg .ecw-pg__cat {
	display: flex;
	align-items: center;
	gap: .6rem;
	margin: 0 0 .65rem;
	font-size:  12px;
	font-weight: 600;
	letter-spacing: 0.14em;
	line-height: 1.2;
	text-transform: uppercase;
	color: #8A5A4F;
}

.ecw-pg__cat-icon {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	color: var(--ecw-pg-accent);
}

/* Título (link esticado: o cartão inteiro é clicável) */
.ecw-pg .ecw-pg__title {
	margin: 0 0 1rem;
	font-size: 1.35rem;
	font-weight: 600;
	line-height: 1.25;
	color: #1b120d;
	transition: color .3s ease;
}

.ecw-pg .ecw-pg__title a {
	color: inherit;
	text-decoration: none;
}

.ecw-pg .ecw-pg__title a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.ecw-pg__card:hover .ecw-pg__title,
.ecw-pg__card:focus-within .ecw-pg__title {
	color: var(--ecw-pg-accent);
}

.ecw-pg .ecw-pg__title a:focus-visible::after {
	outline: 2px solid var(--ecw-pg-accent);
	outline-offset: 4px;
}

/* Meta: autor • data → */
.ecw-pg .ecw-pg__meta {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: .4rem .6rem;
	margin-top: auto;
	font-size: .78rem;
	line-height: 1.2;
	color: #6b6b6b;
}

.ecw-pg__dot {
	flex-shrink: 0;
	width: 4px;
	height: 4px;
	border-radius: 50%;
	background: var(--ecw-pg-accent);
}

.ecw-pg__arrow {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	color: var(--ecw-pg-accent);
	transition: transform .3s ease;
}

.ecw-pg__card:hover .ecw-pg__arrow,
.ecw-pg__card:focus-within .ecw-pg__arrow {
	transform: translateX(5px);
}

/* Responsivo (defaults; os controlos do Elementor têm prioridade) */
@media (max-width: 1024px) {
	.ecw-pg { --ecw-pg-cols: 2; }
}

@media (max-width: 767px) {
	.ecw-pg { --ecw-pg-cols: 1; }
	.ecw-pg .ecw-pg__title { font-size: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
	.ecw-pg .ecw-pg__img,
	.ecw-pg__arrow,
	.ecw-pg .ecw-pg__title {
		transition: none;
	}
	.ecw-pg__card:hover .ecw-pg__img,
	.ecw-pg__card:hover .ecw-pg__arrow {
		transform: none;
	}
}