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

body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    font-family: "Alan Sans", "Segoe UI", Arial, sans-serif;
    font-size: 16px;
    line-height: 1.45;
    color: #343a40;
    background: #fff;
}

main {
    flex: 1;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: #007bff;
}

a:hover,
a:focus {
    text-decoration: underline;
}

button {
    font-family: inherit;
    font-size: inherit;
}

.skip {
    position: absolute;
    left: 0.5rem;
    top: -3rem;
    background: #343a40;
    color: #fff;
    padding: 0.4rem 0.6rem;
}

.skip:focus {
    top: 0.4rem;
}

.site-header {
    background: #fff;
    border-bottom: 1px solid #d5d5d5;
}

.header-inner,
.gallery,
.footer-inner {
    width: min(100% - 2rem, 1100px);
    margin: 0 auto;
}

.header-inner {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand img {
    height: 52px;
    width: auto;
}

.site-label {
    margin: 0;
    color: #222;
    font-size: 16px;
    font-weight: 600;
    white-space: nowrap;
}

.gallery {
    padding: 16px 0 28px;
}

.grid {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.card-open {
    display: block;
    width: 100%;
    padding: 0;
    border: 1px solid #c8c8c8;
    background: #eee;
    cursor: pointer;
}

.card-open:hover,
.card-open:focus-visible {
    border-color: #007bff;
}

.card-open img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
}

.empty {
    margin: 1.5rem 0;
    color: #333;
}

.site-footer {
    background: #343a40;
    color: #fff;
    font-size: 14px;
}

.footer-inner {
    padding: 16px 0;
}

.footer-inner p {
    margin: 0.15rem 0;
}

.site-footer a {
    color: #fff;
}

.lightbox {
    width: min(960px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    padding: 8px;
    border: 0;
    background: #111;
    color: #fff;
}

.lightbox::backdrop {
    background: rgba(0, 0, 0, 0.88);
}

.lightbox-bar,
.lightbox-stage {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.lightbox-bar {
    padding: 4px 4px 8px;
}

.lightbox-count {
    margin: 0;
    font-size: 14px;
}

.lightbox-close,
.lightbox-nav {
    border: 1px solid #666;
    background: #222;
    color: #fff;
    cursor: pointer;
    padding: 6px 10px;
}

.lightbox-close:hover,
.lightbox-nav:hover,
.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
    background: #333;
}

.lightbox-stage {
    align-items: stretch;
}

.lightbox img {
    flex: 1;
    width: 100%;
    max-height: calc(100vh - 90px);
    object-fit: contain;
    background: #000;
}

@media (max-width: 800px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 560px) {
    .header-inner {
        min-height: 64px;
    }

    .brand img {
        height: 40px;
    }

    .grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lightbox-stage {
        flex-wrap: wrap;
    }

    .lightbox img {
        order: -1;
        flex-basis: 100%;
    }
}
