.gallery-container {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 2rem;
  width: 100%; /* Controls visible width */
}

.gallery-nav {
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  border-radius: 4px;
  padding: 0 12px;
  height: 60px;
  user-select: none;
  z-index: 10;
}

.gallery-nav:focus {
  outline: 2px solid #005fcc;
  outline-offset: 2px;
}

/* Gallery uses grid with vertical flow and horizontal scroll */
.gallery {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 300px;
  grid-template-rows: repeat(2, 300px);
  gap: 10px;
  overflow-x: auto;
  scroll-behavior: smooth;
  width: 90%; /* 3 full cols (300*3=450) + 10px gap + ~40px peek */
  user-select: none;
  scrollbar-width: none; /* Firefox hide scrollbar */
}

.gallery::-webkit-scrollbar {
  display: none; /* Chrome/Safari hide scrollbar */
}

.gallery img {
  width: 300px;
  height: 300px;
  object-fit: cover;
  cursor: pointer;
  border-radius: 6px;
  transition: transform 0.3s;
}

.gallery img:hover,
.gallery img:focus {
  outline: 2px solid #005fcc;
  transform: scale(1.05);
  outline-offset: 2px;
}

/* Lightbox overlay */
.lightbox, .lightbox2 {
  display: none;
  position: fixed;
  z-index: 9999;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 1rem;
  text-align: center;
}

.lightbox.open, .lightbox2.open {
  display: flex;
}

.lightbox img, .lightbox2 img  {
  max-width: 90%;
  max-height: 80vh;
  border-radius: 8px;
  user-select: none;
  margin-bottom: 0.5rem;
}

/* Caption */
.lightbox-caption, .lightbox2-caption {
  color: #eee;
  font-size: 3rem;
  max-width: 90%;
  margin-bottom: 1rem;
  user-select: none;
}

/* Close button */
.close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #fff;
  font-size: 5rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
  z-index: 10002;
}

/* Navigation buttons inside lightbox */
.nav-btn, .nav-btn2 {
  position: fixed;
  top: 50%;
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  font-size: 3rem;
  cursor: pointer;
  padding: 0.1em 0.5em;
  border-radius: 4px;
  user-select: none;
  transform: translateY(-50%);
  z-index: 10001;
}

.prev-btn, .prev-btn2 {
  left: 10px;
}

.next-btn, .next-btn2 {
  right: 10px;
}

.nav-btn:focus, .nav-btn2:focus {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/*GRID*/
.gallery-grid-container {
  display: block;
  width: auto;
  margin-bottom: 2rem;
}

.gallery-grid-nav {
  display: none;
}
/* Gallery-grid grid: 3 columns, auto rows */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 31%);
  grid-auto-rows: 150px;
  gap: 10px;
  overflow: visible;
  width: 100%
  user-select: none;
}
/* Wrapper for each thumbnail and its caption overlay */
.thumb-wrapper {
  position: relative;
  width: 100%;
  height: 150px;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
}

.thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
  border-radius: 6px;
}

.thumb-wrapper:hover img,
.thumb-wrapper:focus-within img {
  transform: scale(1.05);
  outline-offset: 2px;
  outline: none;
}

/* Title overlay at bottom of thumbnail */
.thumb-title {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 33%;
    background: rgba(0, 0, 0, 0.75);
    padding: 4px 6px;
    box-sizing: border-box;
    overflow: hidden;
    border-bottom-left-radius: 6px;
    border-bottom-right-radius: 6px;
    user-select: none;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
}

.thumb-title span{
    color: white;
    font-size: 14px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}


.thumb-caption {
    color: #eee;
    font-size: 3rem;
    max-width: 90vw;
    margin-bottom: 1rem;
    user-select: text;
}

/* Focus outline on wrapper */
.thumb-wrapper:focus-within {
  outline: 2px solid #005fcc;
  outline-offset: 2px;
}

/*Masonry*/
.boxed-slider-wrapper {
  display: flex;
  align-items: center;
  max-width: 100%; 
  margin: 0 auto 2rem;
}

.boxed-nav-btn {
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  user-select: none;
  transition: background 0.3s;
  flex-shrink: 0;
  margin: 0 5px;
}

.boxed-nav-btn:hover,
.boxed-nav-btn:focus {
  background: rgba(0, 0, 0, 0.8);
  outline: none;
}

.boxed-gallery-grid {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 180px;
  grid-template-rows: repeat(2, 180px);
  gap: 0;
  overflow-x: auto;
  scroll-behavior: smooth;
  outline: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-snap-type: x mandatory;
  user-select: none;
  -webkit-overflow-scrolling: touch;
  scroll-padding-left: 10px;
  scroll-padding-right: 10px;
  border-radius: 8px;
}

.boxed-gallery-grid::-webkit-scrollbar {
  display: none;
}

.boxed-thumb-wrapper {
  position: relative;
  cursor: pointer;
  overflow: hidden;

  outline-offset: 2px;

  scroll-snap-align: start;
  box-sizing: border-box;
}

.boxed-thumb-wrapper:focus-visible {
  outline: 3px solid #007acc;
}

.boxed-thumb-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.boxed-thumb-wrapper:hover img {
  transform: scale(1.05);
}

/* Highlighted big thumbnails: span 2 cols x 2 rows */
.boxed-thumb-wrapper.highlighted {
  grid-column: span 2;
  grid-row: span 2;
}

/* Lightbox */

.boxed-lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  padding: 1rem;
  text-align: center;
}

.boxed-lightbox.open {
  display: flex;
}

.boxed-lightbox img {
  max-width: 90vw;
  max-height: 80vh;
  border-radius: 8px;
  user-select: none;
  margin-bottom: 0.5rem;
}

.boxed-lightbox-caption {
  color: #eee;
  font-size: 3rem;
  max-width: 90vw;
  margin-bottom: 1rem;
  user-select: text;
}

.boxed-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  color: #fff;
  font-size: 5rem;
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
  z-index: 10002;
}

.boxed-prev-btn-lightbox {
  position: fixed;
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
  z-index: 10001;
}

.boxed-next-btn-lightbox {
  position: fixed;
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
  z-index: 10001;
}

.boxed-nav-btn-lightbox {
  background: rgba(0, 0, 0, 0.5);
  border: none;
  color: white;
  font-size: 3rem;
  cursor: pointer;
  padding: 0.2em 0.6em;
  border-radius: 4px;
  user-select: none;
  margin: 0 1rem;
  transition: background 0.3s;
}

.boxed-nav-btn-lightbox:hover,
.boxed-nav-btn-lightbox:focus {
  background: rgba(0, 0, 0, 0.8);
  outline: none;
}

.gdSliderSect{
  margin-top: 80px;
}