:root {
  --bg: #f1f2ee;
  --ink: #17201c;
  --muted: #5d6862;
  --line: #d6d9d2;
  --accent: #2547d0;
  --accent-ink: #fff;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14181a;
    --ink: #eceee9;
    --muted: #9aa49e;
    --line: #2b3236;
    --accent: #7b96ff;
    --accent-ink: #0e1224;
  }
}

* { box-sizing: border-box; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
}
.wrap { max-width: 1200px; margin: 0 auto; padding: 56px 24px 80px; }

.head h1 {
  font-size: clamp(2.8rem, 9vw, 6rem);
  font-weight: 800;
  line-height: .95;
  letter-spacing: -0.04em;
}
.head p { margin-top: 16px; color: var(--muted); max-width: 46ch; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 36px 0 28px; }
.chip {
  font: inherit; font-size: .95rem;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent; color: var(--ink);
  cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.chip:hover { border-color: var(--ink); }
.chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip:focus-visible, .item a:focus-visible, .lb-btn:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px;
}

/* Masonry grid */
.grid { columns: 3 280px; column-gap: 16px; }
.item { break-inside: avoid; margin-bottom: 16px; }
.item[hidden] { display: none; }
.item a {
  display: block; position: relative; overflow: hidden;
  border-radius: var(--radius); background: var(--line);
}
.item img {
  display: block; width: 100%; height: auto;
  transition: transform .5s cubic-bezier(.2,.7,.2,1);
}
.item figcaption {
  position: absolute; inset: auto 0 0 0;
  padding: 36px 16px 14px;
  color: #fff; font-weight: 600;
  background: linear-gradient(to top, rgba(0,0,0,.65), transparent);
  opacity: 0; transform: translateY(8px);
  transition: opacity .25s, transform .25s;
}
.item a:hover img, .item a:focus-visible img { transform: scale(1.05); }
.item a:hover figcaption, .item a:focus-visible figcaption { opacity: 1; transform: none; }
@media (hover: none) { .item figcaption { opacity: 1; transform: none; } }

.empty { margin-top: 40px; color: var(--muted); }

/* Lightbox */
.lightbox {
  position: fixed; inset: 0; z-index: 100;
  display: grid; grid-template-columns: 64px 1fr 64px; align-items: center;
  background: rgba(10, 12, 12, .92);
  backdrop-filter: blur(6px);
}
.lightbox[hidden] { display: none; }
.lb-figure { display: flex; flex-direction: column; align-items: center; gap: 14px; min-height: 0; }
.lb-figure img {
  max-width: 100%; max-height: 80vh; border-radius: 6px;
  animation: lbIn .25s ease;
}
.lb-figure figcaption { color: #e8eae6; font-size: 1rem; }
.lb-btn {
  background: none; border: 0; color: #fff; cursor: pointer;
  font-size: 2.6rem; line-height: 1; padding: 12px;
  opacity: .75; transition: opacity .2s;
}
.lb-btn:hover { opacity: 1; }
.lb-close { position: absolute; top: 10px; right: 14px; font-size: 2.2rem; }
@keyframes lbIn { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

@media (max-width: 600px) {
  .wrap { padding: 36px 16px 56px; }
  .lightbox { grid-template-columns: 44px 1fr 44px; }
  .lb-btn { font-size: 2rem; padding: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
