/**
 * Elementor 模块：车间图库（瀑布流）
 *
 * 用 CSS 多列实现瀑布流：无需 JS，图片懒加载时也不会跳动（img 自带宽高属性）。
 * 列数：桌面 4 / 平板 3 / 手机 2（Elementor 中可调）。
 */

.elementor-widget-ss_gallery_masonry {
	width: 100%;
	max-width: 100%;
}

.ssgal {
	--ssgal-cols: 4;
	--ssgal-gap: 16px;
	--ssgal-radius: 6px;
	--ssgal-overlay: rgba(10, 30, 60, 0.45);
}

.ssgal-list {
	column-count: var(--ssgal-cols);
	column-gap: var(--ssgal-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.ssgal-item {
	display: block;
	margin: 0 0 var(--ssgal-gap);
	padding: 0;
	list-style: none;
	break-inside: avoid;
	-webkit-column-break-inside: avoid;
	page-break-inside: avoid;
}

.ssgal-link {
	position: relative;
	display: block;
	overflow: hidden;
	background: #eef1f4;
	border-radius: var(--ssgal-radius);
	cursor: zoom-in;
	/* 修复 Safari 圆角 + overflow 下缩放时的锯齿 */
	-webkit-mask-image: -webkit-radial-gradient(white, black);
}

span.ssgal-link {
	cursor: default;
}

.ssgal-link .ssgal-img {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	transition: transform 0.6s ease;
}

/* 悬停遮罩 + 放大镜 */
.ssgal-link::after {
	content: "";
	position: absolute;
	inset: 0;
	background: var(--ssgal-overlay);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.ssgal-zoom {
	position: absolute;
	top: 50%;
	left: 50%;
	z-index: 1;
	width: 48px;
	height: 48px;
	margin: -24px 0 0 -24px;
	background: rgba(255, 255, 255, 0.95);
	border-radius: 50%;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
	opacity: 0;
	transform: scale(0.7);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

/* 放大镜：圆 + 手柄 + 加号 */
.ssgal-zoom::before {
	content: "";
	position: absolute;
	top: 13px;
	left: 13px;
	width: 16px;
	height: 16px;
	border: 2px solid #15202e;
	border-radius: 50%;
	background:
		linear-gradient(#15202e, #15202e) center / 8px 2px no-repeat,
		linear-gradient(#15202e, #15202e) center / 2px 8px no-repeat;
}

.ssgal-zoom::after {
	content: "";
	position: absolute;
	top: 29px;
	left: 28px;
	width: 2px;
	height: 8px;
	background: #15202e;
	border-radius: 1px;
	transform: rotate(-45deg);
}

a.ssgal-link:hover .ssgal-img,
a.ssgal-link:focus-visible .ssgal-img {
	transform: scale(1.06);
}

a.ssgal-link:hover::after,
a.ssgal-link:focus-visible::after,
a.ssgal-link:hover .ssgal-zoom,
a.ssgal-link:focus-visible .ssgal-zoom {
	opacity: 1;
	transform: scale(1);
}

a.ssgal-link:focus-visible {
	outline: 2px solid #0b63ce;
	outline-offset: 2px;
}

.ssgal-empty {
	padding: 24px;
	text-align: center;
	color: #666;
	border: 1px dashed #ccc;
}

@media (max-width: 1024px) {
	.ssgal {
		--ssgal-cols: 3;
		--ssgal-gap: 12px;
	}
}

@media (max-width: 767px) {
	.ssgal {
		--ssgal-cols: 2;
		--ssgal-gap: 8px;
		--ssgal-radius: 4px;
	}
}

/* 触屏：不显示悬停效果 */
@media (hover: none) {
	a.ssgal-link:hover .ssgal-img {
		transform: none;
	}

	a.ssgal-link:hover::after,
	a.ssgal-link:hover .ssgal-zoom {
		opacity: 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ssgal-link .ssgal-img,
	.ssgal-link::after,
	.ssgal-zoom {
		transition: none;
	}
}
