/* ───────────────────────────────────────────
   Reset & base
─────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial,
    sans-serif;
  background: #f5f5f3;
  color: #1a1a1a;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ───────────────────────────────────────────
   Layout
─────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

main.container {
  flex: 1;
  padding-bottom: 4rem;
}

/* ───────────────────────────────────────────
   Header
─────────────────────────────────────────── */
.site-header {
  padding: 1.75rem 0 1.5rem;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 2.5rem;
  background: #fff;
}

.site-title a {
  color: inherit;
  text-decoration: none;
}

.site-title {
  font-size: clamp(1.3rem, 3vw, 2.05rem);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

/* ───────────────────────────────────────────
   Gallery layout — sidebar + content
─────────────────────────────────────────── */
.gallery-layout {
  display: flex;
  align-items: flex-start;
  gap: 0;
}

/* ── LHS sidebar ── */
.collection-nav {
  width: 200px;
  flex-shrink: 0;
  border-right: 1px solid #e0e0e0;
  padding-right: 1.5rem;
  margin-right: 2rem;
  /* stick below the header when scrolling */
  position: sticky;
  top: 2rem;
  max-height: calc(100vh - 4rem);
  overflow-y: auto;
}

.collection-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.collection-nav-link {
  display: block;
  padding: 0.35rem 0.6rem;
  border-radius: 4px;
  text-decoration: none;
  font-size: 0.9rem;
  color: #555;
  transition: color 0.15s, background 0.15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.collection-nav-link:hover {
  color: #1a1a1a;
  background: #ebebea;
}

.collection-nav-link.active {
  color: #1a1a1a;
  font-weight: 600;
  background: #e8e8e6;
}

/* ── RHS intro pane ── */
.collection-intro {
  font-size: 0.975rem;
  color: #555;
  line-height: 1.7;
}

.collection-intro[hidden] {
  display: none;
}

/* ── RHS content area ── */
.gallery-content {
  flex: 1;
  min-width: 0; /* prevent flex blowout */
}

/* ───────────────────────────────────────────
   Gallery — masonry via CSS columns
─────────────────────────────────────────── */
.gallery {
  column-count: 3;
  column-gap: 1rem;
}

@media (max-width: 1200px) { .gallery { column-count: 2; } }
@media (max-width: 600px)  { .gallery { column-count: 1; } }

.gallery-item {
  break-inside: avoid;
  margin-bottom: 1rem;
  overflow: hidden;
  border-radius: 4px;
  background: #e8e8e8;
}

.gallery-link {
  display: block;
  line-height: 0;
  cursor: zoom-in;
}

.gallery-item img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 4px;
  transition: transform 0.25s ease, opacity 0.25s ease;
  opacity: 0;
}

.gallery-item img.loaded {
  opacity: 1;
}

.gallery-item:hover img {
  transform: scale(1.015);
}

/* Empty state */
.gallery-empty {
  color: #888;
  font-style: italic;
  padding: 2rem 0;
}

.gallery-empty code {
  font-family: monospace;
  background: #eee;
  padding: 0.1em 0.4em;
  border-radius: 3px;
}

/* ───────────────────────────────────────────
   Mobile — stack nav above content
─────────────────────────────────────────── */
@media (max-width: 640px) {
  .gallery-layout {
    flex-direction: column;
    gap: 1.25rem;
  }

  .collection-nav {
    width: 100%;
    position: static;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
    padding-right: 0;
    padding-bottom: 0.75rem;
    margin-right: 0;
    overflow-x: auto;
    overflow-y: visible;
  }

  .collection-nav-list {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 0.25rem;
  }

  .collection-nav-link {
    white-space: nowrap;
  }
}

/* ───────────────────────────────────────────
   Lightbox
─────────────────────────────────────────── */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 3px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.6);
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2.25rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 0.15s;
}

.lightbox-close:hover { opacity: 1; }

/* ───────────────────────────────────────────
   Footer
─────────────────────────────────────────── */
.site-footer {
  padding: 1.5rem 0;
  border-top: 1px solid #e0e0e0;
  background: #fff;
  font-size: 0.85rem;
  color: #aaa;
  text-align: center;
}
