:root {
  color-scheme: dark;
  --black: #000;
  --white: #fff;
  --muted: #929292;
  --line: rgba(255, 255, 255, 0.2);
  --page: min(100% - 40px, 1440px);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--black); }
body { margin: 0; min-width: 320px; background: var(--black); color: var(--white); font-family: Arial, Helvetica, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: inherit; }

.backdrop { --logo-gutter: clamp(32px, 7vw, 112px); position: fixed; z-index: 0; inset: 0; overflow: hidden; pointer-events: none; }
.backdrop::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0, 0, 0, 0.36), #000 94%); }
.backdrop-logo { position: absolute; top: var(--logo-gutter); left: var(--logo-gutter); width: calc(100% - var(--logo-gutter) - var(--logo-gutter)); height: calc(100% - var(--logo-gutter) - var(--logo-gutter)); object-fit: contain; opacity: 0.3; filter: grayscale(1) contrast(1.35); }

.site-header { position: fixed; z-index: 20; top: 0; left: 0; width: 100%; border-bottom: 1px solid var(--line); background: rgba(0, 0, 0, 0.88); backdrop-filter: blur(12px); }
.header-inner { width: var(--page); min-height: 72px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.wordmark, .header-nav a, .footer-note { font-size: 11px; font-weight: 700; letter-spacing: 0.18em; text-transform: uppercase; }
.wordmark, .header-nav a { text-decoration: none; }
.header-nav { display: flex; align-items: center; gap: clamp(18px, 3vw, 44px); }
.header-nav a { color: var(--muted); }
.header-nav a:hover, .header-nav a:focus-visible, .header-nav a[aria-current] { color: var(--white); }

.site-footer { position: relative; z-index: 2; border-top: 1px solid var(--line); background: var(--black); }
.footer-inner { width: var(--page); min-height: 76px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.footer-note { margin: 0; color: var(--muted); }

/* Photo albums listing */
.photos-page { position: relative; z-index: 1; width: var(--page); min-height: 100svh; margin: 0 auto; padding: clamp(130px, 16vh, 190px) 0 80px; }
.page-title { margin: 0 0 clamp(40px, 6vw, 88px); font-size: clamp(34px, 6vw, 88px); line-height: 0.94; letter-spacing: -0.05em; text-transform: uppercase; }

.album-grid { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: clamp(24px, 3vw, 40px); }
.album-card { display: block; text-decoration: none; }
.album-cover { position: relative; aspect-ratio: 4 / 3; display: grid; gap: 2px; overflow: hidden; border: 1px solid var(--line); background: #080808; }
.album-cover img { width: 100%; height: 100%; display: block; object-fit: cover; filter: grayscale(0.15); transition: transform 0.4s ease, filter 0.4s ease; }
.album-card:hover .album-cover img, .album-card:focus-visible .album-cover img { transform: scale(1.03); filter: none; }

/* Mosaic cover: up to 16 shuffled thumbnails in a 4-col grid, animated in via covers.js (anime.js). */
.album-cover--mosaic { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 1fr; }
/* Without this, a grid item's automatic minimum size falls back to its
   intrinsic (photo) aspect ratio, so an album with mostly portrait photos
   gets visibly taller mosaic rows than one with mostly landscape photos —
   every tile must be forced to the grid cell's shape, never the source
   photo's, so all albums render identically regardless of what was shot. */
.cover-thumb { min-width: 0; min-height: 0; will-change: transform, opacity; }
.album-meta { margin-top: 16px; display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.album-title { margin: 0; font-size: clamp(17px, 2vw, 24px); font-weight: 700; letter-spacing: -0.02em; text-transform: uppercase; }
.album-count { flex: 0 0 auto; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }

/* Album detail */
.album-page-header { margin-bottom: clamp(40px, 6vw, 80px); padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.album-back { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none; }
.album-back:hover, .album-back:focus-visible { color: var(--white); }
.album-page-title { margin: 0 0 10px; font-size: clamp(26px, 5vw, 60px); line-height: 1; letter-spacing: -0.04em; text-transform: uppercase; }
.album-page-date { margin: 0; color: var(--muted); font-size: 13px; }

.photographer-group + .photographer-group { margin-top: clamp(56px, 7vw, 96px); }
.photographer-heading { margin: 0 0 20px; padding-bottom: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; }
.photographer-heading strong { color: var(--white); font-weight: 700; }
.photographer-links { display: flex; align-items: center; gap: 8px; }
.photographer-links a { color: var(--muted); text-decoration: none; }
.photographer-links a:hover, .photographer-links a:focus-visible { color: var(--white); }
.photo-grid { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px; }
.photo-thumb { position: relative; width: 100%; aspect-ratio: 3 / 2; padding: 0; border: 0; background: #080808; overflow: hidden; cursor: zoom-in; }
.photo-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; filter: grayscale(0.1); transition: transform 0.35s ease, filter 0.35s ease; }
.photo-thumb:hover img, .photo-thumb:focus-visible img { transform: scale(1.05); filter: none; }

/* Viewer */
.viewer { position: fixed; inset: 0; z-index: 50; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #000; color: #fff; }
.viewer::backdrop { background: rgba(0, 0, 0, 0.94); }
.viewer[open] { display: block; }
/* Fullscreened element must be a dialog descendant, not the dialog itself
   (Chrome/Firefox throw on requestFullscreen() called on a <dialog>). */
.viewer-inner { position: relative; width: 100%; height: 100%; display: flex; flex-direction: column; background: #000; }
.viewer-inner:fullscreen { width: 100vw; height: 100vh; }
.viewer-counter { position: absolute; top: 18px; left: 18px; z-index: 5; font-size: 10px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.viewer-close { position: absolute; top: 14px; right: 14px; z-index: 6; width: 44px; height: 44px; display: grid; place-items: center; border: 1px solid var(--line); background: rgba(0, 0, 0, 0.5); color: #fff; cursor: pointer; transition: opacity 0.25s ease, border-color 0.15s ease, background 0.15s ease, color 0.15s ease; }
.viewer-close:hover, .viewer-close:focus-visible { border-color: #fff; background: #fff; color: #000; outline: none; }
.viewer-close svg { width: 16px; height: 16px; display: block; }
.viewer-close svg path { fill: currentColor; }
.viewer.is-fullscreen .viewer-close, .viewer.is-fullscreen .viewer-controls { opacity: 0; pointer-events: none; }
.viewer.is-fullscreen.controls-visible .viewer-close, .viewer.is-fullscreen.controls-visible .viewer-controls { opacity: 1; pointer-events: auto; }

.viewer-stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: clamp(40px, 8vh, 110px) clamp(24px, 8vw, 110px); overflow: hidden; }
.viewer-inner:fullscreen .viewer-stage, .viewer.is-fullscreen .viewer-stage { padding: 0; }

.viewer-image { max-width: 100%; max-height: 100%; width: auto; height: auto; display: block; object-fit: contain; outline: 1px solid var(--line); cursor: zoom-in; user-select: none; -webkit-user-drag: none; touch-action: none; will-change: transform; transform-origin: center center; }
.viewer-inner:fullscreen .viewer-image, .viewer.is-fullscreen .viewer-image { outline: 0; }
.viewer-image.is-zoomed { cursor: grab; }
.viewer-image.is-panning { cursor: grabbing; }

.viewer-tap { position: absolute; top: 0; bottom: 0; width: 50%; padding: 0; border: 0; background: transparent; }
.viewer-tap--prev { left: 0; cursor: w-resize; }
.viewer-tap--next { right: 0; cursor: e-resize; }
.viewer-inner:fullscreen .viewer-tap, .viewer.is-fullscreen .viewer-tap { display: none; }

.viewer-controls { position: relative; z-index: 5; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px 0 max(16px, env(safe-area-inset-bottom)); transition: opacity 0.25s ease; }
.viewer-btn { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.04); color: #fff; cursor: pointer; transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, opacity 0.15s ease; }
.viewer-btn:hover, .viewer-btn:focus-visible { border-color: #fff; background: #fff; color: #000; outline: none; }
.viewer-btn svg { width: 18px; height: 18px; display: block; }
.viewer-btn svg path { fill: currentColor; }
.viewer-btn[disabled] { opacity: 0.3; pointer-events: none; }
.viewer-btn--fullscreen.is-active { border-color: #fff; }

@media (max-width: 640px) {
  :root { --page: min(100% - 28px, 1440px); }
  .header-inner { min-height: 62px; }
  .header-nav { gap: 9px; }
  .header-nav a { font-size: 8px; letter-spacing: 0.08em; }
  .backdrop { --logo-gutter: 22px; }
  .photos-page { padding-top: 118px; }
  .album-grid { grid-template-columns: 1fr; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .viewer-controls { gap: 10px; }
  .viewer-btn { width: 42px; height: 42px; }
  .viewer-close { width: 40px; height: 40px; }
  .viewer-stage { padding: clamp(20px, 6vh, 56px) clamp(16px, 5vw, 56px); }
}
