/* ═══════════════════════════════════════
   GALERÍA MASONRY — Portfolio style
═══════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500&display=swap');

:root {
  --mf-gap: 6px;
  --mf-text: #f0ede8;
  --mf-salmon: #c0785a;
}

/* ── WRAPPER GENERAL ── */
.mf-gallery-wrapper {
  padding: 0 0 4rem;
  width: 100%;
  box-sizing: border-box;
  position: relative;
}

/* ── FIX STICKY — forzar que los ancestros de Divi no corten el sticky ── */
.mf-gallery-wrapper,
.mf-gallery-wrapper * {
  overflow: visible;
}

.mf-gallery-grid {
  overflow: visible !important;
}

/* ── FILTROS STICKY FIJO ── */
.mf-filters-sticky {
  position: fixed;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: flex;
  justify-content: center;
  pointer-events: none;

  /* Oculto por defecto, visible solo cuando la galería está en pantalla */
  opacity: 0;
  transition: opacity 0.4s ease;
}

.mf-filters-sticky.is-visible {
  opacity: 1;
  pointer-events: all;
}

/* ── DROPDOWN WRAPPER ── */
.mf-dropdown {
  position: relative;
  pointer-events: all;
  display: inline-block;
  z-index: 99999;
}

/* ── BOTÓN PRINCIPAL — estado normal ── */
.mf-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.98rem 1.82rem;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 100px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 1.014rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #1a1a1a;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  transition: background 0.4s ease,
              box-shadow 0.4s ease,
              border-color 0.4s ease,
              color 0.4s ease;
  white-space: nowrap;
  user-select: none;
  position: relative;
  z-index: 99999;
}

/* ── ESTADO SCROLLED — blur transparente ── */
.mf-dropdown-toggle.is-scrolled {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: none;
  color: #ffffff;
}

.mf-dropdown-toggle.is-scrolled .mf-dropdown-arrow {
  background: rgba(255, 255, 255, 0.15);
}

.mf-dropdown-toggle.is-scrolled .mf-dropdown-arrow svg {
  stroke: #ffffff;
}

/* ── HOVER — siempre vuelve a blanco ── */
.mf-dropdown-toggle:hover,
.mf-dropdown-toggle.is-scrolled:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.14);
  color: #1a1a1a;
}

.mf-dropdown-toggle:hover .mf-dropdown-arrow,
.mf-dropdown-toggle.is-scrolled:hover .mf-dropdown-arrow {
  background: rgba(255, 255, 255, 0.7);
}

.mf-dropdown-toggle:hover .mf-dropdown-arrow svg,
.mf-dropdown-toggle.is-scrolled:hover .mf-dropdown-arrow svg {
  stroke: #c0785a;
}

/* ── DROPDOWN ABIERTO ── */
.mf-dropdown.is-open .mf-dropdown-toggle {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.14);
  color: #1a1a1a;
}

.mf-dropdown.is-open .mf-dropdown-toggle .mf-dropdown-arrow {
  background: rgba(255, 255, 255, 0.6);
}

.mf-dropdown.is-open .mf-dropdown-toggle .mf-dropdown-arrow svg {
  stroke: #c0785a;
}

/* ── ÍCONO FLECHA DROPDOWN ── */
.mf-dropdown-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 50%;
  transition: background 0.4s ease;
  flex-shrink: 0;
}

.mf-dropdown-arrow svg {
  width: 14px;
  height: 14px;
  stroke: #c0785a;
  stroke-width: 2.5;
  fill: none;
  transition: transform 0.3s ease, stroke 0.4s ease;
}

.mf-dropdown.is-open .mf-dropdown-arrow svg {
  transform: rotate(180deg);
}

/* ── PANEL DESPLEGABLE ── */
.mf-dropdown-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  min-width: 240px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.14);
  padding: 0.6rem 0.5rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 99999;
}

.mf-dropdown.is-open .mf-dropdown-panel {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

/* ── OPCIONES DEL DROPDOWN ── */
.mf-dropdown-panel button {
  display: block;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(30, 30, 30, 0.4);
  padding: 0.65rem 1rem;
  border-radius: 12px;
  text-align: left;
  transition: background 0.2s ease, color 0.2s ease;
  white-space: nowrap;
}

.mf-dropdown-panel button:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #1a1a1a;
}

.mf-dropdown-panel button.is-checked {
  color: #1a1a1a;
}

/* ── GRID MASONRY ── */
.mf-gallery-grid {
  width: 100%;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.mf-gallery-grid.is-ready {
  opacity: 1;
}

.mf-gallery-grid .grid-sizer,
.mf-gallery-item {
  width: calc(33.333% - 4px);
}

.mf-gallery-item.is-hidden-loadmore {
  display: none;
}

.mf-gallery-item {
  margin-bottom: var(--mf-gap);
  overflow: hidden;
  position: relative;
  cursor: pointer;
  display: block;
  background: #111;
  z-index: 1;
}

.mf-gallery-item img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.7s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              filter 0.7s ease,
              opacity 0.7s ease;
  filter: brightness(0.85);
  opacity: 0.92;
}

