:root {
  color-scheme: dark light;
  --bg: #050509;
  --fg: #f5f5f5;
  --accent: #ffcc33;
  --thumb-bg: #111;
  --thumb-border: #222;
  --font: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

/* Global reset-ish */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Page background: dark grey + subtle texture */
body {
  margin: 0;
  font-family: var(--font);

  /* Base dark grey */
  background-color: #2a2a2e;

  /* Layer 1: very subtle diagonal texture */
  background-image:
    repeating-linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.03) 0,
      rgba(255, 255, 255, 0.03) 1px,
      transparent 1px,
      transparent 4px
    );

  background-attachment: fixed;
  background-size: auto;
  color: var(--fg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Header */
.site-header {
  padding: 1.5rem 1.5rem 0.75rem;
  text-align: center;
}

.site-header h1 {
  margin: 0;
  font-size: clamp(1.6rem, 2vw + 1rem, 2.2rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

/* Layout */
main {
  flex: 1;
  padding: 0 1.5rem 2rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* Gallery grid */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
}

/* Hide gallery when viewing a single image */
.gallery--hidden {
  display: none;
}

.gallery__item {
  position: relative;
  overflow: hidden;
  border-radius: 0.5rem;
  background: var(--thumb-bg);
  border: 1px solid var(--thumb-border);
  cursor: pointer;
  aspect-ratio: 4 / 3;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
  opacity: 0.95;
}

.gallery__item::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.08), transparent 55%);
  mix-blend-mode: screen;
  opacity: 0;
  transition: opacity 0.3s ease-out;
}

.gallery__item:hover img,
.gallery__item:focus-visible img {
  transform: scale(1.04);
  opacity: 1;
}

.gallery__item:hover::after,
.gallery__item:focus-visible::after {
  opacity: 1;
}

/* Lightbox overlay: full-screen, slightly dimmed */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35); /* see page background through it */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1.5rem;
}

.lightbox--open {
  display: flex;
}

/* Centered content, no panel background */
.lightbox__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

/* Full image */
.lightbox__image {
  max-width: min(100%, 1200px);
  max-height: 80vh;
  border-radius: 0.5rem;
}

/* Caption */
.lightbox__caption {
  max-width: min(100%, 900px);
  font-size: 0.9rem;
  color: rgba(245, 245, 245, 0.85);
  text-align: center;
  line-height: 1.4;
}

/* Close & nav buttons (top-right X + bigger arrows) */
.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: absolute;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: var(--fg);
  cursor: pointer;

  display: flex;
  align-items: center;
  justify-content: center;

  border-radius: 999px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* Close button in the upper-right corner */
.lightbox__close {
  top: 1.5rem;
  right: 1.5rem;
  padding: 0.4rem 0.7rem;
  font-size: 1.6rem;
}

/* Larger navigation arrows, vertically centered */
.lightbox__prev,
.lightbox__next {
  top: 50%;
  transform: translateY(-50%);
  padding: 0.75rem 1.1rem;
  font-size: 2rem;
  min-width: 44px;
  min-height: 44px;
}

.lightbox__prev {
  left: 1.2rem;
}

.lightbox__next {
  right: 1.2rem;
}

.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover {
  background: rgba(0, 0, 0, 0.85);
}

/* Small screens */
@media (max-width: 600px) {
  main {
    padding-inline: 1rem;
  }

  .site-header {
    padding-inline: 1rem;
  }

  .lightbox__close {
    top: 1rem;
    right: 1rem;
  }

  .lightbox__prev {
    left: 0.5rem;
  }

  .lightbox__next {
    right: 0.5rem;
  }
}
