/* ==========================================================================
   Ápice Portafolio para Elementor
   Todo está prefijado con .apc- para no chocar con el tema.
   Las variables se pueden sobreescribir desde los controles de Estilo.
   ========================================================================== */

.apc,
.apc-lightbox {
	--apc-green: #192C27;
	--apc-text: #365951;
	--apc-black: #000000;
	--apc-white: #FFFFFF;
	--apc-mist: #F2F7F6;
	--apc-gray: #69727D;
	--apc-line: #DFDFDF;
	--apc-radius: 4px;
	--apc-font: 'Montserrat', 'Helvetica Neue', Arial, sans-serif;
	--apc-accent: var(--apc-green);
}

.apc,
.apc *,
.apc *::before,
.apc *::after,
.apc-lightbox,
.apc-lightbox *,
.apc-lightbox *::before,
.apc-lightbox *::after {
	box-sizing: border-box;
}

.apc {
	font-family: var(--apc-font);
	color: var(--apc-text);
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
	width: 100%;
}

/* Reset ligero de botones para ganarle a los estilos del tema */
.apc button,
.apc-lightbox button {
	font-family: var(--apc-font);
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
	margin: 0;
	-webkit-appearance: none;
	appearance: none;
}

.apc-empty {
	padding: 2rem;
	text-align: center;
	border: 1px dashed #ccc;
	color: #777;
}

/* ========== SECCIÓN / ENCABEZADO ========== */

.apc-section {
	max-width: 1400px;
	margin: 0 auto;
	padding: 5rem 2rem 6rem;
}

.apc-header {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	margin-bottom: 2.5rem;
	gap: 1.5rem;
}

.apc-title {
	font-family: var(--apc-font);
	font-size: clamp(2.2rem, 4.5vw, 3.4rem);
	font-weight: 700;
	letter-spacing: -0.01em;
	color: var(--apc-green);
	line-height: 1.15;
	margin: 0;
	padding: 0;
}

.apc-title em {
	color: var(--apc-green);
	font-style: italic;
	font-weight: 700;
}

.apc-subtitle {
	font-size: 0.95rem;
	color: var(--apc-gray);
	max-width: 400px;
	margin: 0.6rem 0 0;
}

/* ========== BARRA DE CONTROLES ========== */

.apc-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1.25rem;
	padding: 1.1rem 1.4rem;
	background: var(--apc-mist);
	border: 1px solid var(--apc-line);
	border-radius: var(--apc-radius);
	margin-bottom: 2.5rem;
}

.apc-controls.is-sticky {
	position: sticky;
	top: 1rem;
	z-index: 50;
}

.apc-filters {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
}

.apc button.apc-filter-btn {
	background: transparent;
	border: 1px solid var(--apc-line);
	border-radius: calc(var(--apc-radius) - 1px);
	padding: 0.55rem 1.15rem;
	font-size: 0.82rem;
	font-weight: 500;
	line-height: 1.2;
	color: var(--apc-text);
	cursor: pointer;
	transition: all 0.2s ease;
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
}

.apc button.apc-filter-btn i,
.apc button.apc-filter-btn svg {
	font-size: 0.7rem;
	width: 0.8em;
	height: 0.8em;
	opacity: 0.8;
	fill: currentColor;
}

.apc button.apc-filter-btn:hover,
.apc button.apc-filter-btn:focus-visible {
	background: transparent;
	border-color: var(--apc-green);
	color: var(--apc-green);
}

.apc button.apc-filter-btn.is-active,
.apc button.apc-filter-btn.is-active:hover {
	background: var(--apc-black);
	border-color: var(--apc-black);
	color: var(--apc-white);
}

.apc-view-toggle {
	display: flex;
	align-items: center;
	gap: 0.6rem;
}

.apc-view-label {
	font-size: 0.72rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: var(--apc-gray);
}

.apc-view-buttons {
	display: flex;
	gap: 0.25rem;
	background: var(--apc-line);
	padding: 0.25rem;
	border-radius: calc(var(--apc-radius) - 1px);
}

