setLightboxOpen(false)}
onTouchStart={(e) => { touchStartX.current = e.touches[0].clientX; }}
onTouchEnd={(e) => {
if (touchStartX.current === null) return;
const dx = e.changedTouches[0].clientX - touchStartX.current;
if (Math.abs(dx) > 50 && photos.length > 1) {
e.stopPropagation();
if (dx < 0) setPhotoIdx((i) => Math.min(i + 1, photos.length - 1));
else setPhotoIdx((i) => Math.max(i - 1, 0));
}
touchStartX.current = null;
}}
style={{
position: 'fixed', inset: 0, zIndex: 500,
background: 'rgba(0,0,0,0.96)',
display: 'flex', alignItems: 'center', justifyContent: 'center',
cursor: 'zoom-out',
}}
>
e.stopPropagation()}
style={{
maxWidth: '100%', maxHeight: '100%',
objectFit: 'contain',
userSelect: 'none', pointerEvents: 'none',
}}
/>
{/* Close button */}
{ e.stopPropagation(); setLightboxOpen(false); }}
style={{
position: 'absolute',
top: 'calc(env(safe-area-inset-top, 0px) + 12px)',
right: 12,
width: 40, height: 40, borderRadius: 999,
background: 'rgba(255,255,255,0.1)',
border: '1px solid rgba(255,255,255,0.2)',
color: '#fff', fontSize: 20, fontWeight: 300,
cursor: 'pointer', display: 'flex', alignItems: 'center', justifyContent: 'center',
backdropFilter: 'blur(8px)',
}}
>×
{/* Counter */}
{photos.length > 1 && (
{photoIdx + 1} / {photos.length}
)}
{/* Prev / Next arrows (desktop) */}
{photos.length > 1 && photoIdx > 0 && (
{ e.stopPropagation(); setPhotoIdx((i) => Math.max(i - 1, 0)); }}
style={{
position: 'absolute', left: 12, top: '50%', transform: 'translateY(-50%)',
width: 44, height: 44, borderRadius: 999,
background: 'rgba(255,255,255,0.1)', border: '1px solid rgba(255,255,255,0.2)',
color: '#fff', fontSize: 22, cursor: 'pointer',
display: 'flex', alignItems: 'center', justifyContent: 'center',
backdropFilter: 'blur(8px)',
}}
>‹
)}
{photos.length > 1 && photoIdx < photos.length - 1 && (
{ e.stopPropagation(); setPhotoIdx((i) => Math.min(i + 1, photos.length - 1)); }}
style={{
position: 'absolute', right: 12, top: '50%', transform: 'translateY(-50%)',
width: 44, height: 44, borderRadius: 999,
background: 'rgba(255,255,255,0.1)', border: '1px solid rgba(255,255,255,0.2)',
color: '#fff', fontSize: 22, cursor: 'pointer',
display: 'flex', alignItems: 'center', justifyContent: 'center',
backdropFilter: 'blur(8px)',
}}
>›
)}
)}