* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
button, a { -webkit-tap-highlight-color: transparent; }
.gallery-navigation { position: fixed; z-index: 10; left: 32px; bottom: max(30px, env(safe-area-inset-bottom)); }
.gallery-navigation a {
  display: inline-flex;
  align-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0 8px;
  background: color-mix(in srgb, var(--page-bg) 88%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 13px;
  letter-spacing: -.025em;
  text-decoration: none;
}
.gallery-navigation a:hover { text-decoration: underline; text-underline-offset: 4px; }
main { padding: calc(var(--nav-h) + clamp(24px, 3vw, 48px)) clamp(20px, 4vw, 64px) clamp(64px, 8vw, 112px); }
.photo-field {
  display: grid;
  grid-template-columns: repeat(24, minmax(0, 1fr));
  column-gap: clamp(4px, .65vw, 10px);
  row-gap: clamp(54px, 6vw, 96px);
  align-items: start;
  max-width: 1440px;
  margin: 0 auto;
}
.photo {
  grid-column: var(--column) / span var(--span);
  grid-row: var(--row);
  margin: clamp(0px, var(--offset), 180px) 0 0;
  min-width: 0;
}
.photo-link { display: block; position: relative; text-decoration: none; cursor: zoom-in; }
.photo-frame {
  display: block;
  overflow: hidden;
  aspect-ratio: var(--ratio);
  background: color-mix(in srgb, var(--ink) 7%, var(--page-bg));
}
.photo picture, .photo img { display: block; width: 100%; height: 100%; }
.photo img {
  object-fit: cover;
  object-position: var(--crop-x, 50%) var(--crop-y, 50%);
  transition: filter .2s ease;
}
.photo figcaption {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-top: 11px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
  letter-spacing: .025em;
}
.photo-number { font-variant-numeric: tabular-nums; opacity: .55; }
@media (hover: hover) {
  .photo-link:hover img { filter: brightness(1.07); }
  .photo-link:hover + figcaption { color: var(--ink); }
}
.gallery-message { color: var(--muted); font-size: 13px; }

html[data-viewer-open] { overflow: hidden; }
.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 20px clamp(20px, 4vw, 64px);
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: hidden;
}
.lightbox[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: 20px; }
.lightbox::backdrop { background: color-mix(in srgb, var(--page-bg) 94%, transparent); backdrop-filter: blur(10px); }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; font-size: 12px; }
.viewer-bar p { margin: 0; }
#viewer-count { font-variant-numeric: tabular-nums; color: var(--muted); }
.viewer-bar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
#viewer-close { line-height: 1; }
.viewer-close-icon { display: block; flex: none; }
.viewer-controls { display: flex; gap: 16px; }
.viewer-controls button { font-size: 22px; }
.viewer-stage { position: relative; min-height: 0; min-width: 0; touch-action: pan-y pinch-zoom; }
.viewer-stage picture { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; pointer-events: none; }
.viewer-stage img { display: block; width: auto; height: auto; max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: auto; }
.viewer-stage picture { animation: photo-arrive .16s ease-out; }
@keyframes photo-arrive { from { opacity: .45; } to { opacity: 1; } }

@media (max-width: 650px) {
  main { padding: calc(var(--nav-h) + 22px) 22px 100px; }
  .photo-field { display: flex; flex-direction: column; gap: 54px; }
  .photo { width: var(--mobile-width); align-self: var(--mobile-align); margin: 0; }
  .photo figcaption { font-size: 10px; padding-top: 9px; gap: 10px; }
  .lightbox { padding: max(10px, env(safe-area-inset-top)) 18px max(10px, env(safe-area-inset-bottom)); }
  .lightbox[open] { gap: 12px; }
  .viewer-controls { gap: 12px; }
}
@media (max-width: 560px) {
  .gallery-navigation { left: 18px; bottom: max(26px, env(safe-area-inset-bottom)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
