:root {
  --bg: #fdfdfd;
  --fg: #111214;
  --muted: #6b6e73;
  --line: #e7e8ea;
  --placeholder: #eceded;
  --gap: clamp(6px, 0.9vw, 12px);
  --pad: clamp(20px, 4vw, 56px);
  --row: clamp(150px, 21vw, 300px);
  --sans: "Avenir Next", "Helvetica Neue", Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d0e0f;
    --fg: #e9eaec;
    --muted: #8b8e94;
    --line: #232527;
    --placeholder: #17181a;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

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

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--fg); color: var(--bg); padding: 8px 12px; z-index: 100;
}
.skip:focus { left: 8px; }

/* Header and footer */
header.site {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: var(--pad) var(--pad) clamp(20px, 3vw, 36px);
}

.brand {
  font-size: 1.15rem;
  font-weight: 400;
  letter-spacing: 0.01em;
}

header.site nav { display: flex; gap: clamp(18px, 3vw, 32px); }

header.site nav a {
  color: var(--muted);
  font-size: 0.95rem;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.15s;
}
header.site nav a:hover { color: var(--fg); }
header.site nav a[aria-current="page"] { color: var(--fg); border-bottom-color: var(--fg); }

footer.site {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 24px;
  padding: clamp(40px, 8vw, 96px) var(--pad) var(--pad);
  color: var(--muted);
  font-size: 0.9rem;
}
footer.site a:hover { color: var(--fg); }
footer.site .links { display: flex; gap: 20px; }

main { padding: 0 var(--pad); min-height: 55vh; outline: none; }

/* Page headings */
.page-head { margin: 0 0 clamp(24px, 4vw, 44px); }
.page-head h1 {
  margin: 0 0 6px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  font-weight: 300;
  letter-spacing: -0.005em;
  line-height: 1.2;
}
.page-head p { margin: 0; color: var(--muted); max-width: 58ch; }

.back {
  display: inline-block;
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 18px;
}
.back:hover { color: var(--fg); }

/* Photo rows: every row is the same height, photos keep their own proportions */
.rows { display: flex; flex-wrap: wrap; gap: var(--gap); }
.rows::after { content: ""; flex-grow: 1000000; }

.rows figure {
  --ar: 1.5;
  margin: 0;
  flex: var(--ar) 1 calc(var(--ar) * var(--row));
  aspect-ratio: var(--ar);
  min-width: 0;
}

.rows button {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: var(--placeholder);
  cursor: zoom-in;
  overflow: hidden;
}

.rows img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.2s;
}
.rows button:hover img { opacity: 0.88; }

/* Album cards */
.albums {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: clamp(24px, 3vw, 40px) var(--gap);
}
.card { display: block; }
.card .thumb { aspect-ratio: 3 / 2; background: var(--placeholder); overflow: hidden; }
.card img { display: block; width: 100%; height: 100%; object-fit: cover; transition: opacity 0.2s; }
.card:hover img { opacity: 0.88; }
.card h2 { margin: 12px 0 0; font-size: 1.05rem; font-weight: 400; }
.card p { margin: 0; color: var(--muted); font-size: 0.9rem; }

/* About */
.about { display: grid; gap: 32px clamp(32px, 6vw, 80px); grid-template-columns: 1fr; max-width: 980px; }
.about.with-portrait { grid-template-columns: minmax(0, 320px) minmax(0, 1fr); }
@media (max-width: 720px) { .about.with-portrait { grid-template-columns: 1fr; } }
.about img { display: block; width: 100%; height: auto; }
.about .copy { max-width: 60ch; font-size: 1.1rem; line-height: 1.7; }
.about .copy p { margin: 0 0 1.1em; }
.about .copy a { border-bottom: 1px solid var(--line); }
.about .copy a:hover { border-bottom-color: var(--fg); }

.empty { color: var(--muted); max-width: 52ch; }

/* Viewer: the photo, with its text beside it */
#lb {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  background: var(--bg);
}
#lb[hidden] { display: none; }

.lb-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: clamp(56px, 6vw, 72px) clamp(16px, 3vw, 40px);
}
.lb-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.lb-side {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 24px;
  padding: clamp(56px, 6vw, 72px) clamp(24px, 3vw, 40px) clamp(24px, 3vw, 40px);
  border-left: 1px solid var(--line);
  overflow: auto;
}
.lb-text h2 { margin: 0 0 10px; font-size: 1.25rem; font-weight: 400; line-height: 1.3; }
.lb-text p { margin: 0 0 0.9em; max-width: 52ch; }
.lb-text .meta { color: var(--muted); font-size: 0.9rem; margin-top: 16px; }
.lb-count { color: var(--muted); font-size: 0.85rem; font-variant-numeric: tabular-nums; }

.lb-btn {
  position: absolute;
  background: none;
  border: 0;
  padding: 8px 10px;
  color: var(--muted);
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
}
.lb-btn:hover { color: var(--fg); }
.lb-close { top: 14px; right: 18px; }
.lb-prev { left: clamp(8px, 2vw, 24px); bottom: 14px; }
.lb-next { left: clamp(64px, 6vw, 88px); bottom: 14px; }

@media (max-width: 800px) {
  #lb { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
  .lb-stage { padding: 56px 12px 12px; }
  .lb-side { border-left: 0; border-top: 1px solid var(--line); max-height: 36vh; padding: 20px 20px 64px; justify-content: flex-start; }
  .lb-count { display: none; }
  .lb-prev { left: 12px; bottom: 16px; }
  .lb-next { left: auto; right: 12px; bottom: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
