.container {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); /* Adjusted for aspect ratio */
    gap: 10px;
    width: 100%;
    max-width: 1100px;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    aspect-ratio: 915 / 513; /* Maintain the correct aspect ratio */
    object-fit: contain; /* Ensure the entire image fits without cropping */
    border-radius: 5px;
    border: 1px solid #231430; /* Thin border around each image */
    cursor: pointer;
}

.story img {
    width: 100%;
    height: 100%;
    aspect-ratio: 915 / 513; /* Maintain the correct aspect ratio */
    object-fit: contain; /* Ensure the entire image fits without cropping */
    border-radius: 5px;
}

#image-viewer {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    z-index: 10;
}

#image-viewer.active {
    display: flex;
}

.nav-arrow {
    position: absolute;
    top: 50%;
    background: rgba(0,0,0,0.3);
    border: none;
    color: white;
    font-size: 3rem;
    padding: 0.1em 0.3em;
    cursor: pointer;
    user-select: none;
    transform: translateY(-50%);
    z-index: 9;
    border-radius: 3px;
}

#prev-image {
    left: 20px;
}

#next-image {
    right: 20px;
}

.nav-arrow:hover {
    background: rgba(0,0,0,0.6);
}

#viewer-image {
    max-width: 80%;
    max-height: 80%;
}

.image-details {
    color: white;
    text-align: center;
}

#close-viewer {
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 30px;
    cursor: pointer;
    color: white;
}