.mf-gallery-item:hover img {
  transform: scale(1.05);
  filter: brightness(1);
  opacity: 1;
}

/* ── CAPTION HOVER ── */
.mf-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 3rem 1.1rem 1.1rem;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.78) 0%,
    rgba(0, 0, 0, 0.2) 60%,
    transparent 100%
  );
  color: var(--mf-text);
  font-family: Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-size: 0.8rem;
  letter-spacing: 0.03em;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.4s ease, transform 0.4s ease;
  pointer-events: none;
}

.mf-gallery-item:hover .mf-caption {
  opacity: 1;
  transform: translateY(0);
}

/* ── BOTÓN LOAD MORE ── */
.mf-load-more-wrap {
  display: flex;
  justify-content: center;
  padding: 3rem 0 1rem;
}

.mf-load-more {
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.2);
  border-radius: 100px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #1a1a1a;
  padding: 0.85rem 2.2rem;
  transition: background 0.25s ease,
              border-color 0.25s ease,
              color 0.25s ease;
}

.mf-load-more:hover {
  background: #1a1a1a;
  border-color: #1a1a1a;
  color: #ffffff;
}

.mf-load-more-wrap.is-hidden {
  display: none;
}

/* ── RESPONSIVE GRID ── */
@media (max-width: 1024px) {
  .mf-gallery-grid .grid-sizer,
  .mf-gallery-item {
    width: calc(50% - 3px);
  }
}

@media (max-width: 600px) {
  .mf-gallery-grid .grid-sizer,
  .mf-gallery-item {
    width: 100%;
  }
  .mf-filters-sticky {
    top: 70px;
  }
  .mf-dropdown-toggle {
    font-size: 0.85rem;
    padding: 0.8rem 1.3rem;
  }
  .mf-dropdown-arrow {
    width: 30px;
    height: 30px;
  }
}

/* ════════════════════════════════════════
   LIGHTBOX CUSTOM
════════════════════════════════════════ */

.mf-lightbox-overlay {
  position: fixed;
  inset: 0;
  background: #ffffff;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
}

.mf-lightbox-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

.mf-lb-close {
  position: absolute;
  top: 3rem;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 40px;
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.25);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, background 0.2s ease;
  z-index: 10;
}

.mf-lb-close:hover {
  background: rgba(0, 0, 0, 0.05);
  border-color: rgba(0, 0, 0, 0.4);
}

.mf-lb-close svg {
  width: 14px;
  height: 14px;
  stroke: #333;
  stroke-width: 1.8;
  fill: none;
}

.mf-lb-image-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1100px;
  padding: 0 8rem;
  box-sizing: border-box;
}

.mf-lb-image-wrap img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  display: block;
  transition: opacity 0.25s ease;
}

.mf-lb-image-wrap img.is-loading {
  opacity: 0;
}

.mf-lb-title {
  margin-top: 1.6rem;
  text-align: center;
  font-family: 'Inter', sans-serif;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #1a1a1a;
}

.mf-lb-counter {
  margin-top: 0.8rem;
  font-family: 'Inter', sans-serif;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mf-lb-counter-current { color: var(--mf-salmon); }
.mf-lb-counter-sep     { color: rgba(0, 0, 0, 0.3); }
.mf-lb-counter-total   { color: rgba(0, 0, 0, 0.3); }

.mf-lb-prev,
.mf-lb-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, background 0.2s ease;
  z-index: 10;
}

.mf-lb-prev { left: 2.5rem; }
.mf-lb-next { right: 2.5rem; }

.mf-lb-prev:hover,
.mf-lb-next:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.3);
}

.mf-lb-prev svg,
.mf-lb-next svg {
  width: 14px;
  height: 14px;
  stroke: var(--mf-salmon);
  stroke-width: 2;
  fill: none;
}

.mf-lb-mobile-nav {
  display: none;
  gap: 1rem;
  margin-top: 1.2rem;
}

.mf-lb-mobile-prev,
.mf-lb-mobile-next {
  width: 44px;
  height: 44px;
  background: none;
  border: 1px solid rgba(0, 0, 0, 0.15);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.mf-lb-mobile-prev svg,
.mf-lb-mobile-next svg {
  width: 13px;
  height: 13px;
  stroke: var(--mf-salmon);
  stroke-width: 2;
  fill: none;
}

@media (max-width: 768px) {
  .mf-lb-close        { top: 1.2rem; }
  .mf-lb-image-wrap   { padding: 0 1.2rem; max-width: 100%; }
  .mf-lb-image-wrap img { max-height: 52vh; }
  .mf-lb-prev,
  .mf-lb-next         { display: none; }
  .mf-lb-mobile-nav   { display: flex; }
}