/**
 * App-wide custom CSS (non-Tailwind overrides and animations)
 */

body {
    font-family: 'Space Grotesk', sans-serif;
}

/* HTMX loading indicator */
.htmx-indicator {
    display: none;
}

.htmx-request .htmx-indicator {
    display: inline-flex;
}

.htmx-request.htmx-indicator {
    display: inline-flex;
}

/* Masonry-like grid - Optimized for performance */
.gallery-grid {
    columns: 1;
    column-gap: 1rem;
    contain: layout style;
}

@media (min-width: 640px) {
    .gallery-grid {
        columns: 2;
    }
}

@media (min-width: 1024px) {
    .gallery-grid {
        columns: 3;
    }
}

@media (min-width: 1280px) {
    .gallery-grid {
        columns: 4;
    }
}

@media (min-width: 1536px) {
    .gallery-grid {
        columns: 5;
    }
}

.gallery-grid>* {
    break-inside: avoid;
    margin-bottom: 1rem;
}

/* Card entrance animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.98);
    }

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

.gallery-card-enter {
    animation: fadeInUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
    will-change: transform, opacity;
}

/* Card optimization classes */
.card-optimized {
    contain: layout style paint;
    will-change: transform;
}

.card-loading {
    min-height: 200px;
}

.card-loaded {
    min-height: auto;
}

/* Skeleton shimmer animation */
@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

.skeleton-shimmer {
    background: linear-gradient(90deg,
            oklch(var(--b3)) 0%,
            oklch(var(--b2)) 20%,
            oklch(var(--b3)) 40%,
            oklch(var(--b3)) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
}

.skeleton-card {
    animation: fadeInUp 0.3s ease-out both;
}

/* Scroll sentinel styling */
.scroll-sentinel {
    width: 100%;
    break-inside: avoid;
}

.scroll-sentinel-end {
    break-inside: avoid;
}

/* GPU acceleration hints */
.will-change-opacity {
    will-change: opacity;
}

/* Ensure Sidebar is always above content when overlapping */
.drawer-side {
    z-index: 9998 !important;
}

.drawer-content {
    z-index: 1;
}

/* Allow sidebar dropdowns to overflow */
.drawer-side > div {
    overflow: visible !important;
}

/* Ensure sidebar footer allows dropdowns to extend */
.drawer-side .border-t {
    overflow: visible;
}

/* Hide Alpine.js cloak */
[x-cloak] {
    display: none !important;
}

/* Toast/Notification positioning fixes */
#toast-container {
    position: fixed !important;
    top: 1rem !important;
    right: 1rem !important;
    z-index: 9999 !important;
    pointer-events: none; /* Allow clicks through container */
}

#toast-container > * {
    pointer-events: auto; /* But allow clicks on actual toasts */
    margin-bottom: 0.5rem; /* Space between multiple toasts */
}

/* Ensure toast container is not affected by any parent overflow */
#toast-container {
    max-width: calc(100vw - 2rem);
}

/* On mobile, position toasts below the navbar */
@media (max-width: 1024px) {
    #toast-container {
        top: 5rem !important; /* Below mobile navbar which is sticky at top */
        right: 0.5rem !important;
        left: 0.5rem !important;
        max-width: calc(100vw - 1rem);
    }
}

@media (max-width: 640px) {
    #toast-container {
        top: 4.5rem !important;
        right: 0.5rem !important;
        left: 0.5rem !important;
        max-width: calc(100vw - 1rem);
    }
}
