img {
    max-width: 100%;
}

h1 {
    font-size: 3.158rem;
    margin: 0.125rem 0;
}

/* --- */

body {
    padding-bottom: 5%;
}

header {
    padding: 1em;
    border-radius: 0 0 2rem 2rem;
    text-align: center;
    background: var(--secondary);
}

nav {
    width: 100%;
    text-align: center;
}

.tag-section {
    display: flex;
    flex-direction: column;
    gap: 1em;
    justify-content: center;
}

.tags {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5em;
    padding: 0.5em 0.125em;
    border: 1px solid var(--primary);
    border-radius: 0.5rem;
    background: var(--background);
}

.tags:not(:has(> *)) {
    visibility: hidden;
}

.tags .tag {
    width: fit-content;
    padding: 0.125em;
    border: 1px solid var(--accent);
    border-radius: 0.25rem;
    box-shadow: 0 0 4px 1px var(--accent);
    background: var(--secondary);
    font-size: 0.75rem;
    transition: all 100ms ease-out;
}

.tags .tag:is(:hover, :focus) {
    translate: 0 -1px;
}

.search-field {
    position: relative;
}

.search-field:has(.search-results:not(:empty)) input {
    border-radius: 0.5em 0.5em 0 0;
}

.search-results {
    position: absolute;
    bottom: 0;
    left: 0;
    translate: 0 calc(100% - 2px);
    z-index: 1;
    width: 100%;
    border: 1px solid var(--accent);
    border-radius: 0 0 0.5em 0.5em;
}

.search-results:empty {
    display: none;
}

.search-results .tag {
    display: block;
    width: 100%;
    border-radius: 0;
    cursor: pointer;
    box-shadow: none;
}

.search-results .tag:last-of-type {
    border-radius: 0 0 0.5em 0.5em;
}

.search-results .tag:is(:hover, :focus) {
    box-shadow: 0 2px var(--accent);
}

.tag.delete:focus,
.tag.delete:hover {
    color: red;
}

.tag.add:focus,
.tag.add:hover {
    color: green;
}

main {
    display: grid;
    place-items: center;
    margin: 1rem;
    padding-bottom: 25%;
}

main img {
    max-height: 100vh;
    border: 2px solid var(--accent);
    border-radius: 1rem;
    box-shadow: 0 0 4px 1px var(--accent);
    cursor: zoom-in;
}

footer {
    position: fixed;
    left: 0;
    bottom: 0;
    width: 100%;
    padding: 1em;
    display: flex;
    justify-content: space-evenly;
    align-items: baseline;
    gap: 1rem;
    border-radius: 2rem 2rem 0 0;
    text-align: center;
    background: var(--secondary);
}

footer a.buttonlike {
    min-width: 3rem;
    padding: 0.125em;
    aspect-ratio: 1;
}

@media (min-width: 750px) {
    .tag-section {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }

    .tag-section:has(.tags:empty) {
        flex-direction: row-reverse;
    }

    .tags {
        max-width: 33%;
    }

    main {
        padding-bottom: 5%;
    }

    footer {
        padding-inline: 25%;
    }

    footer > * {
        flex: 33%;
    }

    footer a.buttonlike {
        width: 100%;
        padding: 1em;
        aspect-ratio: 0;
    }
}
