:root {
  --paper: #ffffff;
  --ink: #111111;
  --muted: #77736d;
  --side: clamp(12px, 1.1vw, 18px);
  --gap: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.site-header {
  padding: 18px var(--side) 20px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
}
.identity { display: flex; align-items: baseline; gap: 10px; }
.name { font-size: 13px; letter-spacing: .12em; font-weight: 600; }
.subtitle { font-size: 11px; color: var(--muted); }
nav { display: flex; gap: 16px; font-size: 11px; }
nav a, .email { border-bottom: 1px solid transparent; }
nav a:hover, .email:hover { border-color: currentColor; }

/*
  Masonry gallery: equal-width columns, compact spacing and natural image
  proportions. JavaScript distributes each new image to the currently
  shortest column, so portrait and landscape mixes stay visually balanced.
*/
.gallery {
  width: calc(100% - (2 * var(--side)));
  max-width: 1900px;
  margin: 0 auto;
  padding-bottom: 42px;
}
.masonry-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 5), minmax(0, 1fr));
  gap: var(--gap);
  align-items: start;
}
.masonry-column {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
  min-width: 0;
}
.photo { margin: 0; overflow: hidden; }
.photo-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.photo img {
  display: block;
  width: 100%;
  height: auto;
}

.contact-page {
  width: min(760px, calc(100% - (2 * var(--side))));
  margin: 0 auto;
  padding: min(18vh, 150px) 0 80px;
}
.contact-card {
  max-width: 520px;
  font-size: clamp(18px, 2.2vw, 28px);
  line-height: 1.35;
}
.contact-card p { margin: 0 0 22px; }
.email { font-size: 13px; }

.lightbox {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(8,8,8,.97);
  overflow: hidden;
}
.lightbox::backdrop { background: #080808; }
.lightbox[open] { display: grid; place-items: center; }
.lightbox img { max-width: 92vw; max-height: 90vh; width: auto; height: auto; object-fit: contain; }
.close, .nav {
  position: fixed;
  z-index: 2;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  opacity: .72;
}
.close:hover, .nav:hover { opacity: 1; }
.close { top: 16px; right: 22px; font-size: 36px; line-height: 1; }
.nav { top: 50%; transform: translateY(-50%); font-size: 26px; padding: 18px; }
.prev { left: 6px; }
.next { right: 6px; }

@media (max-width: 620px) {
  :root { --gap: 7px; }
  .site-header { padding-top: 16px; padding-bottom: 18px; }
  .identity { flex-direction: column; gap: 3px; }
  .gallery { width: calc(100% - 16px); }
  .masonry-grid { grid-template-columns: 1fr; }
  .nav { display: none; }
  .lightbox img { max-width: 96vw; max-height: 88vh; }
  .contact-page { padding-top: 18vh; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
