/*=============== GALLERY HERO ===============*/
.gallery-hero {
  position: relative;
  min-height: 60vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.gallery-hero__video-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
}

.gallery-hero__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  filter: brightness(0.5) contrast(1.2) saturate(1.1);
}

.gallery-hero__video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg,
      rgba(0, 0, 0, 0.7) 0%,
      rgba(0, 0, 0, 0.4) 50%,
      rgba(0, 0, 0, 0.7) 100%);
}

.gallery-hero__container {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 3rem 2rem;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
}

.gallery-hero__content {
  max-width: 800px;
  margin: 0 auto;
}

.gallery-hero__badge {
  margin-bottom: 2rem;
  opacity: 0;
  transform: translateY(30px);
  animation: galleryFadeInUp 1s ease 0.5s forwards;
}

.gallery-hero__badge span {
  display: inline-block;
  background: var(--badge_color);
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  padding: 0.7rem 1.8rem;
  border-radius: 50px;
  font-family: var(--accent-font);
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
}

.gallery-hero__title {
  font-family: var(--accent-font);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 700;
  margin-bottom: 1.5rem;
  line-height: 1.1;
  color: var(--title-color);
  opacity: 0;
  transform: translateY(40px);
  animation: galleryFadeInUp 1s ease 0.8s forwards;
}

.gallery-hero__description {
  font-size: clamp(1.1rem, 2.5vw, 1.3rem);
  color: var(--text-color);
  margin-bottom: 0;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
  opacity: 0;
  transform: translateY(30px);
  animation: galleryFadeInUp 1s ease 1.1s forwards;
}

@keyframes galleryFadeInUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media screen and (max-width: 768px) {
  .gallery-hero {
    min-height: 50vh;
  }

  .gallery-hero__container {
    padding: 2rem 1rem;
  }

  .gallery-hero__badge span {
    font-size: 0.8rem;
    padding: 0.6rem 1.5rem;
  }
}

@media screen and (max-width: 480px) {
  .gallery-hero {
    min-height: 40vh;
  }

  .gallery-hero__title {
    margin-bottom: 1rem;
  }
}


/*=============== GALLERY FILTERS ===============*/
.gallery-filters {
  background: linear-gradient(180deg,
      rgba(0, 0, 0, 0.9) 0%,
      var(--container-color) 100%);
  padding: 2.5rem 0;
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.gallery-filters__container {
  position: relative;
  z-index: 2;
}

.gallery-filters__group {
  margin-bottom: 2rem;
}

.gallery-filters__group--sub {
  border-left: 2px solid var(--primary-color);
  padding-left: 1.5rem;
  margin-left: 0.5rem;
}

.gallery-filters__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.gallery-filters__title {
  font-family: var(--accent-font);
  font-size: 1.1rem;
  color: var(--title-color);
  font-weight: var(--font-medium);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.gallery-filters__title i {
  color: var(--primary-color);
  font-size: 1.2rem;
}

.gallery-filters__line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg,
      var(--primary-color),
      transparent 80%);
}

.gallery-filters__nav {
  width: 100%;
}

.gallery-filters__items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: flex-start;
}

.gallery-filters__item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.9rem 1.6rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-color);
  text-decoration: none;
  border-radius: 12px;
  font-family: var(--body-font);
  font-size: 0.9rem;
  font-weight: var(--font-medium);
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  backdrop-filter: blur(10px);
  min-width: fit-content;
}

.gallery-filters__item i {
  font-size: 1rem;
  transition: transform 0.3s ease;
}

.gallery-filters__item:hover {
  border-color: var(--primary-color);
  color: var(--title-color);
  transform: translateY(-2px);
  box-shadow:
    0 8px 25px var(--primary-hover),
    0 0 0 1px var(--primary-hover);
}

.gallery-filters__item:hover i {
  transform: scale(1.1);
}

.gallery-filters__item--active {
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  color: var(--body-color);
  border-color: var(--primary-color);
  transform: translateY(-2px);
  box-shadow:
    0 8px 25px var(--primary-hover),
    0 0 0 1px var(--primary-color);
}

.gallery-filters__item--active i {
  color: var(--body-color);
}

