/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: #555;
    background-color: #fdfdfd;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
header {
    background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%);
    color: #fff;
    padding: 2rem 0;
    text-align: center;
    box-shadow: 0 2px 15px rgba(0,0,0,0.1);
}

header h1 {
    font-size: 2.8rem;
    margin-bottom: 0.5rem;
    text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

.subtitle {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* 导航栏样式 */
nav {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav ul {
    list-style: none;
    display: flex;
    justify-content: center;
}

nav ul li {
    margin: 0 1.5rem;
}

nav ul li a {
    display: block;
    padding: 1.2rem 0.5rem;
    text-decoration: none;
    color: #666;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

nav ul li a:hover {
    color: #ff6b6b;
}

nav ul li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(to right, #ff9a9e, #fad0c4);
    transition: width 0.3s ease;
}

nav ul li a:hover::after {
    width: 100%;
}

/* 主要内容区域 */
main {
    min-height: calc(100vh - 200px);
}

/* 首页横幅 */
.hero {
    padding: 3rem 0;
    background-color: #fffaf0;
}

.hero-content {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
}

.hero h2 {
    font-size: 2.2rem;
    color: #ff6b6b;
    margin-bottom: 1rem;
}

.hero p {
    font-size: 1.1rem;
    color: #666;
    margin-bottom: 2rem;
}

/* 相册区域 */
.gallery-section {
    padding: 4rem 0;
    background-color: #fff;
}

.section-header {
    text-align: center;
    margin-bottom: 3rem;
}

.section-header h2 {
    font-size: 2rem;
    color: #ff6b6b;
    margin-bottom: 1rem;
}

.section-header p {
    color: #888;
    font-size: 1.1rem;
}

.gallery-controls {
    text-align: center;
    margin-bottom: 2rem;
}

.play-button {
    background: linear-gradient(135deg, #ff9a9e, #fad0c4);
    border: none;
    color: white;
    padding: 12px 24px;
    font-size: 1.1rem;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.play-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
}

.play-button:active {
    transform: translateY(1px);
}

.play-icon {
    margin-right: 8px;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 25px;
}

.gallery-item {
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    background-color: #fff;
    cursor: pointer;
    position: relative;
    touch-action: manipulation;
}

.gallery-item:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.15);
}

.gallery-item:active {
    transform: translateY(-5px);
}

.gallery-item img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    display: block;
    transition: opacity 0.3s;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

.gallery-item img.lazy {
    opacity: 0;
}

.gallery-item img:not(.lazy) {
    opacity: 1;
}

.gallery-item .info {
    padding: 15px;
    text-align: center;
}

.gallery-item .info h3 {
    margin-bottom: 5px;
    color: #ff6b6b;
    font-size: 1.1rem;
}

.gallery-item .info .filename {
    font-size: 0.8rem;
    color: #666;
    font-family: 'Courier New', monospace;
    word-break: break-all;
    margin: 5px 0;
}

.gallery-item .info .status {
    font-size: 0.8rem;
    padding: 3px 6px;
    border-radius: 3px;
    display: inline-block;
    margin-top: 5px;
}

.gallery-item .info .status.loaded {
    background-color: #e8f5e9;
    color: #4caf50;
}

.gallery-item .info .status.error {
    background-color: #ffebee;
    color: #f44336;
}

/* 成长回忆区域 */
.memories-section {
    padding: 4rem 0;
    background: linear-gradient(to bottom, #fffaf0, #f8f9fa);
}

.memories-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
}

.memory-card {
    background: #fff;
    border-radius: 10px;
    padding: 2rem;
    box-shadow: 0 5px 15px rgba(0,0,0,0.05);
    transition: transform 0.3s ease;
}

.memory-card:hover {
    transform: translateY(-5px);
}

.memory-card h3 {
    color: #ff6b6b;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

.memory-card p {
    color: #666;
    line-height: 1.7;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
    -webkit-overflow-scrolling: touch;
}

.modal-content {
    margin: auto;
    display: block;
    width: 90%;
    max-width: 90vw;
    max-height: 90vh;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.modal-content img {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 5px;
    margin: 0 auto;
    display: block;
}

#caption {
    text-align: center;
    color: #fff;
    padding: 20px 0;
}

#caption h3 {
    font-size: 1.5rem;
    margin-bottom: 10px;
}

#caption p {
    font-size: 1.1rem;
    opacity: 0.8;
    font-family: 'Courier New', monospace;
}

.close {
    position: absolute;
    top: 30px;
    right: 40px;
    color: #fff;
    font-size: 50px;
    font-weight: bold;
    transition: 0.3s;
    z-index: 1001;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.close:hover,
.close:focus {
    color: #ccc;
    text-decoration: none;
    cursor: pointer;
}

.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.7);
    border: none;
    color: #333;
    font-size: 30px;
    font-weight: bold;
    padding: 15px 20px;
    cursor: pointer;
    border-radius: 5px;
    user-select: none;
    transition: background-color 0.3s;
    z-index: 1001;
}

.nav-button:hover {
    background-color: rgba(255, 255, 255, 0.9);
}

.prev-button {
    left: 20px;
}

.next-button {
    right: 20px;
}

.image-counter {
    color: white;
    font-size: 18px;
    margin-top: 15px;
}

.image-counter span {
    font-weight: bold;
}

.slideshow-controls {
    margin-top: 15px;
}

.pause-play-button {
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: white;
    font-size: 18px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pause-play-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

/* 页脚样式 */
footer {
    background-color: #333;
    color: #fff;
    text-align: center;
    padding: 2rem 0;
}

/* 响应式设计 */
@media(max-width: 768px) {
    header h1 {
        font-size: 2.2rem;
    }
    
    .subtitle {
        font-size: 1rem;
    }
    
    nav ul {
        flex-direction: column;
        align-items: center;
    }
    
    nav ul li {
        margin: 0;
    }
    
    nav ul li a {
        padding: 0.8rem;
    }
    
    .hero {
        padding: 2rem 0;
    }
    
    .hero h2 {
        font-size: 1.8rem;
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }
    
    .gallery-item img {
        height: 160px;
    }
    
    .memories-content {
        grid-template-columns: 1fr;
    }
    
    .memory-card {
        padding: 1.5rem;
    }
    
    .close {
        top: 15px;
        right: 20px;
        font-size: 40px;
    }
    
    .modal-content {
        width: 95%;
        top: 50%;
        transform: translate(-50%, -50%);
    }
    
    .section-header h2 {
        font-size: 1.8rem;
    }
    
    .nav-button {
        font-size: 24px;
        padding: 10px 15px;
    }
    
    .prev-button {
        left: 10px;
    }
    
    .next-button {
        right: 10px;
    }
    
    .play-button {
        padding: 10px 20px;
        font-size: 1rem;
    }
}

@media(max-width: 480px) {
    .container {
        padding: 0 15px;
    }
    
    header {
        padding: 1.5rem 0;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 10px;
    }
    
    .gallery-item img {
        height: 140px;
    }
    
    .section-header h2 {
        font-size: 1.6rem;
    }
    
    #caption h3 {
        font-size: 1.2rem;
    }
    
    #caption p {
        font-size: 1rem;
    }
    
    .memory-card {
        padding: 1rem;
    }
    
    .memory-card h3 {
        font-size: 1.2rem;
    }
    
    .nav-button {
        font-size: 20px;
        padding: 8px 12px;
    }
    
    .pause-play-button {
        width: 35px;
        height: 35px;
        font-size: 16px;
    }
}

/* 移动端特殊优化 */
@media (hover: none) and (pointer: coarse) {
    /* 在触摸设备上禁用悬停效果 */
    .gallery-item:hover {
        transform: none;
        box-shadow: 0 5px 15px rgba(0,0,0,0.08);
    }
    
    /* 触摸反馈 */
    .gallery-item:active {
        transform: scale(0.98);
    }
    
    nav ul li a:hover {
        color: #666;
    }
    
    nav ul li a:hover::after {
        width: 0;
    }
}

/* 支持iOS安全区域 */
@supports (padding: max(0px)) {
    .container {
        padding-left: max(20px, env(safe-area-inset-left));
        padding-right: max(20px, env(safe-area-inset-right));
    }
    
    header {
        padding-top: max(2rem, env(safe-area-inset-top));
    }
    
    footer {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
}