/* ----------------- GALLERY SECTION ----------------- */

.gallery-section {
    background-color: var(--background-color-first);
    padding: 2.5rem 1rem;
    position: relative;
    overflow: hidden;
  }
  
  /* Title & description */
  .gallery-title {
    font-size: 2.6rem; /* ~1.3x original 2rem */
    font-weight: bold;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    text-align: center;
    opacity: 0;            /* for scroll-in animation */
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  
  .gallery-description {
    font-size: 1.235rem; /* ~1.3x original 0.95rem => about 1.235rem */
    color: var(--text-color);
    margin-bottom: 2rem;
    text-align: center;
    opacity: 0;           /* for scroll-in animation */
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
  }
  
  /* Class applied when scrolling into view triggers animation */
  .gallery-animate-in {
    opacity: 1 !important;
    transform: translateY(0) !important;
  }
  
  /* Container for images in normal layout */
  .gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    /* We'll place the absolute container on top of this as well. */
  }
  
  /* We'll create rows (in normal mode) with a distribution logic. */
  .gallery-row {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    margin-bottom: 1rem; /* spacing between rows */
    box-sizing: border-box;
  }
  
  /* Each "column" in a row. We'll fix width via script. */
  .gallery-column {
    box-sizing: border-box;
    position: relative;
    overflow: hidden;
    margin-right: 0.5rem; /* small horizontal gap inside row */
  }
  .gallery-column:last-child {
    margin-right: 0;
  }
  
  /* The actual image wrapper in normal layout */
  .gallery-image-wrapper {
    position: relative;
    width: 100%;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform 1s ease, border-color 1s ease;
    border-radius: 0.75rem; /* round corners */
    /* For the scroll-in "pop" animation: */
    opacity: 0;
    transform: translateY(30px);
  }
  
  /* Once the image "pops" in */
  .gallery-image-in {
    opacity: 1 !important;
    transform: translateY(0) !important;
  }
  
  /* The actual <img> inside the wrapper */
  .gallery-img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: 0.75rem; /* round corners */
  }
  
  /* -------- ABSOLUTE CONTAINER (Expanded Mode) -------- */
  .gallery-absolute-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none; /* let clicks pass if we want, but we'll handle carefully */
    z-index: 10; /* on top of normal rows */
  }
  
  /* We'll place each image in absolute mode for the "expanded" effect. */
  .gallery-expanded-item {
    position: absolute;
    transform-origin: top left;
    transition: transform 1s ease, top 1s ease, left 1s ease;
    pointer-events: auto; /* we want to be able to click the images still */
  }
  
  /* On mobile: show first image and a glimpse of the second => horizontal scroll */
  @media (max-width: 640px) {
    .gallery-row {
      display: flex !important;
      width: 100%;
      overflow-x: scroll;
      margin-bottom: 1rem;
    }
    .gallery-column {
      flex: 0 0 85%;
      margin-right: 1rem;
    }
    .gallery-column:last-child {
      margin-right: 0;
    }
    .gallery-section {
      padding: 2.5rem 0.5rem;
    }
  }