/* ============================================================================
   图片画廊 + 灯箱（多图切换、点击放大）
   配合 assets/js/gallery.js 使用，标记由 tools/build-content.py 生成。

   关键约束：所有图片都是真实的 <img src="真实文件">。
   —— 这样才能右键「存储图像为」；用 CSS background-image 是做不到的。
   —— 因此本文件里绝不能出现 background-image 承载图片内容的做法。
   ============================================================================ */

/* ---------- 卡片内的多图区域 ---------- */
.img-gallery {
    position: relative;
    overflow: hidden;
    background: #F3F4F6;
}

.img-gallery-img {
    display: block;
    width: 100%;
    height: 16rem;              /* 与 Tailwind 的 h-64 一致，保证列表整齐 */
    object-fit: cover;
    cursor: zoom-in;
}

.img-gallery-img.is-hidden { display: none; }

/* 左右切换箭头：默认半透明，鼠标移到卡片或聚焦时显现 */
.img-gallery-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(17, 24, 39, .55);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s, background .15s;
    z-index: 2;
}
.img-gallery:hover .img-gallery-nav,
.img-gallery:focus-within .img-gallery-nav { opacity: 1; }
.img-gallery-nav:hover { background: rgba(17, 24, 39, .85); }
.img-gallery-nav.prev { left: 10px; }
.img-gallery-nav.next { right: 10px; }

/* 右下角计数，如 2 / 4 */
.img-gallery-count {
    position: absolute;
    right: 10px;
    bottom: 10px;
    background: rgba(17, 24, 39, .6);
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 99px;
    z-index: 2;
    pointer-events: none;
}

/* 底部圆点 */
.img-gallery-dots {
    position: absolute;
    left: 50%;
    bottom: 12px;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 2;
}
.img-gallery-dots button {
    width: 7px;
    height: 7px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, .55);
    cursor: pointer;
}
.img-gallery-dots button[aria-current="true"] { background: #fff; }

/* 图片文件缺失时的占位框 */
.img-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 16rem;
    padding: 12px;
    background: #E5E7EB;
    color: #6B7280;
    font-size: 13px;
    text-align: center;
    line-height: 1.5;
}

/* ---------- 灯箱（点开大图） ---------- */
.lb {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(17, 24, 39, .93);
    display: none;
}
.lb.is-open {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 72px 20px 76px;
}

/* 真实 <img>：右键「存储图像为」在这里生效 */
.lb-img {
    max-width: min(1200px, 94vw);
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    background: #111827;
}

.lb-close,
.lb-prev,
.lb-next {
    position: absolute;
    border: 0;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background .15s;
}
.lb-close { top: 16px; right: 16px; width: 40px; height: 40px; font-size: 22px; line-height: 1; }
.lb-prev,
.lb-next { top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 26px; line-height: 1; }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
.lb-close:hover,
.lb-prev:hover,
.lb-next:hover { background: rgba(255, 255, 255, .28); }

.lb-bar {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    color: #E5E7EB;
    font-size: 13px;
    background: linear-gradient(to top, rgba(17, 24, 39, .92), rgba(17, 24, 39, 0));
}
.lb-bar .lb-caption { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bar a {
    color: #fff;
    text-decoration: underline;
    white-space: nowrap;
    flex-shrink: 0;
}

body.lb-open { overflow: hidden; }

@media (max-width: 640px) {
    .lb-prev { left: 6px; }
    .lb-next { right: 6px; }
    .lb.is-open { padding: 64px 10px 72px; }
    .lb-bar { font-size: 12px; padding: 12px 14px; }
}
