/* ===== 基础变量 ===== */
:root {
    /* 主色调 - 暖橙系 */
    --primary-dark: #c05621;
    --primary: #dd6b20;
    --primary-light: #ed8936;

    /* 中性色 */
    --bg-primary: #faf9f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f0ebe5;
    --text-primary: #2d3748;
    --text-secondary: #4a5568;
    --text-tertiary: #718096;
    --border: #e2d5c5;

    /* 强调色 */
    --accent-coral: #fc8181;
    --accent-mint: #68d391;

    /* 间距 */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    --space-12: 48px;

    /* 字体 */
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;

    /* 阴影 */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
    --shadow-md: 0 10px 15px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 25px rgba(0, 0, 0, 0.12);

    /* 圆角 */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-md: 16px;
    --radius-lg: 24px;

    /* 过渡 */
    --transition-fast: 150ms ease;
    --transition: 300ms ease;
    --transition-slow: 500ms ease;
}

/* ===== 重置样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: linear-gradient(135deg, #faf9f7 0%, #f5f0eb 50%, #faf9f7 100%);
    min-height: 100vh;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== 容器布局 ===== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-6);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== 头部样式 ===== */
.header {
    text-align: center;
    padding: var(--space-3) 0 var(--space-2);
    animation: fadeInDown 0.8s ease;
    flex-shrink: 0;
}

.title {
    font-size: clamp(1.5rem, 4vw, 2rem);
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

/* ===== 画廊主体 ===== */
.gallery {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-2) 0;
    min-height: 0;
    overflow: hidden;
}

/* ===== 卡片容器 ===== */
.card-container {
    width: 100%;
    max-width: 500px;
    perspective: 1000px;
    margin-bottom: var(--space-4);
    flex-shrink: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===== 卡片样式 ===== */
.card {
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: box-shadow var(--transition-slow), transform var(--transition-slow);
    transform-style: preserve-3d;
    will-change: transform, opacity;
}

.card.initial-load {
    animation: fadeInScale 0.6s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.card-image-wrapper {
    width: 100%;
    max-height: 45vh;
    overflow: hidden;
    background: var(--bg-tertiary);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-image {
    max-width: 100%;
    max-height: 45vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.card-image {
    cursor: zoom-in;
}

.card-content {
    padding: var(--space-3);
}

.card-text {
    font-size: clamp(0.85rem, 1.8vw, 0.95rem);
    line-height: 1.6;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
    text-align: justify;
}

.card-date {
    display: inline-block;
    font-size: 0.875rem;
    color: var(--text-tertiary);
    padding: var(--space-1) var(--space-3);
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}

/* ===== 翻页动画类 ===== */
.card.animating {
    pointer-events: none;
}

.card.slide-out-left {
    animation: slideOutLeft 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.card.slide-in-right {
    animation: slideInRight 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.card.slide-out-right {
    animation: slideOutRight 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.card.slide-in-left {
    animation: slideInLeft 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* ===== 顶部分页控制 ===== */
.top-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    box-shadow: var(--shadow-sm);
}

.nav-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.1);
    box-shadow: var(--shadow);
}

.nav-btn:active {
    transform: scale(0.95);
}

.nav-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: var(--border);
    color: var(--text-tertiary);
    transform: none;
}

.page-indicator {
    font-size: 1rem;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 60px;
    text-align: center;
}

/* ===== 圆点指示器 ===== */
.dots {
    display: flex;
    gap: var(--space-1);
    flex-wrap: wrap;
    justify-content: center;
    max-width: 280px;
    flex-shrink: 0;
    max-height: 40px;
    overflow: hidden;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    cursor: pointer;
    transition: all var(--transition);
}

.dot:hover {
    background: var(--primary-light);
    transform: scale(1.2);
}

.dot.active {
    background: var(--primary);
    width: 24px;
    border-radius: 4px;
}

/* ===== 页脚 ===== */
.footer {
    text-align: center;
    padding: var(--space-2) 0;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    flex-shrink: 0;
}

/* ===== 动画定义 ===== */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
    to {
        opacity: 0;
        transform: translate3d(-80px, 0, 0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translate3d(80px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
    to {
        opacity: 0;
        transform: translate3d(80px, 0, 0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translate3d(-80px, 0, 0);
    }
    to {
        opacity: 1;
        transform: translate3d(0, 0, 0);
    }
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .container {
        padding: var(--space-3) var(--space-4);
    }

    .header {
        padding: var(--space-2) 0 var(--space-1);
    }

    .top-controls {
        gap: var(--space-3);
        margin-bottom: var(--space-3);
    }

    .nav-btn {
        width: 36px;
        height: 36px;
    }

    .card-container {
        max-width: 100%;
        margin-bottom: var(--space-3);
    }

    .card-content {
        padding: var(--space-3);
    }

    .card-image-wrapper {
        max-height: 50vh;
    }

    .card-image {
        max-height: 50vh;
    }

    .card-content {
        padding: var(--space-3);
    }
}

@media (max-width: 480px) {
    .container {
        padding: var(--space-2) var(--space-3);
    }

    .header {
        padding: var(--space-1) 0;
    }

    .title {
        font-size: 1.25rem;
    }

    .top-controls {
        gap: var(--space-2);
        margin-bottom: var(--space-2);
    }

    .nav-btn {
        width: 32px;
        height: 32px;
    }

    .nav-btn svg {
        width: 16px;
        height: 16px;
    }

    .page-indicator {
        font-size: 0.9rem;
    }

    .card-image-wrapper {
        max-height: 45vh;
    }

    .card-image {
        max-height: 45vh;
    }

    .card-content {
        padding: var(--space-3);
    }

    .card-text {
        font-size: 0.9rem;
        line-height: 1.7;
    }
}

/* ===== 减少动画偏好 ===== */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ===== 图片放大模态框 ===== */
.image-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.image-modal.active {
    opacity: 1;
    visibility: visible;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1001;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.modal-close:active {
    transform: scale(0.95);
}

.modal-content {
    max-width: 95vw;
    max-height: 95vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-image {
    max-width: 100%;
    max-height: 95vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: zoom-out;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.image-modal.active .modal-image {
    transform: scale(1);
}

/* ===== 加载状态 ===== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    color: var(--text-tertiary);
}

.loading::after {
    content: "";
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: var(--space-3);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
