:root {
  --bg: #fafaf8;
  --fg: #1b1b1a;
  --muted: #6b6b66;
  --line: #e2e2dc;
  --card: #f0f0ec;
  --gap: 8px;
  --row: 230px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121211; --fg: #ecece8; --muted: #9a9a93; --line: #2b2b28; --card: #1c1c1a; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: 8px; top: 8px; background: var(--bg); padding: 8px 12px; z-index: 10; }

.site-header, main, .site-footer { max-width: 1400px; margin: 0 auto; padding: 0 20px; }
.site-header {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 8px 24px; padding-top: 22px; padding-bottom: 18px;
}
.brand { font-size: 1.35rem; font-weight: 600; letter-spacing: .04em; text-decoration: none; }
nav ul { display: flex; flex-wrap: wrap; gap: 4px 22px; list-style: none; margin: 0; padding: 0; }
nav a { text-decoration: none; color: var(--muted); padding: 4px 0; border-bottom: 1px solid transparent; }
nav a:hover, nav a[aria-current] { color: var(--fg); border-bottom-color: var(--fg); }

main { padding-bottom: 56px; min-height: 60vh; }
h1 { font-size: clamp(1.6rem, 3.5vw, 2.3rem); font-weight: 500; margin: 18px 0 22px; }
h2 { font-size: 1.15rem; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; margin: 44px 0 14px; }
h2 a { text-decoration: none; }
h2 a:hover { text-decoration: underline; }
.crumb { margin: 18px 0 -12px; font-size: .9rem; letter-spacing: .08em; text-transform: uppercase; }
.crumb a { color: var(--muted); text-decoration: none; }
.crumb a:hover { color: var(--fg); }
.lead { font-size: 1.15rem; margin-bottom: 4px; }

.hero { padding: 34px 0 6px; }
.hero h1 { font-size: clamp(2.2rem, 7vw, 4rem); margin: 0; letter-spacing: .02em; }
.hero p { color: var(--muted); margin: 6px 0 0; font-size: 1.1rem; }

.cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px; list-style: none; margin: 0; padding: 0;
}
.card { display: block; text-decoration: none; background: var(--card); border-radius: 4px; overflow: hidden; }
.card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; transition: transform .35s ease; }
.card:hover img, .card:focus-visible img { transform: scale(1.03); }
.card-text { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 11px 14px 13px; }
.card-title { font-weight: 500; }
.count { color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* Justified rows: each item grows in proportion to its aspect ratio. */
.gallery { display: flex; flex-wrap: wrap; gap: var(--gap); }
.gallery::after { content: ""; flex: 10 1 0; }
.shot { display: block; height: var(--row); overflow: hidden; background: var(--card); border-radius: 2px; cursor: zoom-in; }
.shot img { width: 100%; height: 100%; object-fit: cover; transition: opacity .2s; }
.shot:hover img, .shot:focus-visible img { opacity: .86; }
.r06 { flex: 0.6 1 calc(var(--row) * 0.6); }
.r07 { flex: 0.75 1 calc(var(--row) * 0.75); }
.r10 { flex: 1 1 calc(var(--row) * 1); }
.r13 { flex: 1.33 1 calc(var(--row) * 1.33); }
.r15 { flex: 1.5 1 calc(var(--row) * 1.5); }
.r18 { flex: 1.78 1 calc(var(--row) * 1.78); }
.r24 { flex: 2.4 1 calc(var(--row) * 2.4); }
@media (max-width: 640px) {
  :root { --row: 150px; --gap: 5px; }
  .site-header, main, .site-footer { padding-left: 14px; padding-right: 14px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

.site-footer { border-top: 1px solid var(--line); padding-top: 18px; padding-bottom: 34px; color: var(--muted); font-size: .9rem; }

:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

/* Image viewer */
.viewer {
  border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; height: 100dvh;
  max-width: none; max-height: none; background: #0b0b0b; color: #eee;
}
.viewer::backdrop { background: #0b0b0b; }
.viewer-stage { position: absolute; inset: 0 0 52px 0; display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.viewer-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.viewer-bar {
  position: absolute; left: 0; right: 0; bottom: 0; height: 52px; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; font-size: .9rem;
}
.viewer-caption { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-count { color: #aaa; white-space: nowrap; font-variant-numeric: tabular-nums; }
.viewer button {
  position: absolute; background: rgba(0, 0, 0, .35); color: #eee; border: 0; cursor: pointer;
  font: inherit; font-size: 1.7rem; line-height: 1; width: 48px; height: 48px; border-radius: 50%;
}
.viewer button:hover { background: rgba(255, 255, 255, .16); }
.viewer button:focus-visible { outline: 2px solid #eee; }
.viewer-close { top: 12px; right: 12px; }
.viewer-prev { left: 12px; top: calc(50% - 50px); }
.viewer-next { right: 12px; top: calc(50% - 50px); }
@media (max-width: 640px) { .viewer-prev, .viewer-next { display: none; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
