/* ======================================== */
/* GLOBAL */
/* ======================================== */

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;

    font-family: "Nunito", sans-serif;

    background-color: rgb(227, 205, 176);
    color: darkgreen;
}

body {
    min-height: 100vh;

    margin: 0;
}

button,
input {
    font: inherit;
}


/* ======================================== */
/* HEADER */
/* ======================================== */

.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    min-height: 90px;

    padding: 1rem 2rem;

    border-bottom: 2px solid darkgreen;
}

.site-title {
    color: darkgreen;

    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;

    text-decoration: none;
}

.site-title:hover {
    background: orange;
}


/* NAV */

.site-nav {
    display: flex;

    gap: 0.75rem;
}

.site-nav a {
    padding: 0.65rem 1rem;

    background: darkgreen;
    color: white;

    border: 2px solid orange;
    border-radius: 0.75rem;

    box-shadow: 5px 5px orange;

    font-weight: 700;

    text-decoration: none;
}

.site-nav a:hover,
.site-nav a.active {
    color: orange;
}


/* ======================================== */
/* PAGE */
/* ======================================== */

.gallery-page {
    width: min(1400px, 94%);

    min-height: 75vh;

    margin: 2rem auto 4rem;
}


/* ======================================== */
/* GALLERY HEADER */
/* ======================================== */

.gallery-top {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 2rem;

    margin-bottom: 2rem;
}

.gallery-top h1 {
    margin: 0;

    font-size: clamp(2rem, 5vw, 3.5rem);
}

.gallery-top p {
    margin: 0.25rem 0 0;

    font-family: "Roboto Mono", monospace;

    opacity: 0.75;
}


/* ======================================== */
/* MAIN BUTTON */
/* ======================================== */

.main-button {
    flex-shrink: 0;

    padding: 0.75rem 1rem;

    background: darkgreen;
    color: white;

    border: 2px solid orange;
    border-radius: 0.75rem;

    box-shadow: 6px 6px orange;

    font-weight: 700;

    cursor: pointer;
}

.main-button:hover {
    transform: translate(2px, 2px);

    box-shadow: 4px 4px orange;
}


/* ======================================== */
/* SEARCH */
/* ======================================== */

.gallery-tools {
    display: flex;
    justify-content: space-between;
    align-items: center;

    gap: 1rem;

    margin-bottom: 1.5rem;
}

#gallerySearch {
    width: min(400px, 100%);

    padding: 0.7rem;

    background: white;
    color: darkgreen;

    border: 2px solid darkgreen;
    border-radius: 0.5rem;

    outline: none;

    font-family: "Roboto Mono", monospace;
}

#gallerySearch:focus {
    border-color: orange;
}

#galleryCount {
    font-family: "Roboto Mono", monospace;

    font-size: 0.85rem;
}


/* ======================================== */
/* STATUS */
/* ======================================== */

.gallery-status {
    min-height: 1.5rem;

    font-family: "Roboto Mono", monospace;

    font-size: 0.85rem;
}


/* ======================================== */
/* GALLERY GRID */
/* ======================================== */

.gallery-grid {
    display: grid;

    grid-template-columns:
        repeat(
            auto-fill,
            minmax(240px, 1fr)
        );

    gap: 1rem;
}


/* ======================================== */
/* GALLERY CARDS */
/* ======================================== */

.gallery-card {
    min-width: 0;

    background: white;

    border: 2px solid darkgreen;
    border-radius: 0.6rem;

    overflow: hidden;
}


/* NORMAL POST */

.gallery-post {
    display: flex;
    flex-direction: column;
}

.gallery-image {
    width: 100%;

    aspect-ratio: 1 / 1;

    overflow: hidden;

    background: #f4f4f4;
}

.gallery-image img {
    width: 100%;
    height: 100%;

    display: block;

    object-fit: cover;
}

.gallery-info {
    min-height: 70px;

    display: flex;
    flex-direction: column;

    gap: 0.15rem;

    padding: 0.65rem 0.75rem;

    font-family: "Roboto Mono", monospace;
}

.gallery-title {
    font-weight: 700;
}

.gallery-author {
    font-size: 0.8rem;

    opacity: 0.65;
}


/* ======================================== */
/* ADD YOURS CARD */
/* ======================================== */

.add-card {
    min-height: 320px;

    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    gap: 1rem;

    color: darkgreen;

    border-style: dashed;

    cursor: pointer;
}

