/* Mission Control — Gallery Styles */

.gallery-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-bottom: var(--space-xl);
}

.gallery-nav a {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--border-radius);
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.gallery-nav a:hover {
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.gallery-date-header {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: var(--space-xl) 0 var(--space-md);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-sm);
}

.gallery-item {
  position: relative;
  margin: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gallery-item-frame {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: var(--border-radius);
  border: 1px solid var(--border);
  background-color: var(--bg-tertiary);
  background-image:
    linear-gradient(45deg, var(--bg-secondary) 25%, transparent 25%),
    linear-gradient(-45deg, var(--bg-secondary) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--bg-secondary) 75%),
    linear-gradient(-45deg, transparent 75%, var(--bg-secondary) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
  transition: border-color var(--transition-fast);
}

.gallery-item:hover .gallery-item-frame {
  border-color: var(--accent-green);
}

.gallery-item-archive-no {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--accent-amber);
  background-color: rgba(0, 0, 0, 0.55);
  padding: 2px 6px;
  border-radius: 2px;
  pointer-events: none;
}

.gallery-item img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-base);
  background-color: var(--bg-secondary);
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item-broken-fallback {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: var(--font-mono);
  color: var(--text-muted);
  pointer-events: none;
}

.gallery-broken-code {
  font-size: 0.7rem;
  letter-spacing: 0.25em;
  color: var(--accent-red);
  text-transform: uppercase;
}

.gallery-broken-id {
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

.gallery-item img.gallery-img--broken {
  opacity: 0;
}

.gallery-item-overlay {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-sm);
  padding: 4px 2px 0;
  margin: 0;
  background: none;
  opacity: 1;
  transition: none;
}

.gallery-item-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 70%;
}

.gallery-item-date {
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.1em;
}

/* --- Lightbox --- */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--border-radius);
}

.lightbox-close {
  position: absolute;
  top: var(--space-lg);
  right: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 1.5rem;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 2rem;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-md);
}

.lightbox-prev {
  left: var(--space-lg);
}

.lightbox-next {
  right: var(--space-lg);
}

.gallery-pagination {
  display: flex;
  justify-content: center;
  gap: var(--space-md);
  margin-top: var(--space-xl);
}