.apc button.apc-view-btn {
	background: transparent;
	border: none;
	border-radius: calc(var(--apc-radius) - 1px);
	padding: 0.45rem 0.85rem;
	font-size: 0.8rem;
	font-weight: 600;
	line-height: 1.2;
	color: var(--apc-gray);
	cursor: pointer;
	transition: all 0.2s ease;
	min-width: 38px;
}

.apc button.apc-view-btn:hover,
.apc button.apc-view-btn:focus-visible {
	background: transparent;
	color: var(--apc-green);
}

.apc button.apc-view-btn.is-active,
.apc button.apc-view-btn.is-active:hover {
	background: var(--apc-white);
	color: var(--apc-green);
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* ========== GRID ========== */

.apc-grid {
	display: grid;
	gap: 1.75rem;
	transition: all 0.3s ease;
}

.apc-grid.apc-view-2 { grid-template-columns: repeat(2, 1fr); gap: 2rem; }
.apc-grid.apc-view-4 { grid-template-columns: repeat(4, 1fr); gap: 1.5rem; }
.apc-grid.apc-view-6 { grid-template-columns: repeat(6, 1fr); gap: 1.1rem; }

/* ========== TARJETA ========== */

.apc-card {
	background: var(--apc-white);
	border-radius: var(--apc-radius);
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
	transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.4s ease;
	display: flex;
	flex-direction: column;
	cursor: pointer;
	border: 1px solid var(--apc-line);
	position: relative;
	min-width: 0;
}

.apc-card[hidden] {
	display: none;
}

.apc-card.is-entering {
	animation: apc-fade-in 0.4s ease both;
}

@keyframes apc-fade-in {
	from { opacity: 0; transform: translateY(10px); }
	to   { opacity: 1; transform: translateY(0); }
}

.apc-card:hover {
	transform: translateY(-6px);
	box-shadow: 0 24px 40px -16px rgba(0, 0, 0, 0.12);
}

.apc-card::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: var(--apc-accent);
	z-index: 3;
	opacity: 0;
	transition: opacity 0.3s ease;
}

.apc-card:hover::before {
	opacity: 1;
}

/* ---------- Carrusel de la tarjeta ---------- */

.apc-card-carousel {
	position: relative;
	width: 100%;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: var(--apc-mist);
}

.apc-track,
.apc-lb-track {
	display: flex;
	height: 100%;
	transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
	will-change: transform;
}

.apc-slide,
.apc-lb-slide {
	min-width: 100%;
	height: 100%;
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
}

.apc-slide img.apc-img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	max-width: none;
	margin: 0;
	border-radius: 0;
}

.apc-lb-slide img.apc-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	max-width: none;
	margin: 0;
	border-radius: 0;
}

.apc-placeholder {
	width: 100%;
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	color: rgba(255, 255, 255, 0.9);
	font-size: 3.5rem;
}

.apc-placeholder i,
.apc-placeholder svg {
	font-size: 1em;
	width: 1em;
	height: 1em;
	fill: currentColor;
	opacity: 0.9;
	filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.35));
}

.apc button.apc-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 34px;
	height: 34px;
	padding: 0;
	border-radius: calc(var(--apc-radius) - 1px);
	background: rgba(255, 255, 255, 0.92);
	border: none;
	color: var(--apc-black);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.25s ease, background 0.2s ease, transform 0.2s ease;
	z-index: 3;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.apc-card:hover button.apc-arrow,
.apc button.apc-arrow:focus-visible {
	opacity: 1;
}

.apc button.apc-arrow:hover {
	background: var(--apc-white);
	color: var(--apc-black);
	transform: translateY(-50%) scale(1.1);
}

.apc button.apc-arrow.prev { left: 0.7rem; }
.apc button.apc-arrow.next { right: 0.7rem; }

.apc-dots {
	position: absolute;
	bottom: 0.8rem;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 0.35rem;
	z-index: 3;
	padding: 0.3rem 0.55rem;
	background: rgba(0, 0, 0, 0.25);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	border-radius: calc(var(--apc-radius) - 1px);
}

.apc button.apc-dot {
	width: 6px;
	height: 6px;
	min-width: 0;
	min-height: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.5);
	border: none;
	cursor: pointer;
	transition: background 0.2s ease, width 0.25s ease;
	padding: 0;
}

