/*   Gallery Section    */

.gallery-section {
  /* padding: 10px 0; */
  background-color: #fff;
  /* font-family: var(--font-heading); */
  position: relative;
}



/*    Gallery Grid   */

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 24px;
  padding: 2rem 10px;
  transition: all 0.3s ease;
}

/*    Gallery Items  */

.gallery-item {
  position: relative;
  /* overflow: hidden; */
  border-radius: 12px;
  background-color: #f5f5f5;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  aspect-ratio: 1/1;

  animation: itemReveal 0.6s ease-out forwards;
  z-index: 10;
}

@keyframes itemReveal {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

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

.gallery-item::after {
  opacity: 0;
  display: flex;
  justify-content: start;
  align-items: end;
  padding: 5% 10%;

  content: var(--after-text);
  color: white;

  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;

  background: linear-gradient(rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.988));
  transition: opacity 0.3s ease-in;
  border-radius: 12px;
}

.gallery-item.active::after {
  opacity: 1;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
  z-index: 10;
}

@media (hover: hover) {
  .gallery-item:hover::after {
    opacity: 1;
  }

  .gallery-item:hover img {
    transform: scale(1.1);
  }
}

.gallery-item.active img {
  transform: scale(1.1);
}

.gallery-image-container {
  width: 100%;
  height: 100%;
  overflow: hidden;

  position: relative;

  border-radius: 12px;
  z-index: 10;
}

/* lightbox nav */

.nav-hitbox {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  z-index: 10;
  cursor: pointer;

  .nav-hitbox {
  -webkit-tap-highlight-color: transparent;
  /* Optional: removes standard outline for keyboard navigation if it's also bothering you */
  outline: none; 
}
}

.nav-hitbox.left {
  left: 0;
}

.nav-hitbox.right {
  right: 0;
}

/* Lightbox */

.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;

  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  z-index: 2000;
  padding: 20px;
}

.lightbox.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

