/* General styles */
body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    background: linear-gradient(to bottom, #e0e0e0, #a0a0a0); /* Light grey to dark grey gradient */
    color: #333; /* Ensure text is readable */
}

header {
    background: #333;
    color: #fff;
    padding: 1rem;
    text-align: center;
}

nav ul {
    background: #444;
    color: #fff;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
}

nav ul li {
    margin: 0.5rem;
}

nav ul li a {
    color: #fff;
    text-decoration: none;
}

section {
    padding: 2rem;
}

.thumbnail {
    width: 150px;
    margin: 10px;
    display: inline-block;
}

.thumbnail img {
    width: 100%;
    height: auto;
    cursor: pointer;
}

footer {
    background: #333;
    color: #fff;
    text-align: center;
    padding: 1rem;
    position: relative;
    width: 100%;
    bottom: 0;
}

/* Carousel styles */
.carousel {
    position: relative;
    max-width: 100%;
    margin: auto;
    overflow: hidden;
    height: 200px; /* Adjust the height to match the thumbnail size */
    display: flex;
    justify-content: center; /* Center the carousel container */
    align-items: center; /* Center the carousel container vertically */
}

.carousel-container {
    display: flex;
    transition: transform 0.5s ease;
    position: relative; /* Add position relative to place arrows within this container */
}

.carousel-slide {
    min-width: 100%;
    box-sizing: border-box;
    display: flex;
    justify-content: center; /* Center the image horizontally */
    align-items: center; /* Center the image vertically */
}

.carousel-slide img {
    max-height: 100%;
    max-width: 200px; /* Set a fixed max width for the thumbnails */
    object-fit: contain; /* Maintain aspect ratio */
}

.prev, .next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    color: white;
    font-weight: bold;
    font-size: 18px;
    transition: 0.6s ease;
    user-select: none;
    transform: translateY(-50%); /* Center the arrows vertically */
    background-color: rgba(0, 0, 0, 0.5); /* Add a background to make arrows visible */
    border-radius: 50%;
}

.prev {
    left: 25%; /* Adjust the position to be closer to the center */
}

.next {
    right: 25%; /* Adjust the position to be closer to the center */
}

.prev:hover, .next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Lightbox styles */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden; /* prevent scrolling */
    padding: 0;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    margin: 0;
    padding: 0;
    text-align: center;
}

.lightbox-content img {
    display: block;
    margin: 0 auto;
    max-height: 75vh;      /* limit vertical size */
    max-width: 90vw;       /* limit horizontal size */
    width: auto;           /* do not stretch horizontally */
    height: auto;          /* do not stretch vertically */
    object-fit: contain;   /* preserve aspect ratio within box */
}


.close {
    position: absolute;
    top: 20px;
    right: 25px;
    color: #fff;
    font-size: 35px;
    font-weight: bold;
    cursor: pointer;
}

.lightbox .prev, .lightbox .next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -50px;
    color: #fff;
    font-weight: bold;
    font-size: 20px;
    transition: 0.3s;
    user-select: none;
}

.lightbox .prev {
    left: 0;
}

.lightbox .next {
    right: 0;
}

.lightbox .prev:hover, .lightbox .next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* Responsive styles */
@media (max-width: 768px) {
    header {
        padding: 0.5rem;
    }

    nav ul {
        flex-direction: column;
    }

    nav ul li {
        margin: 0.2rem 0;
    }

    section {
        padding: 1rem;
    }

    footer {
        padding: 0.5rem;
        position: relative;
    }

    .carousel {
        height: auto; /* Adjust carousel height for smaller screens */
    }

    .carousel-slide img {
        max-width: 100%;
        height: auto; /* Ensure images fit smaller screens */
    }

    .prev, .next {
        left: 10px;
        right: 10px;
    }

    .lightbox-content {
        width: 90%;
    }
}

figure {
    display: inline-block;
    text-align: center;
    margin: 10px;
    vertical-align: top; /* Ensure all figures align at the top */
}

figure img {
    vertical-align: top; /* Ensure images align at the top */
}

figcaption {
    margin-top: 5px;
    font-style: italic;
    color: #555;
}

.lightbox .caption {
    text-align: center;
    color: white;
    padding: 10px 0;
    font-size: 18px;
}


/* Keep gallery layout normal */
#gallery {
    display: block;
}

/* Make only the thumbnails within each section a grid */
.gallery-section {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 30px;
}

/* Consistent thumbnail sizing */
.thumbnail {
    width: 180px;
    height: 180px;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    text-align: center;
}

.thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
    cursor: pointer;
}

.thumbnail img:hover {
    transform: scale(1.05);
}

.thumbnail figcaption {
    font-size: 0.9em;
    margin-top: 5px;
    color: #333;
}
