:root {
    --bg: #0a0a0a;
    --fg: #f3f1eb;
    --muted: #918f89;
    --hairline: rgba(255,255,255,.15);
    --page-pad: clamp(14px, 2.2vw, 36px);
    --gallery-max: 920px;
}

* { box-sizing: border-box; }

html {
    background: var(--bg);
    color: var(--fg);
    font-family: Arial, Helvetica, sans-serif;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--fg);
}

button, a { -webkit-tap-highlight-color: transparent; }

.site-header {
    height: 68px;
    padding: 0 var(--page-pad);
    display: flex;
    align-items: center;
    gap: 22px;
    position: relative;
    z-index: 10;
    background: rgba(10,10,10,.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.brand,
.admin-link {
    color: var(--fg);
    text-decoration: none;
    font-size: 11px;
    letter-spacing: .18em;
}

.brand { font-weight: 700; }

.header-rule {
    flex: 1;
    height: 1px;
    background: var(--hairline);
}

.admin-link { color: var(--muted); }

.category-filter {
    width: min(calc(100% - 40px), var(--gallery-max));
    margin: 14px auto 0;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.category-filter-button {
    border: 1px solid rgba(255,255,255,.12);
    border-radius: 999px;
    padding: 7px 10px;
    background: transparent;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: .12em;
    cursor: pointer;
}

.category-filter-button:hover,
.category-filter-button.is-active {
    color: var(--fg);
    border-color: rgba(255,255,255,.35);
    background: rgba(255,255,255,.05);
}

.gallery {
    width: min(calc(100% - 40px), var(--gallery-max));
    margin: 20px auto 80px;
}

.photo-card {
    --accent: #6f6f6f;
    width: 100%;
    margin: 0 0 30px;
}

.photo-card[hidden] { display: none; }

.photo-open {
    position: relative;
    display: block;
    width: 100%;
    border: 0;
    margin: 0;
    padding: 0;
    background: #111;
    cursor: zoom-in;
    overflow: hidden;
}

.photo-open::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 2px;
    background: var(--accent);
    opacity: .8;
    pointer-events: none;
}

.photo-open img {
    display: block;
    width: 100%;
    height: auto;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

.image-protection-layer {
    position: absolute;
    inset: 0;
    z-index: 2;
    pointer-events: none;
}

.photo-meta {
    padding: 8px 1px 0;
    display: grid;
    grid-template-columns: minmax(180px, 1.2fr) minmax(220px, 1.5fr) auto;
    gap: 14px;
    align-items: start;
}

.photo-meta-primary {
    min-width: 0;
}

.accent-line {
    width: 28px;
    height: 2px;
    margin: 0 0 7px;
    background: var(--accent);
    border-radius: 2px;
}

.photo-meta h2 {
    margin: 0 0 4px;
    font-size: 12px;
    line-height: 1.35;
    font-weight: 500;
}

.photo-context {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 3px 7px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
}

.photo-context > span:not(:last-child)::after {
    content: "·";
    margin-left: 7px;
    color: #555;
}

.category-tag {
    color: var(--accent);
}

.caption {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.45;
}

.photo-data,
.photo-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.35;
}

.photo-data span:not(:last-child)::after,
.photo-tech span:not(:last-child)::after {
    content: "·";
    margin-left: 10px;
    color: #555;
}

.photo-tech {
    justify-content: flex-end;
    white-space: nowrap;
}

.empty-state {
    min-height: calc(100vh - 68px);
    display: grid;
    place-items: center;
    color: var(--muted);
}

.viewer {
    position: fixed;
    inset: 0;
    display: none;
    z-index: 1000;
    background: #000;
}

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

.viewer-toolbar {
    position: absolute;
    inset: 0 0 auto 0;
    min-height: 58px;
    padding: 0 14px 0 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 5;
    background: linear-gradient(to bottom, rgba(0,0,0,.75), transparent);
    pointer-events: none;
}

.viewer-title {
    max-width: 55vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: rgba(255,255,255,.8);
    font-size: 11px;
    letter-spacing: .08em;
}

.viewer-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    pointer-events: auto;
}

.viewer-actions button {
    border: 0;
    background: rgba(255,255,255,.08);
    color: white;
    min-height: 36px;
    padding: 0 12px;
    border-radius: 99px;
    font-size: 10px;
    letter-spacing: .08em;
    cursor: pointer;
}

#viewer-close {
    width: 42px;
    height: 42px;
    padding: 0;
    font-size: 27px;
    font-weight: 200;
}

.viewer-stage {
    width: 100%;
    height: 100%;
    overflow: auto;
    display: grid;
    place-items: center;
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
}

.viewer-stage img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    transform-origin: center center;
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
}

.viewer-stage.is-actual {
    display: block;
    padding-top: 70px;
}

.viewer-stage.is-actual img {
    max-width: none;
    max-height: none;
}

@media (max-width: 1050px) {
    .gallery,
    .category-filter {
        width: min(calc(100% - 28px), 920px);
    }
}

@media (max-width: 760px) {
    .site-header { height: 58px; }

    .category-filter {
        width: calc(100% - 28px);
        margin-top: 10px;
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .category-filter::-webkit-scrollbar { display: none; }

    .category-filter-button { flex: 0 0 auto; }

    .gallery {
        width: 100%;
        margin: 12px 0 50px;
    }

    .photo-card { margin-bottom: 34px; }

    .photo-meta {
        grid-template-columns: 1fr;
        gap: 5px;
        padding: 8px 14px 0;
    }

    .photo-tech { justify-content: flex-start; }

    .viewer-title { display: none; }

    .viewer-toolbar { justify-content: flex-end; }
}
