/* ---- setup ---- */

@font-face {
    font-family: 'Agency FB Bold';
    font-style: normal;
    font-weight: normal;
    src: local('Agency FB Bold'), url('/fonts/AGENCYB.woff') format('woff');
}

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: normal;
    src: url('/fonts/montserrat-v30-latin-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Montserrat';
    font-style: oblique;
    font-weight: normal;
    src: url('/fonts/montserrat-v30-latin-italic.woff2') format('woff2');
}

@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: bold;
    src: url('/fonts/montserrat-v30-latin-700.woff2') format('woff2');
}

* {
    box-sizing: border-box;
    word-wrap: break-word;
}

html {
    min-height: 100%;
    scroll-padding-top: 50px;
}

:root {
    --body-bg-color: #ccc;
    --dark-pink: #c9337b;
    --light-pink: #ff6bc0;
    --alt-bg-color: #ddd;
    --alt-alt-bg-color: #bbb;
    --pink-hl-color: #FFD5E9;
    --pink-alt-hl-color: #FFB7DA;
    --darker-accent-color: #2a4bc8;
    --darkest-accent-color: #1c379f;
    --green-color: #196300;
    --lightest-accent-color: #6f9dff;
    --lighter-accent-color: #3265d2;

    --border-color: #bbb;
    --component-border-color: #aaa;

    --border-radius: 5px;

    --normal-box-shadow: rgba(0, 0, 0, 0.2);
    --light-box-shadow: rgba(0, 0, 0, 0.1);
    --glow-box-shadow: rgba(255, 255, 255, 0.2);

    --shiny-gradient-1: linear-gradient(to bottom, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.3) 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.3));
    --shiny-gradient-2: linear-gradient(to bottom,
        rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.5) 10px,
        rgba(255, 255, 255, 0) 10px, rgba(255, 255, 255, 0.5) calc(100% - 10px),
        rgba(255, 255, 255, 0) calc(100% - 10px), rgba(255, 255, 255, 0.5)
    );
}

/* ---- global styles ---- */

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;

    background: lightgrey;

    font-family: 'Montserrat';
    font-size: 16px;
}

#nav {
    font-size: 1.3rem;

    background: var(--shiny-gradient-1),
                linear-gradient(to bottom, var(--light-pink), var(--dark-pink));
    box-shadow: 0 0 10px inset var(--glow-box-shadow), 0 0 10px var(--normal-box-shadow);

    margin-bottom: 50px;

    display: flex;
    flex-direction: row;
    padding: 0 30px;
    align-items: center;

    color: white;

    font-size: 1rem;

    #nav-menu {
        flex: 1 0 auto;

        .nav-holder {
            flex: 1 0 auto;

            display: flex;
            flex-direction: row;
            padding: 15px 0;
            align-items: center;

            .flexible-gap {
                flex-grow: 1;
            }
        }
    }

    a {
        margin: -10px 0;
        padding: 10px 15px;

        color: inherit;
        text-decoration: none;

        border-radius: 10px;

        font-weight: bold;

        &:hover {
            background: linear-gradient(to bottom, var(--dark-pink), var(--light-pink) 50%, var(--dark-pink) 50%, var(--light-pink));
            box-shadow: 5px 20px 30px inset rgba(255, 255, 255, 0.7), 2px 2px 5px rgba(0, 0, 0, 0.2);
        }

        &:active {
            background: linear-gradient(to bottom, var(--light-pink), var(--dark-pink));
            box-shadow: 5px 20px 30px inset rgba(0, 0, 0, 0.6);
        }

        .active {
            box-shadow: 0 0 10px inset rgba(0, 0, 0, 0.3);
        }
    }

    .close-nav-link {
        display: none;
    }

    #logo-text a {
        font-family: 'Agency FB Bold', sans-serif;
        font-size: 1.2rem;
    }
}

.nav-menu-header {
    display: none;
    font-family: 'Agency FB Bold', sans-serif;
}

#nav-menu-button {
    display: none;

    font-size: 2rem;
    padding: 0 2px 0 5px;

    a {
        padding: 0 10px;
        margin-top: -15px;
        display: block;
    }
}

.reg {
    font-family: sans-serif;
    font-size: 0.7em;
    display: inline-block;
    vertical-align: top;
}

#body-container {
    flex: 1 0 auto;
}

#container-box {
    background: var(--shiny-gradient-2) #eee;
    /*border: 1px solid var(--border-color);*/
    max-width: 1024px;
    margin: 0 auto;
    padding: 20px 30px;
    box-shadow: 0 10px 20px var(--normal-box-shadow);
}

