:root {
  --bg: #fafaf8;
  --fg: #151515;
  --muted: #777;
  --accent: #e0227e; /* pink for the current page in the nav */
  --placeholder: #e8e8e4;
  --gap: 10px;
  --row-h: clamp(260px, 22vw, 620px); /* target row height; grows with the screen. Raise the numbers for bigger photos */
  --pad: clamp(14px, 3vw, 32px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101010;
    --fg: #ececec;
    --muted: #8a8a8a;
    --accent: #ff5fae;
    --placeholder: #1c1c1c;
  }
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.6 ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
}

a {
  color: inherit;
}

/* Left sidebar: site title, then the page links stacked underneath */
.site-header {
  grid-row: 1 / span 2;
  position: sticky;
  top: 0;
  align-self: start;
  max-height: 100vh;
  overflow-y: auto;
  padding: var(--pad);
}

.site-title {
  display: block;
  margin-bottom: 18px;
  text-decoration: none;
  font-weight: 600;
}

.site-header nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.site-header nav a {
  text-decoration: none;
  color: var(--muted);
}

.site-header nav a:hover {
  color: var(--fg);
}

.site-header nav a[aria-current="page"] {
  color: var(--accent);
}

main {
  grid-column: 2;
  padding: var(--pad) var(--pad) var(--pad) 0;
}

.site-footer {
  grid-column: 2;
}

@media (max-width: 700px) {
  :root {
    --row-h: 300px;
  }

  body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
  }

  .site-header {
    grid-row: auto;
    position: static;
    max-height: none;
    padding-bottom: 12px;
  }

  .site-title {
    margin-bottom: 8px;
  }

  .site-header nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px 20px;
  }

  main,
  .site-footer {
    grid-column: 1;
  }

  main {
    padding: 0 var(--pad) var(--pad);
  }
}

/* Justified rows: photos read left to right, each row fills the width.
   --ar is the photo's aspect ratio, set inline on each figure. */
.group + .group {
  margin-top: 44px;
}

.group h2 {
  margin: 0 0 12px;
  font-size: 15px;
  font-weight: 400;
  color: var(--muted);
}

.gallery {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
}


.gallery figure {
  margin: 0;
  background: var(--placeholder);
  flex-grow: calc(var(--ar) * 100);
  flex-basis: calc(var(--ar) * var(--row-h));
  /* a short last row may grow, but not past 1.5x the normal size */
  max-width: calc(var(--ar) * var(--row-h) * 1.5);
  min-width: 0;
}

.gallery a {
  display: block;
  cursor: zoom-in;
}

.gallery img {
  display: block;
  width: 100%;
  height: auto;
}

.text,
.empty {
  max-width: 62ch;
}

.text p {
  margin: 0 0 1.2em;
}

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

/* Lightbox */
.lb {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.94);
  display: flex;
  align-items: center;
  justify-content: center;
}

.lb[hidden] {
  display: none;
}

.lb img {
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  object-fit: contain;
}

.lb button {
  position: absolute;
  background: none;
  border: 0;
  color: #fff;
  font: inherit;
  font-size: 34px;
  line-height: 1;
  padding: 16px 20px;
  cursor: pointer;
  opacity: 0.7;
}

.lb button:hover,
.lb button:focus-visible {
  opacity: 1;
}

.lb-close {
  top: 0;
  right: 0;
}

.lb-prev {
  left: 0;
  top: 50%;
  transform: translateY(-50%);
}

.lb-next {
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

body.lb-open {
  overflow: hidden;
}

@media (max-width: 600px) {
  .lb-prev,
  .lb-next {
    display: none;
  }
}
