*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
  background: #0a0a0a;
  color: #888;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 13px;
  min-height: 100vh;
}

header { padding: 2rem 2rem 1.5rem; }

header a {
  color: #ccc;
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}

header h1 { margin: 0; font: inherit; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 0 2rem 2rem;
}

.grid img {
  width: 100%;
  display: block;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.4s ease;
  object-fit: cover;
  aspect-ratio: 1;
}

.grid img.loaded { opacity: 1; }
.grid img.broken { display: none; }
.grid img:hover { filter: brightness(1.1); }

.grid img:focus-visible,
.lb-half:focus-visible {
  outline: 2px solid #ccc;
  outline-offset: -3px;
}

.empty {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #222;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
}

.lb {
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 100;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
}

.lb.open { display: flex; }

.lb img {
  max-width: 80vw;
  max-height: 90vh;
  object-fit: contain;
  position: relative;
  z-index: 102;
  cursor: pointer;
  -webkit-user-drag: none;
}

.lb-half {
  position: fixed;
  top: 0;
  width: 50%;
  height: 100%;
  z-index: 101;
  display: flex;
  align-items: center;
  border: 0;
  background: transparent;
  color: inherit;
}

.lb-half.prev { left: 0; cursor: pointer; padding-left: 1.5rem; }
.lb-half.next { right: 0; cursor: pointer; padding-right: 1.5rem; justify-content: flex-end; }

.lb-arrow {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  transition: background 0.2s;
  pointer-events: none;
}

.lb-half:hover .lb-arrow { background: rgba(255,255,255,0.25); }

.lb-arrow svg {
  width: 32px;
  height: 32px;
  fill: none;
  stroke: rgba(255,255,255,0.5);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s;
}

.lb-half:hover .lb-arrow svg { stroke: rgba(255,255,255,0.9); }

.lb-counter {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  color: #666;
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  z-index: 104;
}

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); padding: 0 1rem 1rem; }
  header { padding: 1.5rem 1rem 1rem; }
}

@media (max-width: 500px) {
  .grid { grid-template-columns: 1fr; }
}

