.gallery {
  padding: var(--section-padding-vertical) 0;
  background-color: #ffffff;
}

.gallery-carousel {
  position: relative;
  height: calc(var(--gallery-card-width) * 3 / 4 * 1.12 + 3vw);
  overflow: hidden;
}

.gallery-card {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--gallery-card-width);
  margin-left: calc(var(--gallery-card-width) / -2);
  margin-top: calc(var(--gallery-card-width) * 3 / 4 / -2);
  border-radius: 0.6rem;
  overflow: hidden;
  box-shadow: 0 0.4vw 1.2vw rgba(29, 29, 27, 0.3);
  transform: translateX(calc(var(--slot, 0) * var(--gallery-spacing)));
  transition: var(--transition-smooth);
  z-index: 1;
}

.gallery-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.gallery-card figcaption {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 0.5vw;
  text-align: center;
  font-size: 1.1vw;
  color: var(--color-web-background);
  background-color: rgba(0, 0, 0, 0.6);
}

.gallery-card[data-offset="0"] {
  scale: 1.12;
  opacity: 1;
  z-index: 2;
}

.gallery-card[data-offset="1"],
.gallery-card[data-offset="-1"] {
  scale: 0.9;
  opacity: 0.45;
}

.gallery-card:not([data-offset="0"]):not([data-offset="1"]):not([data-offset="-1"]) {
  opacity: 0;
  pointer-events: none;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3.2vw;
  height: 3.2vw;
  border: none;
  border-radius: 50%;
  background-color: var(--color-primary-background);
  padding: 0.7vw;
  cursor: pointer;
  transition: background-color 0.3s ease;
  z-index: 3;
}

.gallery-arrow svg {
  width: 100%;
  height: 100%;
}

.arrow-fill {
  fill: var(--color-primary-foreground);
}

.gallery-arrow:hover {
  background-color: var(--color-secondary-background);
}

.gallery-prev {
  left: 14vw;
}

.gallery-arrow:focus-visible {
  outline: 3px solid var(--color-primary-foreground);
}

.gallery-next {
  right: 14vw;
}

.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: none;
  align-items: center;
  justify-content: center;
  background-color: rgba(29, 29, 27, 0.92);
  padding: 2vw;
  box-sizing: border-box;
}

.gallery-modal.open {
  display: flex;
}

.gallery-modal-frame {
  position: relative;
  width: min(calc(100vw - 4vw), calc((100vh - 4vw) * 4 / 3));
  aspect-ratio: 4 / 3;
  border-radius: 0.6rem;
  overflow: hidden;
  box-shadow: 0 0.6vw 2.4vw rgba(0, 0, 0, 0.6);
}

.gallery-modal-close {
  position: absolute;
  top: 1vw;
  left: 1vw;
  z-index: 10;
  width: 3vw;
  height: 3vw;
  border: none;
  border-radius: 50%;
  background-color: rgba(33, 56, 81, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.gallery-modal-close:hover {
  background-color: var(--color-primary-foreground);
}

.gallery-modal-close img {
  width: 55%;
  height: 55%;
}

.gallery-modal-info-btn {
  position: absolute;
  top: 1vw;
  right: 1vw;
  z-index: 10;
  width: 3vw;
  height: 3vw;
  border: none;
  border-radius: 50%;
  background-color: rgba(33, 56, 81, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.gallery-modal-info-btn:hover,
.gallery-modal-info-btn.active {
  background-color: var(--color-primary-foreground);
}

.gallery-modal-info-btn img {
  width: 55%;
  height: 55%;
}

.gallery-modal-media-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #1d1d1b;
  overflow: hidden;
}

.gallery-modal-media {
  position: relative;
  width: 100%;
  height: 100%;
}

.gallery-modal-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.gallery-modal-media img.active {
  opacity: 1;
}

.gallery-modal-arrow.gallery-modal-prev {
  left: 2vw;
}

.gallery-modal-arrow.gallery-modal-next {
  right: 2vw;
}

.gallery-modal-dots {
  position: absolute;
  bottom: 1vw;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.6vw;
  padding: 0.4vw 0.8vw;
  border-radius: 50vw;
  background-color: rgba(29, 29, 27, 0.45);
  z-index: 3;
}

.gallery-modal-dots[hidden] {
  display: none;
}

.gallery-modal-dot {
  width: 0.8vw;
  height: 0.8vw;
  min-width: 0.8vw;
  border: none;
  border-radius: 50%;
  background-color: rgba(248, 248, 248, 0.6);
  cursor: pointer;
  transition: background-color 0.3s ease;
  padding: 0;
}

.gallery-modal-dot:hover {
  background-color: var(--color-web-background);
}

.gallery-modal-dot.active {
  background-color: var(--color-primary-foreground);
}

.gallery-modal.info-open .gallery-modal-close,
.gallery-modal.info-open .gallery-modal-arrow,
.gallery-modal.info-open .gallery-modal-dots {
  display: none;
}

.gallery-modal-info {
  position: absolute;
  inset: 0;
  z-index: 2;
  padding: 3vw;
  overflow-y: auto;
  background-color: rgba(0, 0, 0, 0.72);
  color: var(--color-web-background);
}

.gallery-modal-info[hidden] {
  display: none;
}

.gallery-modal-info-title {
  margin-bottom: 1vw;
  font-size: 1.8vw;
  color: var(--color-primary-foreground);
}

.gallery-modal-info-text {
  font-size: 1.1vw;
  text-align: justify;
  line-height: 1.7;
}
