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

:root {
    --primary-color: #3498db;
    --dark-color: #2c3e50;
    --light-color: #ecf0f1;
    --accent-color: #e74c3c;
    --text-color: #333;
    --light-gray: #f5f5f5;
    --border-radius: 8px;
    --box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--light-gray);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.image_container {
    display: flex;
    flex-direction: row;
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部样式 */
.header {
    background-color: white;
    box-shadow: var(--box-shadow);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 20px 0;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 28px;
    font-weight: 700;
    color: var(--dark-color);
    text-decoration: none;
    letter-spacing: 1px;
}

.nav ul {
    display: flex;
    list-style: none;
}

.nav li {
    margin: 0 15px;
}

.nav a {
    text-decoration: none;
    color: var(--text-color);
    font-weight: 500;
    position: relative;
    padding: 8px 0;
    transition: var(--transition);
}

.nav a.active, .nav a:hover {
    color: var(--primary-color);
}

.nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: var(--transition);
}

.nav a.active::after, .nav a:hover::after {
    width: 100%;
}

.search-box {
    display: flex;
}

.search-box input {
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    outline: none;
    width: 250px;
}

.search-box button {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0 15px;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    cursor: pointer;
    transition: var(--transition);
}

.search-box button:hover {
    background: #2980b9;
}

/* 主标题区样式 */
.hero {
    background: linear-gradient(rgba(44, 62, 80, 0.7), rgba(44, 62, 80, 0.7)), 
                url('../img/摄影画廊.png') center/cover;
    color: white;
    text-align: center;
    padding: 100px 0;
    margin-bottom: 50px;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.hero p {
    font-size: 1.5rem;
    max-width: 700px;
    margin: 0 auto 40px;
}

.filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 30px;
}

.filter-btn {
    background: transparent;
    border: 2px solid white;
    color: white;
    padding: 10px 20px;
    border-radius: 50px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.filter-btn:hover, .filter-btn.active {
    background: white;
    color: var(--dark-color);
}

/* 瀑布流样式 */
.gallery {
    padding-bottom: 50px;
    display: flex;
    flex-direction: row;
}

.masonry {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
    margin: 0 auto;
    justify-items: center;
}
.grid-sizer { display: none; }
.photo-card {
    width: 260px;
    max-width: 100%;
    background: white;
    border-radius: var(--border-radius);
    overflow: visible;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    margin: 0 0 28px 0;
    padding: 0;
    display: block;
    opacity: 0;
    animation: fade-in 0.8s forwards;
    /* animation-delay 由JS动态设置 */
}

.photo-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

.photo-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    aspect-ratio: unset;
    max-width: 100%;
    max-height: none;
    background: #f5f5f5;
}

.photo-info {
    padding: 15px;
    position: relative;
}

.photo-index {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 8px;
}

.photo-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 10px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background: var(--light-color);
    color: var(--text-color);
    font-size: 0.8rem;
    padding: 4px 10px;
    border-radius: 50px;
    transition: var(--transition);
}

.tag:hover {
    background: var(--primary-color);
    color: white;
    cursor: pointer;
}

#photo-grid {
    position: relative;
}
.loading {
    position: fixed;
    left: 0; top: 0; right: 0; bottom: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.7);
    z-index: 9999;
    font-size: 1.5rem;
    color: #3498db;
    pointer-events: none;
}

.loading.show {
    display: flex;
}

/* 照片详情弹窗样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000 !important;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

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

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    border-radius: var(--border-radius);
    overflow: visible;
    display: flex;
    position: relative;
    z-index: 3100;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 1.8rem;
    color: var(--dark-color);
    cursor: pointer;
    z-index: 3400;
}

.photo-container {
    flex: 0 0 70%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.photo-container img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
}

.photo-details {
    flex: 0 0 30%;
    padding: 40px 20px;
    background: white;
    overflow-y: auto;
}

/* .photo-info {
    margin-bottom: 25px;
    padding: 0;
} */

.photo-info h2 {
    font-size: 1.8rem;
    margin: 15px 0;
    color: var(--dark-color);
}

.photo-description {
    line-height: 1.8;
    font-size: 1rem;
    color: #555;
    margin-bottom: 25px;
}

.photo-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
    font-size: 0.9rem;
    color: #777;
}

.photo-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
}

.nav-controls {
    display: flex;
    justify-content: space-between;
    padding: 0 20px 20px;
    z-index: 3200;
    position: relative;
}

.nav-controls button {
    background: var(--primary-color);
    color: #fff;
    border: none;
    padding: 12px 25px;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    font-size: 1rem;
    z-index: 3300;
    position: relative;
}

.nav-controls button:hover {
    background: #2980b9;
}

/* 底部样式 */
.footer {
    background: var(--dark-color);
    color: white;
    padding: 50px 0 30px;
}

.footer .container {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.footer-info h3 {
    font-size: 1.8rem;
    margin-bottom: 15px;
}

.footer-info p {
    color: #bbb;
    max-width: 400px;
}

.social-links {
    display: flex;
    gap: 20px;
}

.social-links a {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
    transition: var(--transition);
}

.social-links a:hover {
    background: var(--primary-color);
    transform: translateY(-3px);
}

.copyright {
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    color: #bbb;
    font-size: 0.9rem;
}
/* ============ 动画关键帧 ============ */
@keyframes fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pop-in {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }

    80% {
        transform: scale(1.05);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes float {
    0% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0);
    }
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-15px);
    }

    60% {
        transform: translateY(-7px);
    }
}

