/* CSS Reset */

html,
body,
div,
span,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
abbr,
address,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
samp,
small,
strong,
sub,
sup,
var,
b,
i,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section,
summary,
time,
mark,
audio,
video {
    margin: 0;
    padding: 0;
    border: 0;
    outline: 0;
    font-size: 100%;
    vertical-align: baseline;
    background: transparent;
}

article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
    display: block;
}

nav ul {
    list-style: none;
}

blockquote,
q {
    quotes: none;
}

blockquote:before,
blockquote:after,
q:before,
q:after {
    content: "";
    content: none;
}

a {
    margin: 0;
    padding: 0;
    font-size: 100%;
    vertical-align: baseline;
    background: transparent;
    text-decoration: underline;
    cursor: pointer;
    color: inherit;
}

ins {
    background-color: #ff9;
    color: #000;
    text-decoration: none;
}

mark {
    background-color: #ff9;
    color: #000;
    font-style: italic;
    font-weight: bold;
}

del {
    text-decoration: line-through;
}

abbr[title],
dfn[title] {
    border-bottom: 1px dotted;
    cursor: help;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

hr {
    display: block;
    height: 1px;
    border: 0;
    border-top: 1px solid #cccccc;
    margin: 1em 0;
    padding: 0;
}

input,
select {
    vertical-align: middle;
}

*,
*:before,
*:after {
    box-sizing: border-box;
    @media (prefers-reduced-motion) {
        /* This could be a little aggressive... */
        transition-duration: 0ms !important;
    }
}

input,
input[type],
select,
select:focus,
textarea {
    font-size: inherit;
}

select:-webkit-autofill,
textarea:-webkit-autofill,
input:-webkit-autofill {
    /* Remove yellow bg in Chrome autofilled inputs */
    -webkit-box-shadow: 0 0 0 500px transparent inset;
    background-clip: content-box;
    -webkit-text-fill-color: white !important;
}

/* Vars */
:root {
    --fontFamily-system: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif, "Apple Color Emoji",
        "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
    --color-background: hsl(180, 10%, 15%);
    --color-card: hsl(180, 10%, 10%);
    --color-modal: hsl(180, 10%, 15%);
    --color-focus: hsl(180, 70%, 50%);
}

/* Base Styles */
*,
*:before,
*:after {
    box-sizing: border-box;
}

html,
body {
    font-family: var(--fontFamily-system);
    color: white;
    background: var(--color-background);
    font-size: 16px;
}

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

main {
    position: relative;
    flex-grow: 1;
}

/* Modules */

/* btn */

.btn {
    background: none;
    border: 1px solid currentColor;
    border-radius: 0.5em;
    color: inherit;
    padding: 8px 12px;
    line-height: 1em;
}

.btn.is-pending {
    position: relative;
    overflow: clip;
}
.btn.is-pending:before {
    content: "";
    position: absolute;
    inset: -1px;
    background: rgba(0, 0, 0, 0.8);
}
.btn.is-pending:after {
    content: "";
    position: absolute;
    width: 16px;
    aspect-ratio: 1/1;
    border: 1px solid white;
    border-color: white white transparent transparent;
    animation: loading 500ms linear infinite;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    border-radius: 999px;
}

.btn:focus-visible {
    outline: 2px solid currentColor;
}

/* header */

.header {
    background: var(--color-card);
    padding: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title {
    font-weight: 200;
    letter-spacing: 0.1em;
}

/* loading */

.loading {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
}

.loading:after {
    content: "";
    position: absolute;
    width: 32px;
    aspect-ratio: 1/1;
    border: 1px solid white;
    border-color: white white transparent transparent;
    animation: loading 500ms linear infinite;
    top: 50%;
    left: 50%;
    translate: -50% -50%;
    border-radius: 999px;
}

@keyframes loading {
    100% {
        transform: rotate(1turn);
    }
}

/* modal */

.modal {
    background: var(--color-modal);
    border-radius: 0.5em;
    border: 0;
    box-shadow: 0 2px 2px rgba(0, 0, 0, 0.4);
    color: white;
    position: fixed;
    top: 0;
    padding: 32px;
}

.modal::backdrop {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
}

.modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 0;
    width: 12px;
    aspect-ratio: 1/1;
    background: none;
    border: 0;
    color: inherit;
}
.modal-close:before,
.modal-close:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    background: currentColor;
    width: 100%;
    height: 2px;
    transform-origin: center center;
    transform: translate(-50%, -50%) rotate(45deg);
}
.modal-close:before {
    transform: translate(-50%, -50%) rotate(-45deg);
}
.modal-close:focus-visible {
    outline: 1px solid currentColor;
}

.modal p {
    margin-bottom: 16px;
}

/* input */

