/* Removed @import rules. Ensure base.css, header.css, media-viewer.css, and dialog.css are linked in the HTML where needed. */

body {
    overflow-y: scroll;
}
the-library {
    width: 100%;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    justify-content: stretch;
}

the-library > .header {
    position: sticky;
    top: -1px;
    z-index: 1;
    flex: 0 0 auto;
    max-width: 60rem;
    width: calc(100% - 2rem);
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: stretch;
    margin: 0 auto;
    padding: 1rem;
    gap: .5rem;
    border: 1px solid rgba(var(--primary-rgb), .5);
    background: rgba(0, 0, 0, .75);
    border-radius: .25rem;
    backdrop-filter: blur(1rem);
    box-shadow: 0px .25rem 1rem 0 rgb(0 0 0 / 50%), inset 0 0 2rem 0 rgba(var(--primary-rgb), calc(var(--glow-intensity) / 3));
}
the-library > .header div {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
}

the-library > .header div.divider {
    flex: 0 0 1px;
    background-color: rgba(var(--primary-rgb), .25);
    align-self: stretch;
}

the-library > .header svg {
    flex: 0 0 auto;
    background: rgba(0, 0, 0, 0);
    cursor: pointer;
    padding: .5rem;
    width: 2.5rem;
    height: 2.5rem;
    fill: var(--primary-color);
    transition: opacity .2s;
    filter: drop-shadow(0 .25rem .25rem rgba(var(--primary-rgb), var(--glow-intensity)));
}
the-library > .header .view-mode,
the-library > .header .toggle-mode,
the-library > .header .select-any-mode,
the-library > .header .select-span-mode {
    padding: .25rem;
}
the-library > .header .media-deselect, 
the-library > .header .media-move, 
the-library > .header .media-delete,
the-library > .header .media-download {
    pointer-events: none;
    opacity: .5;
    transition: opacity .2s;
}

the-library > .header svg.allowed {
    opacity: 1;
    pointer-events: all;
}

the-library > .header .select-span-mode {
    margin-right: auto;
}
the-library > .header .media-zoom {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-start;
    gap: .25rem;
    margin-right: auto;
}

the-library > .header .media-zoom svg {
    flex: 0 0 1.75rem;
    background: rgba(0, 0, 0, 0);
    width: 1.75rem;
    height: 1.75rem;
    cursor: pointer;
}

the-library > .header .media-zoom svg path {
    fill: var(--primary-color);
    filter: drop-shadow(0 .25rem .25rem rgba(var(--primary-rgb), var(--glow-intensity)));
}

the-library > .header .search-tools input {
    flex: 1 1 14rem;
    width: 100%;
    color: var(--input-color);
    background: #000000;
    border: 1px solid var(--primary-color);
    border-radius: .25rem;
    padding: .25rem;
    font-size: 1rem;
    outline: none;
    resize: none;
}
the-library > .header .search-tools input::placeholder {
    color: var(--primary-color);
    font-style: italic;
    opacity: .75;
}

the-library > .header .search-tools button {
    flex: 0 0 auto;
    border: 1px solid var(--primary-color);
    background: #000000;
    color: var(--primary-color);
    font-weight: 800;
    border-radius: .25rem;
    width: 1.75rem;
    height: 1.75rem;
    font-size: 1rem;
    cursor: pointer;
    padding: 0;
}

the-library > .header .search-tools button * {
    pointer-events: none;
}

the-library > .header .search-tools button svg {
    width: 100%;
    height: 100%;
    padding: 0;
    fill: var(--primary-color);
}

the-library > .content {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: repeat(var(--library-num-columns), 1fr);
    grid-auto-rows: min-content;
    gap: .5rem;
    padding: 1rem;
    overflow-x: hidden;
    overflow-y: auto;
    will-change: scroll-position;
}

the-library > .content.hidden {
    display: none;
}

the-library > .content div.loading {
    flex: 0 0 100%;
}

the-library > .content .media-item {
    width: 100%;
    height: 100%;
    cursor: pointer;
    margin: auto;
    overflow: hidden;
    background: rgba(0, 0, 0, 1);
    box-shadow: 0 .5rem 1.5rem rgba(236, 72, 153, calc(1 / 5));
    position: relative;
    aspect-ratio: 1;
}

the-library > .content .media-item * {
    user-select: none;
}

the-library > .content .media-item img.blur {
    position: absolute;
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: none;
    outline: none;
    pointer-events: none;
}

the-library > .content .media-item img:not(.blur) {
    /* position: absolute; */
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: none;
    outline: none;
    pointer-events: none;
    transition: opacity .5s;
    opacity: 1;
}

the-library > .content .media-item.loading {
    border: 1px solid rgba(var(--primary-rgb), .25);
}

the-library > .content .media-item.loading img {
    opacity: 0;
}

the-library > .content .media-item.selected {
    box-shadow: 
    0 0 1px 1px var(--primary-color), 
    0 0 1px 1px var(--primary-color), 
    0 0 1px 1px var(--primary-color), 
    0 0 1px 1px var(--primary-color), 
    0 0 1px 1px var(--primary-color), 
    0 .5rem 1.5rem rgba(var(--primary-rgb), calc(var(--glow-intensity) / 5));
}

the-library > .content .media-item .selected-icon {
    position: absolute;
    width: 33%;
    height: 33%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    display: none;
}
the-library > .content .media-item .selected-icon path {
    fill: var(--primary-color);
}
the-library > .content .media-item.selected .selected-icon {
    display: block;
    mix-blend-mode: plus-lighter;
    filter: drop-shadow(0 0 .25rem var(--primary-color));
}

the-library.is-view-mode .view-mode {
    fill: var(--input-color);
}
the-library.is-view-mode .view-tools {
    display: flex;
}
the-library.is-view-mode .search-tools {
    display: none;
}
the-library.is-view-mode .select-tools {
    display: none;
}

the-library.is-search-mode .search-mode {
    fill: var(--input-color);
}
the-library.is-search-mode .view-tools {
    display: none;
}
the-library.is-search-mode .search-tools {
    display: flex;
}
the-library.is-search-mode .select-tools {
    display: none;
}

the-library.is-select-any-mode .select-any-mode {
    fill: var(--input-color);
}
the-library.is-select-span-mode .select-span-mode {
    fill: var(--input-color);
}
the-library.is-select-any-mode .view-tools,
the-library.is-select-span-mode .view-tools {
    display: none;
}
the-library.is-select-any-mode .search-tools,
the-library.is-select-span-mode .search-tools {
    display: none;
}
the-library.is-select-any-mode .select-tools,
the-library.is-select-span-mode .select-tools {
    display: flex;
}

/*********** MEDIA QUERIES START HERE ***********/
@media only screen and (max-width: 720px) {

    body {
        gap: .5rem;
    }

    the-library > .header {
        padding: .25rem;
        gap: .25rem;
        width: calc(100% - 1rem);
    }

    the-library > .header div {
        gap: .25rem;
    }

    the-library > .content {
        padding: .5rem;
        gap: .25rem;
    }

}
/*********** MEDIA QUERIES END HERE ***********/
