/* General Styles */
.ast-container {
  max-width: 1400px;
  padding: 0;
}
#page {
  background-color: #f4f2f1;
}
/* Gallery Container */
.gallery-container {
  width: 100%;
  margin: 0 auto;
  padding: 75px 35px;
}

#load-more {
  display: flex;
  width: 180px;
  height: 45px;
  text-align: center;
  outline: none;
  font-size: 14px;
  border: 1px solid #d7d2cb;
  color: #d7d2cb;
  align-items: center;
  justify-content: center;
  background-color: #212322;
  margin: 2rem 0;
  border-radius: 0;
}
#load-more:hover {
  background-color: #d7d2cb;
  color: #212322;
  border: 1px solid #212322;
}
.gallery-container h1 {
  text-align: left;
  font-size: 48px;
  margin: 0 0 20px;
  font-family: var(--secondary-font);
  color: var(--background-color);
  font-weight: 500;
  width: max-content;
}
.work-link {
  display: block;
  width: max-content;
}
/* Gallery Layout */
.gallery-layout {
  display: flex;
}

/* Filters */
.filters {
  width: 20%;
  padding-right: 20px;
  transition: transform 0.3s ease, opacity 0.3s ease; /* Smooth slide-in effect */
}
.grid-wrap {
  width: 80%;
}
.filters button {
  display: block;
  width: 100%;
  margin-bottom: 10px;
  font-family: var(--secondary-font);
  background-color: var(--secondar-background-color);
  border: none;
  cursor: pointer;
  text-align: left;
  box-shadow: none;
  font-size: 28px;
  color: var(--secondary-color);
  padding: 0;
}

.filters h2,
.mobile-filter {
  font-size: 16px;
  color: var(--body-copy);
  font-weight: 700;
  margin-bottom: 1rem;
  width: max-content;
}

.filters button:hover {
  color: #716e6a;
}

/* Filter Toggle Button */
.filter-toggle {
  display: none;
  position: fixed;
  bottom: 10px;
  right: 10px;
  z-index: 100;
  background-color: var(--secondary-background-color);
  color: var(--secondary-color);
  border: none;
  padding: 10px 20px;
  cursor: pointer;
  font-size: 16px;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.mobile-filter {
  display: none;
}

.filter-close-icon {
  display: none;
}

/* Filters on Small Screens */
@media (max-width: 921px) {
  .leftover-group {
    gap: 20px !important;
  }
  .leftover-group .grid-item {
    width: 100% !important;
  }
  .grid-wrap {
    width: 100%;
  }
  .filters {
    position: fixed;
    bottom: -100%; /* Hidden off-screen */
    left: 0;
    width: 100%;
    background-color: var(--secondary-background-color);
    z-index: 99;
    opacity: 0;
    transform: translateY(0);
  }
  .filter-close-icon {
    width: 30px;
    height: 30px;
    display: block;
    position: absolute;
    top: 2rem;
    right: 2rem;
    z-index: 55;
    filter: invert(1);
  }
  .mobile-filter {
    display: block;
    text-align: left;
    cursor: pointer;
  }
  .visible {
    bottom: 0;
    opacity: 1;
    height: 50%;
    padding: 5rem;
    background-color: var(--secondary-background-color);
  }

  .filter-toggle {
    display: block; /* Show toggle button */
  }
}

/* Mosaic Grid Container */
.mosaic-grid {
  width: 100%;
  position: relative;
}

/* Post Group Layout */
.post-group {
  display: flex;
  justify-content: space-between;
  gap: 2%;
  margin-bottom: 2%;
  max-height: 600px;
}

.layout-odd {
  /* No special styling needed; layout can differ by HTML structure */
}

.layout-even {
  /* If you want to visually differentiate even groups, you can add styling here */
}

/* Big Square and Stacked Squares */
.big-square {
  width: 60%;
  display: flex;
  flex-direction: column;
}

.stacked-squares {
  width: 38%;
  display: flex;
  flex-direction: column;
}

/* Adjust heights as needed. Remove if you'd prefer natural image sizing */
.big-square .grid-item {
  width: 100%;
  height: 600px; /* Large square height */
  position: relative;
}

.stacked-squares .grid-item {
  width: 100%;
  height: 300px; /* Half the big square height */
  position: relative;
}

/* Add spacing between stacked squares */
.stacked-squares .grid-item:not(:last-child) {
  margin-bottom: 20px;
}

/* Grid Item General Styles */
.grid-item {
  position: relative;
  overflow: hidden;
}

/* Overlay */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.2); /* Semi-transparent black overlay */
  color: #fff;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease; /* Smooth fade-in effect */
  text-align: center;
  font-size: 1.2em;
  padding: 10px;
  box-sizing: border-box;
}
.overlay img {
  width: 40px !important;
  height: 40px !important;
  position: absolute;
  top: 30px;
  right: 30px;
}
.grid-item:hover .overlay {
  opacity: 1;
}

/* Post Title */
.post-title {
  position: relative;
  transform: translateY(20px); /* Start 20px below the center */
  opacity: 0; /* Start fully transparent */
  transition: transform 0.3s ease, opacity 0.3s ease; /* Smooth movement and fade */
}

.grid-item:hover .post-title {
  transform: translateY(0); /* Move to the center */
  opacity: 1; /* Fade in */
}

/* Images */
.grid-item a {
  display: block;
  width: 100%;
  height: 100%;
}

.grid-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease; /* Smooth scaling effect */
}

.grid-item:hover img {
  transform: scale(1.05);
}

/* Responsive Adjustments */
@media (max-width: 921px) {
  .filters,
  .mosaic-grid {
    width: 100%;
  }

  .gallery-layout {
    flex-direction: column;
  }

  .post-group {
    flex-direction: column;
    align-items: center;
    max-height: unset;
    margin-bottom: 0;
  }
  .layout-even .big-square {
    margin-top: 20px;
  }
  .layout-odd {
    margin-bottom: 20px;
  }
  .big-square {
    margin-bottom: 20px;
  }
  .big-square,
  .stacked-squares {
    width: 100%;
  }

  /* Remove fixed heights on smaller screens to allow fluid resizing */
  .big-square .grid-item,
  .stacked-squares .grid-item {
    height: auto;
  }

  .stacked-squares .grid-item:not(:last-child) {
    margin-bottom: 20px;
  }
}

@media (max-width: 600px) {
  .stacked-squares .grid-item {
    margin-bottom: 20px;
  }
  .layout-odd {
    margin-bottom: 0px;
  }
  
    .layout-even .big-square {
    margin-top: 0px;
  }
}
