:root {
  --bg: #16120d;
  --ink: #d8cbb8;
  --ink-dim: #8a7c68;
  --gutter: 10px;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  font: 15px/1.5 Georgia, 'Times New Roman', serif;
  color: var(--ink);
  background: var(--bg);
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 46px;
  padding: 0 18px;
  background: color-mix(in srgb, var(--bg) 65%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.3s ease;
}

.topbar.hidden { transform: translateY(-100%); }

.topbar-title {
  margin: 0;
  font-size: 15px;
  font-weight: normal;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
}

.about-open {
  background: none;
  border: 0;
  color: var(--ink-dim);
  font: inherit;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  padding: 6px 8px;
}

.about-open:hover, .about-open:focus-visible { color: var(--ink); }

#grid {
  position: relative;
  margin: 46px auto 0;
  padding-top: var(--gutter);
}

.tile {
  position: absolute;
  overflow: hidden;
  border-radius: 2px;
  background: #221c14; /* placeholder while the image loads */
  cursor: pointer;
  padding: 0;
  border: 0;
}

/* Warm, slow sheen while the tile's image is still on its way. */
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg,
    transparent 40%,
    rgba(216, 203, 184, 0.07) 50%,
    transparent 60%);
  background-size: 250% 100%;
  animation: shimmer 2.4s ease-in-out infinite;
}

.tile:has(img.loaded)::before {
  animation: none;
  opacity: 0;
}

@keyframes shimmer {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .tile::before { animation: none; }
}

.tile img {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.9s ease;
}

.tile img.loaded { opacity: 1; }

.tile:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

#sentinel { height: 2px; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 8, 5, 0.94);
}

.lightbox[hidden] { display: none; }

.lb-figure {
  margin: 0;
  max-width: min(92vw, 1400px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.lb-img {
  max-width: 100%;
  max-height: calc(92vh - 70px);
  object-fit: contain;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  transition: filter 0.35s ease;
}

/* Blur-up: cached thumb shows instantly, softened until the full
   derivative decodes and swaps in. */
.lb-img.lb-loading { filter: blur(8px); }

.lb-caption {
  text-align: center;
  max-width: 70ch;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lb-title { font-style: italic; }

.lb-meta { color: var(--ink-dim); font-size: 13px; }

.lb-source {
  color: var(--ink-dim);
  font-size: 13px;
  text-decoration: underline;
}

.lb-source:hover { color: var(--ink); }

.lb-close, .lb-prev, .lb-next {
  position: fixed;
  z-index: 101;
  background: none;
  border: 0;
  color: var(--ink);
  font: 40px/1 Georgia, serif;
  cursor: pointer;
  padding: 12px 18px;
  opacity: 0.7;
}

.lb-close:hover, .lb-prev:hover, .lb-next:hover { opacity: 1; }

.lb-close { top: 8px; right: 12px; }
.lb-prev { left: 6px; top: 50%; transform: translateY(-50%); }
.lb-next { right: 6px; top: 50%; transform: translateY(-50%); }

body.lightbox-open { overflow: hidden; }

/* ---------------------------------------------------------------- about */

.about {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 8, 5, 0.9);
}

.about[hidden] { display: none; }

.about-panel {
  position: relative;
  max-width: 60ch;
  margin: 20px;
  padding: 32px 36px;
  background: #1e1812;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6);
  line-height: 1.65;
}

.about-panel h2 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: normal;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.about-panel p { margin: 0 0 12px; }
.about-panel p:last-child { margin-bottom: 0; }

.about-panel a { color: var(--ink); text-decoration: underline; }
.about-panel a:hover { color: #fff; }

.about-close {
  position: absolute;
  top: 6px;
  right: 10px;
  background: none;
  border: 0;
  color: var(--ink-dim);
  font: 26px/1 Georgia, serif;
  cursor: pointer;
  padding: 8px;
}

.about-close:hover, .about-close:focus-visible { color: var(--ink); }

body.about-open-scroll-lock { overflow: hidden; }
