/* Gallery Page Specific Styles */

body.page-gallery,
body.page-gallery main {
    background-color: #ffffff !important;
}

body.page-gallery main {
    padding-top: 6rem !important;
    /* Reduced padding to move content up */
}

body.page-gallery .section:first-of-type {
    padding-top: 0 !important;
    /* Removed padding to move content up */
}

/* Ensure header background is white on gallery page if needed */
body.page-gallery .site-header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

/* Make the main section white */
body.page-gallery .section.accent {
    background-color: #ffffff !important;
}

/* Force heading to be single line on larger screens */
body.page-gallery .section-heading {
    max-width: 100% !important;
    padding: 0 1rem;
}

body.page-gallery .section-heading h2 {
    white-space: nowrap;
    max-width: 100%;
}

@media (max-width: 768px) {
    body.page-gallery .section-heading h2 {
        white-space: normal;
    }
}

/* Lightbox Styles */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox.is-active {
    opacity: 1;
    visibility: visible;
}

.lightbox[hidden] {
    display: none;
}

.lightbox-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(4px);
}

.lightbox-content {
    position: relative;
    z-index: 1001;
    width: 100%;
    height: 100%;
}

.lightbox-figure {
    margin: 0;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    max-width: 95vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.lightbox-image-container {
    position: relative;
    overflow: visible;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: transform 0.1s ease-out;
}

.lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1);
    transform-origin: center center;
}

/* Lightbox Caption - Hidden inside header usually, but styled if visible here */
.lightbox-caption {
    margin-top: 1.5rem;
    color: #fff;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
    opacity: 0.9;
}

.lightbox-close:hover {
    transform: scale(1.1);
}

.lightbox-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1.5rem;
    z-index: 1002;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent);
}

.lightbox-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-right: 1rem;
}

.lightbox-control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    cursor: pointer;
    padding: 0.6rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.lightbox-control-btn svg {
    width: 20px;
    height: 20px;
}

.lightbox-control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.lightbox-control-btn:active {
    transform: translateY(0);
}

.lightbox-close {
    position: static;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
    border: none;
    cursor: pointer;
}

.lightbox-close svg {
    width: 20px;
    height: 20px;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.lightbox-image-container {
    position: relative;
    overflow: hidden;
    cursor: grab;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: transform 0.1s ease-out;
}

.lightbox-image-container:active {
    cursor: grabbing;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    transition: transform 0.3s cubic-bezier(0.2, 0, 0.2, 1);
    transform-origin: center center;
}

.lightbox.is-dragging .lightbox-image {
    transition: none !important;
    cursor: grabbing !important;
}

.lightbox.is-dragging .lightbox-image-container {
    cursor: grabbing !important;
}

/* Fullscreen Specific Enhancements */
.lightbox.is-fullscreen {
    background: #000;
}

.lightbox.is-fullscreen .lightbox-overlay {
    background: #000;
}

.lightbox.is-fullscreen .lightbox-figure {
    max-width: 100vw;
    max-height: 100vh;
}

.lightbox.is-fullscreen .lightbox-image {
    max-height: 100vh;
    max-width: 100vw;
    border-radius: 0;
    box-shadow: none;
}

.lightbox.is-fullscreen .lightbox-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 2rem 1rem 1.5rem;
}

.lightbox.is-fullscreen .lightbox-count {
    bottom: auto;
    top: 1.8rem;
    left: 2rem;
    transform: none;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
    z-index: 1003;
}

.lightbox-nav {
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* Allow clicking through */
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
}

.lightbox-btn {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #fff;
    font-size: 3rem;
    cursor: pointer;
    padding: 1rem;
    pointer-events: auto;
    /* Re-enable pointer events */
    transition: background 0.2s ease;
    border-radius: 50%;
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.lightbox-count {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.8);
    font-size: 1.1rem;
    font-weight: 500;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
}

@media (max-width: 768px) {
    .lightbox-btn {
        font-size: 2rem;
        width: 50px;
        height: 50px;
        background: rgba(0, 0, 0, 0.5);
    }

    .lightbox-nav {
        padding: 0 1rem;
    }

    .lightbox-close {
        top: 1rem;
        right: 1rem;
        font-size: 2.5rem;
    }

    .lightbox-count {
        bottom: 1.5rem;
    }

    .lightbox-figure {
        width: 100vw;
        max-width: 100vw;
    }

    .lightbox-image {
        width: 100vw;
        max-width: 100vw;
        max-height: 80vh;
        border-radius: 0;
    }
}