/* =========================================================
   ESCOMBROS
========================================================= */

.rubble-intro {
  width: 100%;
  max-width: 920px;
  margin: 0 auto 52px auto;
}

.rubble-hero {
  width: min(620px, 100%);
  margin: 0 auto 38px auto;
}

.rubble-hero img {
  width: 100%;
  aspect-ratio: 1 / 1;
  display: block;
  object-fit: cover;
  object-position: center center;
}

.rubble-text {
  max-width: 760px;
  margin: 0 auto 52px auto;
  color: rgba(0,0,0,0.78);
}

.rubble-text p {
  margin: 0 0 22px 0;
  font-size: var(--text-base);
  font-weight: 300;
  line-height: var(--leading-base);
  letter-spacing: var(--tracking-base);
  text-align: justify;
  text-justify: inter-word;

  hyphens: none;
  -webkit-hyphens: none;
  -ms-hyphens: none;

  word-break: normal;
  overflow-wrap: normal;
}

.rubble-text strong {
  font-weight: 500;
}

/* GALERÍA INICIAL */

.rubble-gallery-section {
  width: 100%;
  max-width: 980px;
  margin: 0 auto 52px auto;
}

.rubble-thumb-gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

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

.rubble-thumb-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center center;
  opacity: 0.92;
  transition:
    opacity 0.28s ease,
    transform 0.32s ease;
}

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

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

/* CRÉDITOS */

.rubble-credits {
  max-width: 760px;
  margin: 0 auto 38px auto;
  color: rgba(0,0,0,0.72);
}

.rubble-credits p {
  margin: 0 0 20px 0;
  font-size: var(--text-caption);
  font-weight: 300;
  line-height: 1.22;
  letter-spacing: var(--tracking-small);
  text-align: justify;
  text-justify: inter-word;

  hyphens: none;
  -webkit-hyphens: none;
  -ms-hyphens: none;

  word-break: normal;
  overflow-wrap: normal;
}

.rubble-credits strong {
  font-weight: 500;
}

/* BOTONES */

.rubble-actions {
  max-width: 760px;
  margin: 0 auto 38px auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rubble-video-btn,
.rubble-external-link {
  display: block;
  width: fit-content;
  padding: 0;
  border: none;
  background: none;
  color: #00008b;
  font: inherit;
  font-size: var(--text-base);
  font-weight: 300;
  line-height: var(--leading-base);
  letter-spacing: var(--tracking-base);
  text-decoration: none;
  cursor: pointer;
}

.rubble-video-btn:hover,
.rubble-external-link:hover {
  text-decoration: underline;
}

/* GALERÍA DOCUMENTAL CON TEXTO */

.rubble-documentary-section {
  width: 100%;
  max-width: 1140px;
  margin: 0 auto;
}

.rubble-documentary-item {
  display: grid;
  grid-template-columns: 28% 1fr;
  column-gap: 42px;
  padding: 34px 0;
  border-bottom: 1px solid rgba(0,0,0,0.12);
}

.rubble-documentary-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
  display: block;
}

.rubble-documentary-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center center;
  opacity: 0.92;
  transition:
    opacity 0.28s ease,
    transform 0.32s ease;
}

.rubble-documentary-thumb:hover img {
  opacity: 1;
  transform: scale(1.025);
}

.rubble-documentary-caption {
  color: rgba(0,0,0,0.76);
}

.rubble-documentary-caption p {
  margin: 0 0 16px 0;
  font-size: var(--text-base);
  font-weight: 300;
  line-height: var(--leading-base);
  letter-spacing: var(--tracking-base);
  text-align: justify;
  text-justify: inter-word;

  hyphens: none;
  -webkit-hyphens: none;
  -ms-hyphens: none;

  word-break: normal;
  overflow-wrap: normal;
}

.rubble-documentary-caption strong {
  font-weight: 500;
}

.rubble-documentary-caption em {
  font-style: italic;
}

/* MODAL */

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

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

.rubble-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;
}

.rubble-modal-content {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.7fr);
  gap: 28px;
  padding: 42px 56px 22px 56px;
}

