/* ========== 统一灯箱(Medium 风格) ========== */ .lightbox-overlay { position: fixed; inset: 0; z-index: 50; /* overflow:hidden 裁剪超大的 absolute img,防止原图(可能数千 px) 撑大文档可滚动区,否则会触发非预期的 scroll 事件。 */ overflow: hidden; background: rgba(0, 0, 0, 0.92); opacity: 1; } /* 灯箱图片:绝对定位,尺寸/位置由 JS 的 transform 控制。 transform-origin 为 top left,配合 translate+scale 实现原地缩放。 显式 width/height 由 JS 设置为原图尺寸,确保布局尺寸确定, transform 只做视觉缩放,不改变占位。 */ .lightbox-img { position: absolute; left: 0; top: 0; transform-origin: top left; max-width: none; max-height: none; object-fit: contain; opacity: 1; } .lightbox-caption { position: fixed; left: 0; right: 0; bottom: 2rem; text-align: center; color: rgba(255, 255, 255, 0.85); font-size: 0.95rem; padding: 0 2rem; pointer-events: none; z-index: 2; } .lightbox-counter { position: fixed; right: 1.5rem; bottom: 1.5rem; color: rgba(255, 255, 255, 0.7); font-size: 0.85rem; z-index: 2; } .lightbox-nav { position: fixed; top: 50%; transform: translateY(-50%); background: transparent; border: none; color: rgba(255, 255, 255, 0.7); font-size: 3rem; line-height: 1; width: 3rem; height: 5rem; cursor: pointer; z-index: 2; border-radius: 0.5rem; transition: color 0.2s ease-out, background 0.2s ease-out; } .lightbox-nav:hover { color: #fff; background: rgba(255, 255, 255, 0.1); } .lightbox-prev { left: 1rem; } .lightbox-next { right: 1rem; }