.input {
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
}
.input > label {
    font-size: 0.8em;
    padding-bottom: 4px;
}
.input > input {
    color: inherit;
    background: none;
    border: 0;
    border-bottom: 1px solid white;
    width: 100%;
    min-width: 30vw;
    max-width: 100%;
}

.input > input:focus {
    outline: 0;
    border-bottom-color: var(--color-focus);
}

.input-hint {
    font-size: 0.8em;
    margin: -8px 0 16px;
    line-height: 1.4em;
    opacity: 0.6;
}

/* fileInput */

.fileInput {
    margin-bottom: 16px;
}

.fileInput-btn {
    padding: 6px;
    border: 1px solid currentColor;
    border-radius: 0.5em;
    display: inline-block;
    margin-bottom: 8px;
    width: 100%;
    text-align: center;
    font-size: 0.9em;
    display: flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
}

.fileInput-btn input {
    position: absolute;
    left: -999vw;
}

.fileInput img {
    max-width: 100%;
    background: var(--color-card);
    display: block;
    margin: auto;
}

/* error */

.error {
    color: hsl(0, 60%, 60%);
    line-height: 1.2em;
    display: block;
}

.error:not(:empty) {
    margin-top: 12px;
}

/* gallery */

.gallery {
    padding: 16px;
    list-style: none;
}
@media (min-width: 800px) {
    .gallery {
        padding: 32px;
    }
}

.gallery > li {
    position: relative;
}

.gallery h2 {
    position: sticky;
    top: 0;
    background: var(--color-background);
    border-bottom: 1px solid currentColor;
    padding: 8px;
    font-weight: 200;
    font-size: 1.6em;
    text-transform: uppercase;
    margin-bottom: 16px;
    z-index: 1;
}

.gallery-images {
    gap: 16px;
    display: flex;
    flex-wrap: wrap;
    padding-bottom: 32px;
}

.gallery-images > img {
    max-height: 200px;
    background: var(--color-card);
    flex-grow: 1;
    object-fit: cover;
    max-width: 500px;
}
.gallery-images > img:focus-visible {
    outline: 1px solid currentColor;
}

.gallery-images > img.is-loading {
    aspect-ratio: 1/1;
    animation: gallery-loading 1000ms linear infinite;
}
.gallery-images > img.is-loading:nth-child(4n + 3) {
    animation-delay: -250ms;
}
.gallery-images > img.is-loading:nth-child(4n + 2) {
    animation-delay: -500ms;
}
.gallery-images > img.is-loading:nth-child(4n + 1) {
    animation-delay: -750ms;
}

@keyframes gallery-loading {
    50% {
        opacity: 0.5;
    }
    0%,
    100% {
        opacity: 1;
    }
}

.gallery-message {
    text-align: center;
    opacity: 0.75;
    font-size: 0.8em;
    padding: 16px;
    min-height: 40vh;
    display: grid;
    place-items: center;
}

/* lightbox */

.lightbox {
    background: none;
    border: 0;
    color: white;
    position: fixed;
    top: 0;
    padding: 0;
    overflow: visible;
}

.lightbox::backdrop {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
}

.lightbox img {
    max-width: 100%;
    max-height: calc(90vh - 100px);
    border-radius: 0.5em;
    box-shadow: 0 2px 2px rgba(0, 0, 0, 0.4);
    display: block;
    margin: auto;
}

.lightbox-nav,
.lightbox-close {
    font-size: 0;
    width: 32px;
    aspect-ratio: 1/1;
    border-radius: 999px;
    border: 1px solid currentColor;
    background: none;
    color: inherit;
    position: relative;
}

.lightbox-nav:focus-visible,
.lightbox-close:focus-visible {
    outline: 2px solid currentColor;
}

.lightbox-close {
    width: 24px;
}

.lightbox-nav:before,
.lightbox-nav:after,
.lightbox-close:before,
.lightbox-close:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    background: currentColor;
    width: 60%;
    height: 1px;
    transform-origin: center center;
    transform: translate(-50%, -50%) rotate(45deg);
}

.lightbox-close:after,
.lightbox-nav:after {
    transform: translate(-50%, -50%) rotate(-45deg);
}

.lightbox-nav_next:before,
.lightbox-nav_next:after {
    transform-origin: right center;
    width: 35%;
}
.lightbox-nav_prev:before,
.lightbox-nav_prev:after {
    transform-origin: left center;
    width: 35%;
}

.lightbox-ctrls {
    display: inline-grid;
    gap: 32px;
    grid-template-columns: repeat(3, 1fr);
    place-items: center;
}

.lightbox-info {
    background: var(--color-modal);
    border-radius: 0.5em;
    border: 0;
    box-shadow: 0 2px 2px rgba(0, 0, 0, 0.4);
    padding: 12px;
    margin: 8px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: space-between;
}

/* Utils */

[hidden] {
    display: none;
}

.u-center {
    text-align: center;
}
