.tm-gallery {
  padding: 1rem 0.75rem 2.5rem;
}

.tm-gallery__container {
  max-width: 1700px;
}

.tm-gallery__header {
  margin-bottom: 0.9rem;
}

.tm-gallery__title {
  margin: 0;
  font-size: clamp(2rem, 2vw, 2.45rem);
  line-height: 1.1;
  font-weight: 700;
  color: #252525;
}

.tm-gallery__headline {
  width: 170px;
  max-width: 78vw;
  margin: 0.55rem auto 0.85rem;
  height: 3px;
  border-radius: 20px;
  background: #312b9f;
  position: relative;
}

.tm-gallery__headline::before,
.tm-gallery__headline::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #312b9f;
  transform: translateY(-50%);
}

.tm-gallery__headline::before {
  left: -4px;
}

.tm-gallery__headline::after {
  right: -4px;
}

.tm-gallery__board {
  padding: 0.8rem 0.4rem 1.1rem;
}

.tm-gallery__carousel-wrap {
  display: block;
}

#carruselgaleria .carousel-item {
  padding-top: 0.3rem;
  padding-bottom: 2.7rem;
  padding-left: 1.8rem;
  padding-right: 1.8rem;
}

.tm-gallery-grid {
  display: grid;
  grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr));
  gap: 1.2rem 0.9rem;
  align-items: start;
  justify-items: center;
  max-width: 960px;
  margin: 0 auto;
}

.tm-gallery-card {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 250px;
}

.tm-gallery-card__media {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 1;
  background: #dadada;
}

.tm-gallery-card__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tm-gallery-card__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(11, 157, 204, 0.38) 0%, rgba(49, 43, 159, 0.52) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}

.tm-gallery-card:hover .tm-gallery-card__overlay,
.tm-gallery-card.is-touch-active .tm-gallery-card__overlay,
.tm-gallery-card:focus-within .tm-gallery-card__overlay {
  opacity: 1;
}

.tm-gallery-card__action {
  border: 0;
  background: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 76px;
}

.tm-gallery-card__action--expand {
  width: 68px;
  height: 84px;
}

.tm-gallery-card__action img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.tm-gallery-card__text {
  margin: 0.35rem 0 0;
  color: #6a6a6a;
  font-size: 0.98rem;
  line-height: 1.08;
}

.tm-gallery__indicators {
  bottom: -30px;
  margin-bottom: 0;
}

.tm-gallery__indicator {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 0;
  margin: 0 4px;
  opacity: 1;
  background: #b7b7b7;
}

.tm-gallery__indicators .active {
  background: #312b9f;
}

.tm-gallery-modal {
  z-index: 3000;
}

body.tm-gallery-modal-open .modal-backdrop.show {
  z-index: 2990;
  background-color: rgba(27, 30, 49, 0.36);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.tm-gallery-modal__content {
  background: transparent;
  border: 0;
  box-shadow: none;
  align-items: center;
}

.tm-gallery-modal__close {
  position: absolute;
  top: -0.75rem;
  right: -0.25rem;
  width: 2.6rem;
  height: 2.6rem;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  z-index: 2;
}

.tm-gallery-modal__close::before,
.tm-gallery-modal__close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 18px;
  height: 2px;
  background: #312b9f;
}

.tm-gallery-modal__close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.tm-gallery-modal__close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.tm-gallery-modal__image {
  width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: 18px;
  box-shadow: 0 18px 32px rgba(0, 0, 0, 0.3);
}

@media (max-width: 1399px) {
  #carruselgaleria .carousel-item {
    padding-left: 1.3rem;
    padding-right: 1.3rem;
  }

  .tm-gallery-grid {
    max-width: 900px;
  }

  .tm-gallery-card__text {
    font-size: 0.92rem;
  }
}

@media (max-width: 1099px) {
  .tm-gallery-grid {
    max-width: 780px;
  }

  .tm-gallery-card {
    max-width: 235px;
  }

  .tm-gallery-card__action {
    width: 68px;
    height: 68px;
  }

  .tm-gallery-card__action--expand {
    width: 58px;
    height: 74px;
  }
}

@media (max-width: 767px) {
  .tm-gallery {
    padding: 0.8rem 0.55rem 2rem;
  }

  .tm-gallery__title {
    font-size: clamp(1.7rem, 8vw, 2.05rem);
  }

  #carruselgaleria .carousel-item {
    padding-left: 0.8rem;
    padding-right: 0.8rem;
  }

  .tm-gallery-grid {
    gap: 1rem;
    max-width: 100%;
  }

  .tm-gallery-card {
    max-width: 320px;
  }

  .tm-gallery-card__action {
    width: 62px;
    height: 62px;
  }

  .tm-gallery-card__action--expand {
    width: 54px;
    height: 66px;
  }

  .tm-gallery-card__text {
    font-size: 0.92rem;
  }
}
