/* Article Image Gallery Styles */

/* Gallery Container */
.article-gallery {
    margin: 2rem 0;
    padding: 0;
}

.article-gallery-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--color-text);
}

.article-gallery-description {
    font-size: 1rem;
    color: var(--color-text-muted, #666);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

/* Responsive Grid Layout */
.article-gallery-grid {
    display: grid;
    gap: 1rem;
    margin-bottom: 2rem;
}

/* Grid columns based on screen size */
@media (min-width: 1200px) {
    .article-gallery-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (min-width: 768px) and (max-width: 1199px) {
    .article-gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 480px) and (max-width: 767px) {
    .article-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 479px) {
    .article-gallery-grid {
        grid-template-columns: 1fr;
    }
}

/* Gallery Item */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    background: transparent;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.05);
}

/* Zoom indicator */
.gallery-item::after {
    content: '🔍';
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    font-size: 1.1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.gallery-item:hover::after {
    opacity: 1;
}

/* Featured badge */
.gallery-item.featured::before {
    content: '★';
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    background: var(--color-accent, #d4a017);
    color: white;
    padding: 0.4rem 0.7rem;
    border-radius: 6px;
    font-size: 1rem;
    z-index: 1;
    font-weight: bold;
}

/* Caption overlay */
.gallery-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    color: white;
    padding: 2rem 1rem 0.75rem;
    font-size: 0.9rem;
    line-height: 1.4;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover .gallery-caption {
    opacity: 1;
}

/* Lightbox Overlay */
.gallery-lightbox {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    animation: fadeIn 0.3s ease;
}

.gallery-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Lightbox content wrapper */
.lightbox-content-wrapper {
    position: relative;
    max-width: 95%;
    max-height: 90%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Lightbox image */
.gallery-lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    animation: zoomIn 0.3s ease;
}

@keyframes zoomIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Lightbox caption */
.lightbox-caption-text {
    color: #fff;
    text-align: center;
    padding: 1rem 2rem;
    font-size: 1rem;
    line-height: 1.6;
    max-width: 800px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 6px;
    margin-top: 1rem;
}

/* Lightbox controls */
.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    color: #fff;
    font-size: 3rem;
    font-weight: 300;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10000;
    line-height: 1;
    user-select: none;
    background: rgba(0, 0, 0, 0.5);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    color: var(--color-accent, #d4a017);
    transform: rotate(90deg);
    background: rgba(0, 0, 0, 0.8);
}

/* Navigation arrows */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 3rem;
    cursor: pointer;
    user-select: none;
    background: rgba(0, 0, 0, 0.5);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10000;
}

.lightbox-nav:hover {
    background: rgba(0, 0, 0, 0.8);
    color: var(--color-accent, #d4a017);
}

.lightbox-prev {
    left: 2rem;
}

.lightbox-next {
    right: 2rem;
}

.lightbox-nav.disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.lightbox-nav.disabled:hover {
    background: rgba(0, 0, 0, 0.5);
    color: #fff;
}

/* Image counter */
.lightbox-counter {
    position: absolute;
    top: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 1rem;
    background: rgba(0, 0, 0, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    z-index: 10000;
}

/* Mobile optimizations */
@media (max-width: 768px) {
    .lightbox-close {
        top: 1rem;
        right: 1rem;
        font-size: 2rem;
        width: 40px;
        height: 40px;
    }

    .lightbox-nav {
        font-size: 2rem;
        width: 50px;
        height: 50px;
    }

    .lightbox-prev {
        left: 1rem;
    }

    .lightbox-next {
        right: 1rem;
    }

    .lightbox-counter {
        top: 1rem;
        font-size: 0.9rem;
        padding: 0.4rem 0.8rem;
    }

    .lightbox-caption-text {
        font-size: 0.9rem;
        padding: 0.75rem 1rem;
    }

    .gallery-lightbox-image {
        max-height: 70vh;
    }
}

/* Loading state */
.gallery-item.loading {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Credits text */
.gallery-credits {
    font-size: 0.85rem;
    color: var(--color-text-muted, #888);
    margin-top: 0.5rem;
    font-style: italic;
}