.lightbox-content {
  position: relative;
  display: flex;
  flex-direction: column;

  width: 100%;
  max-width: 1100px;
  height: 85vh;

  background-color: #fefdfa;
  border-radius: 24px;
  padding: 40px 30px 20px 30px;

  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.lightbox-top-row {
  display: flex;
  flex: 1;
  gap: 30px;
  min-height: 0;
}

/* Left */

.lightbox-left {
  flex: 2.5;
  position: relative;

  background-color: #f5f5f5;
  border-radius: 16px;
  overflow: hidden;

  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox-left img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

/* Right */

.lightbox-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.lightbox-right-info {
  flex: 1;
  display: flex;
  flex-direction: column;

  overflow-y: auto;
  padding-top: 2rem;
  padding-left: 1rem;
}

/* Bottom tray */

.lightbox-bottom-tray {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid #eee;

  display: flex;
  justify-content: center;
  align-items: center;
}

/* Alt text */

.alt-text-item {
  font-family: var(--font-heading);
  font-size: 1.7rem;
  font-weight: 400;
  letter-spacing: 0.5px;

  cursor: pointer;
  transition: color 0.3s ease, transform 0.2s ease;

  color: #888;
  margin-bottom: 5px;
  line-height: 1.3;
}

.alt-text-item:hover {
  color: #555;
  /* transform: translateX(5px); */
}

.alt-text-item.active {
  color: var(--color-primary);
}

/* Thumbnails */

.thumbnail-track {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.thumb-item {
  width: 70px;
  aspect-ratio: 1/1;
  object-fit: cover;

  border-radius: 8px;
  cursor: pointer;

  opacity: 0.5;
  transition: opacity 0.3s ease, transform 0.2s ease;
}

.thumb-item:hover {
  opacity: 0.8;
}

.thumb-item.active {
  opacity: 1;
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Close button */

.close-btn {
  position: absolute;
  top: 15px;
  right: 15px;

  width: 40px;
  height: 40px;

  border-radius: 50%;
  background: #eee;
  border: none;

  font-size: 28px;
  line-height: 1;

  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;

  z-index: 2100;
  color: #333;
  transition: background 0.2s;
}

.close-btn:hover {
  background: #ddd;
}

/* Mobile caption */

.mobile-alt-caption {
  display: none;
}

/* ========================= */
/* ===== Responsive ======== */
/* ========================= */

/* <= 960px */

@media (max-width: 960px) {
  .gallery-section {
    /* padding: 20px 0; */
    padding-bottom: 20px;
  }

  .gallery-section h2 {
    font-size: 2.2rem;
  }

  .gallery-section .section-header {
    margin: 0 0 20px 0;
  }

  .lightbox-content {
    flex-direction: column;
    height: auto;
    max-height: 90vh;
    padding: 50px 15px 15px;
    gap: 15px;
    width: 95%;
  }

  .lightbox-top-row {
    flex-direction: column;
    flex: none;
  }

  .lightbox-left {
    flex: none;
    height: 45vh;
  }

  .lightbox-right {
    flex: none;
    height: auto;
  }

  .lightbox-right-info {
    display: none;
  }

  .lightbox-bottom-tray {
    border-top: none;
    margin: 10px auto 0;
    width: 90%;
    max-width: 350px;
    overflow: hidden;
    position: relative;

    -webkit-mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
    mask-image: linear-gradient(to right, transparent, black 15%, black 85%, transparent);
  }

  .thumbnail-track {
    gap: 12px;
    justify-content: flex-start;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 10px 45px;

    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .thumbnail-track::-webkit-scrollbar {
    display: none;
  }

  .thumb-item {
    flex: 0 0 65px;
    width: 65px;
  }

  .close-btn {
    top: 10px;
    right: 10px;
    width: 35px;
    height: 35px;
  }

  .mobile-alt-caption {
    display: block;
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;

    background-color: rgba(101, 67, 33, 0.7);
    color: #fefdfa;

    padding: 12px 20px;
    font-family: var(--font-primary);
    font-size: 1rem;
    text-align: center;

    z-index: 15;
    pointer-events: none;

    backdrop-filter: blur(4px);
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
  }
}

/* Tablet Layout: Force 4 columns only on medium screens */
@media (min-width: 769px) and (max-width: 1024px) {
  .gallery-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (max-width: 768px) {
  .gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}


@media (max-width: 280px) {
  .gallery-grid {
    grid-template-columns: 1fr;
  }
}

/* Folder count Badge */

.item-count-badge {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 42px;  /* Slightly larger for this icon style */
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  pointer-events: none;
  border-radius: 50%;
}

.badge-icon {
  position: absolute;
  /* top: 0; */
  /* left: 0; */
  width: 75%;
  height: 75%;
  color: #fff; /* SVG color */
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

.badge-icon svg {
  width: 100%;
  height: 100%;
}

.badge-num {
  position: relative;
  z-index: 2;
  
  /* POSITIONING:
     We move it slightly up and left to sit in the folder "pocket" 
     and avoid the plus sign in the bottom right corner */
  transform: translate(-3px, 1px);
  
  font-family: var(--font-primary);
  font-size: 0.7rem; 
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* On mobile, shrink the whole badge slightly */
@media (max-width: 768px) {
  .item-count-badge {
    width: 32px;
    height: 32px;
    top: 8px;
    right: 8px;
  }
  .badge-num {
    font-size: 0.6rem;
    transform: translate(-2px, 1px);
  }
}

/* Ensure badge remains visible or fades on hover if desired */
.gallery-item:hover .item-count-badge {
  background-color: #94673abe; 
}

/* User Prompt Pulse Effect */

.gallery-item.intro-active .item-count-badge {
  opacity: 1;
  background-color: #94673abe; /* Slightly darker for better visibility */
}

/* 2. The Pulse Effect */
/* Ensure the badge is the anchor for the transformation */
/* 1. Permanent Enlargement during Intro */
.gallery-item.pulse-trigger .item-count-badge {
  opacity: 1;
  background-color:#94673abe;
  transform: scale(1.3); 
  transition: transform 0.5s ease;
  z-index: 10;
}

/* 2. Filled Ripple Base Style */
.gallery-item.pulse-trigger .item-count-badge::before,
.gallery-item.pulse-trigger .item-count-badge::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  /* Using background-color for the "filled" effect */
  background-color: #c29b62; 
  opacity: 0;
  pointer-events: none;
  z-index: -1; /* Ripples emanate from BEHIND the badge */
  animation: filledStaggeredRipple 2s ease-out infinite;
}

/* 3. Staggered Delay */
.gallery-item.pulse-trigger .item-count-badge::after {
  animation-delay: 0.5s; /* Second filled pulse follows the first */
}

/* 4. Tighter Ripple Animation */
@keyframes filledStaggeredRipple {
  0% {
    transform: scale(1);
    opacity: 0.6; /* Starts as a visible filled circle */
  }
  50% {
    opacity: 0.3;
  }
  100% {
    /* Reduced scale from 3.5 to 2.2 for a "tighter" extent */
    transform: scale(2.2); 
    opacity: 0;
  }
}


/* user prompt notification capsule */

/* Gallery Item Notification Overlay */
.gallery-item .gallery-item-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  
  background-color: #fefdfa; 
  color: #654321;
  border: 1px solid #c29b62; 
  border-bottom: none; 
  border-radius: 12px 12px 0 0; 
  
  position: absolute;
  /* Starts exactly 15px below the top edge of the image container */
  top: 15px; 
  left: 0;
  width: 100%;
  
  /* INITIAL STATE: Sitting still, hidden behind the image */
  transform: translateY(0); 
  opacity: 0;
  
  z-index: 5; /* LOWER than the image container */
  pointer-events: none; 
  
  /* Added extra padding at the bottom so the text isn't cut off by the overlapping image */
  padding: 10px 15px 20px 15px; 
  
  font-family: var(--font-primary);
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-align: center;
  
  box-shadow: 0 -4px 10px rgba(101, 67, 33, 0.15);

  /* Added a slight cubic-bezier for a smooth, natural sliding motion */
  transition: transform 0.6s cubic-bezier(0.25, 1, 0.5, 1), 
              opacity 0.4s ease-out;
}

/* 3. ACTIVE STATE */
.gallery-item.show-notice .gallery-item-notice {
  /* Slides UP out from behind the image. Because it started 15px down, 
     it remains tucked 15px behind the image, leaving zero gaps! */
  transform: translateY(-100%);
  opacity: 1;
}

.gallery-item-notice svg {
  color: #c29b62; 
}

/* Lazy Loading States */
.gallery-item img.lazy-image {
  opacity: 0;
  /* We keep your transform transition so the hover zoom still works! */
  transition: opacity 0.5s ease-in-out, transform 0.4s ease;
}

.gallery-item img.lazy-loaded {
  opacity: 1;
}

@media (max-width: 768px) {
  .gallery-item-notice span{
    font-size: 0.7rem;
    gap: 6px;
  }

  .gallery-item-notice{
    padding: 5px 10px 10px 10px; /* Maintained bottom padding ratio */

  }
  
  /* .gallery-item-notice svg{
    width: 14px;
    height: 14px;
  } */



}