:root {
  --bg: #fafaf8;
  --fg: #151515;
  --muted: #777;
  --placeholder: #e8e8e4;
  --gap: 10px;
  --pad: clamp(14px, 3vw, 32px);
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101010;
    --fg: #ececec;
    --muted: #8a8a8a;
    --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: flex;
  flex-direction: column;
}

a {
  color: inherit;
}

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 24px;
  padding: var(--pad);
}

.site-title {
  text-decoration: none;
  font-weight: 600;
}

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

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

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

.site-header nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 4px;
}

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

/* Masonry gallery using CSS columns */
.gallery {
  column-width: 340px;
  column-gap: var(--gap);
}

.gallery figure {
  margin: 0 0 var(--gap);
  break-inside: avoid;
  background: var(--placeholder);
}

.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;
  }
}
