/* ==========================================================================
   GALLERY PRO — Natural Masonry + Lightbox Pro
   File: public/assets/css/gallery.css
   v=20260629gallery
   ========================================================================== */

/* ── NATURAL MASONRY (no forced crop) ──────────────────────────────────── */
.masonry-natural {
  columns: 4;
  column-gap: 10px;
  padding: 28px 40px;
  max-width: var(--container-wide);
  margin: 0 auto;
}
.masonry-natural .tile {
  break-inside: avoid;
  margin-bottom: 10px;
  border-radius: var(--radius-sm, 6px);
  overflow: hidden;
  display: block;
  position: relative;
  cursor: zoom-in;
  text-decoration: none;
}
.masonry-natural .tile-img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.32s cubic-bezier(0.4,0,0.2,1), filter 0.32s ease;
  background: rgba(255,255,255,0.04);
}
.masonry-natural .tile:hover .tile-img {
  transform: scale(1.035);
  filter: brightness(1.12) saturate(1.06);
}
.masonry-natural .tile .tile-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.62) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.28s ease;
  display: flex;
  align-items: flex-end;
  padding: 14px;
  pointer-events: none;
}
.masonry-natural .tile:hover .tile-overlay { opacity: 1; }
.masonry-natural .tile .tile-label {
  color: #fff;
  font: 600 11px/1.3 var(--font-heading, "Barlow Condensed", sans-serif);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Article gallery (in blog/project) — more compact columns */
.article-gallery {
  columns: 3;
  column-gap: 8px;
  margin: 28px 0;
}
.article-gallery .tile {
  break-inside: avoid;
  margin-bottom: 8px;
  border-radius: var(--radius-sm, 6px);
  overflow: hidden;
  display: block;
  position: relative;
  cursor: zoom-in;
  text-decoration: none;
}
.article-gallery .tile-img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.28s ease, filter 0.28s ease;
  background: rgba(255,255,255,0.04);
}
.article-gallery .tile:hover .tile-img {
  transform: scale(1.03);
  filter: brightness(1.1);
}

/* Responsive masonry */
@media (max-width: 1100px) {
  .masonry-natural { columns: 3; }
  .article-gallery { columns: 3; }
}
@media (max-width: 768px) {
  .masonry-natural { columns: 2; padding: 16px 16px; }
  .article-gallery { columns: 2; }
}
@media (max-width: 480px) {
  .masonry-natural { columns: 2; column-gap: 6px; padding: 12px 12px; }
  .masonry-natural .tile { margin-bottom: 6px; }
  .article-gallery { columns: 2; column-gap: 6px; }
}

/* ==========================================================================
   LIGHTBOX — Simple & Stable
   ========================================================================== */

/* Overlay — hidden by default, shown only via .mc-lb-active */
.mc-lb-overlay {
  position: fixed;
  inset: 0;
  z-index: 10001;
  display: none;          /* removed from render tree entirely */
  visibility: hidden;
  pointer-events: none;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.mc-lb-overlay.mc-lb-active {
  display: flex;
  visibility: visible;
  pointer-events: all;
  animation: mc-lb-fadein 0.2s ease;
}
@keyframes mc-lb-fadein {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* Prevent body scroll while lightbox is open */
html.mc-lb-locked { overflow: hidden; }

/* Stage — centers the image, constrains to viewport */
.mc-lb-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: calc(100vw - 128px);   /* leave room for prev/next buttons */
  max-width: 1400px;
  height: calc(100vh - 80px);
}

/* Image — always contain, never overflow, never crop */
.mc-lb-img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
  user-select: none;
  -webkit-user-drag: none;
  /* Zoom pivot from center so wheel zoom stays centered */
  transform-origin: center center;
  /* Open animation; zoom uses JS inline style which overrides these */
  opacity: 0;
  transform: scale(0.94);
  transition: opacity 0.22s ease, transform 0.15s ease;
}
.mc-lb-img.mc-lb-loaded {
  opacity: 1;
  transform: scale(1);
  /* cursor: zoom-in hints that scroll-to-zoom is available */
  cursor: zoom-in;
}

/* Loading spinner — sits on top of stage while image loads */
.mc-lb-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.mc-lb-ring {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--color-orange, #FF6347);
  border-radius: 50%;
  animation: mc-lb-spin 0.7s linear infinite;
}
@keyframes mc-lb-spin { to { transform: rotate(360deg); } }

/* Error message */
.mc-lb-error {
  color: #ffb3a4;
  font: 500 14px/1.5 var(--font-heading, "Barlow Condensed", sans-serif);
  text-align: center;
  padding: 24px 32px;
  border: 1px dashed rgba(255, 99, 71, 0.4);
  border-radius: 8px;
}

/* ── Buttons (all absolute within overlay, never fixed) ── */
.mc-lb-close,
.mc-lb-prev,
.mc-lb-next {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 10, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s, border-color 0.15s;
  line-height: 1;
}
.mc-lb-close:hover,
.mc-lb-prev:hover,
.mc-lb-next:hover {
  background: var(--color-orange, #FF6347);
  border-color: var(--color-orange, #FF6347);
}

/* Close — top-right corner */
.mc-lb-close {
  top: 16px;
  right: 16px;
  width: 44px;
  height: 44px;
  z-index: 2;
}

/* Prev / Next — vertically centered, outside the stage area */
.mc-lb-prev,
.mc-lb-next {
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  z-index: 2;
}
.mc-lb-prev { left: 12px; }
.mc-lb-next { right: 12px; }

/* Bottom bar — counter left, caption right */
.mc-lb-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  pointer-events: none;
  gap: 16px;
}
.mc-lb-count {
  font: 500 12px/1 var(--font-mono, "JetBrains Mono", monospace);
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.08em;
  white-space: nowrap;
  flex-shrink: 0;
}
.mc-lb-caption {
  font: 600 12px/1.4 var(--font-heading, "Barlow Condensed", sans-serif);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.72);
  text-align: right;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Mobile ── */
@media (max-width: 640px) {
  .mc-lb-stage {
    width: calc(100vw - 16px);
    height: calc(100vh - 110px);
  }
  .mc-lb-prev { left: 6px;  width: 40px; height: 40px; }
  .mc-lb-next { right: 6px; width: 40px; height: 40px; }
  .mc-lb-close { top: 10px; right: 10px; width: 40px; height: 40px; }
  .mc-lb-bar { padding: 10px 14px; }
}
