:root {
  --bg: #f6f5f2;
  --fg: #1b1b1a;
  --muted: #7a776f;
  --line: #e2dfd8;
  --tile: #e9e6df;
  --gap: 6px;
  --pad: clamp(16px, 4vw, 48px);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111110;
    --fg: #ecebe7;
    --muted: #8d8a82;
    --line: #262624;
    --tile: #1c1c1a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.55 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: inherit; }
main { flex: 1; padding: 0 var(--pad) 48px; }

/* Header */
.site-header {
  display: flex;
  align-items: baseline;
  gap: 12px 32px;
  flex-wrap: wrap;
  padding: 28px var(--pad) 24px;
}
.site-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav {
  display: flex;
  gap: 22px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 0;
  border-bottom: 1px solid transparent;
}
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--fg); border-bottom-color: currentColor; }

.site-footer {
  padding: 24px var(--pad) 32px;
  font-size: 13px;
  color: var(--muted);
}

.tagline {
  max-width: 40em;
  margin: 8px 0 36px;
  font-size: clamp(18px, 2.2vw, 24px);
  line-height: 1.4;
  color: var(--muted);
}
.empty { color: var(--muted); }

/* Home: gallery cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 36px 20px;
}
.card { text-decoration: none; display: grid; gap: 2px; }
.card-image {
  aspect-ratio: 4 / 3;
  background: var(--tile);
  overflow: hidden;
  margin-bottom: 10px;
}
.card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}
.card:hover .card-image img { transform: scale(1.025); }
.card-title { font-size: 16px; font-weight: 500; }
.card-count { font-size: 13px; color: var(--muted); }

/* Gallery page */
.gallery-head { margin: 8px 0 28px; max-width: 46em; }
.gallery-head h1 {
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 10px;
}
.description { color: var(--muted); }
.description p { margin: 0 0 0.8em; }

/* Justified grid: each tile grows in proportion to its aspect ratio (--r),
   so every row ends up the same height without any JavaScript. */
.grid {
  --row: 320px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}
.grid::after { content: ""; flex-grow: 1000000; }
.tile {
  flex: calc(var(--r) * 1000) 1 calc(var(--r) * var(--row));
  aspect-ratio: var(--r);
  background: var(--tile);
  overflow: hidden;
  display: block;
  cursor: zoom-in;
}
.tile picture, .tile img { display: block; width: 100%; height: 100%; }
.tile img { object-fit: cover; }

@media (max-width: 1100px) { .grid { --row: 260px; } }
@media (max-width: 640px) {
  :root { --gap: 4px; }
  .grid { --row: 170px; }
  .site-header { padding-top: 20px; padding-bottom: 16px; }
}

/* PhotoSwipe caption */
.pswp__custom-caption {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  max-width: min(90vw, 720px);
  padding: 8px 14px;
  font-size: 14px;
  line-height: 1.4;
  color: #f2f1ed;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 6px;
  text-align: center;
}
.pswp__custom-caption[hidden] { display: none; }

/* About page: portrait beside the text, stacked on phones */
.about {
  display: grid;
  grid-template-columns: minmax(0, 420px) minmax(0, 36em);
  gap: clamp(24px, 5vw, 64px);
  align-items: start;
  margin-top: 8px;
}
.about.no-photo { grid-template-columns: minmax(0, 40em); }
.about-photo img { display: block; width: 100%; height: auto; background: var(--tile); }
.about-text h1 {
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin: 0 0 18px;
}
.about-text p { margin: 0 0 1em; font-size: 17px; line-height: 1.65; }
.about-contact {
  display: grid;
  gap: 2px;
  margin-top: 32px !important;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
.about-contact span { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }
.about-contact a { text-underline-offset: 3px; }
@media (max-width: 760px) {
  .about { grid-template-columns: minmax(0, 1fr); }
}
