/* =========================================================
   相册 · 雷岚映像  |  公共样式表 album.css
   四个相册页面（album-1.html ~ album-4.html）及主页共用本文件
   ========================================================= */

/* ===== 全局重置 & 基础 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    background: #e8f5e9;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    color: #1a4a2a;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
    padding: 30px 20px;
    position: relative;
    overflow-x: hidden;
}

/* ===== 科技感网格背景 ===== */
.grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background:
        radial-gradient(ellipse at 30% 20%, #e8f5e9, #dcedc8 70%),
        linear-gradient(rgba(0, 80, 40, 0.08) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 80, 40, 0.08) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
    pointer-events: none;
}
.grid-bg::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 70% 80%, rgba(180, 220, 180, 0.20) 0%, transparent 60%),
        radial-gradient(circle at 20% 30%, rgba(160, 200, 160, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

/* ===== 树叶飘落容器 ===== */
#leaf-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

/* ===== 单片树叶 ===== */
.leaf {
    position: absolute;
    top: -80px;
    opacity: 0.7;
    animation: leafFall linear infinite;
    will-change: transform, opacity;
}
/* 内层容器：横向摆动用，避免覆盖外层的下落动画 */
.leaf-inner {
    width: 100%;
    height: 100%;
}
.leaf svg {
    display: block;
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 6px rgba(0, 255, 150, 0.25));
}
@keyframes leafFall {
    0% {
        transform: translateY(0) rotate(0deg) scale(1);
        opacity: 0.8;
    }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% {
        transform: translateY(110vh) rotate(720deg) scale(0.6);
        opacity: 0.2;
    }
}
@keyframes leafSway {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(25px); }
    75% { transform: translateX(-25px); }
}
.leaf.sway .leaf-inner {
    animation: leafSway 6s ease-in-out infinite alternate;
}

/* ===== 主卡片 ===== */
.card {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    background: rgba(255, 255, 245, 0.70);
    backdrop-filter: blur(16px) saturate(1.2);
    -webkit-backdrop-filter: blur(16px) saturate(1.2);
    border: 1px solid rgba(0, 80, 40, 0.15);
    border-radius: 40px 16px 40px 16px;
    padding: 44px 32px 36px;
    box-shadow:
        0 30px 80px rgba(0, 0, 0, 0.7),
        0 0 0 1px rgba(0, 255, 150, 0.08) inset,
        0 0 60px rgba(0, 255, 130, 0.06);
    transition: box-shadow 0.4s ease, border-color 0.4s ease;
    text-align: center;
    margin: 0 auto;
}
.card:hover {
    border-color: rgba(0, 80, 40, 0.30);
    box-shadow:
        0 40px 100px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(0, 255, 150, 0.15) inset,
        0 0 80px rgba(0, 255, 130, 0.10);
}
.card::before {
    content: '';
    position: absolute;
    top: -1px;
    left: 30%;
    width: 40%;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(0, 80, 40, 0.4), transparent);
    border-radius: 50%;
    filter: blur(1px);
}
.card::after {
    content: '';
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-right: 2px solid rgba(0, 80, 40, 0.15);
    border-bottom: 2px solid rgba(0, 80, 40, 0.15);
    border-radius: 0 0 12px 0;
    pointer-events: none;
    transition: border-color 0.4s ease;
}
.card .corner-tl {
    position: absolute;
    top: 16px;
    left: 16px;
    width: 40px;
    height: 40px;
    border-left: 2px solid rgba(0, 80, 40, 0.15);
    border-top: 2px solid rgba(0, 80, 40, 0.15);
    border-radius: 12px 0 0 0;
    pointer-events: none;
    transition: border-color 0.4s ease;
}
.card:hover .corner-tl,
.card:hover::after {
    border-color: rgba(0, 80, 40, 0.35);
}

/* ===== 相册标题 ===== */
.album-header {
    margin-bottom: 30px;
    font-size: 14px;
    color: rgba(26, 74, 42, 0.35);
    letter-spacing: 4px;
    font-weight: 300;
    border-bottom: 1px solid rgba(0, 80, 40, 0.06);
    padding-bottom: 12px;
}
.album-header span {
    display: inline-block;
    animation: pulseGlow 3s ease-in-out infinite;
}
.album-header em {
    display: block;
    margin-top: 8px;
    font-style: normal;
    font-size: 12px;
    letter-spacing: 2px;
    color: rgba(26, 74, 42, 0.30);
}
@keyframes pulseGlow {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 0.7; }
}

/* ===== 图片网格 ===== */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.photo-item {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(0, 80, 40, 0.08);
    background: rgba(0, 80, 40, 0.03);
    transition: all 0.35s ease;
    cursor: pointer;
}
.photo-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;   /* ★ 关键：显示原图上半部分 */
    transition: transform 0.45s ease, filter 0.4s ease;
}
.photo-item:hover {
    border-color: rgba(0, 80, 40, 0.30);
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 40px rgba(0, 80, 40, 0.10);
}
.photo-item:hover img {
    transform: scale(1.06);
    filter: brightness(1.04) contrast(1.02);
}

/* 图片加载失败时的占位 */
.photo-item.is-error {
    cursor: default;
}
.photo-item.is-error img {
    opacity: 0;
}
.photo-item.is-error::after {
    content: attr(data-name);
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    font-size: 12px;
    line-height: 1.6;
    letter-spacing: 1px;
    color: rgba(26, 74, 42, 0.40);
    text-align: center;
    word-break: break-all;
}