.add-card:hover {
    background: #fff8df;

    border-color: orange;
}

.add-plus {
    font-family: "Roboto Mono", monospace;

    font-size: 4rem;

    font-weight: 400;
}


/* ======================================== */
/* UPLOAD MODAL */
/* ======================================== */

.upload-modal {
    position: fixed;

    inset: 0;

    z-index: 10000;

    display: none;
    justify-content: center;
    align-items: center;

    padding: 1rem;

    background: rgba(0, 0, 0, 0.55);
}

.upload-modal.open {
    display: flex;
}


/* WINDOW */

.upload-window {
    width: min(520px, 100%);

    max-height: 92vh;

    overflow-y: auto;

    padding: 1.5rem;

    background: rgb(227, 205, 176);

    border: 3px solid darkgreen;
    border-radius: 1rem;

    box-shadow: 10px 10px orange;
}


/* MODAL HEADER */

.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 1rem;
}

.upload-header h2 {
    margin: 0;

    font-size: 1.8rem;
}

.close-button {
    padding: 0;

    background: transparent;
    color: darkgreen;

    border: 0;

    font-size: 2rem;

    cursor: pointer;
}


/* ======================================== */
/* FORM */
/* ======================================== */

#uploadForm {
    display: flex;
    flex-direction: column;

    gap: 1rem;
}


/* IMAGE PICKER */

.image-picker {
    min-height: 280px;

    display: flex;
    justify-content: center;
    align-items: center;

    overflow: hidden;

    background: white;

    border: 3px dashed green;
    border-radius: 0.75rem;

    cursor: pointer;
}

.image-picker:hover {
    border-color: orange;
}

#imageUpload {
    display: none;
}

#uploadPlaceholder {
    display: flex;
    flex-direction: column;
    align-items: center;

    gap: 0.4rem;

    text-align: center;
}

.upload-plus {
    font-size: 3.5rem;
}

#uploadPlaceholder small {
    opacity: 0.6;
}

#uploadPreview {
    width: 100%;

    max-height: 400px;

    display: none;

    object-fit: contain;
}


/* FIELDS */

.form-field {
    display: flex;
    flex-direction: column;

    gap: 0.4rem;

    font-weight: 700;
}

.form-field input {
    width: 100%;

    padding: 0.7rem;

    background: white;
    color: darkgreen;

    border: 2px solid green;
    border-radius: 0.5rem;

    outline: none;
}

.form-field input:focus {
    border-color: orange;
}


/* ======================================== */
/* UPLOAD STATUS */
/* ======================================== */

.upload-status {
    min-height: 1.2rem;

    margin: 0;

    font-family: "Roboto Mono", monospace;

    font-size: 0.8rem;
}


/* ======================================== */
/* SUBMIT */
/* ======================================== */

.submit-button {
    padding: 0.8rem;

    background: darkgreen;
    color: white;

    border: 2px solid orange;
    border-radius: 0.5rem;

    font-weight: 700;

    cursor: pointer;
}

.submit-button:hover {
    color: orange;
}

.submit-button:disabled {
    opacity: 0.5;

    cursor: wait;
}


/* ======================================== */
/* FOOTER */
/* ======================================== */

footer {
    padding: 1rem 2rem;

    border-top: 2px solid darkgreen;

    font-weight: 700;
}


/* ======================================== */
/* TABLET */
/* ======================================== */

@media (max-width: 700px) {

    .site-header {
        flex-direction: column;
        align-items: flex-start;

        gap: 1.5rem;
    }

    .gallery-top {
        flex-direction: column;
        align-items: flex-start;
    }

    .gallery-tools {
        align-items: flex-start;
        flex-direction: column;
    }

}


/* ======================================== */
/* MOBILE */
/* ======================================== */

@media (max-width: 550px) {

    .site-header {
        padding: 1rem;
    }

    .site-nav {
        width: 100%;
    }

    .site-nav a {
        flex: 1;

        padding: 0.6rem 0.4rem;

        text-align: center;

        font-size: 0.85rem;
    }

    .gallery-page {
        width: 96%;

        margin-top: 1rem;
    }

    .gallery-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(0, 1fr)
            );

        gap: 0.6rem;
    }

    .add-card {
        min-height: 220px;
    }

    .gallery-info {
        min-height: 60px;

        font-size: 0.75rem;
    }

}


@media (max-width: 380px) {

    .gallery-grid {
        grid-template-columns: 1fr;
    }

}
