:root { color-scheme: light; --background: #fff; --text: #181818; --muted: #666; --caption: #777; --hover: #f2f2f2; }
:root[data-theme="dark"] { color-scheme: dark; --background: #000; --text: #fff; --muted: #fff; --caption: #fff; --hover: #222; }
@media (prefers-color-scheme: dark) {
    :root[data-theme="system"] { color-scheme: dark; --background: #000; --text: #fff; --muted: #fff; --caption: #fff; --hover: #222; }
}

* { box-sizing: border-box; }
:root { --gutter: clamp(8px, 1.4vw, 20px); --edge: clamp(12px, 2.22vw, 32px); --columns: 4; }
body { margin: 0; background: var(--background); color: var(--text); font-family: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-weight: 400; }
.site-header { min-height: 108px; padding: 31px 16px 22px; text-align: center; }
h1 { margin: 0; font-size: 22px; line-height: 1.25; font-weight: 400; }
.site-header nav { margin-top: 10px; font-size: 14px; line-height: 1.3; }
a { color: inherit; text-decoration: none; }
.site-header a:hover { text-decoration: underline; text-underline-offset: 3px; }
:focus, :focus-visible { outline: none; box-shadow: none; }
main { padding: 0 var(--edge) 48px; }
.gallery { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: var(--gutter); }
.photograph { display: block; flex: 0 0 calc((100% - (var(--columns) - 1) * var(--gutter)) / var(--columns)); min-width: 0; }
.photograph img { display: block; width: 100%; height: auto; }
[data-thumbnail-layout="square"] { --thumbnail-ratio: 1 / 1; }
[data-thumbnail-layout="portrait"] { --thumbnail-ratio: 3 / 4; }
[data-thumbnail-layout="landscape"] { --thumbnail-ratio: 3 / 2; }
[data-thumbnail-layout="square"] .photograph img,
[data-thumbnail-layout="portrait"] .photograph img,
[data-thumbnail-layout="landscape"] .photograph img {
    aspect-ratio: var(--thumbnail-ratio);
    object-fit: cover;
    object-position: center;
}
.empty-state { text-align: center; }
@media (max-width: 1000px) { :root { --columns: 3; } }
@media (max-width: 600px) { :root { --columns: 2; } .site-header { min-height: 96px; padding-top: 25px; } }

.pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 2px; margin-top: clamp(24px, 3vw, 40px); font-size: 14px; }
.pagination a, .pagination [aria-current] { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; min-height: 44px; padding: 4px; }
.pagination [aria-current] { font-weight: 700; }
.pagination a:hover, .empty-state a { text-decoration: underline; text-underline-offset: 3px; }
.pagination .ellipsis { padding: 0 4px; }

body.lightbox-open { position: fixed; width: 100%; overflow: hidden; }
.lightbox { position: fixed; inset: 0; width: 100%; height: 100%; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: var(--background); color: var(--text); overflow: auto; }
.lightbox::backdrop { background: var(--background); }
.lightbox[open] { display: grid; grid-template-rows: 60px minmax(0, 1fr) auto; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.lightbox button { font: inherit; color: inherit; background: transparent; border: 0; min-width: 48px; min-height: 48px; cursor: pointer; border-radius: 3px; }
.lightbox button:hover { background: var(--hover); }
.lightbox button:disabled { opacity: .25; cursor: default; }
.lightbox-top { display: flex; justify-content: flex-end; align-items: center; padding: 4px 12px; }
.lightbox-close { font-size: 30px !important; }
.lightbox-stage { min-height: 0; container-type: size; display: flex; align-items: center; justify-content: center; padding: 0 clamp(12px, 3vw, 48px); touch-action: pan-y pinch-zoom; }
.lightbox-stage.is-zoomed { touch-action: auto; }
.lightbox-figure { margin: 0; width: min(100cqw, calc((100cqh - 64px) * var(--photo-ratio))); }
.lightbox-image { display: block; width: 100%; height: min(calc(100cqh - 64px), calc(100cqw / var(--photo-ratio))); object-fit: contain; }
.lightbox-metadata { margin: 10px 0 0; color: var(--caption); font-size: 12px; line-height: 1.5; text-align: center; overflow-wrap: anywhere; }
.lightbox-footer { text-align: center; padding: 12px 16px 8px; font-size: 13px; line-height: 1.5; }
.lightbox-status { margin: 0 0 8px; }
.lightbox-status:empty { display: none; }
.lightbox-status { color: var(--muted); }
.lightbox-controls { display: flex; align-items: center; justify-content: center; gap: 16px; }
.lightbox-controls button { font-size: 23px; }
.lightbox-counter { min-width: 64px; font-variant-numeric: tabular-nums; color: var(--muted); }
@media (max-height: 500px) { .lightbox[open] { grid-template-rows: 48px minmax(0, 1fr) auto; } .lightbox-footer { padding-top: 4px; } }

.archive-toggle { font: inherit; color: inherit; border: 0; background: none; padding: 0; cursor: pointer; }
.archive-toggle:hover { text-decoration: underline; text-underline-offset: 3px; }
.archive-years { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; max-width: 720px; margin: 14px auto 0; }
.archive-years[hidden] { display: none; }
.archive-years a { padding: 8px 0; }
.archive-years [aria-current] { font-weight: 700; }
