/* Custom LightGallery Theme Styles */

/* Enhanced gallery item hover effects */
.gallery-item {
    position: relative;
    overflow: hidden;
}

.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0);
    transition: background 0.3s ease;
    z-index: 1;
    pointer-events: none;
}

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

/* Loading animation */
.gallery-item img {
    transition: transform 0.3s ease;
}

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

/* Custom lightbox styling */
.lg-outer .lg-thumb-outer {
    background-color: rgba(0,0,0,0.9) !important;
}

.lg-outer .lg-thumb-item.active,
.lg-outer .lg-thumb-item:hover {
    border-color: #fff !important;
}

/* Custom toolbar */
.lg-toolbar .lg-icon {
    color: #fff !important;
    font-size: 18px !important;
}

.lg-toolbar .lg-icon:hover {
    color: #ccc !important;
}

/* Loading spinner */
.lg-outer .lg-item.lg-start-zoom .lg-img {
    transition: transform 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0s !important;
}

/* Album grid for subalbums */
.albums-section {
    margin-top: 50px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.albums-section h2 {
    text-align: center;
    margin-bottom: 30px;
    font-weight: 300;
    color: #333;
}

.no-thumbnail {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    color: #666;
    font-weight: 500;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .gallery-item img {
        height: 150px;
    }
    
    body {
        padding: 10px;
    }
}

/* Smooth animations */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Focus styles for accessibility */
.gallery-item:focus {
    outline: 2px solid #4A90E2;
    outline-offset: 2px;
}

/* Essay functionality styles */
.essay-chip {
    position: fixed !important;
    right: 15% !important;
    top: 51% !important;
    transform: translateY(-50%) !important;
    width: 44px !important;
    height: 44px !important;
    border-radius: 50% !important;
    border: 2px solid white !important;
    color: #333 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 18px !important;
    font-weight: bold !important;
    z-index: 1060 !important;
    opacity: 0 !important;
    transition: opacity 0.3s ease !important;
    line-height: 1 !important;
    text-align: center !important;
}

.essay-chip.fade-in {
    opacity: 1 !important;
}

/* When drawer is open, move chip to left edge and change to close button */
.essay-chip.drawer-open {
    right: 480px !important; /* Position on left edge of 400px drawer with 80px offset */
    transform: translateY(-50%) !important;
    transition: right 0.3s ease, opacity 0.3s ease !important;
    font-size: 18px !important;
    line-height: 1 !important;
    text-align: center !important;
}

/* Hide essay chip when lightGallery hides controls */
.lg-hide-items .essay-chip {
    opacity: 0 !important;
}

/* Ensure lightGallery navigation controls appear above essay drawer */
.lg-outer .lg-prev,
.lg-outer .lg-next,
.lg-outer .lg-actions,
.lg-outer .lg-toolbar,
.lg-outer .lg-prev-slide,
.lg-outer .lg-next-slide,
.lg-outer button[data-lg-action] {
    z-index: 1200 !important;
}

/* Ensure all lightGallery control elements are above drawer */
.lg-outer > * {
    z-index: 1150 !important;
}

.lg-outer .lg-inner {
    z-index: 1050 !important;
}



.essay-chip:hover {
    /* No hover effects for cleaner aesthetic */
}

.essay-chip.hidden {
    display: none;
}

.essay-drawer {
    position: fixed;
    top: 60px;
    right: -400px;
    bottom: 120px;
    width: 400px;
    background: white;
    z-index: 1100;
    transition: right 0.3s ease;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.essay-drawer.open {
    right: 80px;
}

.essay-drawer h3 {
    margin: 0 0 20px 0;
    color: #333;
    font-size: 1.5rem;
    font-weight: 300;
}

.essay-drawer .essay-content {
    color: #666;
    line-height: 1.6;
    font-size: 14px;
}

.essay-drawer .essay-content h1,
.essay-drawer .essay-content h2,
.essay-drawer .essay-content h3,
.essay-drawer .essay-content h4,
.essay-drawer .essay-content h5,
.essay-drawer .essay-content h6 {
    color: #333;
    margin-top: 1.5em;
    margin-bottom: 0.5em;
}

.essay-drawer .essay-content p {
    margin-bottom: 1em;
}

.essay-drawer .essay-content strong {
    font-weight: 600;
}

.essay-drawer .essay-content em {
    font-style: italic;
}

.essay-drawer .essay-content ul,
.essay-drawer .essay-content ol {
    margin: 1em 0;
    padding-left: 1.5em;
}

.essay-drawer .essay-content blockquote {
    border-left: 3px solid #ddd;
    padding-left: 1em;
    margin: 1em 0;
    color: #555;
    font-style: italic;
}

.essay-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.essay-close:hover {
    color: #333;
}

/* Print styles */
@media print {
    .gallery-grid {
        display: block !important;
    }
    
    .gallery-item {
        break-inside: avoid;
        margin-bottom: 20px;
    }
    
    /* Hide essay elements when printing */
    .essay-chip,
    .essay-drawer {
        display: none !important;
    }
}