/* Slideshow + contact sheet layout for large projects (>=500MB) */

body.slideshow-page {
    background-color: #000;
    color: #fff;
    font-family: monospace, sans-serif;
    overflow: hidden;
    height: 100vh;
    height: 100dvh; /* Accounts for mobile browser toolbars so nothing gets clipped */
    display: flex;
    flex-direction: column;
    line-height: 1.3;
}

#slideshowHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 14px 20px;
    flex-wrap: wrap;
    z-index: 20;
    flex-shrink: 0;
}

#viewToggle {
    display: flex;
    gap: 8px;
}

.view-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    padding: 6px 14px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.view-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.view-btn.active {
    background: rgba(255, 255, 255, 0.25);
    font-weight: 900;
}

#slideshowInfo {
    text-align: center;
    flex: 1;
    min-width: 200px;
}

#infoLine {
    display: flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
}

#projectTitle {
    font-size: 16px;
    font-weight: 900;
}

#orderNote {
    opacity: 0.7;
}

.info-sep {
    opacity: 0.4;
}

#projectDescription {
    font-size: 12px;
    opacity: 0.7;
    display: block;
    margin: 2px 0 0;
}

#headerLinks {
    display: flex;
    gap: 14px;
    font-size: 12px;
}

#headerLinks a {
    color: #fff;
    text-decoration: none;
    font-weight: 900;
}

#headerLinks a:hover {
    text-decoration: line-through;
}

.view-panel {
    display: none;
    flex: 1;
    min-height: 0;
    position: relative;
}

.view-panel.active {
    display: flex;
}

/* Contact sheet / grid view */
#gridView {
    overflow-y: auto;
    padding: 4px;
}

#contactSheet {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 4px;
    width: 100%;
    align-content: start;
}

.contact-thumb {
    position: relative;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    cursor: pointer;
    background: #111;
}

.contact-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.contact-thumb:hover {
    outline: 2px solid rgba(255, 255, 255, 0.6);
    outline-offset: -2px;
}

.contact-thumb.active {
    outline: 2px solid #fff;
    outline-offset: -2px;
}

.contact-index {
    position: absolute;
    bottom: 4px;
    right: 6px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.8);
    background: rgba(0, 0, 0, 0.5);
    padding: 1px 4px;
}

/* Slideshow view */
#slideView {
    align-items: center;
    justify-content: center;
}

#slideStage {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 0;
    box-sizing: border-box;
}

#slideImage {
    width: 92vw;
    height: 100%;
    max-width: 92vw;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 44px;
    height: 44px;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.nav-btn:disabled {
    opacity: 0.25;
    cursor: default;
}

#prevBtn {
    left: 16px;
}

#nextBtn {
    right: 16px;
}

#slideCounter {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 12px;
    opacity: 0.6;
}

#loadingIndicator {
    position: absolute;
    bottom: 16px;
    left: 16px;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: rgba(255, 255, 255, 0.8);
    border-radius: 50%;
    z-index: 15;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
}

#loadingIndicator.visible {
    opacity: 1;
    animation: loading-spin 0.7s linear infinite;
}

@keyframes loading-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 767px) {

    /* Contact sheet is desktop-only; mobile always gets the plain slideshow */
    #viewToggle,
    #gridView {
        display: none !important;
    }

    #slideshowHeader {
        padding: 10px 14px;
    }

    #slideshowInfo {
        text-align: left;
    }

    #infoLine {
        flex-direction: column;
        align-items: flex-start;
        justify-content: flex-start;
        font-size: 11px;
        gap: 2px;
    }

    .info-sep {
        display: none;
    }

    #projectTitle {
        font-size: 14px;
    }

    /* Move prev/next off the middle of the image and down to a bottom bar */
    .nav-btn {
        top: auto;
        bottom: calc(14px + env(safe-area-inset-bottom));
        transform: none;
        width: 52px;
        height: 52px;
        font-size: 20px;
    }

    #prevBtn {
        left: 16px;
    }

    #nextBtn {
        right: 16px;
    }

    #slideCounter {
        bottom: calc(30px + env(safe-area-inset-bottom));
    }

    #loadingIndicator {
        bottom: auto;
        top: 10px;
        left: 14px;
    }

    #slideImage {
        width: 100vw;
        height: 100%;
        max-width: 100vw;
        max-height: 100%;
    }
}