.apc button.apc-dot:hover {
	background: rgba(255, 255, 255, 0.8);
}

.apc button.apc-dot.is-active,
.apc button.apc-dot.is-active:hover {
	background: var(--apc-white);
	width: 16px;
	border-radius: 10px;
}

/* ---------- Contenido de la tarjeta ---------- */

.apc-card-content {
	padding: 1.4rem 1.4rem 1.5rem;
	display: flex;
	flex-direction: column;
	flex: 1;
}

.apc-narrative {
	font-style: italic;
	font-size: 0.82rem;
	color: var(--apc-gray);
	margin: 0 0 0.85rem;
	line-height: 1.5;
	padding-left: 0.75rem;
	border-left: 2px solid var(--apc-accent);
}

.apc-cat {
	font-size: 0.68rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.1em;
	color: var(--apc-accent);
	margin: 0 0 0.55rem;
	display: flex;
	align-items: center;
	gap: 0.4rem;
}

.apc-cat i,
.apc-cat svg {
	font-size: 0.7rem;
	width: 0.9em;
	height: 0.9em;
	fill: currentColor;
}

.apc-card-title {
	font-family: var(--apc-font);
	font-size: 1.2rem;
	font-weight: 700;
	margin: 0 0 0.5rem;
	padding: 0;
	color: var(--apc-green);
	line-height: 1.25;
	letter-spacing: -0.01em;
}

.apc-card-desc {
	font-size: 0.85rem;
	color: var(--apc-gray);
	line-height: 1.6;
	margin: 0 0 1.1rem;
	flex: 1;
}

.apc .apc-cta,
.apc button.apc-cta {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--apc-green);
	transition: color 0.2s ease, gap 0.25s ease;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	text-decoration: none;
	background: transparent;
	border: none;
	padding: 0;
	cursor: pointer;
	width: fit-content;
	line-height: 1.4;
}

.apc-card:hover .apc-cta,
.apc-card:hover button.apc-cta {
	gap: 0.75rem;
	color: var(--apc-accent);
	background: transparent;
}

.apc .apc-cta svg {
	transition: transform 0.25s ease;
}

.apc-card:hover .apc-cta svg {
	transform: translateX(3px);
}

/* ---------- Variantes según vista ---------- */

.apc-grid.apc-view-2 .apc-card-carousel { aspect-ratio: 16 / 10; }
.apc-grid.apc-view-2 .apc-card-content { padding: 1.75rem 1.85rem 1.9rem; }
.apc-grid.apc-view-2 .apc-card-title { font-size: 1.6rem; }
.apc-grid.apc-view-2 .apc-card-desc { font-size: 0.92rem; }
.apc-grid.apc-view-2 .apc-narrative { font-size: 0.95rem; margin-bottom: 1.1rem; }
.apc-grid.apc-view-2 .apc-placeholder { font-size: 4.5rem; }

.apc-grid.apc-view-6 .apc-card-carousel { aspect-ratio: 1 / 1; }
.apc-grid.apc-view-6 .apc-card-content { padding: 0.95rem 1rem 1.1rem; }
.apc-grid.apc-view-6 .apc-narrative { display: none; }
.apc-grid.apc-view-6 .apc-card-title { font-size: 0.95rem; margin-bottom: 0.35rem; }
.apc-grid.apc-view-6 .apc-card-desc {
	font-size: 0.75rem;
	line-height: 1.5;
	margin-bottom: 0.8rem;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.apc-grid.apc-view-6 .apc-cta { font-size: 0.7rem; }
.apc-grid.apc-view-6 .apc-placeholder { font-size: 2.4rem; }
.apc-grid.apc-view-6 button.apc-arrow { width: 28px; height: 28px; }
.apc-grid.apc-view-6 .apc-dots { bottom: 0.5rem; padding: 0.2rem 0.4rem; }
.apc-grid.apc-view-6 button.apc-dot { width: 5px; height: 5px; }
.apc-grid.apc-view-6 button.apc-dot.is-active { width: 12px; }

/* ---------- Contador ---------- */

.apc-count {
	margin-top: 2rem;
	justify-content: center;
	font-size: 0.78rem;
	color: var(--apc-gray);
	font-weight: 500;
	letter-spacing: 0.02em;
	display: flex;
	align-items: center;
	gap: 0.4rem;
	text-align: center;
	flex-wrap: wrap;
}

.apc-count strong {
	color: var(--apc-green);
	font-weight: 700;
}

/* ========== LIGHTBOX ========== */

.apc-lightbox {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.94);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	font-family: var(--apc-font);
	color: var(--apc-text);
	line-height: 1.65;
}