.gallery-filters__indicator {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 2px;
  background: var(--primary-color);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.gallery-filters__item:hover .gallery-filters__indicator {
  transform: scaleX(1);
}

.gallery-filters__item--active .gallery-filters__indicator {
  transform: scaleX(1);
}

.gallery-filters__text {
  position: relative;
  z-index: 2;
  transition: transform 0.3s ease;
}

.gallery-filters__item:hover .gallery-filters__text {
  transform: translateX(3px);
}

/* Responsive Design - Desktop First */
@media screen and (max-width: 1200px) {
  .gallery-filters__items {
    gap: 0.7rem;
  }

  .gallery-filters__item {
    padding: 0.8rem 1.4rem;
    font-size: 0.88rem;
    color: var(--primary-color);
  }
}

@media screen and (max-width: 968px) {
  .gallery-filters {
    padding: 2rem 0;
  }

  .gallery-filters__items {
    gap: 0.6rem;
  }

  .gallery-filters__item {
    padding: 0.8rem 1.2rem;
    font-size: 0.85rem;
  }

  .gallery-filters__title {
    font-size: 1rem;
  }
}

@media screen and (max-width: 768px) {
  .gallery-filters {
    padding: 1.5rem 0;
  }

  .gallery-filters__container {
    padding: 0 1rem;
  }

  .gallery-filters__group {
    margin-bottom: 2rem;
  }

  .gallery-filters__group--sub {
    border-left: 1px solid var(--primary-color);
    padding-left: 1rem;
    margin-left: 0.5rem;
  }

  .gallery-filters__header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
  }

  .gallery-filters__title {
    font-size: 1rem;
    white-space: normal;
  }

  .gallery-filters__line {
    width: 80px;
    height: 2px;
    background: var(--primary-color);
    flex: none;
  }

  .gallery-filters__items {
    flex-direction: column;
    gap: 0.8rem;
  }

  .gallery-filters__item {
    width: 100%;
    padding: 1.1rem 1.5rem;
    border-radius: 10px;
    justify-content: flex-start;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }

  .gallery-filters__item i {
    font-size: 1.1rem;
    min-width: 20px;
  }
}

@media screen and (max-width: 480px) {
  .gallery-filters {
    padding: 1.2rem 0;
  }

  .gallery-filters__container {
    padding: 0 0.8rem;
  }

  .gallery-filters__item {
    padding: 1rem 1.2rem;
    font-size: 0.85rem;
  }

  .gallery-filters__title {
    font-size: 0.95rem;
    gap: 0.4rem;
  }

  .gallery-filters__title i {
    font-size: 1rem;
  }
}

/* Scroll horizontal para muchos elementos en móvil */
.gallery-filters__items--scrollable {
  flex-direction: row;
  overflow-x: auto;
  padding-bottom: 0.8rem;
  scrollbar-width: thin;
  scrollbar-color: var(--primary-color) transparent;
}

.gallery-filters__items--scrollable::-webkit-scrollbar {
  height: 4px;
}

.gallery-filters__items--scrollable::-webkit-scrollbar-track {
  background: transparent;
  margin: 0 1rem;
}

.gallery-filters__items--scrollable::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 2px;
}

.gallery-filters__items--scrollable .gallery-filters__item {
  flex-shrink: 0;
  min-width: auto;
  white-space: nowrap;
}

/* Estados de animación */
.gallery-filters__group {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease;
}

.gallery-filters__group.animate {
  opacity: 1;
  transform: translateY(0);
}

.gallery-filters__item {
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.4s ease;
}

.gallery-filters__item.animate {
  opacity: 1;
  transform: translateX(0);
}

/*============ IMPROVED GALLERY ============*/
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
  margin-bottom: 4rem;
  padding: 0 1rem;
}

.gallery .image {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow:
    0 8px 25px rgba(0, 0, 0, 0.15),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  cursor: pointer;
  background: var(--container-color);
  opacity: 0;
  transform: translateY(20px);
  animation: imageAppear 0.6s ease forwards;
}

@keyframes imageAppear {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.gallery .image span {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.gallery .image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.gallery .image:hover {
  transform: translateY(-8px);
  box-shadow:
    0 20px 40px rgba(0, 0, 0, 0.25),
    0 0 0 1px var(--primary-color),
    0 0 30px var(--primary-hover);
}

.gallery .image:hover img {
  transform: scale(1.1);
}

/* Stagger animations */
.gallery .image:nth-child(1) {
  animation-delay: 0.1s;
}

.gallery .image:nth-child(2) {
  animation-delay: 0.15s;
}

.gallery .image:nth-child(3) {
  animation-delay: 0.2s;
}

.gallery .image:nth-child(4) {
  animation-delay: 0.25s;
}

.gallery .image:nth-child(5) {
  animation-delay: 0.3s;
}

.gallery .image:nth-child(6) {
  animation-delay: 0.35s;
}

.gallery .image:nth-child(7) {
  animation-delay: 0.4s;
}

.gallery .image:nth-child(8) {
  animation-delay: 0.45s;
}

.gallery .image:nth-child(9) {
  animation-delay: 0.5s;
}

.gallery .image:nth-child(10) {
  animation-delay: 0.55s;
}

/* Empty state */
.gallery .alert {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 3rem 2rem;
  text-align: center;
  animation: fadeInUp 0.6s ease;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Responsive Design */
@media screen and (max-width: 1200px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.25rem;
  }
}

@media screen and (max-width: 968px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
  }

  .gallery .image:hover {
    transform: translateY(-4px);
  }
}

@media screen and (max-width: 768px) {
  .gallery {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.8rem;
    margin-top: 1.5rem;
    margin-bottom: 3rem;
    padding: 0 0.5rem;
  }
}

@media screen and (max-width: 576px) {
  .gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
  }

  .gallery .image:hover {
    transform: translateY(-2px);
  }
}

