html {
    color: white;
    background: black;
    font-size: 14px;
    font-weight: lighter;
    font-family: 'Roboto', sans-serif;
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}

body {
    margin-bottom: 60px;
    margin-left: 10px;
    margin-right: 10px;
}

#mediaTypeSelector {
    margin-bottom: 5px;
    color: gray;
}

#mediaFormatSelector {
    display: flex;
    margin-bottom: 5px;
}

.mediaFormat, .mediaType {
    font-size: xx-large;
    color: gray;
    cursor: pointer;
    border: 0;
    padding: 0;
    background: transparent;
    font: inherit;
    font-size: 32px;
}

.mediaType {
    font-size: 50px;
}

.hidden {
    display: none;
}

.selected, .mediaFormat:hover, .mediaType:hover {
    color: white;
}

#search {
    width: 100%;
    color: white;
    margin-bottom: 10px;
    background-color: black;
    border-width: 0px 0px 1px 0px;
    font-size: xx-large;
    font-weight: lighter;
    font-family: 'Roboto', sans-serif;
}

#search:focus {
    outline: none;
}

#mediaEntries {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.musicEntry {
    margin-right: 5px;
    margin-bottom: 15px;
    width: 252px;
    cursor: pointer;
}

.filmEntry {
    margin-right: 5px;
    margin-bottom: 15px;
    width: 252px;
}

.bookEntry {
    margin-right: 5px;
    margin-bottom: 15px;
    width: 252px;
}

.musicEntry .coverArt {
    height: 251px;

    display: flex;
    flex-direction: column;
    justify-content: end;
    border: 1px solid transparent;
    margin-bottom: 5px;
}

.filmEntry .coverArt {
    height: 375px;
    
    display: flex;
    flex-direction: column;
    justify-content: end;
    border: 1px solid transparent;
    margin-bottom: 5px;
}

.bookEntry .coverArt {
    height: 383px;

    display: flex;
    flex-direction: column;
    justify-content: end;
    border: 1px solid transparent;
    margin-bottom: 5px;
}

.coverArt img:hover {
    border: 1px solid white;
}

.musicEntry:focus-visible {
    outline: 1px solid white;
    outline-offset: 3px;
}

.coverArt img {
    width: 250px;
    opacity: 1;
    max-height: 380px;
    border: 1px solid black;
    object-fit: scale-down;
    transition: border-color 0.2s, opacity 0.5s;
}

.coverArt .loading {
    opacity: 0;
}

.coverArt .failed {
    border-color: gray;
}

.albumInfo, .filmInfo, .bookInfo {
    width: 90%;
}

    .albumInfo *, .filmInfo *, .bookInfo * {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

.musicAlbum, .filmTitle, .bookTitle {
    font-weight: normal;
}

#resultCount {
    width: 100%;
    color: white;
    margin-top: 10px;
    margin-bottom: 10px;
    text-align: end;
    background-color: black;
    border-width: 0px 0px 1px 0px;
    font-size: xx-large;
    font-weight: lighter;
    font-family: 'Roboto', sans-serif;
}

#status {
    min-height: 1.2em;
}

.albumDetailsOverlay {
    position: fixed;
    z-index: 1;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.82);
}

.albumDetailsOverlay.hidden {
    display: none;
}

.albumDetailsPanel {
    position: relative;
    width: min(620px, 100%);
    max-height: 90vh;
    overflow-y: auto;
    border: 1px solid gray;
    padding: 25px;
    background: black;
}

.closeAlbumDetails {
    position: absolute;
    top: 8px;
    right: 12px;
    color: gray;
    cursor: pointer;
    border: 0;
    background: transparent;
    font: inherit;
    font-size: 32px;
    line-height: 1;
}

.closeAlbumDetails:hover, .closeAlbumDetails:focus {
    color: white;
}

.albumDetailsHeader {
    display: flex;
    gap: 20px;
    align-items: end;
    padding-right: 32px;
}

.albumDetailsHeader .coverArt img {
    width: 160px;
    max-height: 160px;
}

.albumDetailsHeader .coverArt img:hover {
    border-color: black;
}

.albumDetailsInfo {
    min-width: 0;
}

.albumDetailsArtist {
    color: gray;
    font-size: x-large;
}

.albumDetailsTitle {
    font-size: xx-large;
    font-weight: normal;
}

.albumDetailsMeta, .albumDetailsStatus {
    color: gray;
    margin-top: 5px;
}

.musicBrainzLink, .wikipediaLink {
    display: inline-block;
    color: gray;
    margin-top: 15px;
    font-size: x-large;
    line-height: 1;
    text-decoration: none;
    vertical-align: middle;
}

.musicBrainzLink:hover, .musicBrainzLink:focus,
.wikipediaLink:hover, .wikipediaLink:focus {
    color: white;
}

.musicBrainzIcon {
    display: block;
    height: 22px;
    width: 20px;
}

.wikipediaLink {
    margin-left: 15px;
}

.wikipediaIcon {
    display: block;
    height: 22px;
    filter: invert(1);
    opacity: 0.6;
    width: 22px;
}

.wikipediaLink:hover .wikipediaIcon, .wikipediaLink:focus .wikipediaIcon {
    opacity: 1;
}

.trackList {
    margin: 30px 0 0;
    padding-left: 0;
    list-style: none;
}

.trackList li {
    display: grid;
    grid-template-columns: 2em minmax(0, 1fr) auto;
    gap: 20px;
    padding: 5px 0;
    border-bottom: 1px solid #222;
}

.discTitle {
    color: white;
    display: block;
    font-size: large;
    font-weight: bold;
    margin: 25px 0 5px;
}

.discTitle:first-child {
    margin-top: 0;
}

.trackNumber, .trackLength {
    color: gray;
}

.trackLength {
    text-align: end;
}

.visuallyHidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 767px) {
    #mediaEntries {
        justify-content: space-between;
    }

    .musicEntry, .filmEntry, .bookEntry {
        width: calc((100% - 10px) / 3);
        margin-right: 0;
        margin-bottom: 12px;
    }

    .musicEntry .coverArt, .filmEntry .coverArt, .bookEntry .coverArt {
        height: auto;
    }

    .musicEntry .coverArt {
        aspect-ratio: 1;
    }

    .filmEntry .coverArt {
        aspect-ratio: 2 / 3;
    }

    .bookEntry .coverArt {
        aspect-ratio: 250 / 383;
    }

    .coverArt img {
        width: 100%;
        height: 100%;
        max-height: none;
    }

    .albumDetailsPanel {
        padding: 20px;
    }

    .albumDetailsHeader {
        align-items: start;
    }

    .albumDetailsHeader .coverArt img {
        width: 110px;
        max-height: 110px;
    }
}
