/* ===================================
   拍立得照片墙 - Polaroid Grid
   =================================== */

/* 区块标题 */
.polaroid-section {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 16px;
}

.polaroid-section-title {
    font-family: 'ZCOOL KuaiLe', cursive, sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
    color: #5a3e6f;
    text-align: center;
    margin-bottom: 32px;
    background: #fff5fb;
    display: inline-block;
    padding: 5px 20px;
    left: 50%;
    position: relative;
    transform: translateX(-50%);
    border-radius: 50px;
    border: 2px solid rgba(255, 142, 199, 0.12);
    box-shadow: 0 2px 8px rgba(255, 142, 199, 0.06);
}

/* 网格布局 */
.polaroid-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 28px 24px;
    padding: 0 8px;
}

/* ===== 单张拍立得卡片 ===== */
.polaroid-card {
    perspective: 800px;
    cursor: pointer;
    text-decoration: none;
    display: block;
}

.polaroid-inner {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-style: preserve-3d;
}

/* 仅在支持 hover 的设备上启用悬停翻转 */
@media (hover: hover) {
    .polaroid-card:hover .polaroid-inner {
        transform: rotateY(180deg);
    }
}

.polaroid-card.flipped .polaroid-inner {
    transform: rotateY(180deg);
}

/* 正面和背面共用 */
.polaroid-front,
.polaroid-back {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 6px;
    overflow: hidden;
    box-shadow:
        0 4px 16px rgba(0, 0, 0, 0.08),
        0 1px 4px rgba(0, 0, 0, 0.04);
}

/* ===== 正面：拍立得照片 ===== */
.polaroid-front {
    background: #fff;
    padding: 10px 10px 42px;
    display: flex;
    flex-direction: column;
}

.polaroid-photo {
    flex: 1;
    overflow: hidden;
    border-radius: 2px;
    background: #f8f0fc;
    position: relative;
}

.polaroid-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.polaroid-card:hover .polaroid-photo img {
    transform: scale(1.05);
}

/* 无图片时的占位 */
.polaroid-photo-empty {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #fff0f6, #f3e8ff);
    font-size: 2.5rem;
}

/* 底部日期 & 标题 - 手写风格 */
.polaroid-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 10px;
}

.polaroid-caption-text {
    font-family: 'ZCOOL KuaiLe', cursive, sans-serif;
    font-size: 0.78rem;
    color: #8b6e9e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    max-width: 100%;
}

/* ===== 背面：文字信息 ===== */
.polaroid-back {
    background: linear-gradient(145deg, #fff5fb 0%, #f3e8ff 100%);
    transform: rotateY(180deg);
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 10px;
    border: 2px solid rgba(255, 142, 199, 0.15);
}

.polaroid-back-mood {
    font-size: 2rem;
    line-height: 1;
}

.polaroid-back-title {
    font-family: 'ZCOOL KuaiLe', cursive, sans-serif;
    font-size: 1rem;
    color: #5a3e6f;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.polaroid-back-overview {
    font-size: 0.8rem;
    color: #8b6e9e;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.polaroid-back-date {
    font-size: 0.72rem;
    color: #b8a0c8;
    font-weight: 600;
    margin-top: auto;
    padding-top: 8px;
    border-top: 1px dashed rgba(255, 142, 199, 0.2);
    width: 100%;
}

.polaroid-back-stats {
    display: flex;
    gap: 10px;
    font-size: 0.7rem;
    color: #b8a0c8;
    justify-content: center;
}

.polaroid-back-stats span {
    display: flex;
    align-items: center;
    gap: 2px;
}

.polaroid-back-stats svg {
    width: 12px;
    height: 12px;
}

/* 查看按钮 */
.polaroid-back-view {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    border-radius: 20px;
    background: linear-gradient(135deg, #ff8ec7, #b794f6);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
    margin-top: 6px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255, 142, 199, 0.3);
}

.polaroid-back-view:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 14px rgba(255, 142, 199, 0.4);
}

/* 空状态 */
.polaroid-empty {
    text-align: center;
    padding: 40px 20px;
    color: #d5b3ff;
    font-size: 0.95rem;
    grid-column: 1 / -1;
}

/* ===== 随机轻微旋转 - 增加手工感 ===== */
.polaroid-card:nth-child(4n+1) .polaroid-inner { --rotate: -2deg; }
.polaroid-card:nth-child(4n+2) .polaroid-inner { --rotate: 1.5deg; }
.polaroid-card:nth-child(4n+3) .polaroid-inner { --rotate: -1deg; }
.polaroid-card:nth-child(4n+4) .polaroid-inner { --rotate: 2deg; }

.polaroid-front {
    transform: rotate(var(--rotate, 0deg));
}

.polaroid-card:hover .polaroid-front,
.polaroid-card.flipped .polaroid-front {
    transform: rotate(0deg);
}

/* 入场动画 */
.polaroid-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}

.polaroid-card.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== 响应式 ===== */
@media (max-width: 768px) {
    .polaroid-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px 12px;
        padding: 0;
    }

    .polaroid-front {
        padding: 6px 6px 32px;
    }

    .polaroid-caption {
        height: 28px;
    }

    .polaroid-caption-text {
        font-size: 0.7rem;
    }

    .polaroid-back {
        padding: 14px 10px;
        gap: 6px;
    }

    .polaroid-back-mood {
        font-size: 1.5rem;
    }

    .polaroid-back-title {
        font-size: 0.85rem;
    }

    .polaroid-back-overview {
        font-size: 0.72rem;
        -webkit-line-clamp: 2;
    }

    .polaroid-section {
        margin: 24px auto;
    }
}

@media (min-width: 1200px) {
    .polaroid-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* 胶带装饰（可选，用 CSS 伪元素） */
.polaroid-front::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(-2deg);
    width: 50px;
    height: 16px;
    background: rgba(255, 224, 178, 0.65);
    border-radius: 2px;
    z-index: 2;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
