/* reset */
* {
    box-sizing: border-box;
}

/* defaults */
body {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin: 0;
    min-height: 100vh;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Oxygen,
        Ubuntu,
        Cantarell,
        "Open Sans",
        "Helvetica Neue",
        sans-serif;

    & > h1 {
        margin: 2rem;
    }
}
.header-shadow {
    position: fixed;
    top: 0px;
    box-shadow: 0px -900px 500px 1000px rgba(0, 0, 0, 0.1);
    z-index: -1;
}
header {
    position: sticky;
    top: 0px;
    z-index: 1001;

    & nav {
        padding: 0.7rem;
        background-color: #fff;
        flex-wrap: wrap;

        & div {
            display: flex;
            align-content: center;

            .logo {
                display: flex;
                align-items: center;
                & img {
                    height: 2.5rem;
                }
            }
        }
    }
}
footer {
    display: flex;
    justify-content: space-evenly;
    flex-wrap: wrap;
    margin-top: 5rem;
    padding: 1rem;
    /*box-shadow: 0px 1000rem 1rem 1001rem rgba(0, 0, 0, 0.1);
    background: rgba(0, 0, 0, 0.1);*/
    box-shadow: inset 0px 1000px 15px -1000px rgba(0, 0, 0, 0.15);

    & a {
        color: #555;
        text-decoration: none;
        &:hover {
            color: #000;
            text-decoration: underline;
        }
    }
}
main,
section,
aside {
    max-width: min(50rem, 100% - 2rem);
    margin: 1rem auto;
    padding: 0.5rem;
    background-color: #fff;
    border-radius: 0.5rem;
    box-shadow: 2px 2px 5px 0px rgba(0, 0, 0, 0.1);
}
main,
section {
    width: 100%;
}
main {
    flex-grow: 1;
}
body > .side-by-side {
    margin: 1rem;
}

:is(h1, h2, h3, h4, h5, h6):nth-child(1) {
    margin-top: 0px;
}

form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
input:not([type="radio"]):not([type="checkbox"]),
textarea {
    width: 100%;
    font-size: inherit;
}
input:not([type="search"]) {
    max-width: 15rem;
}
input[type="file"]::file-selector-button {
    margin-right: 0.5rem;
}
button,
a.button,
::file-selector-button {
    display: inline-block;
    padding: 0.3rem 0.7rem;
    background-color: #3af;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 0.4rem;
    appearance: none;
    cursor: pointer;
    color: #fff;
    text-decoration: none;
    text-align: center;
    font-size: inherit;
    font-weight: 500;
    box-shadow: 1px 1px 5px 0px rgba(0, 0, 0, 0.3);
    &:disabled {
        filter: saturate(0);
        cursor: not-allowed;
    }
}
textarea {
    min-height: 7em;
    resize: vertical;
}

img,
iframe {
    width: 100%;
}
iframe {
    border: none;
    border-radius: 0.5rem;
}

dl {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
    & dt {
        text-align: end;
    }
    & dd {
        margin: 0px;
    }
}

table {
    width: 100%;
    margin-bottom: 1rem;
    border-collapse: collapse;
    & :is(th, td) {
        padding: 0.2rem 0.5rem;
        border: 1px solid #eee;
    }
    & th {
        background-color: #f5f5f5;
        text-align: start;
    }
}

@media (width > 50rem) {
    aside {
        float: left;
    }
}

.card {
    padding: 0.5rem;
    border: 1px solid #eee;
    border-radius: 0.5rem;

    &.item {
        display: grid;
        grid-template-columns: 10rem 1fr;
        grid-template-rows: auto auto 1fr;
        grid-template-areas:
            "img title"
            "img tags"
            "img description";
        gap: 0.5rem;

        max-height: 11.5rem;

        & img {
            grid-area: img;
            grid-row: 1 / 4;
            height: 100%;
            object-fit: cover;
            border-radius: 0.5rem;
        }
        & .title {
            grid-area: title;
        }
        & .tags {
            grid-area: tags;
            display: flex;
            align-items: center;
        }
        & .description {
            grid-area: description;
            margin: 0px;
            contain: size;
            overflow: scroll;
        }
    }
}

.image-list {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas:
        "aside  "
        "preview";
    gap: 0.5rem;
    & > aside {
        grid-area: aside;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        min-width: 10rem;
        max-width: 15rem;
        max-height: 80vh;
        justify-content: space-between;
        padding: 0.5rem;
        border: 1px solid #eee;
        border-radius: 0.5rem;
        & .selector {
            grid-area: selector;
            overflow-y: auto;
            padding: 2px;
            & > label {
                display: contents;
                cursor: pointer;
                & input[type="radio"] {
                    display: none;
                }
                &:has(:checked) img {
                    outline: 2px solid orange;
                    border-radius: 3px;
                }
            }
        }
    }
    & .preview {
        flex-grow: 1;
        flex-shrink: 1;
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        height: 80vh;
        & .preview-option {
            display: flex;
            flex-direction: column;
            height: 100%;
            margin: auto;
            & img {
                min-height: 0px;
                width: 100%;
                height: 100%;
                flex-shrink: 1;
                object-fit: contain;
            }
        }
    }
}
@media (width < 50rem) {
    .image-list {
        display: grid;
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto;
        grid-template-areas: "preview" "aside";
        & aside {
            width: 100%;
            max-width: unset;
            & .selector {
                display: flex;
                flex-direction: row;
                gap: 1rem;
                justify-content: center;
                & input:not(#specificity) {
                    display: block;
                }
                & img {
                    display: none;
                }
            }
        }
        & .preview {
            & .preview-option {
                width: 100%;
            }
        }
    }
}

/* components*/

.badge {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
    background-color: #f5f5f5;
    border: 1px solid #eee;
    border-radius: 1rem;
    color: #000;
    text-decoration: none;
    & .icon {
        line-height: 0;
    }
    & > :first-child:not(.icon) {
        margin-left: 0.5rem;
    }
    & > :last-child:not(.icon) {
        margin-right: 0.5rem;
    }
    &:hover {
        background-color: #eee;
    }
}

div.map {
    height: 80vh;
    border-radius: 0.5rem;
}

/* utils */
.w-max {
    width: max-content;
}
.h-full {
    height: 100%;
}
.m-auto {
    margin: auto;
}
.contents {
    display: contents;
}
.flex-row,
.flex-column {
    display: flex;
    gap: 0.5rem;
    &.flex-row {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    &.flex-column {
        flex-direction: column;
    }
}
.flex-wrap {
    flex-wrap: wrap;
}
@media (width>50rem) {
    .side-by-side {
        display: flex;
        flex-direction: row;
        gap: 0.5rem;
        justify-content: space-between;
        & > section {
            flex-grow: 1;
        }
        & > div {
            width: 100%;
        }
    }
}
.justify-content-start {
    justify-content: start;
}
.justify-content-center {
    justify-content: center;
}
.justify-items-center {
    justify-items: center;
}
.align-items-center {
    align-items: center;
}
.flex-grow {
    flex-grow: 1;
}
.actions {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    justify-content: right;
}