@media screen and (max-width: 380px) {
  .gallery {
    grid-template-columns: 1fr;
    gap: 0.8rem;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
  }
}

/* Touch device optimizations */
@media (hover: none) {
  .gallery .image:active {
    transform: scale(0.98);
  }

  .gallery .image:active img {
    transform: scale(1.05);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {

  .gallery .image,
  .gallery .image:hover,
  .gallery .image img,
  .gallery .image:hover img {
    transition: none;
    transform: none;
    animation: none;
  }

  .gallery .image {
    opacity: 1;
  }
}

/* ============ IMPROVED MODAL ============ */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  justify-content: center;
  align-items: center;
  padding: 2rem;
  backdrop-filter: blur(10px);
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.modal-content {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: modalScaleIn 0.3s ease;
}

@keyframes modalScaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-content img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.close-modal {
  position: fixed;
  top: 2rem;
  right: 2rem;
  color: white;
  font-size: 2.5rem;
  cursor: pointer;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  border: 2px solid rgba(255, 255, 255, 0.2);
  z-index: 10001;
}

.close-modal:hover {
  background: var(--primary-color);
  color: var(--body-color);
  transform: rotate(90deg);
  border-color: var(--primary-color);
}

/* Loading indicator for modal */
.modal-loading {
  display: none;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--primary-color);
  font-size: 2rem;
}

.modal-content.loading .modal-loading {
  display: block;
}

.modal-content.loading img {
  opacity: 0.5;
}

/* Responsive modal */
@media screen and (max-width: 768px) {
  .modal-overlay {
    padding: 1rem;
  }

  .modal-content {
    max-width: 100vw;
    max-height: 100vh;
  }

  .modal-content img {
    max-height: 85vh;
    border-radius: 8px;
  }

  .close-modal {
    top: 1rem;
    right: 1rem;
    width: 45px;
    height: 45px;
    font-size: 2rem;
    background: rgba(0, 0, 0, 0.8);
  }
}

@media screen and (max-width: 480px) {
  .modal-overlay {
    padding: 0.5rem;
  }

  .close-modal {
    top: 0.5rem;
    right: 0.5rem;
    width: 40px;
    height: 40px;
    font-size: 1.8rem;
  }

  .modal-content img {
    max-height: 80vh;
  }
}

/* PAGINACION */
*.pagination {
  display: flex;
  justify-content: center;
  margin: 30px 0;
  flex-wrap: wrap;
  gap: 5px;
}

.pagination a {
  color: var(--text-color);
  padding: 8px 16px;
  text-decoration: none;
  border: 1px solid var(--primary-color);
  transition: background-color 0.3s;
}

.pagination a.active {
  background-color: var(--title-color);
  color: white;
  border: 1px solid var(--title-color);
}

.pagination a:hover:not(.active) {
  background-color: #ddd;
}

.pagination a:first-child {
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
}

.pagination a:last-child {
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
}

.pagination {
  display: flex;
  justify-content: center;
  margin: 30px 0;
  flex-wrap: wrap;
  gap: 5px;
}

.pagination a {
  color: #ffffff;
  padding: 8px 16px;
  text-decoration: none;
  border: 1px solid var(--primary-color);
  transition: background-color 0.3s;
}

.pagination a.active {
  background-color: var(--primary-hover);
  color: rgb(255, 255, 255);
  border: 1px solid var(--primary-color);
}

.pagination a:hover:not(.active) {
  background-color: var(--primary-hover);
}

.pagination a:first-child {
  border-top-left-radius: 5px;
  border-bottom-left-radius: 5px;
}

.pagination a:last-child {
  border-top-right-radius: 5px;
  border-bottom-right-radius: 5px;
}

@media (max-width: 1200px) {
  .gallery .image {
    width: calc(33.333% - 15px);
  }
}

@media (max-width: 768px) {
  .gallery .image {
    width: calc(50% - 15px);
  }
}

@media (max-width: 480px) {
  .gallery .image {
    width: 100%;
    max-width: 350px;
    margin: 0 auto 15px;
  }

  .gallery {
    gap: 15px 0;
  }
}