:root {
    color-scheme: dark;
    --bg: #050505;
    --fg: #f8fafc;
    --muted: #a7b0bd;
    --line: rgba(255, 255, 255, .14);
    --panel: rgba(18, 18, 18, .88);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
}

input {
    font: inherit;
}

.home-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.home-shell {
    width: min(100vw - 28px, 1440px);
    display: grid;
    gap: 18px;
    justify-items: center;
}

.home-hero {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #111;
}

.home-hero span {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    color: var(--muted);
    border: 1px solid var(--line);
}

.home-hero img,
.image-tile img,
.lightbox img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.home-text {
    margin: 0;
    max-width: 820px;
    color: var(--muted);
    text-align: center;
    font-size: clamp(1rem, 1.2vw, 1.25rem);
    line-height: 1.5;
}

.home-link,
.play-button {
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--fg);
    border-radius: 7px;
    padding: 10px 14px;
    font-weight: 800;
}

.gallery-header {
    position: sticky;
    top: 0;
    z-index: 10;
    min-height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 18px;
    background: rgba(5, 5, 5, .88);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.brand {
    font-weight: 900;
}

.access-form {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.access-form input,
.access-panel-form input {
    min-height: 38px;
    width: min(34vw, 180px);
    border: 1px solid var(--line);
    border-radius: 7px;
    background: rgba(255, 255, 255, .08);
    color: var(--fg);
    padding: 8px 10px;
}

.access-form button,
.access-panel-form button {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--fg);
    color: var(--bg);
    padding: 8px 12px;
    font-weight: 800;
    cursor: pointer;
}

.access-state {
    margin-left: auto;
    color: var(--muted);
    font-size: .92rem;
}

.gallery-shell {
    display: grid;
    gap: 18px;
    padding: 18px;
}

.category-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.category-nav a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 8px 11px;
    color: var(--muted);
}

.category-nav a.is-active {
    color: var(--fg);
    background: var(--panel);
}

.category-nav small {
    opacity: .7;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 10px;
}

.image-tile {
    border: 0;
    padding: 0;
    aspect-ratio: 16 / 10;
    background: #111;
    overflow: hidden;
    cursor: pointer;
}

.image-tile img {
    transition: transform .28s ease, opacity .28s ease;
}

.image-tile:hover img {
    transform: scale(1.035);
}

.empty-state {
    min-height: 50vh;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 10px;
    color: var(--muted);
    text-align: center;
}

.empty-state h1 {
    margin: 0;
    color: var(--fg);
}

.access-panel {
    min-height: 50vh;
    display: grid;
    align-content: center;
    justify-items: center;
    gap: 14px;
    text-align: center;
}

.access-panel h1 {
    margin: 0;
}

.access-panel-form {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.access-error {
    margin: 0;
    color: #fca5a5;
}

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: grid;
    place-items: center;
    background: rgba(0, 0, 0, .96);
}

.lightbox[hidden] {
    display: none;
}

.lightbox img {
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain;
    opacity: 1;
    transition: opacity .35s ease;
}

.lightbox.is-fading img {
    opacity: .18;
}

.lightbox-close,
.lightbox-nav {
    position: fixed;
    z-index: 60;
    border: 1px solid var(--line);
    background: rgba(0, 0, 0, .46);
    color: var(--fg);
    border-radius: 7px;
    cursor: pointer;
}

.lightbox-close {
    top: 16px;
    right: 16px;
    width: 42px;
    height: 42px;
}

.lightbox-nav {
    top: 50%;
    width: 46px;
    height: 64px;
    transform: translateY(-50%);
    font-size: 2.4rem;
    line-height: 1;
}

.lightbox-prev {
    left: 16px;
}

.lightbox-next {
    right: 16px;
}

@media (max-width: 700px) {
    .home-shell,
    .gallery-shell {
        width: 100%;
        padding: 12px;
    }

    .gallery-header {
        padding: 10px 12px;
        flex-wrap: wrap;
    }

    .access-form {
        order: 3;
        width: 100%;
        margin-left: 0;
    }

    .access-form input {
        flex: 1;
        width: auto;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}
