#loader {
    position: absolute;
    display: none;
    inset: 0;
    justify-content: center;
    align-items: center;
    background: var(--bg-clr);
    z-index: 50;
    overflow: hidden;
    padding-block: 8dvh 15dvh; /* space top/bottom */
    box-sizing: border-box;
}

.loader-inner {
    position: relative;
    width: min(80%, 100dvh);
    height: min(100%, 100dvh);
    aspect-ratio: 1/1;
    display: flex; /* not strictly needed, just keeps it flexible */
    justify-content: center;
    align-items: center;
}

.loading-image {
    position: absolute; /* stack all in same spot */
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.contact-sheet,
.description {
    background-color: var(--bg-clr-fade);
    position: fixed;
    top: 0;
    width: 100dvw;
    height: 100dvh;
    z-index: 10;
    padding-top: 5dvh;
    display: grid;
    gap: 1rem;
    opacity: 1;
    align-content: center;
    justify-items: center;
    grid-template-columns: repeat(12, 1fr);
}

.description .content {
    grid-column: 2/12;
}

.contact-sheet {
    justify-items: center;
}

.contact-sheet.hidden {
    pointer-events: none;
}

.contact-sheet_grid {
    --contact_gap: 1.5rem;
    grid-column: 2/12;
    display: grid;
    gap: var(--contact_gap);
    align-content: start;
    grid-template-columns: repeat(auto-fit, minmax(65px, 1fr));
}

@media (min-width: 600px) {
    .contact-sheet_grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    }
}

@media (min-width: 900px) {
    .contact-sheet_grid {
        grid-template-columns: repeat(auto-fit, minmax(115px, 1fr));
        /* takes the minimum between 6 columns are their smallest size (130px) or 100% width of the grid its within*/
        max-width: min(calc((115px + var(--contact_gap)) * 6), 100%);
    }
}

.contact-sheet img {
    max-width: 100%;
    cursor: pointer;
}

.description {
    grid-column: 2/12;
}

.image-wrapper {
    padding-top: 8dvh;
    display: grid;
    align-items: center;
    grid-template-columns: repeat(10, 1fr);
    gap: 1rem;
    width: 100%;
    height: 90dvh;
    grid-column: 2/12;
}

.main-image-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden; /* prevent breakout */
    display: flex;
    justify-content: center;
    align-items: center;
    grid-column: 2/10;
}

.main-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.img-preview {
    all: unset; /* remove default button styles */
    cursor: pointer;
    display: inline-block;
    opacity: 0.5; /* apply opacity directly */
    transition: opacity 0.25s ease-out;
    width: fit-content;
}

.img-preview:hover {
    opacity: 1;
}

.img-preview img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100px;
    object-fit: contain;
    display: block;
}

.img-preview:focus-visible {
    outline: 2px solid var(--highlight, dodgerblue); /* visible ring */
    outline-offset: 4px;
    opacity: 1; /* keep it bright when focused */
}

#prev-img {
    grid-column: 1/2;
}

#next-img {
    grid-column: 10/11;
    justify-self: end;
}

@media (max-width: 900px) {
    .image-wrapper {
        grid-template-rows: 4fr 1fr;
    }

    .main-image-wrapper {
        grid-column: 1/11;
    }

    .img-preview {
        grid-row: 2/3;
    }

    #prev-img {
        grid-column: 1/3;
    }

    #next-img {
        grid-column: 9/11;
    }
}
