/* 瀑布流照片墙（theme 模式：仅装饰内容区，保留主题 header/footer） */

.apt_photos-shell {
    /* 正常文档流：填满父容器，绝不溢出、绝不被滚动条放大。
       对齐头部 logo 外沿由 JS 在 align() 里按实测值平移/缩放完成（已规避 100vw 滚动条陷阱）。 */
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 24px 0 40px;            /* 左右 0：与头部内容容器外沿齐平 */
    box-sizing: border-box;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    border: 0 !important;
}

/* 标题（"照片墙"字样）已不在模板内输出，对应样式移除 */

/* 多列瀑布流：保留图片原始比例 → 自然错落 */
.apt_photos-masonry {
    column-count: var(--apt-cols, 3);
    column-gap: 14px;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    box-shadow: none !important;
    border: 0 !important;
}

.apt_photos-item {
    display: block;
    width: 100%;
    margin: 0 0 14px;
    padding: 0;
    border: none;
    background: transparent !important;            /* 去除卡片背景色，纯照片 */
    background-color: transparent !important;
    border-radius: var(--border-radius);
    overflow: hidden;
    cursor: zoom-in;
    break-inside: avoid;            /* 防止单图被分到两列 */
    -webkit-column-break-inside: avoid;
    box-shadow: var(--shadow-sm);
    transition: transform .35s cubic-bezier(.2,.7,.3,1), box-shadow .35s ease;
    animation: aptItemIn .55s ease backwards;   /* 入场错落淡入 */
}

.apt_photos-item:hover {
    transform: translateY(-6px) scale(1.012);
    box-shadow: var(--shadow-md);
}

.apt_photos-item img {
    display: block;
    width: 100%;
    height: auto;                   /* 原比例 → 错落 */
    background: transparent !important;
}