@keyframes glow {
    0% {
        box-shadow: 0 0 5px rgba(255, 107, 139, 0.3);
    }

    50% {
        box-shadow: 0 0 20px rgba(255, 107, 139, 0.6);
    }

    100% {
        box-shadow: 0 0 5px rgba(255, 107, 139, 0.3);
    }
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.03);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes slide-up {
    from {
        opacity: 0;
        transform: translateY(50px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes card-appear {
    0% {
        opacity: 0;
        transform: translateY(30px) rotate(2deg);
    }

    100% {
        opacity: 1;
        transform: translateY(0) rotate(0);
    }
}

@keyframes toast-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.toast-fade-in {
    opacity: 0;
    animation: toast-fade-in 0.8s forwards;
}

/* ============ 动态类 ============ */
.animate-pop {
    animation: pop-in 1s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.animate-fade-in {
    opacity: 0;
    animation: fade-in 0.8s forwards;
}

.animate-float {
    animation: float 4s infinite ease-in-out;
    animation-delay: var(--delay, 0);
}

.animate-bounce {
    animation: bounce 2s infinite;
}

.animate-glow {
    animation: glow 2s infinite;
}

.animate-pulse {
    animation: pulse 2s infinite;
}

.animate-slide-up {
    opacity: 0;
    animation: slide-up 1s forwards;
}

.animate-card {
    opacity: 0;
    animation: card-appear 0.6s forwards;
    animation-delay: calc(0.1s * var(--i));
}

.animate-form-field {
    transition: all 0.3s ease;
}
/* 响应式布局 */
@media (max-width: 1024px) {
    .masonry {
        column-count: 3;
    }
}

@media (max-width: 768px) {
    .masonry {
        column-count: 2;
    }
    
    .header .container {
        flex-direction: column;
        gap: 20px;
    }
    
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .modal-content {
        flex-direction: column;
        max-height: 90vh;
    }
    
    .photo-container,
    .photo-details {
        flex: 0 0 100%;
    }
    
    .photo-container {
        padding: 10px;
    }
    
    .photo-details {
        max-height: 40vh;
        overflow-y: auto;
    }
}

@media (max-width: 480px) {
    .masonry {
        column-count: 1;
    }
    
    .nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .hero h1 {
        font-size: 2rem;
    }
    
    .hero p {
        font-size: 1.2rem;
    }
}

.splash {
    position: fixed;
    z-index: 99999;
    left: 0; top: 0; right: 0; bottom: 0;
    width: 100vw; height: 100vh;
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    transition: opacity 0.8s;
    opacity: 1;
    pointer-events: all;
}
.splash-bg {
    position: absolute;
    left: 0; top: 0; right: 0; bottom: 0;
    width: 100vw; height: 100vh;
    background: linear-gradient(rgba(44,62,80,0.7),rgba(44,62,80,0.7)), url('https://Leavesch.site/img/摄影画廊.png') center/cover;
    z-index: 1;
    opacity: 0.95;
}
.splash-title {
    position: relative;
    z-index: 2;
    color: #fff;
    font-size: 3.5rem;
    font-weight: bold;
    letter-spacing: 0.2em;
    text-shadow: 0 8px 32px rgba(0,0,0,0.25);
    animation: pop-in 1.2s cubic-bezier(0.175,0.885,0.32,1.275) forwards;
}
.splash.hide {
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.8s;
}
/* 主内容动画已在 animate-fade-in/slide-up 定义，无需重复 */
.header.animate-fade-in { animation-delay: 0.3s; }
.hero.animate-fade-in { animation-delay: 0.7s; }
.filters.animate-slide-up { animation-delay: 1.1s; }
.gallery.animate-fade-in { animation-delay: 1.5s; }

/* 新增样式 */
.photo-category {
    font-size: 0.8rem;
    color: var(--primary-color);
    background: rgba(52, 152, 219, 0.1);
    padding: 2px 8px;
    border-radius: 12px;
    display: inline-block;
 /*   margin-bottom: 8px;*/
    font-weight: 500;
}

.favorite-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    color: var(--accent-color);
    font-size: 1.2rem;
    background: rgba(255, 255, 255, 0.9);
    padding: 5px;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.favorite-active {
    color: var(--accent-color) !important;
    font-weight: bold;
}

#modal-favorite.favorite-active {
    color: var(--accent-color);
}

.photo-meta span {
    display: flex;
    align-items: center;
    gap: 5px;
    margin-bottom: 8px;
}

.photo-meta i {
    width: 16px;
    color: var(--primary-color);
}

.photo-category, .tags {
    display: inline-block;
    vertical-align: middle;
}
.tags {
    font-size: 0.8rem;
    margin-left: 8px;
    vertical-align: middle;
}

/* 加载更多按钮样式 */
.load-more-btn {
    display: block;
    margin: 30px auto 50px auto;
    padding: 12px 32px;
    font-size: 1.1rem;
    border-radius: 8px;
    background: var(--primary-color, #3498db);
    color: #fff;
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    box-shadow: 0 2px 8px rgba(44,62,80,0.08);
    outline: none;
}
.load-more-btn:hover:enabled {
    background: #2980b9;
}
.load-more-btn:disabled {
    background: #aaa;
    cursor: not-allowed;
}