html {
    overflow-y: auto;
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;

    @media (max-width: 1023px) {
        padding-top: 3.25rem;
    }
}

app-view {
    display: flex;
    flex-flow: column nowrap;
    align-items: stretch;
    justify-content: flex-start;
    min-height: 100vh;
}

nav {
    flex: 0 0 auto;

    .navbar-item {
        &.is-navigation {
            color: hsl(from var(--bulma-navbar-item-color) h s l / 0.8);
            font-size: 14px;
            text-transform: uppercase;

            &.is-active {
                --active-color: hsl(from var(--bulma-link-text) h s l / 0.9);

                border-bottom: 1px solid var(--active-color);
                border-radius: 0;
                color: var(--active-color);
                background: none;
            }
        }
    }

    @media (max-width: 1023px) {
        position: fixed;
        top: 0;
        width: 100%;
    }
}    

content-view {
    flex: 1 0 auto;
}

footer {
    flex: 0 0 auto;
}

/* Not particularly a fan of Bulma's default button + icon styling so this gives an alternate look. */
.button.has-icon {
    display: flex;
    flex-flow: row nowrap;
    align-items: center;

    [class^='svg-inline--fa'] {
        margin: 0 8px 0 0;
        width: 1rem;
        height: 1rem;
    }
}

.is-loading {
    position: relative;

    .loading-indicator {
        opacity: 1;
        z-index: 5;
    }
}

.loading-indicator {
    flex: 1 0 auto;
    display: flex;
    flex-flow: column nowrap;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100%;
    background: #fff;
    opacity: 0;
    z-index: -1;
    transition: opacity 300ms;

    &.is-page {
        .loader {
            width: 120px;
            height: 120px;
        }
    }
    
    .loader {
        width: 80px;
        height: 80px;
    }
}

.image-container {
    text-align: center;

    .image-view {
        display: inline-flex;
        flex-flow: column nowrap;
        align-items: stretch;
    
        h4 {
            flex: 0 0 auto;
        }
    
        .image-details {
            flex: 1 1 auto;
            display: flex;
            flex-flow: row nowrap;
            align-items: flex-start;
    
            .image-tags {
                display: flex;
                flex-flow: row nowrap;
                align-items: flex-start;
    
                .tags {
                    display: inline-flex;
                    flex-flow: row wrap;
                    margin-left: 0.5rem;
                }
            }
        }
    }    
}

#home-carousel {
    .column {
        position: relative;

        &.is-paused {
            .nav-button {
                display: flex;
            }
        }
    
        .nav-button {
            position: absolute;
            top: 12px;
            bottom: 12px;
            display: none;
            flex-flow: column nowrap;
            align-items: center;
            justify-content: center;
            width: 50px;
            background: #000;
            color: #fff;
            opacity: 0.25;
            transition: opacity 250ms ease-in-out;
            z-index: 5;
    
            &:hover {
                cursor: pointer;
                opacity: 0.75;
            }
    
            .svg-inline--fa {
                width: 24px;
                height: 24px;
            }
    
            &.backwards {
                left: -50px;
            }
    
            &.forwards {
                right: -50px;
            }
        }

        .carousel-container {
            position: relative;
            width: 100%;
            height: 45vh;
            overflow: hidden;
            transform-style: preserve-3d;
        
            .image-container {
                position: absolute;
                width: 100%;
                height: 100%;
                background: #fff;
                backface-visibility: hidden;
        
                &:hover {
                    cursor: pointer;
                }
        
                .image-view {
                    .image-details {
                        img, video {
                            max-width: 83.3333%;
                            max-height: 40vh;
                        }
                    }
                }
            }
        
            @media (min-height: 1081px) {
                height: 55vh;
        
                .image-container {
                    .image-view {
                        .image-details {
                            img, video {
                                max-height: 50vh;
                            }
                        }
                    }
                }
            }
        }
    }
}

#my-images {
    padding-top: 1rem;

    .is-floater {
        position: absolute;
        left: 0;
        right: 0;
        z-index: 10;
        text-align: center;
        transition: top 100ms ease-in-out, opacity 200ms ease-in-out;

        &.is-visible {
            opacity: 1;
        }

        &.is-hiding {
            opacity: 0;
        }

        .notification {
            display: inline-block;
            margin: 0 auto;
            padding: 0.75rem 2rem;
        }
    }

    #search {
        .input {
            height: 2rem;

            &:placeholder-shown + #clear-filter {
                display: none;
            }

            &:placeholder-shown ~ #apply-filter {
                display: none;
            }
        }

        #clear-filter,
        #apply-filter {
            height: 2rem;
            cursor: pointer;
            pointer-events: auto;

            [class^='svg-inline--fa'] {
                width: 1rem;
                height: 1rem;
            }
        }
    }

    .image-card {
        display: flex;
        flex-flow: column nowrap;
        justify-content: center;
        align-items: stretch;
        width: 100%;
        height: 400px;

        &:hover {
            transition: all 1s;
            box-shadow: 0 .5em 1em -.125em rgb(10 10 10 / 10%), 0 0 0 1px rgb(10 10 10 / 2%);
            cursor: pointer;
        }

        .image {
            --height: 212px;

            flex: 0 0 var(--height);
            width: 100%;
            height: var(--height);
            background-position: center;
            background-size: cover;
        }

        .image-details {
            flex: 1 0 auto;
            display: flex;
            flex-flow: column nowrap;
            justify-content: center;
            align-items: stretch;

            .title {
                flex: 1 1 27px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }

            p {
                flex: 0 1 60px;
                display: -webkit-box;
                -webkit-line-clamp: 2;
                -webkit-box-orient: vertical;
                line-clamp: 2;
                overflow: hidden;
            }

            .tags {
                flex: 1 1 24px;
            }
        }
    }
}

#image-modal {
    .modal-card {
        width: 60rem;

        #image-area {
            --image-area-background: hsl(from var(--bulma-body-background-color) h s calc(l - 10));
            --image-area-active-background: hsl(from var(--bulma-body-background-color) h s calc(l - 60));

            &.is-dragging-image {
                border: none;

                #image-preview {
                    background-color: var(--image-area-active-background);
                    color: var(--image-area-background);
                }
            }

            #image-preview {
                border-bottom: none;
                border-radius: 0.5rem 0.5rem 0 0;
                background-color: var(--image-area-background);
                height: 600px;
                transition: background-color 200ms ease-in-out, color 200ms ease-in-out;

                &:focus {
                    background-color: var(--image-area-active-background);
                    color: var(--image-area-background);
                }

                img, video {
                    height: 100%;
                    object-fit: contain;
                }
            }
    
            #image-upload {
                .button {
                    width: 100%;
                    border-radius: 0 0 0.5rem 0.5rem;
                }
    
                input[type='file'] {
                    display: none;
                    width: 1px;
                    height: 1px;
                }
            }    
        }
    }
}

#delete-modal {
    .modal-card {
        width: 50rem;

        .modal-card-body {
            overflow: hidden;

            .image-container {
                margin: 1rem 0;
                
                img, video {
                    max-width: 600px;
                    max-height: 480px;
                }
            }
        }
    }
}
