:root {
    color-scheme: dark;
    --page-bg: #050809;
    --panel-bg: rgba(0, 0, 0, 0.72);
    --ink: #f7fbfc;
    --muted: #a9c5c9;
    --accent: #45d6d0;
    --border: rgba(255, 255, 255, 0.16);
    --gallery-bg-image: url("/images/ocean01.jpg");
    --gallery-bg-repeat: no-repeat;
    --gallery-bg-position: center center;
    --gallery-bg-size: cover;
    --gallery-bg-attachment: fixed;
    --chrome-bg-position: center 42%;
    --footer-bg-position: center 68%;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--page-bg);
}

body {
    min-height: 100%;
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top, rgba(28, 109, 121, 0.3), transparent 34rem),
        var(--gallery-bg-image) var(--gallery-bg-position) / var(--gallery-bg-size) var(--gallery-bg-repeat) var(--gallery-bg-attachment);
}

a {
    color: inherit;
}

.site-header,
.site-footer {
    text-align: center;
}

.site-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    background:
        linear-gradient(to bottom, rgba(1, 14, 185, 0.96), rgba(14, 136, 207, 0.86)),
        var(--gallery-bg-image) var(--chrome-bg-position) / var(--gallery-bg-size) var(--gallery-bg-repeat);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
    transition: transform 220ms ease;
    will-change: transform;
}

.site-header--hidden {
    transform: translateY(-100%);
}

.site-footer {
    background:
        linear-gradient(to bottom, rgba(1, 14, 185, 0.96), rgba(14, 136, 207, 0.86)),
        var(--gallery-bg-image) var(--footer-bg-position) / var(--gallery-bg-size) var(--gallery-bg-repeat);
}

.site-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
    text-decoration: none;
}

.site-logo {
    display: block;
    width: 126px;
    height: auto;
}

.site-title {
    color: var(--ink);
    font-size: clamp(1rem, 2.4vw, 1.35rem);
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.album-title {
    min-width: 0;
    text-align: center;
}

.album-title h1 {
    margin: 0;
    font-size: clamp(0.95rem, 2.3vw, 1.35rem);
    line-height: 1.15;
    letter-spacing: 0;
}

main {
    width: min(1380px, calc(100% - 24px));
    margin: 0 auto;
    padding: 22px 0 32px;
}

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

.thumb {
    appearance: none;
    display: block;
    width: 100%;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #021316;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
}

.thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 180ms ease, filter 180ms ease;
}

.thumb:hover img,
.thumb:focus-visible img {
    transform: scale(1.045);
    filter: brightness(1.15);
}

.thumb:focus-visible,
.viewer-button:focus-visible,
.filmstrip-button:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.viewer {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: none;
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: 100vh;
    height: 100dvh;
    background:
        linear-gradient(rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.7)),
        var(--gallery-bg-image) var(--gallery-bg-position) / var(--gallery-bg-size) var(--gallery-bg-repeat);
}

.viewer.is-open {
    display: grid;
}

.viewer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.92), rgba(0, 0, 0, 0));
}

.viewer-title {
    min-width: 0;
    font-size: 1rem;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.viewer-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.viewer-button {
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--ink);
    background: var(--panel-bg);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.viewer-button:hover {
    background: rgba(69, 214, 208, 0.2);
}

.stage {
    position: relative;
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    padding: 12px 64px;
}

.stage img {
    width: auto;
    height: auto;
    max-width: calc(100vw - 128px);
    max-height: calc(100dvh - 160px);
    display: block;
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 22px 70px rgba(0, 0, 0, 0.74);
    object-fit: contain;
}

.nav-button {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 78px;
    border-radius: 6px;
    font-size: 3rem;
}

.nav-button.prev {
    left: 12px;
}

.nav-button.next {
    right: 12px;
}

.filmstrip {
    position: relative;
    z-index: 2;
    display: flex;
    gap: 8px;
    padding: 10px 12px 12px;
    overflow-x: auto;
    border-top: 1px solid var(--border);
    background: rgba(2, 19, 22, 0.96);
    scrollbar-color: var(--accent) rgba(255, 255, 255, 0.16);
}

.filmstrip-button {
    flex: 0 0 74px;
    height: 54px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 5px;
    overflow: hidden;
    background: #062024;
    cursor: pointer;
    opacity: 0.68;
}

.filmstrip-button.is-active {
    border-color: var(--accent);
    opacity: 1;
}

.filmstrip-button img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.site-footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
    gap: 1rem;
    padding: 14px 18px 16px;
    border-top: 1px solid var(--border);
    font-size: 0.78rem;
    color: var(--muted);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.22);
}

.footer-cell {
    margin: 0;
}

.footer-copyright {
    text-align: left;
}

.footer-back-cell {
    text-align: center;
}

.footer-contact {
    text-align: right;
}

.footer-back {
    appearance: none;
    padding: 0;
    border: 0;
    color: var(--ink);
    background: transparent;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

.footer-back:hover,
.site-footer a:hover {
    color: var(--accent);
}

@media (max-width: 700px) {
    main {
        width: min(100% - 16px, 1380px);
        padding-top: 12px;
    }

    .site-logo {
        width: 104px;
    }

    .site-header {
        grid-template-columns: 1fr auto;
        gap: 0.65rem;
    }

    .site-title {
        font-size: 1rem;
    }

    .album-title {
        grid-column: 1 / -1;
        margin-left: 0;
        text-align: center;
    }

    .site-footer {
        grid-template-columns: 1fr;
        gap: 0.55rem;
    }

    .footer-copyright,
    .footer-contact {
        text-align: center;
    }

    .gallery {
        grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
        gap: 7px;
    }

    .stage {
        padding: 0;
    }

    .stage img {
        max-width: 100vw;
        max-height: calc(100dvh - 178px);
    }

    .nav-button {
        top: auto;
        bottom: 18px;
        width: 48px;
        height: 48px;
        font-size: 2.3rem;
        background: rgba(0, 0, 0, 0.62);
    }

    .filmstrip-button {
        flex-basis: 58px;
        height: 44px;
    }
}
