/* 
 * PC API Galleries - Stylesheet
 * A modern, responsive masonry gallery with pill navigation.
 */

:root {
    --pc-gallery-primary: #1a1a1a;
    --pc-gallery-bg: #f9fafb;
    --pc-gallery-text: #4b5563;
    --pc-gallery-accent: #3b82f6; /* Modern Blue */
    --pc-gallery-radius: 8px;
    --pc-gallery-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pc-gallery-wrapper {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 2rem auto;
    width: 100%;
    max-width: 1400px;
    box-sizing: border-box;
}

/* Navigation Menu */
.pc-gallery-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.pc-gallery-nav-btn {
    background-color: #fff;
    color: var(--pc-gallery-text);
    border: 1px solid #e5e7eb;
    padding: 0.5rem 1.25rem;
    border-radius: 9999px; /* Pill shape */
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--pc-gallery-transition);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.pc-gallery-nav-btn:hover {
    border-color: var(--pc-gallery-primary);
    color: var(--pc-gallery-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.pc-gallery-nav-btn.active {
    background-color: var(--pc-gallery-primary);
    color: #fff;
    border-color: var(--pc-gallery-primary);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Masonry Grid */
.pc-gallery-masonry {
    column-count: 1;
    column-gap: 1rem;
    width: 100%;
}

@media (min-width: 640px) {
    .pc-gallery-masonry {
        column-count: 2;
    }
}

@media (min-width: 1024px) {
    .pc-gallery-masonry {
        column-count: 3;
    }
}

@media (min-width: 1280px) {
    .pc-gallery-masonry {
        column-count: 4;
    }
}

/* Masonry Item */
.pc-gallery-item {
    break-inside: avoid;
    margin-bottom: 1rem;
    display: block;
    border-radius: var(--pc-gallery-radius);
    overflow: hidden;
    position: relative;
    background-color: #e5e7eb; /* Placeholder color before load */
    transform: translateZ(0); /* Hardware acceleration */
}

.pc-gallery-item img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    transition: transform 0.5s ease;
    will-change: transform;
}

/* Hover effect on images */
.pc-gallery-item:hover img {
    transform: scale(1.03);
}

/* Loading overlay effect for images */
.pc-gallery-item::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0);
    transition: background 0.3s ease;
    pointer-events: none;
}

.pc-gallery-item:hover::after {
    background: rgba(0,0,0,0.1);
}

/* Download button overlay */
.pc-gallery-download {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--pc-gallery-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(10px);
    transition: var(--pc-gallery-transition);
    text-decoration: none;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 10;
}

.pc-gallery-item:hover .pc-gallery-download {
    opacity: 1;
    transform: translateY(0);
}

.pc-gallery-download:hover {
    background: var(--pc-gallery-primary);
    color: #fff;
}

.pc-gallery-download svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

/* Loader */
.pc-gallery-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 0;
    color: var(--pc-gallery-text);
}

.pc-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--pc-gallery-primary);
    animation: pc-spin 1s ease-in-out infinite;
    margin-bottom: 1rem;
}

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

/* Error message */
.pc-gallery-error {
    background-color: #fee2e2;
    color: #991b1b;
    padding: 1rem;
    border-radius: var(--pc-gallery-radius);
    text-align: center;
    border: 1px solid #f87171;
    margin: 2rem 0;
}

/* Hide element utility */
.pc-hidden {
    display: none !important;
}

/* PhotoSwipe custom tweaks */
.pswp__button--download {
    display: flex;
    justify-content: center;
    align-items: center;
}
.pswp__button--download svg {
    width: 24px;
    height: 24px;
    fill: #fff;
}
