/* ===================================================
   Gallery Page — gallery.css
   Depends on styles.css being loaded first.
   Only contains styles not already in styles.css.
   =================================================== */

/* ---------------------------------------------------
   PAGE HERO (shared pattern across all inner pages)
   --------------------------------------------------- */
.page-hero {
  padding-top: var(--nav-height);
  background: var(--color-bg-light);
  border-bottom: 1px solid var(--color-border);
}

.page-hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 64px 24px 56px;
}

.breadcrumb {
  font-size: 0.82rem;
  color: var(--color-text-light);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--color-text-light);
  transition: color var(--transition);
}

.breadcrumb a:hover { color: var(--color-primary); }

.page-hero-inner h1 {
  font-size: clamp(2rem, 4vw, 3.2rem);
  color: var(--color-text);
  margin-bottom: 12px;
}

.page-hero-inner .lead {
  font-size: 1.05rem;
  color: var(--color-text-light);
  max-width: 600px;
  line-height: 1.7;
}

/* ---------------------------------------------------
   GALLERY SECTION
   --------------------------------------------------- */
.gallery-section {
  padding: 64px 0 100px;
  background: var(--color-bg);
}

/* ---------------------------------------------------
   MASONRY GRID
   CSS columns give a natural masonry effect without JS.
   --------------------------------------------------- */
.gallery-grid {
  columns: 3;
  column-gap: 16px;
}

/* ---------------------------------------------------
   GALLERY ITEM
   --------------------------------------------------- */
.gallery-item {
  display: block;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  margin-bottom: 16px;
  break-inside: avoid;
  cursor: zoom-in;
  /* Prevent column break splitting the item */
  page-break-inside: avoid;
}

.gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.4s ease;
}

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

/* Hover overlay with zoom icon */
.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.gallery-item-overlay svg {
  width: 40px;
  height: 40px;
  fill: #fff;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity var(--transition), transform var(--transition);
}

.gallery-item:hover .gallery-item-overlay {
  background: rgba(0, 0, 0, 0.35);
}

.gallery-item:hover .gallery-item-overlay svg {
  opacity: 1;
  transform: scale(1);
}

/* Focus state for keyboard users */
.gallery-item:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* ---------------------------------------------------
   LIGHTBOX OVERLAY
   --------------------------------------------------- */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.94);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.lightbox-overlay.open {
  opacity: 1;
  visibility: visible;
}

/* Image wrapper */
.lightbox-img-wrap {
  position: relative;
  max-width: 90vw;
  max-height: 88vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#lightboxImg {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius);
  display: block;
  transition: opacity 0.2s ease;
}

#lightboxImg.loading {
  opacity: 0;
}

/* Loader spinner */
.lightbox-loader {
  position: absolute;
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.lightbox-loader.active { display: block; }

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

/* Close button */
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  z-index: 1;
}

.lightbox-close:hover { background: rgba(255, 255, 255, 0.22); }

/* Prev / Next buttons */
.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
  z-index: 1;
}

.lightbox-prev { left: 20px; }
.lightbox-next { right: 20px; }

.lightbox-prev:hover,
.lightbox-next:hover { background: rgba(255, 255, 255, 0.22); }

.lightbox-prev svg,
.lightbox-next svg {
  width: 28px;
  height: 28px;
  fill: #fff;
}

.lightbox-prev:disabled,
.lightbox-next:disabled { opacity: 0.3; cursor: default; }

/* Counter */
.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

/* ---------------------------------------------------
   WHATSAPP BUTTON
   --------------------------------------------------- */
.wa-wrapper {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.wa-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  background: #25d366;
  border-radius: 50%;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
  transition: transform var(--transition), box-shadow var(--transition);
}

.wa-button:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}

.wa-button img { width: 28px; height: 28px; }

.wa-message {
  background: var(--color-white);
  color: var(--color-text);
  font-size: 0.82rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

/* ---------------------------------------------------
   RESPONSIVE
   --------------------------------------------------- */
@media (max-width: 900px) {
  .gallery-grid { columns: 2; }
}

@media (max-width: 540px) {
  .gallery-grid { columns: 1; }

  .gallery-section { padding: 48px 0 72px; }

  .lightbox-prev { left: 8px; }
  .lightbox-next { right: 8px; }

  .page-hero-inner { padding: 48px 24px 40px; }
}