/* =========================================================
   GALERÍA DE THUMBNAILS UNIFORMES
========================================================= */

.thumb-gallery {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}

.thumb-item {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: block;
  padding: 0;
  border: none;
  background: #eeeeee;
  cursor: pointer;
  overflow: hidden;
}

.thumb-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  opacity: 0.88;
  filter: saturate(0.9);
  transition:
    opacity 0.28s ease,
    filter 0.28s ease,
    transform 0.32s ease;
}

.thumb-item:hover img {
  opacity: 1;
  filter: saturate(1);
  transform: scale(1.035);
}

.thumb-item.is-active img {
  opacity: 0.5;
}

/* =========================================================
   MODAL NEGRO
========================================================= */

.art-modal {
  position: fixed;
  inset: 0;
  z-index: 3000;
  display: none;
  background: rgba(0, 0, 0, 0.95);
  padding: 18px;
}

.art-modal.is-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

.art-modal-panel {
  position: relative;
  width: 96vw;
  height: 94vh;
  color: #ffffff;
  display: grid;
  grid-template-rows: 1fr auto;
  /*background: #050505;
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);*/
  overflow: hidden;
}

.art-modal-content {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(260px, 0.45fr);
  gap: 28px;
  padding: 32px 56px 22px 56px;
}

.art-modal-image-wrap {
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.art-modal-image-wrap img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 82vh;
  display: block;
  object-fit: contain;
}

.art-modal-info {
  align-self: end;
  padding-right: 12px;
}

.art-modal-info h2 {
  margin: 0 0 12px 0;
  font-size: 1.35rem;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: var(--tracking-base);
}

.art-modal-meta {
  margin: 0 0 14px 0;
  font-size: var(--text-caption);
  line-height: var(--leading-small);
  letter-spacing: var(--tracking-small);
  color: rgba(255,255,255,0.68);
}

.art-modal-description {
  margin: 0;
  font-size: var(--text-small);
  line-height: var(--leading-small);
  color: rgba(255,255,255,0.78);
}

.art-modal-description a {
  color: #ffffff;
  text-decoration: underline;
  opacity: 0.78;
}

.art-modal-description a:hover {
  opacity: 1;
}

/* CERRAR */

.art-modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 30;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.12);
  color: #ffffff;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition:
    background-color 0.25s ease,
    transform 0.25s ease;
}

.art-modal-close:hover {
  background: rgba(255,255,255,0.22);
  transform: scale(1.04);
}

/* FLECHAS */

.art-modal-arrow {
  position: absolute;
  top: 45%;
  z-index: 20;
  width: 38px;
  height: 54px;
  border: none;
  border-radius: 4px;
  background: rgba(255,255,255,0.12);
  color: #ffffff;
  font-size: 1.5rem;
  cursor: pointer;
  opacity: 0.55;
  transition:
    opacity 0.25s ease,
    background-color 0.25s ease;
}

.art-modal-arrow:hover {
  opacity: 1;
  background: rgba(255,255,255,0.22);
}

.art-modal-prev {
  left: 14px;
}

.art-modal-next {
  right: 14px;
}

/* MINIATURAS DEL MODAL */

.art-modal-thumbs {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 58px;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 12px 56px 18px 56px;
  background: #050505;
  border-top: 1px solid rgba(255,255,255,0.12);
  scrollbar-width: thin;
}

.art-modal-thumbs::-webkit-scrollbar {
  height: 6px;
}

.art-modal-thumbs::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.08);
}

.art-modal-thumbs::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.28);
  border-radius: 10px;
}

.art-modal-thumb {
  width: 58px;
  height: 58px;
  padding: 0;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  overflow: hidden;
  opacity: 0.55;
  transition:
    opacity 0.25s ease,
    border-color 0.25s ease,
    transform 0.25s ease;
}

.art-modal-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.art-modal-thumb:hover {
  opacity: 0.9;
}

.art-modal-thumb.is-active {
  opacity: 1;
  border-color: rgba(255,255,255,0.75);
  transform: translateY(-2px);
}

