:root {
  --bg: #0a0a0a;
  --card: #161616;
  --fg: #ffffff;
  --muted: #8a8a8a;
  --accent: #ffffff;
  --danger: #ff5a5a;
  /* One spacing value used for the outer edges and between every card. */
  --gap: clamp(6px, 1vw, 14px);
  --header-h: 64px;
  --cols: 2;
  color-scheme: dark;
}
@media (min-width: 720px)  { :root { --cols: 3; --header-h: 72px; } }
@media (min-width: 1200px) { :root { --cols: 4; } }
@media (min-width: 1800px) { :root { --cols: 5; } }

* { box-sizing: border-box; margin: 0; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Inter", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ---------- Header (always visible) ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 10;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) calc(var(--gap) + 10px) 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.82);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
}
.logo { display: block; line-height: 0; }
.logo img { height: 22px; width: auto; }
@media (min-width: 720px) { .logo img { height: 26px; } }

main { padding-top: calc(var(--header-h) + env(safe-area-inset-top)); }

/* ---------- Grid: equal gutters edge to edge ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gap);
  padding: var(--gap);
}
.card {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: var(--card);
  border: 0;
  padding: 0;
  cursor: zoom-in;
  display: block;
  width: 100%;
}
.card img, .card video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity .5s ease, transform .8s cubic-bezier(.2,.7,.2,1);
}
.card.loaded img, .card.loaded video { opacity: 1; }
@media (hover: hover) {
  .card:hover img, .card:hover video { transform: scale(1.03); }
}
.card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.empty { color: var(--muted); text-align: center; padding: 30vh 16px; }

/* ---------- Lightbox ---------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(5, 5, 5, 0.96);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox[hidden] { display: none; }
.lb-stage {
  width: 100%;
  height: 100%;
  padding: calc(var(--header-h) / 1.2) clamp(16px, 6vw, 96px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox button {
  position: absolute;
  background: none;
  border: 0;
  color: var(--fg);
  cursor: pointer;
  font-size: 40px;
  font-weight: 300;
  line-height: 1;
  padding: 12px 16px;
  opacity: .7;
}
.lightbox button:hover { opacity: 1; }
.lb-close { top: env(safe-area-inset-top); right: 4px; }
.lb-prev { left: 0; }
.lb-next { right: 0; }
@media (max-width: 719px) { .lb-nav { display: none; } }
