/* Gallery Section Component Styles */

.gallery-section {
  position: relative;
}

.gallery-container {
  width: 100%;
}

/* Custom Grid Layout - exact structure as specified */

.parent {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 20px;
  width: 100%;
  min-height: 600px;
}

/* Grid positioning classes - exact as specified */

.div1 {
  grid-column: span 2 / span 2;
  grid-row: span 2 / span 2;
}

.div2 {
  grid-column-start: 3;
}

.div3 {
  grid-column-start: 4;
}

.div4 {
  grid-column-start: 3;
  grid-row-start: 2;
}

.div5 {
  grid-column-start: 4;
  grid-row-start: 2;
}

.div6 {
  grid-column: span 2 / span 2;
  grid-row: span 2 / span 2;
  grid-column-start: 2;
  grid-row-start: 3;
}

.div7 {
  grid-column-start: 1;
  grid-row-start: 3;
}

.div8 {
  grid-column-start: 1;
  grid-row-start: 4;
}

.div9 {
  grid-column-start: 4;
  grid-row-start: 4;
}

.div10 {
  grid-column-start: 4;
  grid-row-start: 3;
}

/* Aspect ratios for grid items */

.div1,
.div6 {
  aspect-ratio: 2/1;
}

.div2,
.div3,
.div4,
.div5,
.div7,
.div8,
.div9,
.div10 {
  aspect-ratio: 16/10;
}

/* Gallery Item Card Styles */

.gallery-item-card {
  position: relative;
  height: 100%;
  width: 100%;
  /* Remove gray background */
}

.gallery-item-card img {
  height: 100%;
  width: 100%;
  -o-object-fit: cover;
     object-fit: cover;
  /* Ensure images fill the entire card space */
}

/* Ensure gallery items fill their grid area properly */

.gallery-item {
  height: 100%;
  width: 100%;
}

.gallery-item .gallery-item-card {
  height: 100%;
  width: 100%;
}

/* Pagination Styles */

.gallery-pagination {
  margin-top: 1.5rem;
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
}

.gallery-pagination-left {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  line-height: 1.25rem;
  --tw-text-opacity: 1;
  color: rgb(75 85 99 / var(--tw-text-opacity, 1));
}

.gallery-pagination-center {
  display: flex;
  align-items: center;
  gap: 18px;
}

.gallery-pagination-right {
  display: flex;
  align-items: center;
}

.gallery-nav {
  height: 30px;
  width: 30px;
  border-radius: 6px;
  font-size: 0.875rem;
  line-height: 1.25rem;
  font-weight: 500;
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
  background-color: var(--color-text);
  --tw-text-opacity: 1;
  color: rgb(255 255 255 / var(--tw-text-opacity, 1));
}

.gallery-nav:hover {
  background-color: var(--color-gray-300);
}

.gallery-nav:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.gallery-nav.active {
  background-color: var(--color-primary-100);
  --tw-text-opacity: 1;
  color: rgb(255 255 255 / var(--tw-text-opacity, 1));
}

.gallery-page-numbers button {
  height: 30px;
  width: 30px;
  border-radius: 6px;
  font-size: var(--font-h6);
  line-height: var(--line-height);
  letter-spacing: var(--letter-spacing);
  font-weight: var(--font-weight-regular);
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
  --tw-bg-opacity: 1;
  background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
  color: var(--color-text);
}

.gallery-page-numbers button:hover {
  background-color: var(--color-primary-100);
  --tw-text-opacity: 1;
  color: rgb(255 255 255 / var(--tw-text-opacity, 1));
}

.gallery-page-numbers button.active {
  background-color: var(--color-primary-100);
  --tw-text-opacity: 1;
  color: rgb(255 255 255 / var(--tw-text-opacity, 1));
}

.gallery-per-page-select {
  border-radius: 6px;
  background-color: var(--color-text);
  padding-left: 0.625rem;
  padding-right: 0.625rem;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  font-size: var(--font-h6);
  line-height: var(--line-height);
  letter-spacing: var(--letter-spacing);
  font-weight: var(--font-weight-regular);
  --tw-text-opacity: 1;
  color: rgb(255 255 255 / var(--tw-text-opacity, 1));
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
}

.gallery-per-page-select:hover {
  background-color: var(--color-gray-300);
}

/* Modal Styles */

.gallery-modal {
  position: fixed;
  inset: 0px;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-backdrop {
  position: absolute;
  inset: 0px;
  background-color: rgb(0 0 0 / var(--tw-bg-opacity, 1));
  --tw-bg-opacity: 0.7;
  -webkit-backdrop-filter: blur(30px);
          backdrop-filter: blur(30px);
}

.modal-content {
  position: relative;
  z-index: 10;
  display: flex;
  height: 100%;
  width: 100%;
  align-items: center;
  justify-content: center;
  max-width: 95vw;
  max-height: 95vh;
}

.modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 20;
  cursor: pointer;
  font-size: 1.875rem;
  line-height: 2.25rem;
  --tw-text-opacity: 1;
  color: rgb(255 255 255 / var(--tw-text-opacity, 1));
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 200ms;
}

.modal-close:hover {
  color: var(--color-gray-300);
}

.modal-image-container {
  display: flex;
  height: 100%;
  width: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.modal-image {
  border-radius: 40px;
  -o-object-fit: contain;
     object-fit: contain;
  max-width: 90vw;
  max-height: 85vh;
  width: auto;
  height: auto;
}

.modal-caption {
  margin-top: 1rem;
  text-align: center;
  font-size: 1.125rem;
  line-height: 1.75rem;
  --tw-text-opacity: 1;
  color: rgb(255 255 255 / var(--tw-text-opacity, 1));
}

/* Responsive Design */

@media (max-width: 1024px) {
  .parent {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto;
    gap: 16px;
  }

  .div1,
  .div2,
  .div3,
  .div4,
  .div5,
  .div6,
  .div7,
  .div8,
  .div9,
  .div10 {
    grid-column: auto;
    grid-row: auto;
    aspect-ratio: 16/10;
  }

  .div1,
  .div6 {
    grid-column: span 2;
    aspect-ratio: 2/1;
  }
}

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

  .div1,
  .div2,
  .div3,
  .div4,
  .div5,
  .div6,
  .div7,
  .div8,
  .div9,
  .div10 {
    grid-column: 1;
    aspect-ratio: 16/10;
  }

  .div1,
  .div6 {
    aspect-ratio: 16/10;
  }

  .modal-content {
    padding: 0.5rem;
  }

  .modal-close {
    top: 1rem;
    right: 1rem;
    font-size: 1.5rem;
    line-height: 2rem;
  }
}

/* Show pagination only when there are more than 10 items */

.gallery-container[data-total-pages='1'] .gallery-pagination {
  display: none !important;
}

.gallery-container[data-total-pages]:not([data-total-pages='1'])
  .gallery-pagination {
  display: flex !important;
}