.apc-lightbox.is-open {
	opacity: 1;
	visibility: visible;
}

.apc-lb-inner {
	max-width: 1080px;
	width: 100%;
	background: var(--apc-white);
	border-radius: var(--apc-radius);
	overflow: hidden;
	display: grid;
	grid-template-columns: 1.25fr 1fr;
	max-height: 88vh;
	transform: scale(0.96) translateY(10px);
	transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
	box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.6);
}

.apc-lightbox.is-open .apc-lb-inner {
	transform: scale(1) translateY(0);
}

.apc-lb-carousel {
	position: relative;
	background: var(--apc-black);
	overflow: hidden;
	min-height: 420px;
}

.apc-lb-slide .apc-placeholder {
	font-size: 6rem;
}

.apc-lightbox button.apc-lb-btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 46px;
	height: 46px;
	padding: 0;
	border-radius: calc(var(--apc-radius) - 1px);
	background: rgba(255, 255, 255, 0.92);
	border: none;
	color: var(--apc-black);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, transform 0.2s;
	z-index: 3;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.apc-lightbox button.apc-lb-btn:hover {
	background: var(--apc-white);
	color: var(--apc-black);
	transform: translateY(-50%) scale(1.1);
}

.apc-lightbox button.apc-lb-btn.prev { left: 1.2rem; }
.apc-lightbox button.apc-lb-btn.next { right: 1.2rem; }

.apc-lb-dots {
	position: absolute;
	bottom: 1.2rem;
	left: 50%;
	transform: translateX(-50%);
	display: flex;
	gap: 0.45rem;
	z-index: 3;
	padding: 0.35rem 0.7rem;
	background: rgba(0, 0, 0, 0.3);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	border-radius: calc(var(--apc-radius) - 1px);
}

.apc-lb-dots:empty {
	display: none;
}

.apc-lightbox button.apc-lb-dot {
	width: 8px;
	height: 8px;
	min-width: 0;
	min-height: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.45);
	border: none;
	cursor: pointer;
	transition: background 0.2s, width 0.25s;
	padding: 0;
}

.apc-lightbox button.apc-lb-dot.is-active,
.apc-lightbox button.apc-lb-dot.is-active:hover {
	background: var(--apc-white);
	width: 22px;
	border-radius: 10px;
}

.apc-lb-info {
	padding: 2.75rem 2.25rem;
	display: flex;
	flex-direction: column;
	justify-content: center;
	overflow-y: auto;
}

.apc-lb-category {
	font-size: 0.72rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.12em;
	color: var(--apc-accent);
	margin: 0 0 0.85rem;
	display: flex;
	align-items: center;
	gap: 0.45rem;
}

.apc-lb-category::before {
	content: '';
	width: 20px;
	height: 2px;
	background: currentColor;
}

.apc-lb-title {
	font-family: var(--apc-font);
	font-size: 1.9rem;
	font-weight: 700;
	margin: 0 0 0.85rem;
	padding: 0;
	color: var(--apc-green);
	line-height: 1.15;
	letter-spacing: -0.015em;
}

.apc-lb-narrative {
	font-style: italic;
	font-size: 1rem;
	color: var(--apc-gray);
	line-height: 1.6;
	margin: 0 0 1.5rem;
	padding: 1rem 1.15rem;
	background: var(--apc-mist);
	border-radius: var(--apc-radius);
	border-left: 3px solid var(--apc-accent);
}

.apc-lb-description {
	font-size: 0.9rem;
	color: var(--apc-gray);
	line-height: 1.75;
	margin: 0 0 1.75rem;
}