#footer {
    padding: 25px;
    font-style: oblique;
    background: linear-gradient(to bottom, transparent, var(--alt-bg-color));
    margin-top: 25px;
    flex-shrink: 0;
}

/* -------- text styles --------- */

h1, h2, h3, h4, h5, h6 {
    font-family: 'Agency FB Bold', sans-serif;

    &:first-child {
        margin-top: 0;
    }
}

h1 {
    font-size: 1.8rem;
}

/* ------ component styles -------- */

.miniform {
    /*border: 1px solid var(--border-color);*/

    padding: 20px 30px;
    margin: 10px auto;
    width: 500px;
    max-width: 100%;

    background: var(--shiny-gradient-2), #eee;
    box-shadow: 0 2px 5px var(--normal-box-shadow);

    table th, table td {
        padding: 10px 5px;
    }
}

button, input {
    font-family: 'Montserrat';
}

textarea {
    max-width: 100%;
}

input[type="text"] {
    padding: 5px 10px;
    background: linear-gradient(to bottom, #eee, #fff 50%);
    box-shadow: 0 2px 3px inset var(--light-box-shadow);
    border: 1px solid var(--component-border-color);
    max-width: 100%;
}

button, input[type="submit"], a.button {
    border: 1px solid var(--component-border-color);
    background: var(--shiny-gradient-1), #ddd;
    font-weight: bold;
    padding: 10px 20px;
    box-shadow: 0px 1px 2px var(--normal-box-shadow), 0 0 5px inset var(--glow-box-shadow);
    text-decoration: none;
    color: black;

    &:hover {
        background: var(--shiny-gradient-1), #f8f8f8;
        cursor: pointer;
    }

    &:active {
        background: var(--shiny-gradient-1), #ccc;
    }

    &.success {
        background: var(--shiny-gradient-1), #1f9f1c;
        border: 1px solid #1d7b1b;
        color: white;

        &:hover {
            background: var(--shiny-gradient-1), #18cd14;
        };

        &:active {
            background: var(--shiny-gradient-1), #1e671c;
        };
    }

    &.danger {
        background: var(--shiny-gradient-1), #a92d1b;
        border: 1px solid #842012;
        color: white;

        &:hover {
            background: var(--shiny-gradient-1), #ea351b;
        };

        &:active {
            background: var(--shiny-gradient-1), #782c21;
        }
    }

    &.primary {
        background: var(--shiny-gradient-1), #2071b0;
        border: 1px solid #13446a;
        color: white;

        &:hover {
            background: var(--shiny-gradient-1), #168ce8;
        };

        &:active {
            background: var(--shiny-gradient-1), #13446a;
        };
    }

    &.large {
        font-size: 1.4rem;
        padding: 20px 40px;
    }
}

a:not(.button) {
    text-decoration: none;
    font-weight: bold;
    color: var(--dark-pink);

    &:hover {
        text-decoration: underline;
    }

    &:visited {
        color: var(--dark-pink);
    }
}

/* ------- utility styles ---------- */

.flex-row {
    display: flex;
    flex-direction: row;

    & > * {
        flex: 0 0 auto;
    }
}

.flex-col {
    display: flex;
    flex-direction: row;

    & > * {
        flex: 0 0 auto;
    }
}

.flex-grow {
    flex: 1 0 auto;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    } to {
        transform: rotate(360deg);
    }
}

@keyframes enter {
    from {
        transform: scale(0) rotate(-720deg);
        filter: opacity(0);
    } to {
        transform: scale(100%) rotate(0);
        filter: opacity(1);
    }
}

@keyframes enter-no-rotate {
    from {
        transform: scale(0);
        filter: opacity(0);
    } to {
        transform: scale(100%);
        filter: opacity(1);
    }
}

/* ------- element styles ---------- */

