/* ===== HERO ===== */

.gallery-hero {
  position: relative;
  min-height: clamp(560px, 78vh, 780px);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  isolation: isolate;
}

.gallery-hero-bg {
  position: absolute;
  inset: -4%;
  z-index: -2;
  background-position: center;
  background-size: cover;
  transform: scale(1.04);
  animation: gallery-hero-zoom 12s ease-out both;
}

.gallery-hero-overlay {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, rgba(10, 20, 35, 0.55) 0%, rgba(10, 20, 35, 0.18) 45%, rgba(10, 20, 35, 0.7) 100%),
    linear-gradient(120deg, rgba(242, 123, 19, 0.28), transparent 55%);
}

.gallery-hero-content {
  width: min(820px, calc(100% - 40px));
  padding-top: 70px;
  text-align: center;
  color: #ffffff;
  animation: gallery-rise 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.gallery-eyebrow,
.gallery-section-eyebrow {
  display: inline-block;
  color: var(--color-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.gallery-hero h1 {
  margin-top: 14px;
  font-size: clamp(3rem, 8vw, 6.5rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.05em;
  text-shadow: 0 10px 40px rgba(0, 0, 0, 0.28);
}

.gallery-hero h1 span {
  color: var(--color-secondary);
}

.gallery-hero-content > p {
  max-width: 620px;
  margin: 24px auto 0;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(1rem, 2vw, 1.15rem);
  line-height: 1.75;
}

.gallery-scroll {
  position: absolute;
  bottom: 28px;
  left: 50%;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 50%;
  transform: translateX(-50%);
  animation: gallery-bounce 2.2s ease-in-out infinite;
}

.gallery-scroll svg {
  width: 20px;
  height: 20px;
}

/* ===== GALERIA ===== */

.gallery-section {
  padding: 104px 0 120px;
  background:
    radial-gradient(circle at 5% 5%, rgba(242, 123, 19, 0.07), transparent 24rem),
    #ffffff;
}

.gallery-container {
  width: min(1320px, calc(100% - 64px));
  margin: 0 auto;
}

.gallery-heading {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.7fr);
  gap: 80px;
  align-items: end;
}

.gallery-heading h2 {
  max-width: 720px;
  margin-top: 12px;
  color: var(--color-text);
  font-size: clamp(2rem, 4.2vw, 3.6rem);
  font-weight: 750;
  line-height: 1.08;
  letter-spacing: -0.04em;
}

.gallery-heading h2 span {
  color: var(--color-primary);
}

.gallery-heading > p {
  color: #6b7280;
  font-size: 1rem;
  line-height: 1.75;
}

.gallery-toolbar {
  position: sticky;
  top: 78px;
  z-index: 30;
  margin: 48px 0 28px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(229, 231, 235, 0.9);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(17, 24, 39, 0.07);
  backdrop-filter: blur(18px);
}

.gallery-filters {
  display: flex;
  gap: 6px;
}

.gallery-filter {
  padding: 10px 18px;
  color: #6b7280;
  background: transparent;
  border: 0;
  border-radius: 10px;
  font-family: var(--font-main);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.gallery-filter:hover {
  color: var(--color-secondary);
  background: rgba(242, 123, 19, 0.08);
}

.gallery-filter--active {
  color: #ffffff;
  background: var(--color-secondary);
  box-shadow: 0 5px 16px rgba(242, 123, 19, 0.25);
}

.gallery-filter--active:hover {
  color: #ffffff;
  background: var(--color-secondary-dark);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: 88px;
  grid-auto-flow: dense;
  gap: 14px;
}

.gallery-item {
  grid-row: span 3;
  min-width: 0;
  overflow: hidden;
  background: var(--color-gray-lighter);
  border-radius: 18px;
  box-shadow: 0 3px 14px rgba(17, 24, 39, 0.06);
  animation: gallery-item-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.gallery-item--wide {
  grid-column: span 2;
  grid-row: span 3;
}

.gallery-item--portrait {
  grid-row: span 4;
}

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

.gallery-open {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  padding: 0;
  overflow: hidden;
  background: transparent;
  border: 0;
  cursor: zoom-in;
}

.gallery-open > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 0.65s cubic-bezier(0.22, 1, 0.36, 1), filter 0.4s ease;
}

.gallery-item:hover .gallery-open > img {
  filter: saturate(1.06);
  transform: scale(1.055);
}

.gallery-item-overlay {
  position: absolute;
  inset: auto 0 0;
  padding: 54px 18px 16px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  color: #ffffff;
  background: linear-gradient(to top, rgba(9, 16, 29, 0.82), transparent);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.gallery-item:hover .gallery-item-overlay,
.gallery-open:focus-visible .gallery-item-overlay {
  opacity: 1;
  transform: translateY(0);
}

.gallery-item-overlay > span {
  font-size: 0.9rem;
  font-weight: 650;
  text-align: left;
}

.gallery-item-overlay svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gallery-filter:focus-visible,
.gallery-open:focus-visible,
.gallery-lightbox button:focus-visible {
  outline: 3px solid rgba(242, 123, 19, 0.55);
  outline-offset: 3px;
}

/* ===== LIGHTBOX ===== */

.gallery-modal-open {
  overflow: hidden;
}

.gallery-lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  padding: 0;
  overflow: hidden;
  color: #ffffff;
  background: rgba(5, 10, 18, 0.96);
  border: 0;
}

.gallery-lightbox::backdrop {
  background: rgba(5, 10, 18, 0.8);
  backdrop-filter: blur(10px);
}

.gallery-lightbox-shell {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 56px 90px 40px;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  gap: 24px;
  align-items: center;
}

.gallery-lightbox-figure {
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.gallery-lightbox-figure img {
  max-width: 100%;
  max-height: calc(100dvh - 130px);
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

.gallery-lightbox-figure figcaption {
  min-height: 20px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem;
  text-align: center;
}

.gallery-lightbox button {
  display: grid;
  place-items: center;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.gallery-lightbox button:hover {
  background: var(--color-secondary);
  transform: scale(1.06);
}

.gallery-lightbox button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.gallery-lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  z-index: 2;
  width: 44px;
  height: 44px;
}

.gallery-lightbox-nav {
  width: 52px;
  height: 52px;
}

/* ===== ANIMAÇÕES ===== */

@keyframes gallery-hero-zoom {
  from { transform: scale(1.1); }
  to { transform: scale(1.04); }
}

@keyframes gallery-rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes gallery-item-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes gallery-bounce {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(7px); }
}

/* ===== RESPONSIVO ===== */

@media (max-width: 1024px) {
  .gallery-container {
    width: min(100% - 40px, 900px);
  }

  .gallery-heading {
    gap: 40px;
  }

  .gallery-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .gallery-lightbox-shell {
    padding-inline: 40px;
  }
}

@media (max-width: 760px) {
  .gallery-hero {
    min-height: 620px;
  }

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

  .gallery-heading {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .gallery-toolbar {
    top: 68px;
    margin-top: 36px;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    overflow: hidden;
  }

  .gallery-filters {
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .gallery-filters::-webkit-scrollbar {
    display: none;
  }

  .gallery-filter {
    flex-shrink: 0;
  }

  .gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 76px;
    gap: 10px;
  }

  .gallery-item--wide {
    grid-column: span 2;
  }

  .gallery-lightbox-shell {
    padding: 60px 14px 24px;
    grid-template-columns: 44px minmax(0, 1fr) 44px;
    gap: 8px;
  }

  .gallery-lightbox-nav {
    width: 42px;
    height: 42px;
  }

  .gallery-lightbox-close {
    top: 12px;
    right: 14px;
  }
}

@media (max-width: 480px) {
  .gallery-container {
    width: calc(100% - 28px);
  }

  .gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .gallery-item,
  .gallery-item--wide,
  .gallery-item--portrait {
    grid-column: auto;
    grid-row: auto;
    aspect-ratio: 4 / 3;
  }

  .gallery-item--portrait {
    aspect-ratio: 4 / 5;
  }

  .gallery-item-overlay {
    opacity: 1;
    transform: none;
  }

  .gallery-lightbox-shell {
    grid-template-columns: 1fr;
  }

  .gallery-lightbox-nav {
    position: absolute;
    bottom: 18px;
    z-index: 2;
  }

  .gallery-lightbox-prev {
    left: calc(50% - 52px);
  }

  .gallery-lightbox-next {
    right: calc(50% - 52px);
  }

  .gallery-lightbox-figure {
    padding-bottom: 58px;
  }

  .gallery-lightbox-figure img {
    max-height: calc(100dvh - 180px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .gallery-hero-bg,
  .gallery-hero-content,
  .gallery-item,
  .gallery-scroll {
    animation: none;
  }

  .gallery-open > img,
  .gallery-item-overlay {
    transition: none;
  }
}
