/* Etch-a-Sketch */

.etch-a-sketch-wrapper {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

.grid {
    aspect-ratio: 1 / 1;
    background-color: #ffffff;
    box-shadow: 0px 2px 7px 1px var(--darkGray);
    display: grid;
    grid-template-rows: repeat(var(--gridSize), 1fr);
    grid-template-columns: repeat(var(--gridSize), 1fr);
    width: 80%;

    cursor: url(../images/icons/paintbrush-cursor.png) 6 26,
        auto;
}

.grid-item {
    aspect-ratio: 1 / 1;
    background-color: white;
    border: none;
    padding: 0;
    user-select: none;
}

/* Sketch Actions */

.grid-lines {
    border: 1px solid var(--lightGray);
}

.colors-container {
    display: grid;
    grid-template-columns: 1fr 3fr 1fr;
    gap: 20px;
}

.color-modes {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 20px;
}

button.color-mode {
    width: 40px;
}

button.color-mode.active img {
    filter: brightness(4);
}

button.color-mode.active:nth-child(2) img {
    filter: grayscale(1) invert(1);
}

input[type='color'] {
    width: 100%;
    height: 100%;
    aspect-ratio: 1 / 1;
    border: 0.5px solid var(--darkGray);
    border-radius: 50%;

    transition: transform 0.1s ease-in-out;
    -webkit-appearance: none;
    -moz-appearance: none;
}

input[type='color']::-webkit-color-swatch-wrapper {
    padding: 0;
    background-color: white;
}

input[type='color']::-webkit-color-swatch {
    border: none;
    border-radius: 50px;
    box-shadow: none;
}

input[type='color']::-moz-color-swatch {
    border: none;
    border-radius: 50px;
    box-shadow: none;
}

input[type='color']:hover {
    transform: scale(1.05);
    cursor: pointer;
    background-color: white;
}

input[type='color']:active {
    transition: transform 0.25s ease-in-out;
    transform: scale(1);
    background-color: white;
}

.recent-colors {
    width: 100%;
    padding: 8px 0;

    display: grid;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(5, 1fr);
    justify-content: center;
    align-items: center;
    gap: 5px;
}

button.color-swatch {
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0.1px solid var(--darkGray);
    box-shadow: none;

    grid-column: span 1;
    grid-row: span 1;
}

.buttons {
    width: 100%;
    padding-top: 20px;
    padding-bottom: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 20px;
}

#clear:focus,
#gridLines:focus {
    transform: scale(1);
}

#clear:hover,
#gridLines:hover {
    transform: scale(1.05);
}

#clear:active {
    box-shadow: none;
    background-color: var(--darkGray);
    color: white;
    outline-offset: 4px; /* for focus state */
    transform: scale(1);
}

.grid-sizer-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

.grid-sizer {
    -webkit-appearance: none;
    appearance: none;
    width: 80%;
    height: 15px;
    padding-bottom: 0;

    background: var(--lightGray);
    border-radius: 5px;
    outline: none;
    opacity: 0.7;

    -webkit-transition: 0.2s;
    transition: opacity 0.2s;
}

.grid-sizer:hover {
    opacity: 1;
}

.grid-sizer::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: var(--darkGray);
    cursor: pointer;
}

.grid-sizer::-moz-range-thumb {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: var(--darkGray);
    cursor: pointer;
}

.grid-size {
    text-align: center;
}

/* Download button */

.download {
    width: 100%;
    margin-top: 40px;
}

.download button {
    width: fit-content;
    margin: 0 auto;

    display: flex;
    justify-content: center;
    align-items: center;
    gap: 6px;
}

.download button img {
    width: 1.25em;
}

@media (min-width: 769px) {
    .etch-a-sketch-wrapper {
        flex-direction: row;
        gap: 40px;
    }

    .grid {
        width: 50%;
        max-width: 600px;
    }

    .buttons {
        width: 30%;
        max-width: 250px;
        justify-content: space-between;
        gap: 20px;
    }
}