/* =========================================================
   TABLETA
========================================================= */

@media (max-width: 1024px) {
  .thumb-gallery {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 12px;
  }

  .art-modal {
    padding: 14px;
  }

  .art-modal-panel {
    width: 97vw;
    height: 95vh;
  }

  .art-modal-content {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 16px;
    padding: 30px 38px 18px 38px;
  }

  .art-modal-image-wrap img {
    max-height: 70vh;
  }

  .art-modal-info {
    align-self: start;
    padding-right: 42px;
  }

  .art-modal-info h2 {
    font-size: 1.15rem;
  }

  .art-modal-meta {
    font-size: 0.9rem;
  }

  .art-modal-thumbs {
    grid-auto-columns: 54px;
    padding-left: 38px;
    padding-right: 38px;
  }

  .art-modal-thumb {
    width: 54px;
    height: 54px;
  }
}

/* =========================================================
   CELULAR
========================================================= */

@media (max-width: 768px) {
  /* GRID DE THUMBNAILS: se conserva */
  .thumb-gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* MODAL: corrección de desbordamiento horizontal */
  .art-modal {
    padding: 0;
    overflow-x: hidden;
  }

  .art-modal-panel {
    width: 100%;
    height: 100svh;
    max-height: none;
    display: grid;
    grid-template-rows: 1fr auto auto;
    overflow-x: hidden;
  }

  .art-modal-content {
    min-height: 0;
    width: 100%;
    display: flex;
    flex-direction: column;
    padding: 48px 14px 8px 14px;
    overflow-x: hidden;
  }

  .art-modal-image-wrap {
    flex: 1;
    width: 100%;
    min-height: 0;
    padding: 0 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
  }

  .art-modal-image-wrap img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 72svh;
    object-fit: contain;
    margin: 0;
  }

  .art-modal-info {
    order: 2;
    width: 100%;
    padding: 8px 44px 8px 8px;
    box-sizing: border-box;
    overflow-x: hidden;
  }

  .art-modal-info h2 {
    font-size: 1rem;
    margin-bottom: 6px;
    max-width: 100%;
    overflow-wrap: break-word;
  }

  .art-modal-meta {
    font-size: var(--text-caption);
    margin-bottom: 6px;
    max-width: 100%;
    overflow-wrap: break-word;
  }

  .art-modal-description {
    font-size: var(--text-caption);
    line-height: var(--leading-small);
    max-width: 100%;
    overflow-wrap: break-word;
  }

  .art-modal-close {
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    font-size: 1.35rem;
  }

  .art-modal-prev,
  .art-modal-next {
    position: fixed;
    transform: none;
    bottom: 66px;
    z-index: 35;
  }

  .art-modal-arrow {
    top: auto;
    width: 38px;
    height: 34px;
    font-size: 1.1rem;
  }

  .art-modal-prev {
    left: 12px;
  }

  .art-modal-next {
    right: 12px;
  }

  .art-modal-thumbs {
    position: relative;
    grid-auto-columns: 46px;
    gap: 7px;
    padding: 46px 12px 14px 12px;
    border-top: 1px solid rgba(255,255,255,0.12);
    overflow-x: auto;
    overflow-y: hidden;
  }

  .art-modal-thumbs::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 12px;
    right: 12px;
    height: 30px;
    pointer-events: none;
    border-top: 1px solid rgba(255,255,255,0.08);
  }

  .art-modal-thumb {
    width: 46px;
    height: 46px;
  }
}

/* =========================================================
   CELULAR HORIZONTAL
========================================================= */

@media (max-width: 768px) and (orientation: landscape) {
  .thumb-gallery {
    grid-template-columns: repeat(4, 1fr);
  }

  .art-modal-content {
    display: grid;
    grid-template-columns: 1.25fr 0.75fr;
    padding: 44px 44px 8px 44px;
  }

  .art-modal-image-wrap img {
    max-width: 95vw;
    max-height: 68svh;
  }

  .art-modal-description {
    display: none;
  }

  .art-modal-prev,
  .art-modal-next {
    bottom: 58px;
  }
}