/*
 * Mobile Gallery styles.
 * Scope: .mobile-gallery body class only.
 *
 * Design: 2-column masonry grid, fullscreen lightbox, touch swipe navigation.
 * No animations or transitions — bare bones per the request.
 */

/* ========================================
   Loading state
   ======================================== */

.mobile-gallery .mobile-gallery-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
  gap: 1rem;
}

.mobile-gallery .mobile-gallery-loading p {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  font-weight: 400;
  color: #000;
  margin: 0;
}

.mobile-gallery .mobile-gallery-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid #e0e0e0;
  border-top-color: #000;
  border-radius: 50%;
  animation: mobile-gallery-spin 0.6s linear infinite;
}

@keyframes mobile-gallery-spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   Error state
   ======================================== */

.mobile-gallery .mobile-gallery-error {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4rem 1rem;
  text-align: center;
}

.mobile-gallery .mobile-gallery-error p {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.875rem;
  font-weight: 400;
  color: #000;
  margin: 0;
}

.mobile-gallery .mobile-gallery-error[hidden],
.mobile-gallery .mobile-gallery-loading[hidden] {
  display: none;
}

/* ========================================
   Masonry grid
   ======================================== */

.mobile-gallery .mobile-gallery-grid {
  columns: 2;
  column-gap: 8px;
  padding: 8px;
}

.mobile-gallery .mobile-gallery-grid picture {
  break-inside: avoid;
  margin-bottom: 8px;
  display: block;
}

.mobile-gallery .mobile-gallery-grid img {
  width: 100%;
  height: auto;
  display: block;
  background: #f0f0f0;
}

/* ========================================
   Lightbox
   ======================================== */

.mobile-gallery .mobile-lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

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

.mobile-gallery .mobile-lightbox-media {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.mobile-gallery .mobile-lightbox-media picture {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.mobile-gallery .mobile-lightbox-media img {
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  opacity: 1;
  transition: opacity 150ms ease;
}

/* ========================================
   Lightbox close button
   ======================================== */

.mobile-gallery .mobile-lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1001;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  padding: 0;
}

.mobile-gallery .mobile-lightbox-close svg {
  width: 24px;
  height: 24px;
}

/* ========================================
   Body lock when lightbox is open
   ======================================== */

.schematic-mobile.mobile-lightbox-open {
  overflow: hidden;
}