.rubble-modal-media {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rubble-modal-media iframe {
  width: 100%;
  max-width: 1180px;
  aspect-ratio: 16 / 9;
  display: block;
  border: none;
  background: #000000;
}

.rubble-modal-media img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 82vh;
  display: block;
  object-fit: contain;
  object-position: center center;
}

.rubble-modal-caption {
  align-self: center;
  max-height: 78vh;
  overflow-y: auto;
  padding-right: 8px;
  font-size: var(--text-caption);
  line-height: var(--leading-small);
  letter-spacing: var(--tracking-small);
  color: rgba(255,255,255,0.78);
}

.rubble-modal-caption:empty {
  display: none;
}


/* =========================================================
   MODAL SIN TEXTO
   Centra imágenes y video cuando no existe caption
========================================================= */

.rubble-modal-content:has(.rubble-modal-caption:empty) {
  grid-template-columns: 1fr;
}

.rubble-modal-content:has(.rubble-modal-caption:empty)
.rubble-modal-media {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
}

.rubble-modal-caption p {
  margin: 0 0 14px 0;
}

.rubble-modal-caption strong {
  font-weight: 500;
  color: rgba(255,255,255,0.9);
}

.rubble-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;
}

.rubble-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;
}

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

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

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

.rubble-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);
}

.rubble-modal-thumb {
  width: 58px;
  height: 58px;
  padding: 0;
  border: 1px solid transparent;
  background: none;
  cursor: pointer;
  overflow: hidden;
  opacity: 0.55;
}

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

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

/* TABLETA */

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

  .rubble-documentary-item {
    grid-template-columns: 32% 1fr;
    column-gap: 28px;
  }

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

  .rubble-modal-caption {
    max-height: 28vh;
    font-size: var(--text-caption);
    line-height: var(--leading-small);
  }
}

/* CELULAR */

@media (max-width: 768px) {
  .rubble-hero {
    width: 100%;
    margin-bottom: 30px;
  }

  .rubble-text {
    margin-bottom: 42px;
  }

  .rubble-text p {
    font-size: var(--text-base);
    line-height: var(--leading-base);
    letter-spacing: var(--tracking-small);
    text-align: justify;

    hyphens: none;
    -webkit-hyphens: none;
    -ms-hyphens: none;

    word-break: normal;
    overflow-wrap: normal;
  }

  .rubble-thumb-gallery {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .rubble-credits p {
    font-size: var(--text-caption);
    line-height: 1.22;
    letter-spacing: var(--tracking-small);
  }

  .rubble-video-btn,
  .rubble-external-link {
    font-size: var(--text-base);
    line-height: var(--leading-base);
    letter-spacing: var(--tracking-small);
  }

  .rubble-documentary-item {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 28px 0;
  }

  .rubble-documentary-caption p {
    font-size: var(--text-base);
    line-height: var(--leading-base);
    letter-spacing: var(--tracking-small);
  }

  .rubble-modal {
    padding: 0;
    overflow-x: hidden;
  }

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

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

  .rubble-modal-media {
    width: 100%;
    min-height: 0;
    padding: 0 8px;
    align-items: center;
    overflow-x: hidden;
  }

  .rubble-modal-media iframe {
    width: 100%;
    aspect-ratio: 16 / 9;
  }

  .rubble-modal-media img {
    max-width: 100%;
    max-height: 58svh;
  }

  .rubble-modal-caption {
    width: 100%;
    max-width: 92%;
    max-height: 24svh;
    margin: 0 auto;
    padding: 8px 12px;
    text-align: center;
    font-size: var(--text-caption);
    line-height: 1.4;
    box-sizing: border-box;
  }

  .rubble-modal-close {
    top: 10px;
    right: 10px;
    width: 46px;
    height: 46px;
    font-size: 2rem;
  }

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

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

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

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

  .rubble-modal-thumbs {
    grid-auto-columns: 46px;
    gap: 7px;
    padding: 46px 12px 14px 12px;
    border-top: 1px solid rgba(255,255,255,0.12);
  }

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