/* =====================================================
   RESET + BASE
===================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f9fbfc;
  color: #1d1d1f;
  line-height: 1.6;
}

main {
  max-width: 1300px;
  margin: 0 auto 4rem;
  padding: 0 1rem;
}

/* =====================================================
   HERO
===================================================== */
.galeria-hero {
  min-height: 75vh;
  display: flex;
  align-items: center;
  justify-content: flex-start; /* alinhamento à esquerda */
  padding: 4rem 1.5rem;
  color: #fff;

  background:
    linear-gradient(120deg, rgba(10,40,70,.95), rgba(30,120,160,.6)),
    url("../../images/galeria/galeria-hero.png") center/cover no-repeat;
}

/* evita conflito com .container global */
.galeria-hero .container {
  margin: 0;
  max-width: none;
}

/* container do texto */
.galeria-hero-content {
  max-width: 520px;
  margin-left: clamp(1rem, 6vw, 6rem); /* controla posição horizontal */
}

/* TÍTULO */
.galeria-hero-content h1 {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1rem;
}

/* palavra destacada */
.galeria-hero-content h1 span {
  color: #6ec1ff;
}

/* PARÁGRAFO */
.galeria-hero-content p {
  font-size: 1.05rem;
  line-height: 1.7;
  color: rgba(255,255,255,0.85);
  max-width: 480px;
}

/* =====================================================
   FILTROS
===================================================== */
.gallery-filters {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 1rem 10px;
  margin: -40px auto 2rem;
}

.filter-btn {
  flex: 0 0 auto;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(0,91,153,.2);
  background: #fff;
  font-size: .8rem;
}

.filter-btn.active {
  background: #005b99;
  color: #fff;
}

/* =====================================================
   GRID MOBILE (BASE)
===================================================== */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.gallery-item {
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 1/1;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .4s;
}

/* =====================================================
   LEGENDA (BASE)
===================================================== */
.gallery_caption {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  padding: 0.5rem 1rem;
  border-radius: 999px;

  background: rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(12px);

  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;

  opacity: 1; /* visível no mobile */
  transform: translateY(0);
  transition: all 0.35s ease;
}

/* =====================================================
   TABLET
===================================================== */
@media (min-width: 768px) {

  .gallery-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
  }

  .gallery-item {
    aspect-ratio: auto;
    height: 220px;
  }

}

/* =====================================================
   DESKTOP (MASONRY REAL)
===================================================== */
@media (min-width: 1024px) {

  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 200px;
    gap: 24px;
  }

  .gallery-item {
    height: 100%;
  }

  .gallery-item:nth-child(1),
  .gallery-item:nth-child(6),
  .gallery-item:nth-child(11),
  .gallery-item:nth-child(16) {
    grid-row: span 2;
  }

  .gallery-item:nth-child(3),
  .gallery-item:nth-child(8),
  .gallery-item:nth-child(13) {
    grid-row: span 1;
  }

  .gallery-item:nth-child(5),
  .gallery-item:nth-child(10),
  .gallery-item:nth-child(15) {
    grid-row: span 2;
  }

  /* hover desktop */
  .gallery_caption {
    opacity: 0;
    transform: translateY(8px);
  }

  .gallery-item:hover .gallery_caption {
    opacity: 1;
    transform: translateY(0);
  }

  .gallery-item:hover img {
    transform: scale(1.08);
  }
}

/* =====================================================
   OVERLAY (opcional)
===================================================== */
.gallery-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 45%,
    rgba(0, 30, 60, 0.8) 100%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
}

.gallery-item:hover .gallery-overlay {
  opacity: 1;
}

/* =====================================================
   MODAL
===================================================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.95);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: .4s;
}

.modal.open {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  max-width: 90%;
  max-height: 85%;
  border-radius: 16px;
  overflow: hidden;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.6rem;
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
}