/****************/
/* Font imports */
/****************/

@font-face {
    font-family: 'Departure Mono';
    src: url('assets/fonts/DepartureMono-Regular.woff2') format('woff2');
}

@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@100..800&display=swap');

/*******************/
/* Global defaults */
/*******************/

body {
    font-family: 'JetBrains Mono', monospace;
    margin: 40px auto;
    max-width: min(80rem, 90%);
    line-height: 1.6;
    font-size: 18px;
    color: #444;
    padding: 0 10px;
    background-color: #fafafa;
    background-image:
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 40px,
            rgba(0, 0, 0, 0.05) 40px,
            rgba(0, 0, 0, 0.05) 48px
        ),
        repeating-linear-gradient(
            90deg,
            transparent,
            transparent 40px,
            rgba(0, 0, 0, 0.05) 40px,
            rgba(0, 0, 0, 0.05) 48px
        );
    background-attachment: fixed;
}

h1,
h2 {
    font-family: 'Departure Mono', monospace;
    line-height: 1.2;
}

h1 {
    font-size: clamp(1.5em, 5vw, 3em);
    margin-bottom: 2em;
    text-align: center;
}

/********************/
/* Game list header */
/********************/

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.header-row h2 {
    margin: 0;
}

.controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.controls > * {
    font-family: 'Departure Mono', monospace;
    font-size: 100%;
    font-weight: bold;
}

#search-input {
    padding: 0.2em 0.5em;
    border: 2px solid grey;
    border-radius: 10px;
    background-color: transparent;
    cursor: text;

    transition:
        background-color 0.15s ease,
        opacity 0.15s ease,
        border-color 0.15s ease;
}

#search-input:hover {
    /* Transparency because it looks cool with the background */
    background-color: rgba(211, 211, 211, 0.5);
}

#search-input:focus {
    outline: none;
    border-color: #666;
    background-color: rgba(211, 211, 211, 0.8);
}

#search-input::placeholder {
    color: #999;
    font-weight: normal;
}

#sort-select {
    text-align: right;

    padding: 0.2em 0.5em 0.2em 0;
    border: none;
    border-radius: 10px;
    width: fit-content;
    background-color: transparent;
    cursor: pointer;

    transition:
        background-color 0.15s ease,
        opacity 0.15s ease;
}

#sort-select:hover {
    background-color: lightgrey;
}

/*******************/
/* Game entry grid */
/*******************/

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

    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

/* media query spam for responsive column count */

@media (max-width: 75rem) {
    ul {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 55rem) {
    ul {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 35rem) {
    ul {
        grid-template-columns: 1fr;
    }
}

/****************/
/* Game entries */
/****************/

li {
    background-color: gainsboro;
    padding: 1rem;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
}

li h3 {
    margin: 0 0 0.5rem 0;
}

.tag {
    padding: 0.2em 0.5em;
    border-radius: 999px;
}

/*****************/
/* Entry edit UI */
/*****************/

[contenteditable='true'] {
    outline: 2px dashed grey;
    background-color: lightgrey !important;
    transition: background-color 0.15s ease;
}

[contenteditable='true']:focus {
    outline-color: #666;
    background-color: #eee !important;
}

/* Frozen UI when in edit mode */

#search-input:disabled,
#sort-select:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.button:disabled,
#add-game-button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

/*****************/
/* Entry buttons */
/*****************/

.buttons {
    margin-top: auto;
    display: flex;
    gap: 0.5em;
    justify-content: flex-end;
}

.button {
    padding: 0;
    width: 3em;
    height: 3em;
    border: 2px solid grey;
    border-radius: 10px;
    cursor: pointer;

    background-color: #f0f0f0;
    transition:
        background-color 0.15s ease,
        opacity 0.15s ease;
}

.button:hover {
    background-color: lightgrey;
}

.button.danger {
    border-color: #ff5050;
    background-color: #ffc0c0;
}

.button.danger:hover {
    background-color: #ffa0a0;
}

.button img {
    display: block;
    margin: 0 auto;
}

/********************/
/* New entry button */
/********************/

#add-game-entry {
    display: flex;
    align-items: center;
    justify-content: center;
}

#add-game-button {
    margin: 2rem;
    width: 80%;
    aspect-ratio: 1;
    color: grey;
    border: 5px dashed grey;
    border-radius: 50%;
    cursor: pointer;

    background-color: transparent;
    transition: all 0.25s ease;
}

#add-game-button:hover {
    border-radius: 30%;
    color: #666;
    border-color: #666;
    background-color: lightgrey;
}

#add-game-button svg {
    width: 30%;
}
