/* =========================================================
   THE OAKLEY AT PRO PARK — GALLERY
   Clean replacement for css/gallery.css
   ========================================================= */

.gallery-c__container {
  display: block;
  width: min(1300px, calc(100% - 40px));
  margin: 0 auto;
}

.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 {
  position: relative;
  float: left;
  overflow: hidden;
  background: #f2f0ed;
  background-position: center;
  background-size: cover;
}

.gallery-c__link {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.gallery-c__image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Large left image with two stacked images on the 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;
}

/* Two stacked images on the left with a large image on the 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 {
  float: right;
  width: 63%;
  padding-bottom: 45%;
  margin-left: 20px;
}

/* Four-image 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 {
  position: absolute;
  left: 0;
  bottom: 0;
  width: calc(50% - 10px);
  padding-bottom: 23.8%;
}

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

.gallery-row-hidden,
.gallery-hidden {
  display: none !important;
}

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

.gallery-tabs .nav-link {
  padding: .7rem 1.25rem;
  border: 1px solid #93736c;
  border-radius: 1px !important;
  color: #3f3f3f;
  background: #fff5eb;
  font-weight: 600;
  line-height: 1.2;
  box-shadow: none;
}

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

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

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;
}


/* =========================================================
   RESPONSIVE GALLERY
   Desktop keeps the original mosaic. Mobile uses a separate,
   continuous two-column gallery inside each Bootstrap tab pane.
   ========================================================= */
.gallery-mobile-grid {
  display: none;
}

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

  .gallery-tabs {
    flex-wrap: nowrap;
    gap: 8px;
    width: 100%;
    margin-bottom: 18px;
  }

  .gallery-tabs .nav-item {
    flex: 1 1 0;
    min-width: 0;
  }

  .gallery-tabs .nav-link {
    width: 100%;
    padding: 10px 5px;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
  }

  /* Never alter the desktop mosaic geometry; simply hide it on mobile. */
  .gallery-desktop-mosaic,
  .tab-pane > .gallery-show-more-wrap {
    display: none !important;
  }

  /* Each tab owns its own independent mobile image grid. */
  .tab-pane.active .gallery-mobile-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    margin: 0;
    padding: 0;
  }

  .gallery-mobile-item {
    position: relative;
    display: block;
    width: 100%;
    min-width: 0;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #f2f0ed;
  }

  .gallery-mobile-item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  .tour-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

@media (max-width: 390px) {
  .gallery-c__container {
    padding-inline: 8px;
  }

  .gallery-tabs {
    gap: 6px;
  }

  .gallery-tabs .nav-link {
    padding: 9px 3px;
    font-size: 13px;
  }

  .tab-pane.active .gallery-mobile-grid {
    gap: 8px;
  }
}

/* =========================================================
   MOBILE GALLERY RHYTHM
   Apartment and Community use the same repeating pattern:
   3 images across, then 4 images across.
   Desktop and 3D tours remain unchanged.
   ========================================================= */
@media (max-width: 808px) {
  #apt.tab-pane.active .gallery-mobile-grid[data-mobile-gallery="apt"],
  #comm.tab-pane.active .gallery-mobile-grid[data-mobile-gallery="comm"] {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    grid-auto-flow: row dense;
    gap: 10px;
  }

  #apt .gallery-mobile-grid[data-mobile-gallery="apt"] .gallery-mobile-item,
  #comm .gallery-mobile-grid[data-mobile-gallery="comm"] .gallery-mobile-item {
    grid-column: span 4;
    aspect-ratio: 1 / 1;
  }

  /* Every repeating group of seven: 3 across, then 4 across. */
  #apt .gallery-mobile-grid[data-mobile-gallery="apt"] .gallery-mobile-item:nth-child(7n + 4),
  #apt .gallery-mobile-grid[data-mobile-gallery="apt"] .gallery-mobile-item:nth-child(7n + 5),
  #apt .gallery-mobile-grid[data-mobile-gallery="apt"] .gallery-mobile-item:nth-child(7n + 6),
  #apt .gallery-mobile-grid[data-mobile-gallery="apt"] .gallery-mobile-item:nth-child(7n + 7),
  #comm .gallery-mobile-grid[data-mobile-gallery="comm"] .gallery-mobile-item:nth-child(7n + 4),
  #comm .gallery-mobile-grid[data-mobile-gallery="comm"] .gallery-mobile-item:nth-child(7n + 5),
  #comm .gallery-mobile-grid[data-mobile-gallery="comm"] .gallery-mobile-item:nth-child(7n + 6),
  #comm .gallery-mobile-grid[data-mobile-gallery="comm"] .gallery-mobile-item:nth-child(7n + 7) {
    grid-column: span 3;
  }

  #apt .gallery-mobile-grid[data-mobile-gallery="apt"] .gallery-mobile-item img,
  #comm .gallery-mobile-grid[data-mobile-gallery="comm"] .gallery-mobile-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }
}

@media (max-width: 390px) {
  #apt.tab-pane.active .gallery-mobile-grid[data-mobile-gallery="apt"],
  #comm.tab-pane.active .gallery-mobile-grid[data-mobile-gallery="comm"] {
    gap: 8px;
  }
}
