/* index.gallery.css — public terminal site (index.html): gallery, lightbox, media in posts. One of the index.*.css files, linked in order from index.html. */
/* Two layers, so it is never a question of which rule wins: "page" holds the normal stylesheet rules, "element" holds exact
   styles for single elements. Anything in "element" beats anything in "page", whatever the selectors look like. */
@layer page, element;

@layer page {
/* ─────────────────────────────────────────
   GALLERY
   ───────────────────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

.gallery-item {
  border: 1px solid var(--border);
  background: var(--bg-surface);
  overflow: hidden;
  transition: border-color 0.2s;
}

.gallery-item:hover { border-color: var(--accent-dim); }

.gallery-media {
  width: 100%;
  aspect-ratio: 16/10;
  overflow: hidden;
  background: var(--bg);
  position: relative;
}

.gallery-media img, .gallery-media video {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
}

.gallery-media iframe {
  width: 100%; height: 100%;
  border: none;
}

.gallery-media-count {
  position: absolute; bottom: 6px; right: 6px;
  font-size: 9px; background: rgba(0,0,0,0.7);
  color: var(--text-dim); padding: 2px 6px;
}

.gallery-info { padding: 12px; }
.gallery-info h4 { color: var(--text-bright); font-weight: normal; font-size: 14px; margin-bottom: 4px; }
.gallery-info .desc { color: var(--text-dim); font-size: 12px; margin-bottom: 6px; }
.gallery-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.gallery-tag { font-size: 9px; color: var(--accent); border: 1px solid var(--accent-dim); padding: 1px 6px; }

/* Lightbox */
.lightbox {
  display: none; position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.92); align-items: center; justify-content: center;
  flex-direction: column; cursor: pointer;
}
.lightbox.open { display: flex; }
.lightbox img, .lightbox video {
  max-width: 90vw; max-height: 80vh; object-fit: contain;
}
.lightbox-nav {
  display: flex; gap: 20px; margin-top: 12px;
}
.lightbox-nav button {
  background: none; border: 1px solid var(--border);
  color: var(--text); padding: 6px 16px; cursor: pointer;
  font-family: var(--font-mono); font-size: 12px;
}
.lightbox-nav button:hover { border-color: var(--accent); }
.lightbox-caption {
  color: var(--text-dim); font-size: 11px; margin-top: 8px;
}
.lightbox-close {
  position: absolute; top: 16px; right: 20px;
  color: var(--text-dim); font-size: 20px; cursor: pointer;
  background: none; border: none; font-family: var(--font-mono);
}

/* ─────────────────────────────────────────
   MEDIA IN BLOG POSTS
   ───────────────────────────────────────── */
.post-media {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0;
}
.post-media img, .post-media video {
  max-width: 100%; max-height: 300px; object-fit: cover;
  border: 1px solid var(--border); cursor: pointer;
}
.post-media iframe {
  width: 100%; max-width: 560px; height: 315px; border: 1px solid var(--border);
}
}

/* exact styles for single elements built in index.media.js (these used to be inline). "element" is the top layer: it always beats "page". */
@layer element {
  .renderMedia__img { cursor: pointer; }
}