/* 入场 / 弹窗动效关键帧 */
@keyframes aptItemIn {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes aptZoomIn {
    from { opacity: 0; transform: scale(.92); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes aptPop {
    from { opacity: 0; transform: translateY(12px) scale(.96); }
    to   { opacity: 1; transform: none; }
}
@keyframes aptFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* 卡片入场错落延迟（前 12 张阶梯式淡入） */
.apt_photos-item:nth-child(1)  { animation-delay: .04s; }
.apt_photos-item:nth-child(2)  { animation-delay: .08s; }
.apt_photos-item:nth-child(3)  { animation-delay: .12s; }
.apt_photos-item:nth-child(4)  { animation-delay: .16s; }
.apt_photos-item:nth-child(5)  { animation-delay: .20s; }
.apt_photos-item:nth-child(6)  { animation-delay: .24s; }
.apt_photos-item:nth-child(7)  { animation-delay: .28s; }
.apt_photos-item:nth-child(8)  { animation-delay: .32s; }
.apt_photos-item:nth-child(9)  { animation-delay: .36s; }
.apt_photos-item:nth-child(10) { animation-delay: .40s; }
.apt_photos-item:nth-child(11) { animation-delay: .44s; }
.apt_photos-item:nth-child(12) { animation-delay: .48s; }

/* 卡片图片悬停放大（追加规则，与上方 .apt_photos-item img 合并） */
.apt_photos-item img {
    transition: transform .55s cubic-bezier(.2,.7,.3,1);
}
.apt_photos-item:hover img {
    transform: scale(1.07);
}

/* 照片描述（可选，鼠标悬停时显示在底部） */
.apt_photos-cap {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 8px 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #fff;
    background: linear-gradient(to top, rgba(0, 0, 0, .72), rgba(0, 0, 0, 0));
    opacity: 0;
    transition: opacity .2s ease;
    pointer-events: none;
}
.apt_photos-item:hover .apt_photos-cap {
    opacity: 1;
}

/* 管理员专用：删除按钮 */
.apt_photos-del {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    line-height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    opacity: 0;
    transition: opacity .15s ease;
}
.apt_photos-item:hover .apt_photos-del {
    opacity: 1;
}

/* 管理员专用：网页右下角悬浮「添加照片」按钮 */
.apt_photos-fab {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9998;
    padding: 12px 20px;
    border: none;
    border-radius: 999px;
    background: var(--theme-color, #2563eb);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}

/* 管理员专用：添加照片弹窗（背景透明，靠卡片阴影与主题背景区分）。
   同 lightbox 防御：id+!important 强制全屏覆盖，避免主题父元素 containing block 干扰 */
#aptPhotoModal,
.apt_photos-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    z-index: 10000;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
}
#aptPhotoModal[hidden],
.apt_photos-modal[hidden] {
    display: none !important;
}
.apt_photos-modal-box {
    width: min(420px, 92vw);
    background: var(--bg-card, #fff);
    border-radius: var(--border-radius, 10px);
    padding: 20px;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .3);
    animation: aptPop .22s ease both;
}
.apt_photos-modal-box h3 {
    margin: 0 0 14px;
    color: var(--text-primary);
    font-size: 18px;
}
.apt_photos-modal-pick {
    margin-bottom: 12px;
}
.apt_photos-modal-pick img {
    display: block;
    max-width: 100%;
    max-height: 180px;
    margin-top: 10px;
    border-radius: 8px;
}
.apt_photos-link-row {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px dashed var(--border-primary, #e2e8f0);
}
.apt_photos-link-row .apt_photos-or {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
    margin-bottom: 10px;
}
.apt_photos-link-row label {
    display: block;
    margin: 0 0 6px;
    color: var(--text-secondary);
    font-size: 13px;
}
.apt_photos-link-row input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border-input, #ddd);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    color: var(--text-primary);
    background: var(--bg-card, #fff);
}
.apt_photos-link-row input:focus {
    outline: none;
    border-color: var(--color-link, #2563eb);
}
.apt_photos-modal-box label {
    display: block;
    margin: 10px 0 6px;
    color: var(--text-secondary);
    font-size: 13px;
}
.apt_photos-modal-box textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--border-input, #ddd);
    border-radius: 8px;
    padding: 8px 10px;
    font: inherit;
    color: var(--text-primary);
    background: var(--bg-card, #fff);
    resize: vertical;
}
.apt_photos-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 14px;
}
.apt_photos-msg {
    margin: 10px 0 0;
    color: var(--color-danger, #e11d48);
    font-size: 13px;
    min-height: 16px;
}

.apt_photos-empty {
    color: var(--text-secondary);
    text-align: center;
    padding: 40px 0;
}

/* lightbox：全屏覆盖容器。点开照片时，整窗背景毛玻璃虚化 + 轻微压暗，聚焦图片。
   主题父元素可能因 transform/filter/will-change 等创建新的 containing block，
   导致 position:fixed; inset:0 失效 → 用 id+!important 强制全屏覆盖。
   backdrop-filter 作用于元素背后的页面内容，实现"虚化窗口所有背景"。 */
#aptPhotosLightbox,
.apt_photos-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    z-index: 9999;
    display: flex !important;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, .42) !important;
    background-color: rgba(15, 23, 42, .42) !important;
    background-image: none !important;
    -webkit-backdrop-filter: blur(10px) !important;
    backdrop-filter: blur(10px) !important;
    border: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    padding: 24px;
    box-sizing: border-box;
    cursor: zoom-out;
    animation: aptFadeIn .22s ease both;
}

#aptPhotosLightbox[hidden],
.apt_photos-lightbox[hidden] {
    display: none !important;
}

.apt_photos-lightbox-stage {
    position: relative;          /* 让描述相对图片定位 */
    display: inline-block;       /* 收缩到图片尺寸，居中由外层 flex 完成 */
    max-width: 92vw;
    max-height: 92vh;
    line-height: 0;              /* 去掉 img 底部间隙 */
}
.apt_photos-lightbox-img {
    display: block;
    max-width: 92vw;
    max-height: 92vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .35), 0 0 0 1px rgba(0, 0, 0, .06);
    cursor: default;
    animation: aptZoomIn .3s ease both;
}
/* 描述浮在图片靠下方的中间（覆盖在图片上） */
.apt_photos-lightbox-desc {
    position: absolute;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    max-width: 88%;
    margin: 0;
    padding: 6px 16px;
    box-sizing: border-box;
    text-align: center;
    color: #fff;
    font-size: 14px;
    line-height: 1.5;
    background: rgba(0, 0, 0, .55);
    border-radius: 999px;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    pointer-events: none;        /* 不挡点击关闭 */
    animation: aptFadeIn .3s ease .1s both;
}
.apt_photos-lightbox-desc[hidden] {
    display: none;
}

.apt_photos-lightbox-close {
    position: absolute;
    top: 18px;
    right: 22px;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease;
}

.apt_photos-lightbox-close:hover {
    background: rgba(255, 255, 255, .3);
}

/* 响应式降列（覆盖 --apt-cols） */
@media (max-width: 1024px) {
    .apt_photos-masonry { column-count: 3; }
}
@media (max-width: 760px) {
    .apt_photos-masonry { column-count: 2; }
}
@media (max-width: 480px) {
    .apt_photos-masonry { column-count: 1; }
}

/* 尊重"减少动态效果"系统偏好：关闭动效 */
@media (prefers-reduced-motion: reduce) {
    .apt_photos-item,
    .apt_photos-item img,
    .apt_photos-lightbox-img,
    .apt_photos-modal-box {
        animation: none !important;
        transition: none !important;
    }
}