/* 无图片提示 */
.empty-message {
    grid-column: 1 / -1;
    padding: 40px 20px;
    color: rgba(26, 74, 42, 0.40);
    font-size: 16px;
    letter-spacing: 2px;
}

/* ===== 页码信息 ===== */
.page-info {
    margin-top: 6px;
    font-size: 12px;
    letter-spacing: 2px;
    color: rgba(26, 74, 42, 0.32);
}

/* ===== 相册分页导航 ===== */
.album-nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 22px;
    padding-top: 20px;
    border-top: 1px solid rgba(0, 80, 40, 0.08);
}
.album-nav a,
.album-nav span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
    line-height: 1;
    letter-spacing: 1px;
    text-decoration: none;
    color: rgba(26, 74, 42, 0.65);
    background: rgba(0, 80, 40, 0.04);
    border: 1px solid rgba(0, 80, 40, 0.10);
    border-radius: 60px;
    transition: all 0.3s ease;
    user-select: none;
}
.album-nav a:hover {
    background: rgba(0, 80, 40, 0.09);
    border-color: rgba(0, 80, 40, 0.28);
    color: #0d3d0d;
    transform: translateY(-2px);
}
.album-nav .active {
    background: rgba(0, 80, 40, 0.14);
    border-color: rgba(0, 80, 40, 0.38);
    color: #0d3d0d;
    font-weight: 600;
    cursor: default;
    pointer-events: none;
}
.album-nav .disabled {
    opacity: 0.28;
    cursor: not-allowed;
    pointer-events: none;
}

/* ===== 返回主页链接 ===== */
.back-link {
    display: inline-block;
    margin-top: 22px;
    padding: 10px 28px;
    background: rgba(0, 80, 40, 0.04);
    border: 1px solid rgba(0, 80, 40, 0.10);
    border-radius: 60px;
    color: #1a4a2a;
    font-size: 15px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    letter-spacing: 0.5px;
}
.back-link:hover {
    background: rgba(0, 80, 40, 0.08);
    border-color: rgba(0, 80, 40, 0.30);
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(0, 80, 40, 0.06);
    color: #0d3d0d;
}

/* ===== 大图预览遮罩 ===== */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 9999;
    display: flex;
    align-items: flex-start;              /* 顶部对齐 */
    justify-content: center;
    padding: 12vh 20px 60px;              /* 顶部留白 + 左右/底部呼吸空间 */
    box-sizing: border-box;               /* 让 padding 包含在 100% 内 */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: pointer;
}
.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}
.lightbox-overlay img {
    max-width: 92%;
    max-height: 78vh;         /* 用 vh 更可控，避免与 padding 冲突 */
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    cursor: default;
    background: #1a1a1a;
}
.lightbox-close {
    position: absolute;
    top: 24px;
    right: 32px;
    font-size: 36px;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
    user-select: none;
    z-index: 10;
}
.lightbox-close:hover {
    color: #fff;
}
.lightbox-caption {
    position: absolute;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    max-width: 80%;
    padding: 6px 18px;
    font-size: 13px;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.75);
    background: rgba(0, 0, 0, 0.35);
    border-radius: 60px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
}

/* ===== 响应式 ===== */
@media (max-width: 600px) {
    .lightbox-overlay {
        padding: 9vh 12px 50px;
    }
    .lightbox-overlay img {
        max-height: 76vh;
    }
    .card {
        padding: 28px 16px 24px;
        border-radius: 28px 12px 28px 12px;
    }
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 12px;
    }
    .lightbox-close {
        top: 16px;
        right: 20px;
        font-size: 28px;
    }
    .lightbox-caption {
        bottom: 16px;
        font-size: 12px;
    }
    .album-header {
        font-size: 12px;
        margin-bottom: 20px;
    }
    .album-nav a,
    .album-nav span {
        height: 30px;
        padding: 0 11px;
        font-size: 12px;
    }
}

@media (max-width: 400px) {
    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 8px;
    }
    .card {
        padding: 20px 10px 20px;
    }
}

/* ===== 主页相册入口 ===== */
.home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}
.home-card {
    display: block;
    text-decoration: none;
    color: inherit;
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(0, 80, 40, 0.08);
    background: rgba(0, 80, 40, 0.03);
    transition: all 0.35s ease;
    text-align: center;
}
.home-card:hover {
    border-color: rgba(0, 80, 40, 0.30);
    transform: translateY(-4px) scale(1.01);
    box-shadow: 0 12px 40px rgba(0, 80, 40, 0.10);
}
.home-card .cover {
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: rgba(0, 80, 40, 0.05);
}
.home-card .cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;   /* ★ 关键：封面也显示原图上半部分 */
    display: block;
    transition: transform 0.45s ease, filter 0.4s ease;
}
.home-card:hover .cover img {
    transform: scale(1.06);
    filter: brightness(1.04) contrast(1.02);
}
.home-card .info {
    padding: 14px 12px 16px;
}
.home-card .info h3 {
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #1a4a2a;
    margin-bottom: 6px;
}
.home-card .info p {
    font-size: 12px;
    letter-spacing: 1px;
    color: rgba(26, 74, 42, 0.45);
}
@media (max-width: 600px) {
    .home-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 14px;
    }
    .home-card .info h3 {
        font-size: 14px;
    }
    .home-card .info p {
        font-size: 11px;
    }
}