/* Gallery Lightbox Styles */

:root {
    --gallery-overlay-bg: rgba(0, 0, 0, 0.9);
    --gallery-text-color: #f4f1ea;
    --gallery-btn-hover: #4a6741;
}

dialog#gallery-modal {
    border: none;
    background: transparent;
    max-width: 100vw;
    max-height: 100vh;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
    position: fixed;
    inset: 0;
    z-index: 2000;
    /* Flexbox for centering */
    display: flex; /* Hidden by default, flex when open via JS or attribute */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    visibility: hidden; /* Native dialog handling manages display, but we ensure flex behavior */
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none; /* Prevent clicks when hidden/fading out */
}

dialog#gallery-modal[open] {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    display: flex;
}

dialog#gallery-modal::backdrop {
    background: var(--gallery-overlay-bg);
}

/* Container for the image to handle positioning of arrows relative to it, or screen?
   Let's do screen relative for arrows usually better for galleries. */

.gallery-container {
    position: relative;
    max-width: 90%;
    max-height: 90%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.gallery-img {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.gallery-img.loaded {
    opacity: 1;
}

/* Controls */
.gallery-btn {
    position: absolute;
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: none;
    cursor: pointer;
    padding: 1rem;
    font-size: 2rem;
    border-radius: 50%;
    transition: background 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    user-select: none;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.gallery-btn:hover {
    background: var(--gallery-btn-hover);
    transform: translateY(-50%) scale(1.1);
}

.gallery-prev { left: 20px; }
.gallery-next { right: 20px; }

.gallery-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    color: white;
    font-size: 3rem;
    border: none;
    cursor: pointer;
    line-height: 1;
    z-index: 20;
    transition: color 0.3s;
}

.gallery-close:hover {
    color: var(--gallery-btn-hover);
}

/* Caption (optional, but good for context) */
.gallery-caption {
    margin-top: 1rem;
    color: var(--gallery-text-color);
    font-family: 'Lato', sans-serif;
    font-size: 1.2rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.gallery-title {
    font-weight: bold;
}

.gallery-cta {
    background-color: var(--gallery-btn-hover);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 30px;
    font-family: 'Lato', sans-serif;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
    margin-top: 5px;
}

.gallery-cta:hover {
    background-color: #5c8052; /* Lighter green */
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .gallery-btn {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
        padding: 0.5rem;
    }
    .gallery-prev { left: 10px; }
    .gallery-next { right: 10px; }
    .gallery-img { max-height: 80vh; }
}
