/* Masonry Grid */
.meme-grid {
  columns: 3;
  column-gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (max-width: 900px) {
  .meme-grid {
    columns: 2;
  }
}

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

/* Grid Items */
.meme-item {
  break-inside: avoid;
  margin-bottom: 24px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(40, 44, 52, 0.8);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.quarto-light .meme-item {
  background: #fff;
  border-color: rgba(0, 0, 0, 0.25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.meme-item:hover {
  transform: scale(1.02);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.quarto-light .meme-item:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
}

.meme-item img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
}

/* Lightbox Overlay */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.92);
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.lightbox-overlay.active {
  display: flex;
}

.lightbox-overlay img {
  max-width: 90vw;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 6px;
  user-select: none;
}

/* Lightbox Header (counter + download) */
.lightbox-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  min-height: 40px;
}

.lightbox-counter {
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  font-variant-numeric: tabular-nums;
}

.lightbox-download {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  width: 38px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.lightbox-download:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
  color: white;
}

.lightbox-download svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
}

/* Close Button */
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 32px;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s ease, background 0.15s ease;
  line-height: 1;
}

.lightbox-close:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

/* Lightbox Nav Buttons */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.08);
  border: 1.5px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.lightbox-nav:hover {
  background: rgba(255, 255, 255, 0.15);
  color: white;
  border-color: rgba(255, 255, 255, 0.4);
}

.lightbox-nav svg {
  width: 24px;
  height: 24px;
}

.lightbox-prev {
  left: 16px;
}

.lightbox-next {
  right: 16px;
}

@media (max-width: 600px) {
  .lightbox-nav {
    width: 40px;
    height: 40px;
  }

  .lightbox-prev {
    left: 8px;
  }

  .lightbox-next {
    right: 8px;
  }

  .lightbox-overlay img {
    max-width: 96vw;
    max-height: 80vh;
  }
}

/* Focus styles */
.lightbox-nav:focus-visible,
.lightbox-close:focus-visible,
.lightbox-download:focus-visible {
  outline: 2px solid white;
  outline-offset: 2px;
}
