/* ---------- container sizing ---------- */
.gallery-c__container {
  display: block;
  margin: 0 auto;
  width: 1300px;
}

@media (max-width: 1380px) {
  .gallery-c__container {
    width: 1100px;
  }
}

@media (max-width: 1180px) {
  .gallery-c__container {
    width: 900px;
  }
}

@media (max-width: 980px) {
  .gallery-c__container {
    width: 760px;
  }
}

@media (max-width: 808px) {
  .gallery-c__container {
    width: 100%;
  }
}

/* ---------- core gallery structure ---------- */
.gallery-c {
  position: relative;
}

.gallery-c__row {
  margin-bottom: 20px;
}

.gallery-c__row:last-child {
  margin-bottom: 0;
}

.gallery-c__list {
  position: relative;
}

.gallery-c__list:after {
  content: "";
  display: table;
  clear: both;
}

.gallery-c__item {
  background-color: rgba(0, 0, 0, .05);
  background-position: 50%;
  background-size: cover;
  float: left;
  overflow: hidden;
  position: relative;
}

.gallery-c__link {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}

.gallery-c__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* ---------- desktop layouts ---------- */

/* Row 1: big left + two stacked right */
.gallery-c__item--main-3-1 {
  width: 63%;
  padding-bottom: 45%;
  margin-right: 20px;
}

.gallery-c__item--main-3-2,
.gallery-c__item--main-3-3 {
  width: calc(37% - 20px);
  padding-bottom: 21.7%;
}

.gallery-c__item--main-3-2 {
  margin-bottom: 20px;
}

/* Row 2: 4-up mosaic */
.gallery-c__item--main-4-1,
.gallery-c__item--main-4-2 {
  width: calc(25% - 15px);
  padding-bottom: 23.9%;
  margin-right: 20px;
}

.gallery-c__item--main-4-3 {
  width: calc(50% - 10px);
  padding-bottom: 23.8%;
  position: absolute;
  left: 0;
  bottom: 0;
  margin-top: 20px;
}

.gallery-c__item--main-4-4 {
  width: calc(50% - 10px);
  padding-bottom: 49.25%;
  float: right;
}

/* Row 3: two small left + big right */
.gallery-c__item--tertiary-3-1,
.gallery-c__item--tertiary-3-2 {
  width: calc(37% - 20px);
  padding-bottom: 21.7%;
}

.gallery-c__item--tertiary-3-1 {
  margin-bottom: 20px;
}

.gallery-c__item--tertiary-3-2 {
  position: absolute;
  left: 0;
  bottom: 0;
}

.gallery-c__item--tertiary-3-3 {
  width: 63%;
  padding-bottom: 45%;
  float: right;
  margin-left: 20px;
}

/* Optional tertiary 4-up */
.gallery-c__item--tertiary-4-1 {
  float: left;
  width: calc(50% - 10px);
  padding-bottom: 49.25%;
}

.gallery-c__item--tertiary-4-2,
.gallery-c__item--tertiary-4-3 {
  float: right;
  width: calc(25% - 15px);
  padding-bottom: 23.9%;
  margin-right: 20px;
}

.gallery-c__item--tertiary-4-2 {
  margin-right: 0;
}

.gallery-c__item--tertiary-4-4 {
  position: absolute;
  right: 0;
  bottom: 0;
  width: calc(50% - 10px);
  padding-bottom: 23.8%;
  margin-top: 20px;
}

/* ---------- desktop responsive tweaks ---------- */
@media (max-width: 1380px) {
  .gallery-c__item--main-3-2,
  .gallery-c__item--main-3-3 {
    padding-bottom: 21.6%;
  }

  .gallery-c__item--tertiary-3-1,
  .gallery-c__item--tertiary-3-2 {
    padding-bottom: 21.6%;
  }

  .gallery-c__item--tertiary-4-4 {
    padding-bottom: 23.6%;
  }
}

@media (max-width: 1180px) {
  .gallery-c__item--main-4-3 {
    padding-bottom: 23.2%;
  }

  .gallery-c__item--tertiary-3-1,
  .gallery-c__item--tertiary-3-2 {
    padding-bottom: 21.39%;
  }

  .gallery-c__item--tertiary-4-4 {
    padding-bottom: 23.1%;
  }
}

@media (max-width: 980px) {
  .gallery-c__item--tertiary-4-4 {
    padding-bottom: 22.8%;
  }
}

/* ---------- tabs ---------- */
.gallery-tabs {
  display: flex;
  justify-content: center;
  gap: .75rem;
  margin: 0 auto 1.25rem;
}

.gallery-tabs .nav-link {
  background: #f9fafb;
  color: #412c1a;
  border: 1px solid #999;
  border-radius: 1px !important;
  padding: .70rem 1.25rem;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: none;
}

.gallery-tabs .nav-link:hover {
  background: #f8f8f8;
  color: #2f4b57;
}

.gallery-tabs .nav-link.active,
.gallery-tabs .nav-link[aria-selected="true"] {
  background: #4c7d3d !important;
  color: #fff !important;
  border-color: #222;
}

@media (max-width: 768px) {
  .gallery-tabs .nav-link {
    padding: .60rem .5rem !important;
    font-weight: 500 !important;
    font-size: 15px;
  }
}

@media (max-width: 480px) {
  .gallery-tabs {
    flex-wrap: wrap;
  }
}

/* ---------- mobile spacing ---------- */
@media (max-width: 992px) {
  #gallery .gallery-c__container,
  #gallery .gallery-c__list,
  #gallery .gallery-c__row,
  #gallery .gallery-c__item {
    padding-left: 3px !important;
    padding-right: 3px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

@media (max-width: 660px) {
  #gallery .gallery-c__container,
  #gallery .gallery-c__row,
  #gallery .gallery-c__list,
  #gallery .gallery-c__item {
    padding-left: 0 !important;
    padding-right: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }
}

/* ---------- mobile gallery layout ---------- */
@media (max-width: 808px) {
  #gallery .gallery-c__row > .gallery-c__list {
    display: grid !important;
    gap: 12px !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* 4-up rows */
  #gallery .gallery-c__row--4up > .gallery-c__list {
    grid-template-columns: repeat(4, 1fr) !important;
  }

  /* Default rows: 3-up */
  #gallery .gallery-c__row:not(.gallery-c__row--4up) > .gallery-c__list {
    grid-template-columns: repeat(3, 1fr) !important;
  }

  #gallery .gallery-c__item {
    float: none !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    aspect-ratio: 4 / 3 !important;
    overflow: hidden !important;
  }

  #gallery .gallery-c__link {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
  }

  #gallery .gallery-c__image {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
  }
}

@media (max-width: 380px) {
  #gallery .gallery-c__row > .gallery-c__list {
    gap: 10px !important;
  }
}

/* ---------- Fancybox ---------- */
html.fancybox-active .gallery-tabs,
html.fancybox-active nav.navbar,
html.fancybox-active #navOverlay,
html.fancybox-active .progress-wrap {
  display: none !important;
}

.fancybox__container {
  z-index: 10950 !important;
}