* {
    box-sizing: border-box;
    margin: 0;
}

html {
    font-family: system-ui;
}

img {
    display: block;
    max-width: 100%;
}

nav {
    display: flex;
    flex-direction: row;
    padding-block: 8px;
    padding-inline: 16px;
    gap: 16px;
}

ul {
    list-style-type: none;
    padding: 0;
}

h1 {
    padding-block-end: 0.5em;
}

#home-page {
    padding: 16px;
}

#search-results {
    padding-block: 8px;
}

#cards-page {
    padding: 16px;

    div:has(> h1) {
        display: flex;
        flex-direction: row;
        gap: 16px;
        align-items: baseline;
    }
}

#cover-image img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.movie-card {
    --text-color-base: #121212;
    --text-color-label: #808080;

    border: 0.125em solid black;
    width: min(31.25em, 100%);
    padding: 1em;
    font-family: "Oswald", system-ui;
    font-weight: 400;
    font-optical-sizing: auto;
    font-style: normal;
    color: var(--text-color-base);

    .title {
        display: flex;
        flex-direction: row;
        align-items: baseline;
        gap: 0.5em;
        font-size: 1.2em;

        .name {
            font-size: 1.5em;
            font-weight: 600;
            white-space: nowrap;
            /* overflow: hidden; */
            /* text-overflow: ellipsis; */
        }

        .year {
            flex-grow: 1;
        }

        .age-rating {
            color: var(--text-color-label);
        }
    }

    .label {
        color: var(--text-color-label);
        white-space: nowrap;
    }

    .caps {
        text-transform: uppercase;
    }

    .row {
        display: flex;
        flex-direction: row;
        gap: 0.5em;
        padding-block-end: 0.125em;
    }

    /* List of properties */
    .row :nth-child(2) {
        display: flex;
        flex-direction: row;
        column-gap: 1em;
        flex-wrap: wrap
    }
}

a:has(.movie-card) {
    text-decoration: none;
    color: unset;
}

.thumbnail-picker {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

img.thumbnail {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    cursor: pointer;

    &:hover {
        opacity: 60%;
    }
}

.saved-movie-thumbnails {
    display: grid;
    grid-template-columns: repeat(auto-fit, 100px);
    gap: 8px;
}

.movie-page {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
    justify-items: center;
    padding: 1rem;
    gap: 1rem;

    @media (max-width: 800px) {
        grid-template-columns: 1fr;
    }
}

.movie-controls {
    grid-column: 1 / 3;

    display: flex;
    flex-direction: row;
    gap: 16px;
}

.movie-card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-auto-rows: 12cm;
    gap: 8px;
    justify-items: center;
    font-size: 8pt;
    padding-block: 16px;

    .movie-card {
        height: 100%;
    }
}

.error {
    padding: 8px 16px;
    background-color: #ffaaaa;
    border: 2px solid #ff2222;
    border-radius: 2px;
    max-width: fit-content;
}

@media print {
    h1, h2, nav, button {
        display: none;
    }

    /* Make print colors match screen colors more closely */
    .movie-card {
        --text-color-base: #121212;
        --text-color-label: #cccccc;
    }

    #cards-page, .movie-card-grid {
        padding: 0;
    }
}
