/* Facebook-Style Gallery CSS */
.facebook-gallery {
    margin: 20px 0;
}

/* Grid layout for multiple gallery entries */
.facebook-gallery.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.facebook-gallery.grid-layout .gallery-entry {
    margin-bottom: 0;
    border: none;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.facebook-gallery.grid-layout .gallery-entry:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.facebook-gallery.grid-layout .gallery-photos {
    background: transparent;
}

.gallery-entry {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    margin-bottom: 20px;
    overflow: hidden;
    border: 1px solid #dddfe2;
    transition: box-shadow 0.2s ease;
}

.gallery-entry:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.gallery-entry-header {
    padding: 16px 20px;
    border-bottom: 1px solid #e4e6ea;
    background: #f8f9fa;
}

.gallery-entry-date {
    font-size: 16px;
    font-weight: 600;
    color: #1c1e21;
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.gallery-entry-subtitle {
    font-size: 13px;
    color: #65676b;
    margin: 4px 0 0 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.gallery-photos {
    position: relative;
    background: #f0f2f5;
}

/* Single photo layout */
.photos-single {
    display: block;
    width: 100%;
}

.photos-single img {
    width: 100%;
    height: auto;
    display: block;
    max-width: 100%;
}

/* Two photos layout - two squares side by side */
.photos-two {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px;
    width: 100%;
    aspect-ratio: 2 / 1;
    height: fit-content;
}

.photos-two img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s ease;
    aspect-ratio: 1 / 1;
}

/* Three photos layout - vertical (default) */
.photos-three {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    /* Creates 1:1 aspect ratio */
}

.photos-three>img {
    position: absolute;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.photos-three img:first-child {
    top: 0;
    left: 0;
    width: calc(50% - 1px);
    height: 100%;
}

.photos-three img:nth-child(2) {
    top: 0;
    right: 0;
    width: calc(50% - 1px);
    height: calc(50% - 1px);
}

.photos-three img:nth-child(3) {
    bottom: 0;
    right: 0;
    width: calc(50% - 1px);
    height: calc(50% - 1px);
}

/* Three photos layout - horizontal (first image on top) */
.photos-three-horizontal {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
    /* Creates 1:1 aspect ratio */
}

.photos-three-horizontal>img {
    position: absolute;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.photos-three-horizontal img:first-child {
    top: 0;
    left: 0;
    width: 100%;
    height: calc(50% - 1px);
}

.photos-three-horizontal img:nth-child(2) {
    bottom: 0;
    left: 0;
    width: calc(50% - 1px);
    height: calc(50% - 1px);
}

.photos-three-horizontal img:nth-child(3) {
    bottom: 0;
    right: 0;
    width: calc(50% - 1px);
    height: calc(50% - 1px);
}

/* Three photos layout - vertical with large first image (2/3) */
.photos-three-large {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
}

.photos-three-large>img {
    position: absolute;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.photos-three-large img:first-child {
    top: 0;
    left: 0;
    width: calc(66.67% - 1px);
    height: 100%;
}

.photos-three-large img:nth-child(2) {
    top: 0;
    right: 0;
    width: calc(33.33% - 1px);
    height: calc(50% - 1px);
}

.photos-three-large img:nth-child(3) {
    bottom: 0;
    right: 0;
    width: calc(33.33% - 1px);
    height: calc(50% - 1px);
}

/* Three photos layout - horizontal with large first image (2/3) */
.photos-three-horizontal-large {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%;
}

.photos-three-horizontal-large>img {
    position: absolute;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.photos-three-horizontal-large img:first-child {
    top: 0;
    left: 0;
    width: 100%;
    height: calc(66.67% - 1px);
}

.photos-three-horizontal-large img:nth-child(2) {
    bottom: 0;
    left: 0;
    width: calc(50% - 1px);
    height: calc(33.33% - 1px);
}

.photos-three-horizontal-large img:nth-child(3) {
    bottom: 0;
    right: 0;
    width: calc(50% - 1px);
    height: calc(33.33% - 1px);
}

/* Four photos layout - equal sizes with 1:1 aspect ratio */
.photos-four {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    width: 100%;
    aspect-ratio: 1 / 1;
    height: fit-content;
}

.photos-four img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s ease;
    aspect-ratio: 1 / 1;
}

/* More than 4 photos layout - equal sizes for first 4 with 1:1 aspect ratio */
.photos-more {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 2px;
    width: 100%;
    aspect-ratio: 1 / 1;
    height: fit-content;
}

.photos-more img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s ease;
    aspect-ratio: 1 / 1;
}

.photos-more img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.2s ease;
}

.photos-more .photo-container:last-child {
    position: relative;
}

.photos-more .more-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 600;
    transition: background 0.2s ease;
}

.photos-more .more-overlay:hover {
    background: rgba(0, 0, 0, 0.7);
}

/* Hover effects */
.gallery-photos img:hover {
    opacity: 0.9;
}

/* Modal styles */
.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.gallery-modal.active {
    display: flex;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.modal-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    background: none;
    border: none;
    color: white;
    font-size: 30px;
    padding: 5px;
    line-height: 1;
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    padding: 10px 15px;
    border-radius: 50%;
    transition: background 0.2s ease;
}

.modal-nav:hover {
    background: rgba(255, 255, 255, 0.3);
}

.modal-prev {
    left: -60px;
}

.modal-next {
    right: -60px;
}

.modal-counter {
    position: absolute;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    font-size: 14px;
}

/* Responsive design */
@media (max-width: 768px) {
    .gallery-entry-header {
        padding: 12px 16px;
    }

    .modal-nav {
        font-size: 20px;
        padding: 8px 12px;
    }

    .modal-prev {
        left: -50px;
    }

    .modal-next {
        right: -50px;
    }

    /* Grid layout responsive - 2 columns on tablets */
    .facebook-gallery.grid-layout {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 12px;
    }
}

@media (max-width: 480px) {
    .gallery-entry {
        margin-bottom: 16px;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    .modal-prev,
    .modal-next {
        display: none;
    }

    .modal-content {
        max-width: 95%;
        max-height: 95%;
    }

    /* Grid layout responsive - single column on mobile */
    .facebook-gallery.grid-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .facebook-gallery.grid-layout .gallery-entry {
        border-radius: 8px;
        border: none;
    }
}