/* ==========================================================================
   1. Scroll Container Setup (Desktop & Mobile)
   ========================================================================== */
.assets-grid {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 20px;
  padding-left: 0 !important;
  margin-left: 0 !important;
}

/* ==========================================================================
   2. Base Image Styles
   ========================================================================== */
.asset.image {
  flex-shrink: 0;
  scroll-snap-align: start;
  width: 150px;
  height: auto;
  margin-right: 0;
}

/* ==========================================================================
   3. Center First Image Pair (Desktop Only)
   ========================================================================== */
@media (min-width: 769px) {
  .asset.image:nth-child(1) {
    margin-left: calc(50vw - 150px - 0.5px - 480px);
  }
  .asset.image:nth-child(2) {
    margin-left: 1px;
  }
}

/* ==========================================================================
   4. Spacing Between Pairs (Desktop & Mobile)
   ========================================================================== */
.asset.image:nth-child(2n) {
  margin-left: 1px;    /* seam between two images */
}

/* Desktop spacing between pairs */
@media (min-width: 769px) {
  .asset.image:nth-child(2n) {
    margin-right: 280px;
  }
}

/* Mobile spacing between pairs */
@media (max-width: 768px) {
  .asset.image:nth-child(2n) {
    margin-right: 160px;
  }
}

/* ==========================================================================
   5. Leading & Trailing Space (Desktop)
   ========================================================================== */
@media (min-width: 769px) {
  /* Add trailing space to last asset so it can center like the others */
  body.gallery > main > div > div > div:last-child > div {
    margin-right: 130px !important;
  }
}

/* ==========================================================================
   6. Mobile Overrides - Minimal, No Extra Spacing
   ========================================================================== */
@media (max-width: 768px) {
  /* Remove large margin-left on first image */
  .asset.image:nth-child(1) {
    margin-left: 0 !important;
  }

  /* Remove trailing margin on last asset */
  body.gallery > main > div > div > div:last-child > div {
    margin-right: 0 !important;
  }

  /* Reset container and wrappers to avoid left gap */
  main.container,
  .assets-grid-wrapper,
  .assets-grid,
  body.gallery > main > div > div > div:last-child > div {
    margin-left: 0 !important;
    padding-left: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  /* Sidebar full width on mobile */
  .header.show-header {
    width: 100% !important;
    outline: none;
  }

  main.container {
    padding-left: 0 !important;
    outline: none;
  }
}

/* ==========================================================================
   7. Sidebar & Main Container Tweaks (Desktop Only)
   ========================================================================== */
@media (min-width: 769px) {
  /* Narrow the left header/sidebar */
  .header.show-header {
    width: 200px !important;
    box-sizing: border-box;
  }

  /* Shift main content right by padding (instead of margin) */
  main.container {
    margin-left: 0 !important;
    padding-left: 215px !important; /* = sidebar width + buffer */
    box-sizing: border-box;
  }

  /* Remove extra padding/margin on wrappers */
  .assets-grid-wrapper,
  .assets-grid {
    padding-left: 0 !important;
    margin-left: 0 !important;
  }
}
