.branch-section {
  position: relative;
  padding: 80px 0 100px;
  background: var(--color-four);
}

.branch-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 48px;
}

.branch-tab {
  padding: 12px 28px;
  border: 1.5px solid #4a4a4a;
  border-radius: 999px;
  background: transparent;
  color: #4a4a4a;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.25s ease, color 0.25s ease, background 0.25s ease;
}

.branch-tab:hover:not(.active) {
  border-color: #3a3a3a;
  color: #3a3a3a;
}

.branch-tab.active {
  background: #000000;
  border-color: #000000;
  color: var(--main-color);
  font-weight: 600;
  box-shadow: none;
}

.branch-panel {
  display: none;
  animation: branchFadeIn 0.45s ease;
}

.branch-panel.active {
  display: block;
}

@keyframes branchFadeIn {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.branch-masonry {
  column-count: 3;
  column-gap: 18px;
}

.branch-masonry__item {
  break-inside: avoid;
  margin-bottom: 18px;
  border-radius: 12px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.branch-masonry__item:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 32px rgba(0, 0, 0, 0.16);
}

.branch-masonry__link {
  display: block;
  position: relative;
  overflow: hidden;
}

.branch-masonry__link img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
  transition: transform 0.45s ease;
}

.branch-masonry__item:hover .branch-masonry__link img {
  transform: scale(1.04);
}

.branch-masonry__item--tall .branch-masonry__link img {
  min-height: 320px;
  object-fit: cover;
}

.branch-masonry__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.55) 0%, transparent 55%);
  opacity: 0;
  transition: opacity 0.3s ease;
  display: flex;
  align-items: flex-end;
  padding: 16px;
}

.branch-masonry__item:hover .branch-masonry__overlay {
  opacity: 1;
}

.branch-masonry__caption {
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

@media (max-width: 991px) {
  .branch-masonry {
    column-count: 2;
    column-gap: 14px;
  }

  .branch-section {
    padding: 60px 0 80px;
  }
}

@media (max-width: 575px) {
  .branch-masonry {
    column-count: 1;
  }

  .branch-tab {
    width: 100%;
    text-align: center;
  }
}
