* {
    cursor: url("../arrow.png"), auto;
    --ms-gray: #bfbec0;
}
body{
    padding: 0;
    margin: 0;
    background: var(--ms-gray);
}
#grid{
    display: none;
    flex-wrap: wrap;
    justify-content: flex-start; /* Align items to the left */
    width: 100%;
    gap: 8px;
    padding: 8px;
    box-sizing: border-box;
}
.photo{
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1 0 280px;
    max-width: calc(33.33% - 16px); /* Default for 3 items per row */
    margin-bottom: 12px;
    box-sizing: border-box;
    padding: 4px;
    background-color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);

    & p{
        padding: 0;
        margin: 4px 0;
        font-size: .9rem;
        width: 100%;
        text-align: center;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    &:hover{
        outline: gray dashed 1px;
        transform: translateY(-2px);
        transition: transform 0.2s;

        & p{
            color: blue;
        }
    }
}
#grid img{
    width: 100%;
    height: 200px;
    object-fit: cover;
    object-position: center;
    transition: all 0.3s ease;
}
input:checked ~ #individual{
    display: none;
}
input:checked ~ #grid{
    display: flex;
}
input{
    position: relative;
    top: 0;
    left: 0;
    appearance: none;
    background: white;
    border: 2px solid black;
    width: 30px;
    height: 30px;
    &::after{
        background: url("../icons/group.svg");
        background-size: 90%;
        background-repeat: no-repeat;
        background-position: center;
        content: '';
        width: 100%;
        height: 100%;
        position: absolute;
        top: 0;
        left: 0;
    }
    &:checked::after{
        background: url("../icons/individual.svg");
        background-size: 90%;
        background-repeat: no-repeat;
        background-position: center;
    }
}
#individual img{
    max-width: 100vw;
    max-height: 100%;
}
#individual #image{
    width: 100%;
    height: 90vh;
    display: flex;
    justify-content: center;
    align-items: center;
}
#buttons{
    text-align: center;
    position: absolute;
    display: flex;
    justify-content: center;
    align-items:center;
    bottom: 10px;
    left: 0;
    right: 0;
}
button {
    margin: 5px;
    user-select:none;
    background: #c0c4c8;
    height: 90%;
    font-size: 1.3rem;
    width: fit-content;
    border: outset #a2a2a2 3px;
    &:active,&.clicked{
        border: inset #a2a2a2 3px;
    }
}
#info{
    color: black;
}

/* Media queries for responsive gallery */
@media (max-width: 1200px) { /* Adjust breakpoint as needed */
    .photo {
        max-width: calc(33.33% - 16px); /* Keep 3 items if space allows */
    }
}

@media (max-width: 900px) {
    .photo {
        max-width: calc(50% - 16px); /* 2 items per row */
    }
}

@media (max-width: 600px) {
    .photo {
        max-width: 100%; /* 1 item per row */
    }
}

/* Force left alignment when wider gaps occur */
@media (max-width: 700px) { /* Adjust breakpoint based on when 15% gap might occur with 2 items */
    .photo {
        max-width: calc(50% - 12px); /* Slightly wider to potentially trigger the condition earlier */
    }
}

@media (max-width: 450px) { /* Adjust breakpoint for single item row */
    /* No need to adjust max-width here as it's already 100% */
}