/* ===================== Trabajos: galería antes / después ===================== */
@property --pos { syntax: "<percentage>"; inherits: true; initial-value: 50%; }

.md-jobs {
	display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px;
	grid-auto-flow: row dense; margin: 8px auto 0;
}
.md-job {
	position: relative; display: flex; flex-direction: column; margin: 0;
	background: #fff; border-radius: var(--md-radius); overflow: hidden;
	box-shadow: var(--md-shadow); transition: transform .45s var(--md-ease), box-shadow .45s;
}
.md-job:hover { transform: translateY(-6px); box-shadow: var(--md-shadow-h); }
.md-job--wide { grid-column: span 2; }

/* Zona de fotos: misma altura en tarjetas normales y anchas */
.md-ba, .md-pair, .md-single { position: relative; margin: 0; aspect-ratio: 4 / 5; background: var(--md-lav); overflow: hidden; }
.md-job--wide .md-ba { aspect-ratio: 1.64; }
.md-ba img, .md-pair img, .md-single img {
	display: block; width: 100%; height: 100% !important; object-fit: cover;
	-webkit-user-drag: none; user-select: none;
}
.md-single img { object-fit: contain; background: var(--md-lav); }

/* Comparador */
.md-ba { cursor: ew-resize; touch-action: pan-y; -webkit-tap-highlight-color: transparent; user-select: none; }
.md-ba__after, .md-ba__before { position: absolute; inset: 0; }
.md-ba__before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.md-ba.is-animating { transition: --pos .7s var(--md-ease); }
.md-ba.is-dragging { transition: none; }
.md-ba__handle {
	position: absolute; top: 0; bottom: 0; left: var(--pos); width: 44px; margin-left: -22px; z-index: 3;
	display: grid; place-items: center; cursor: ew-resize; outline: none;
}
.md-ba__handle::before {
	content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 3px; margin-left: -1.5px;
	background: #fff; box-shadow: 0 0 0 1px rgba(20, 32, 79, .18), 0 0 14px rgba(20, 32, 79, .35);
}
.md-ba__knob {
	position: relative; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%;
	color: #fff; background: linear-gradient(135deg, var(--md-purple-2), var(--md-purple-d));
	border: 3px solid #fff; box-shadow: 0 10px 22px -8px rgba(20, 32, 79, .6);
	transition: transform .3s var(--md-ease);
}
.md-ba:hover .md-ba__knob, .md-ba.is-dragging .md-ba__knob { transform: scale(1.1); }
.md-ba__handle:focus-visible .md-ba__knob { outline: 3px solid var(--md-orange); outline-offset: 3px; }

/* Etiquetas ANTES / DESPUÉS */
.md-ba__tag {
	position: absolute; top: 14px; z-index: 2; padding: 6px 12px; border-radius: 999px;
	font-size: .74rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; line-height: 1;
	color: #fff; pointer-events: none; box-shadow: 0 6px 14px -6px rgba(20, 32, 79, .55);
	transition: opacity .3s;
}
.md-ba__tag--before { left: 14px; background: rgba(20, 32, 79, .88); }
.md-ba__tag--after { right: 14px; background: rgba(123, 44, 191, .92); }

/* Tarjeta con dos fotos */
.md-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; background: #fff; }
.md-pair--stack { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.md-pair__item { position: relative; margin: 0; overflow: hidden; min-height: 0; }
.md-pair__item .md-ba__tag { top: 12px; }
.md-pair__item .md-ba__tag--after { right: auto; left: 12px; }

/* Zoom suave y visor */
.md-zoom { cursor: zoom-in; }
.md-zoom img { transition: transform 1s var(--md-ease); }
.md-zoom:hover img { transform: scale(1.06); }

/* Texto de la tarjeta */
.md-job__body { padding: 18px 22px 22px; }
.md-job__title { font-size: 1.15rem; margin: 0 0 .3em; }
.md-job__desc { margin: 0; color: var(--md-muted); font-size: .96rem; line-height: 1.5; }

/* Carrusel "Más trabajos" (collages originales) */
.wp-block-gallery.md-carousel--square.has-nested-images figure.wp-block-image:not(#individual-image) { aspect-ratio: 1 / 1; position: relative; }
.md-car-cap {
	position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; margin: 0; padding: 26px 14px 12px;
	color: #fff; font-size: .9rem; font-weight: 600; line-height: 1.3; text-align: left;
	background: linear-gradient(180deg, rgba(20, 32, 79, 0), rgba(20, 32, 79, .78));
	pointer-events: none;
}
.md-works-more { margin-top: 48px !important; text-align: center; font-size: clamp(1.3rem, 2.2vw, 1.6rem); }
.md-works-note { text-align: center; color: var(--md-muted); font-size: .95rem; margin-top: -6px !important; }

@media (max-width: 1100px) {
	.md-jobs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
}
@media (max-width: 600px) {
	.md-jobs { grid-template-columns: 1fr; gap: 22px; }
	.md-job--wide { grid-column: auto; }
	.md-ba, .md-pair, .md-single { aspect-ratio: 4 / 4.4; }
	.md-job--wide .md-ba { aspect-ratio: 1.3; }
	.md-ba__knob { width: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
	.md-ba.is-animating { transition: none; }
}
