/* =====================================================
   拾光 · 回忆册（第二页）
   瀑布流相册 + 灯箱 + Apple 风格排版
   ===================================================== */

/* ---- Hero ---- */
.memories-hero {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 88vh;
    padding: calc(var(--nav-height) + 56px) 24px 72px;
    overflow: hidden;
    background:
        radial-gradient(circle at 14% 22%, rgba(102, 126, 234, 0.14) 0%, transparent 42%),
        radial-gradient(circle at 86% 74%, rgba(240, 147, 251, 0.12) 0%, transparent 42%),
        radial-gradient(circle at 62% 20%, rgba(79, 172, 254, 0.1) 0%, transparent 46%),
        var(--color-bg);
}

.memories-hero-glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.65) 0%, transparent 55%);
    pointer-events: none;
}

.memories-hero-inner {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.02fr 0.98fr;
    align-items: center;
    gap: 48px;
}

.memories-hero-text {
    max-width: 560px;
}

.memories-eyebrow {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.22em;
    color: var(--color-text-secondary);
    margin-bottom: 14px;
}

.memories-title {
    font-size: clamp(68px, 9.5vw, 128px);
    font-weight: 700;
    letter-spacing: -0.045em;
    line-height: 0.94;
    margin-bottom: 22px;
    background: linear-gradient(135deg, #1d1d1f 0%, #4b4b52 42%, #667eea 76%, #f093fb 100%);
    background-size: 180% 180%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 8s ease infinite;
}

.memories-subtitle {
    font-size: clamp(19px, 2.2vw, 24px);
    color: var(--color-text);
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.4;
    margin-bottom: 18px;
}

.memories-desc {
    font-size: 15px;
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: 26px;
}

.memories-meta {
    display: flex;
    align-items: baseline;
    gap: 8px;
    font-size: 13px;
    color: var(--color-text-secondary);
}

.memories-count {
    font-size: 22px;
    font-weight: 600;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

/* 叠放的照片 */
.memories-stack {
    position: relative;
    height: 480px;
    perspective: 1200px;
}

.memories-stack-card {
    position: absolute;
    width: 58%;
    aspect-ratio: 3 / 4;
    border-radius: 22px;
    overflow: hidden;
    border: 5px solid #ffffff;
    box-shadow: 0 30px 70px rgba(30, 34, 60, 0.22);
    transition: transform 0.7s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.5s ease;
    will-change: transform;
}

.memories-stack-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stack-1 {
    left: 0;
    top: 9%;
    z-index: 1;
    transform: rotate(-8deg);
}

.stack-2 {
    left: 21%;
    top: 1%;
    z-index: 2;
    transform: rotate(2deg);
}

.stack-3 {
    left: 45%;
    top: 13%;
    z-index: 3;
    transform: rotate(10deg);
}

.memories-stack:hover .stack-1 {
    transform: rotate(-11deg) translate(-12px, -10px);
    box-shadow: 0 40px 90px rgba(30, 34, 60, 0.26);
}

.memories-stack:hover .stack-2 {
    transform: rotate(0deg) translateY(-14px);
    box-shadow: 0 44px 96px rgba(30, 34, 60, 0.28);
}

.memories-stack:hover .stack-3 {
    transform: rotate(13deg) translate(12px, -8px);
    box-shadow: 0 40px 90px rgba(30, 34, 60, 0.26);
}

.memories-scroll-hint {
    position: absolute;
    left: 50%;
    bottom: 26px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    letter-spacing: 0.08em;
    color: var(--color-text-secondary);
    opacity: 0;
    animation: fade-in 1s ease 1.1s forwards;
}

.memories-scroll-line {
    width: 1px;
    height: 34px;
    background: linear-gradient(180deg, var(--color-text-secondary), transparent);
}

/* ---- 相册 ---- */
.memories-gallery {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 24px 96px;
}

.memories-toolbar {
    position: sticky;
    top: var(--nav-height);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 18px 0 20px;
    margin-bottom: 12px;
    background: rgba(245, 245, 247, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.memories-filters {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.memory-chip {
    padding: 8px 16px;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: 13px;
    font-weight: 500;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.memory-chip:hover {
    color: var(--color-text);
    border-color: rgba(0, 0, 0, 0.16);
    transform: translateY(-1px);
}

.memory-chip.is-active {
    background: var(--color-text);
    border-color: var(--color-text);
    color: #ffffff;
}

.memories-toolbar-hint {
    font-size: 12px;
    color: var(--color-text-secondary);
    letter-spacing: -0.01em;
}

/* 瀑布流 */
.memory-grid {
    columns: 3;
    column-gap: 18px;
}

.memory-card {
    position: relative;
    display: block;
    width: 100%;
    break-inside: avoid;
    margin: 0 0 18px;
    padding: 0;
    border: none;
    border-radius: 20px;
    overflow: hidden;
    background: #e8e8ed;
    cursor: zoom-in;
    opacity: 0;
    transform: translateY(26px);
    transition:
        opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.8s cubic-bezier(0.16, 1, 0.3, 1),
        box-shadow 0.4s ease;
    box-shadow: 0 10px 30px rgba(20, 24, 40, 0.08);
}

.memory-card.is-in {
    opacity: 1;
    transform: translateY(0);
}

.memory-card:hover {
    box-shadow: 0 24px 54px rgba(20, 24, 40, 0.16);
}

.memory-card img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
}

.memory-card:hover img {
    transform: scale(1.045);
}

.memory-card-caption {
    position: absolute;
    inset: auto 0 0 0;
    padding: 46px 16px 14px;
    background: linear-gradient(180deg, transparent 0%, rgba(8, 10, 16, 0.72) 100%);
    color: #ffffff;
    text-align: left;
    display: flex;
    align-items: baseline;
    gap: 8px;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.35s ease, transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    pointer-events: none;
}

.memory-card:hover .memory-card-caption,
.memory-card:focus-visible .memory-card-caption {
    opacity: 1;
    transform: translateY(0);
}

.memory-card-index {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    opacity: 0.7;
    flex-shrink: 0;
}

.memory-card-text {
    font-size: 13px;
    line-height: 1.4;
}

.memories-empty {
    text-align: center;
    padding: 80px 0;
    font-size: 15px;
    color: var(--color-text-secondary);
}

/* 结尾 */
.memories-outro {
    text-align: center;
    padding: 40px 24px 120px;
}

.memories-outro p {
    font-size: clamp(20px, 2.6vw, 30px);
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 26px;
    color: var(--color-text);
}

/* ---- 灯箱 ---- */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px;
    background: rgba(8, 10, 16, 0.9);
    backdrop-filter: blur(18px) saturate(140%);
    -webkit-backdrop-filter: blur(18px) saturate(140%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lightbox.open {
    opacity: 1;
}

.lightbox-figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    max-width: min(92vw, 980px);
    max-height: 100%;
}

.lightbox-frame {
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 76vh;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 30px 90px rgba(0, 0, 0, 0.5);
    transform: scale(0.96);
    transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

.lightbox.open .lightbox-frame {
    transform: scale(1);
}

.lightbox-img {
    max-width: min(92vw, 980px);
    max-height: 76vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 18px;
}

.lightbox-caption {
    display: flex;
    align-items: baseline;
    gap: 10px;
    color: rgba(255, 255, 255, 0.86);
    font-size: 14px;
    text-align: center;
    max-width: 720px;
}

.lightbox-index {
    font-size: 11px;
    letter-spacing: 0.08em;
    opacity: 0.55;
    flex-shrink: 0;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.22);
    transform: scale(1.06);
}

.lightbox-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    flex-shrink: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    transition: background var(--transition-fast), transform var(--transition-fast);
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.06);
}

/* ---- 响应式 ---- */
@media (max-width: 1024px) {
    .memory-grid {
        columns: 2;
    }

    .memories-hero-inner {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .memories-hero-text {
        max-width: 640px;
    }

    .memories-stack {
        height: 380px;
        max-width: 560px;
    }
}

@media (max-width: 768px) {
    .memories-hero {
        min-height: auto;
        padding-top: calc(var(--nav-height) + 40px);
        padding-bottom: 56px;
    }

    .memories-stack {
        height: 300px;
        max-width: 420px;
    }

    .memories-stack-card {
        border-width: 4px;
        border-radius: 16px;
    }

    .memories-scroll-hint {
        display: none;
    }

    .memories-gallery {
        padding: 4px 16px 72px;
    }

    .memories-toolbar {
        padding: 10px 0 14px;
        gap: 10px;
    }

    .memory-chip {
        padding: 7px 13px;
        font-size: 12px;
    }

    .memories-toolbar-hint {
        display: none;
    }

    .memory-grid {
        column-gap: 12px;
    }

    .memory-card {
        border-radius: 16px;
        margin-bottom: 12px;
    }

    .memory-card-caption {
        opacity: 1;
        transform: none;
        padding: 34px 12px 10px;
    }

    .memory-card-text {
        font-size: 12px;
    }

    .lightbox {
        padding: 16px;
        gap: 0;
    }

    .lightbox-nav {
        position: absolute;
        bottom: 22px;
        width: 44px;
        height: 44px;
        z-index: 3;
    }

    .lightbox-prev {
        left: 20px;
    }

    .lightbox-next {
        right: 20px;
    }

    .lightbox-caption {
        margin-bottom: 58px;
        font-size: 13px;
    }

    .lightbox-img {
        max-height: 68vh;
    }
}

@media (max-width: 480px) {
    .memories-title {
        font-size: 64px;
    }

    .memories-stack {
        height: 250px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .memories-title,
    .memory-card,
    .memory-card img,
    .memories-stack-card,
    .lightbox-frame {
        transition: none;
        animation: none;
    }

    .memory-card {
        opacity: 1;
        transform: none;
    }
}
