/**
 * SmugMug Photo Gallery - Custom Styles
 * 
 * Additional styles beyond Tailwind CSS utilities.
 */

/* ============================================
   Base Styles
   ============================================ */

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
.scrollbar-thin::-webkit-scrollbar {
    height: 6px;
}

.scrollbar-thin::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.scrollbar-thin::-webkit-scrollbar-thumb:hover {
    background: #a1a1a1;
}

/* ============================================
   Button Styles
   ============================================ */

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    background-color: var(--color-primary, #1a56db);
    color: white;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-primary:hover {
    background-color: var(--color-primary-hover, #1e429f);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    background-color: #f3f4f6;
    color: #374151;
    font-weight: 500;
    border-radius: 0.5rem;
    transition: background-color 0.2s, transform 0.1s;
}

.btn-secondary:hover {
    background-color: #e5e7eb;
}

.btn-secondary:active {
    transform: scale(0.98);
}

/* ============================================
   Gallery Grid Styles
   ============================================ */

/* Masonry-like effect for varied aspect ratios (optional) */
.gallery-masonry {
    column-count: 2;
    column-gap: 0.5rem;
}

@media (min-width: 640px) {
    .gallery-masonry {
        column-count: 3;
    }
}

@media (min-width: 1024px) {
    .gallery-masonry {
        column-count: 4;
    }
}

@media (min-width: 1280px) {
    .gallery-masonry {
        column-count: 5;
    }
}

.gallery-masonry .gallery-item {
    break-inside: avoid;
    margin-bottom: 0.5rem;
}

/* ============================================
   PhotoSwipe Customizations
   ============================================ */

.pswp {
    --pswp-bg: rgba(0, 0, 0, 0.95);
}

.pswp__button {
    color: white !important;
}

.pswp__button:hover {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Custom caption styling */
.pswp__custom-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
    color: white;
    text-align: center;
}

.pswp__custom-caption h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.pswp__custom-caption p {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================
   Loading & Animation States
   ============================================ */

/* Skeleton loading effect */
.skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Fade in animation */
.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   Image Placeholder
   ============================================ */

.img-placeholder {
    background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-placeholder::after {
    content: '';
    width: 40px;
    height: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%23a0a0a0'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    opacity: 0.5;
}

/* Hide placeholder in buy panel */
#buy-panel .img-placeholder::after {
    display: none;
}

#buy-panel img {
    opacity: 1 !important;
}

/* ============================================
   Responsive Utilities
   ============================================ */

/* Hide scrollbar but keep functionality */
.hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Touch-friendly tap targets */
@media (pointer: coarse) {
    .touch-target {
        min-height: 44px;
        min-width: 44px;
    }
}

/* ============================================
   Focus States (Accessibility)
   ============================================ */

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--color-primary, #1a56db);
    outline-offset: 2px;
}

/* ============================================
   Skeleton Loader Animation
   ============================================ */

@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.skeleton-loader {
    background: linear-gradient(
        90deg,
        #e5e7eb 0%,
        #f3f4f6 50%,
        #e5e7eb 100%
    );
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
}

/* Error state for failed images */
.image-error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #f3f4f6;
    color: #9ca3af;
}

/* PhotoSwipe button alignment fix */
.pswp__button--download-button {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    header,
    footer,
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
    }
    
    .container {
        max-width: 100% !important;
    }
}