.apc-lb-tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
	margin-bottom: 2rem;
}

.apc-lb-tag {
	background: var(--apc-mist);
	color: var(--apc-text);
	padding: 0.35rem 0.9rem;
	border-radius: calc(var(--apc-radius) - 1px);
	font-size: 0.72rem;
	font-weight: 500;
}

.apc-lightbox a.apc-lb-cta {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	background: var(--apc-black);
	color: var(--apc-white);
	padding: 0.9rem 1.75rem;
	border-radius: calc(var(--apc-radius) - 1px);
	text-decoration: none;
	font-size: 0.88rem;
	font-weight: 500;
	width: fit-content;
	transition: background 0.2s ease, gap 0.25s ease;
}

.apc-lightbox a.apc-lb-cta:hover {
	background: var(--apc-green);
	color: var(--apc-white);
	gap: 0.9rem;
}

.apc-lightbox button.apc-lb-close {
	position: absolute;
	top: 1.5rem;
	right: 1.5rem;
	width: 46px;
	height: 46px;
	padding: 0;
	border-radius: calc(var(--apc-radius) - 1px);
	background: rgba(255, 255, 255, 0.12);
	border: 1px solid rgba(255, 255, 255, 0.25);
	color: var(--apc-white);
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background 0.2s, transform 0.3s;
	z-index: 5;
}

.apc-lightbox button.apc-lb-close:hover {
	background: rgba(255, 255, 255, 0.25);
	color: var(--apc-white);
	transform: rotate(90deg);
}

/* ========== RESPONSIVE ========== */

@media (hover: none) {
	.apc button.apc-arrow { opacity: 1; }
}

@media (max-width: 1100px) {
	.apc-grid.apc-view-6 { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 900px) {
	.apc-grid.apc-view-2,
	.apc-grid.apc-view-4 { grid-template-columns: repeat(2, 1fr); }
	.apc-grid.apc-view-6 { grid-template-columns: repeat(3, 1fr); }

	.apc-lb-inner {
		grid-template-columns: 1fr;
		max-height: 92vh;
		overflow-y: auto;
	}
	.apc-lb-carousel { min-height: 300px; aspect-ratio: 16 / 10; }
	.apc-lb-info { padding: 1.75rem; overflow-y: visible; }
	.apc-lb-title { font-size: 1.5rem; }
}

@media (max-width: 700px) {
	.apc-section { padding: 3rem 1.25rem 4rem; }

	.apc-controls,
	.apc-controls.is-sticky {
		flex-direction: column;
		align-items: stretch;
		gap: 1rem;
		position: static;
	}

	.apc-filters {
		width: 100%;
		flex-wrap: nowrap;
		overflow-x: auto;
		padding-bottom: 0.3rem;
		scrollbar-width: none;
	}
	.apc-filters::-webkit-scrollbar { display: none; }
	.apc button.apc-filter-btn { flex: 0 0 auto; white-space: nowrap; }

	.apc-view-toggle { justify-content: space-between; }

	.apc-grid.apc-view-2,
	.apc-grid.apc-view-4,
	.apc-grid.apc-view-6 {
		grid-template-columns: 1fr;
		gap: 1.5rem;
	}

	/* En móvil todas las vistas muestran la tarjeta completa */
	.apc-grid.apc-view-6 .apc-narrative { display: block; }
	.apc-grid.apc-view-6 .apc-card-title { font-size: 1.15rem; }
	.apc-grid.apc-view-6 .apc-card-desc { font-size: 0.85rem; -webkit-line-clamp: unset; display: block; }
	.apc-grid.apc-view-6 .apc-placeholder { font-size: 3.5rem; }
	.apc-grid.apc-view-6 .apc-card-carousel { aspect-ratio: 4 / 3; }
	.apc-grid.apc-view-6 .apc-cta { font-size: 0.8rem; }

	.apc-lightbox { padding: 0.75rem; }
	.apc-lightbox button.apc-lb-close { top: 0.8rem; right: 0.8rem; width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
	.apc *,
	.apc-lightbox,
	.apc-lightbox * {
		transition-duration: 0.01ms !important;
		animation-duration: 0.01ms !important;
	}
}
