/* Images for Blog - Frontend Styles */

/* 기본 컨테이너 */
.images-for-blog-container {
    margin: 20px 0;
    position: relative;
}

/* 콜라주 레이아웃 */
.collage-layout {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 3px;
    width: 100%;
}

.collage-layout.mobile-stack {
    grid-template-columns: 1fr;
}

.collage-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: auto; /* 자동 비율 조정 */
    min-height: 200px; /* 최소 높이 설정 */
}

.collage-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* 슬라이드 레이아웃 */
.slide-layout {
    position: relative;
    width: 100%;
}

.slide-container {
    position: relative;
    width: 100%;
    height: 300px; /* 고정 높이로 변경 */
    overflow: hidden;
    border-radius: 8px;
    background: #f5f5f5;
}

.slide-wrapper {
    display: flex;
    height: 100%;
    gap: 0px; /* 간격 제거 */
    transition: transform 0.3s ease;
}

.slide-item {
    flex: 0 0 auto;
    position: relative;
    height: 100%;
    cursor: pointer;
    overflow: hidden;
    width: auto; /* 자동 너비 */
}

.slide-item img {
    height: 100%; /* 높이를 100%로 고정 */
    width: auto; /* 너비는 자동으로 비율에 맞게 조정 */
    max-width: none;
    object-fit: cover;
    display: block;
}

/* 슬라이드 네비게이션 */
.slide-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    font-weight: bold;
    border-radius: 50%;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 10;
    user-select: none;
}

.slide-container:hover .slide-nav {
    opacity: 1;
}

.slide-nav:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: translateY(-50%) scale(1.1);
}

.slide-nav.prev {
    left: 20px;
}

.slide-nav.next {
    right: 20px;
}

/* 슬라이드 페이지네이션 */
.slide-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 15px;
    gap: 8px;
}

.pagination-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #ccc;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-block;
}

.pagination-dot:hover {
    background: #999;
    transform: scale(1.2);
}

.pagination-dot.active {
    background: #333;
    transform: scale(1.3);
}

/* 개별 사진 레이아웃 */
.individual-layout {
    display: flex;
    flex-direction: column;
    gap: 0px;
    width: 100%;
}

.individual-item {
    position: relative;
    width: 100%;
    cursor: pointer;
    overflow: hidden;
    border-radius: 4px;
}

.individual-item img {
    width: 100%;
    height: auto;
    display: block;
}

/* 라이트박스 스타일 */
.images-for-blog-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.images-for-blog-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    cursor: pointer; /* 클릭 가능 표시 */
}

.lightbox-close {
    position: absolute;
    top: -50px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.lightbox-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
    background: rgba(0, 0, 0, 0.7);
    padding: 8px 16px;
    border-radius: 20px;
    backdrop-filter: blur(10px);
}

/* 반응형 디자인 */
@media (max-width: 768px) {
    .collage-layout.mobile-stack {
        grid-template-columns: 1fr;
    }

    .collage-layout:not(.mobile-stack) {
        grid-template-columns: repeat(2, 1fr);
    }

    .slide-nav {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .slide-nav.prev {
        left: 10px;
    }

    .slide-nav.next {
        right: 10px;
    }

    .lightbox-close {
        top: 20px;
        right: 20px;
    }

    .lightbox-counter {
        bottom: 20px;
    }
}

@media (max-width: 480px) {
    .images-for-blog-container {
        margin: 15px 0;
    }
    
    .collage-layout {
        gap: 3px;
    }
    
    .collage-layout.mobile-stack .collage-row {
        margin-bottom: 3px;
    }
    
    .slide-container {
        height: 250px;
    }
    
    .pagination-dot {
        width: 10px;
        height: 10px;
    }
    
    .individual-layout {
        gap: 0px;
    }
    
    /* 모바일에서도 콜라주 레이아웃 유지 (mobile-stack이 아닌 경우) */
    .collage-layout:not(.mobile-stack) .collage-row {
        display: flex;
        gap: 3px;
        margin-bottom: 3px;
    }
    
    .collage-layout:not(.mobile-stack) .collage-item {
        flex-basis: calc(50% - 1.5px);
        max-width: calc(50% - 1.5px);
    }
}

/* 로딩 상태 */
.images-for-blog-container img {
    transition: none; /* 호버 효과 제거 */
}

.images-for-blog-container img[loading="lazy"] {
    opacity: 0;
}

.images-for-blog-container img[loading="lazy"].loaded {
    opacity: 1;
}

/* 접근성 */
.slide-nav:focus,
.pagination-dot:focus,
.lightbox-close:focus {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* 애니메이션 */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.images-for-blog-container {
    animation: fadeInUp 0.6s ease;
}

/* 호버 효과 완전 제거 */
.collage-item,
.slide-item,
.individual-item {
    transition: none;
}

.collage-item img,
.slide-item img,
.individual-item img {
    transition: none;
}

/* 터치 기기에서도 호버 효과 없음 */
@media (hover: none) and (pointer: coarse) {
    .slide-nav {
        opacity: 1;
        background: rgba(0, 0, 0, 0.5);
    }
}