/* ==========================================================================
   Lens Gallery – Pitchside
   ========================================================================== */

/* ---- Tokens (aligned with Pitchside spacing scale) ---- */
:root {
  --lens-gap: 8px;
  --lens-radius: 6px;
  --lens-max-width: 1280px;
}

/* ---- Gallery header ---- */
.lens-gallery {
  max-width: var(--lens-max-width);
  margin: 0 auto;
  padding: 0 16px 32px;
}

.lens-gallery__header {
  margin-bottom: 24px;
}

.lens-gallery__title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.lens-gallery__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--color-secondary-text, #6b7280);
}

.lens-gallery__meta-sep {
  user-select: none;
}

/* ---- Responsive grid ---- */
.lens-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--lens-gap);
}

@media (min-width: 640px) {
  .lens-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .lens-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
}

@media (min-width: 1440px) {
  .lens-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

@media (min-width: 1800px) {
  .lens-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

/* ---- Card ---- */
.lens-card {
  display: block;
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  border-radius: var(--lens-radius);
  border: 0;
  padding: 0;
  margin: 0;
  background: var(--color-background-secondary, #f3f4f6);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.lens-card:focus-visible {
  outline: 3px solid var(--ghost-accent-color, #3b82f6);
  outline-offset: 2px;
}

.lens-card__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.2s ease;
}

.lens-card:hover .lens-card__img,
.lens-card:focus-visible .lens-card__img {
  transform: scale(1.03);
}

/* ---- Loading skeleton ---- */
.lens-loading__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--lens-gap);
}

@media (min-width: 640px) {
  .lens-loading__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .lens-loading__grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
  }
}

.lens-loading__card {
  aspect-ratio: 3 / 2;
  border-radius: var(--lens-radius);
}

.lens-skeleton {
  background: linear-gradient(
    90deg,
    var(--color-background-secondary, #e5e7eb) 25%,
    var(--color-background, #f9fafb) 50%,
    var(--color-background-secondary, #e5e7eb) 75%
  );
  background-size: 200% 100%;
  animation: lens-shimmer 1.5s ease-in-out infinite;
}

@keyframes lens-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Empty / Error states ---- */
.lens-empty,
.lens-error {
  text-align: center;
  padding: 48px 16px;
}

.lens-empty__icon,
.lens-error__icon {
  margin: 0 auto 16px;
  opacity: 0.4;
}

.lens-empty__title,
.lens-error__title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0 0 8px;
}

.lens-empty__text,
.lens-error__text {
  font-size: 0.9375rem;
  color: var(--color-secondary-text, #6b7280);
  margin: 0;
}

/* ---- Access Denied ---- */
.lens-access-denied {
  text-align: center;
  padding: 48px 16px;
}

.lens-access-denied__icon {
  display: block;
  margin: 0 auto 16px;
  opacity: 0.5;
}

.lens-access-denied__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 8px;
}

.lens-access-denied__text {
  font-size: 0.9375rem;
  color: var(--color-secondary-text, #6b7280);
  margin: 0 0 16px;
}

/* ---- Lightbox ---- */
.lens-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
}

.lens-lightbox[hidden] {
  display: none;
}

.lens-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
}

.lens-lightbox__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.lens-lightbox__toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 12px 16px;
  color: #fff;
  font-size: 0.875rem;
}

.lens-lightbox__counter {
  margin-right: auto;
  font-variant-numeric: tabular-nums;
}

.lens-lightbox__hires {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: underline;
  font-size: 0.8125rem;
}

.lens-lightbox__hires:hover {
  color: #fff;
}

.lens-lightbox__hires[hidden] {
  display: none;
}

.lens-lightbox__close {
  background: none;
  border: 0;
  padding: 4px;
  color: #fff;
  cursor: pointer;
  border-radius: 4px;
}

.lens-lightbox__close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.lens-lightbox__close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.lens-lightbox__stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 0 16px;
  gap: 8px;
}

.lens-lightbox__img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  user-select: none;
  -webkit-user-drag: none;
}

.lens-lightbox__arrow {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 0;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  cursor: pointer;
  transition: background 0.15s;
}

.lens-lightbox__arrow:hover {
  background: rgba(255, 255, 255, 0.2);
}

.lens-lightbox__arrow:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.lens-lightbox__caption {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.8125rem;
  padding: 8px 16px 16px;
  min-height: 40px;
}