.flash-message {
    background: linear-gradient(to bottom, #fff, #ffa 10px, #ffd calc(100% - 10px), #ffa);
    border-radius: var(--border-radius);
    border: 1px solid #aaaa00;
    padding: 10px 30px;
    color: #440;
    box-shadow: 0 2px 5px var(--normal-box-shadow);
}

.item-image {
    aspect-ratio: 1 / 1;
    max-width: 150px;
    max-height: 150px;

    &.double-size {
        max-width: 300px;
        max-height: 300px;
    }

    img {
        object-fit: contain;
        width: 100%;
        height: 100%;
    }

    &.uncommon {
        img {
            filter: drop-shadow(0 0 5px orange);
        }
    }

    &.rare {
        img {
            filter: drop-shadow(0 0 5px orange) drop-shadow(0 0 10px red);
        }
    }

    &.legendary {
        img {
            filter: drop-shadow(0 0 5px orange) drop-shadow(0 0 10px red) drop-shadow(0 0 20px mediumorchid);
        }
    }

    &.entering {
        animation: enter 4s linear forwards;

        &.glowing::before {
            animation: enter-no-rotate 8s linear forwards, spin 8s linear infinite;
        }
    }

    &.glowing {
        position: relative;

        &::before {
            content: "";
            position: absolute;
            left: -50%;
            top: -50%;
            width: 200%;
            height: 200%;

            border-radius: 50%;

            background: repeating-conic-gradient(#ffa 0deg, #ffa 15deg, transparent 15deg, transparent 30deg);
            z-index: 1;

            animation: spin 8s linear infinite;

            mask-image: radial-gradient(white 0 50%, transparent 71%);
        }

        img {
            position: relative;
            z-index: 2;
        }
    }
}

.item {
    width: 190px;
    max-width: 50%;
    display: block;

    flex: 0 0 190px;
    padding: 20px;
    border-radius: 5px;

    transition: background 0.5s;

    .item-code {
        color: #666;
        text-align: right;
        font-size: 0.6rem;
        font-family: monospace;
    }

    .item-name {
        font-weight: bold;
        text-align: center;
        cursor: default;
    }

    .item-description {
        font-style: oblique;
        text-align: center;
        cursor: default;
    }

    &:hover {
        background: #ddd;
    }
}

/* ---------- small screen ------- */

@media screen and (max-width: 1024px) {
    #container-box {
        border-left: none;
        border-right: none;
        padding-left: 10px;
        padding-right: 10px;
    }

    #nav {
        padding: 15px 0 15px 5px;

        #nav-menu-button {
            display: block;
        }

        #nav-menu:not(:target) {
            display: none;

            .close-nav-link {
                opacity: 0;
                display: none;
                transition: opacity 0.5s, display 0.5s;
            }
        }

        #nav-menu:target {
            display: block;

            .close-nav-link {
                opacity: 1;
                display: block;
                transition: opacity 0.5s, display 0.5s;

                &:hover {
                    background: rgba(128, 128, 128, 0.5);
                    box-shadow: none;
                }

                &:active {
                    background: rgba(128, 128, 128, 0.5);
                    box-shadow: none;
                }
            }
        }

        #nav-menu {
            position: fixed;
            z-index: 10000;
            left: 0;
            top: 0;
            height: 100%;
            width: 100%;
            overscroll-behavior: contain;

            .nav-menu-header {
                display: block;
                font-size: 1.2rem;
            }

            .nav-holder {
                height: 100%;
                max-width: 80%;
                width: 300px;
                position: absolute;
                z-index: 10;
                background-color: white;
                box-shadow: 0 0 10px var(--normal-box-shadow);
                flex-direction: column;

                .username {
                    padding: 10px 15px;
                }

                a, .username, .nav-menu-header {
                    width: 100%;
                    display: block;
                    color: black;
                    margin: 0;
                    border-radius: 0;
                }
            }

            .close-nav-link {
                position: absolute;
                left: 0;
                top: 0;
                height: calc(100vh + 10px);
                width: 100vw;
                border-radius: 0;
                background: rgba(128, 128, 128, 0.5);
                content: "";
                z-index: 1;
            }
        }
    }
}

@media screen and (max-width: 510px) {
    .miniform {
        border-left: none;
        border-right: none;
        margin-left: -10px;
        margin-right: -10px;
        padding-left: 10px;
        padding-right: 10px;
        max-width: calc(100% + 20px);
    }

    .form-table {
        width: 100%;

        tr {
            width: 100%;
        }

        input[type="file"], input[type="text"], textarea {
            width: 100%;
        }
    }

    .flex-row.col-on-small {
        flex-direction: column;
    }
}

/* --------- The Rinder ----------- */

.rinder-selection {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;

}

.rinder-result {
    text-align: center;

    .image {
        max-width: 600px;
        max-height: 600px;
        margin: 0 auto;

        .item-image {
            margin: 25%;
        }
    }

    .text {
        animation: enter-no-rotate 3s linear forwards;
        margin-bottom: 30px;
    }
}

/* --------- my collection ---------- */

.my-collection {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
}

/* -------- item view --------- */

.item-info-table {
    th, td {
        vertical-align: top;
        padding: 10px;
    }

    th {
        text-align: right;
    }
}
