/* LabAncestral · galeria.css
   Estilos exclusivos de la página Galería. */

.ga-page {
  width: 100%;
  min-width: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: #F6EFE1;
  color: #152514;
  font-family: 'IBM Plex Sans', sans-serif;
}

.ga-page *,
.ga-page *::before,
.ga-page *::after {
  min-width: 0;
}

.ga-container {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
}

/* Hero */
.ga-hero {
  position: relative;
  width: 100%;
  padding: 66px 44px 40px;
  overflow: hidden;
  background: #F6EFE1;
}

.ga-hero__grid-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(#0e3d2210 1px, transparent 1px),
    linear-gradient(90deg, #0e3d2210 1px, transparent 1px);
  background-size: 52px 52px;
  pointer-events: none;
}

.ga-hero__glow {
  position: absolute;
  top: -160px;
  right: -120px;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  background:
    radial-gradient(
      circle,
      #F6CE7E 0%,
      rgba(238, 154, 28, .28) 38%,
      transparent 66%
    );
  pointer-events: none;
}

.ga-hero__layout {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 40px;
}

.ga-title {
  max-width: 850px;
  margin: 0 0 20px;
  color: #152514;
  font-family: 'Spectral', serif;
  font-size: 56px;
  font-weight: 300;
  line-height: 1.04;
  letter-spacing: -.02em;
}

.ga-stats {
  display: flex;
  flex: 0 0 auto;
  gap: 30px;
}

/* Barra de vistas */
.ga-toolbar {
  position: sticky;
  top: 73px;
  z-index: 40;
  width: 100%;
  padding: 14px 44px;
  border-top: 1px solid #e4d9c2;
  border-bottom: 1px solid #e4d9c2;
  background: rgba(246, 239, 225, .9);
  backdrop-filter: blur(10px);
}

.ga-toolbar__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
}

.ga-tabs {
  display: inline-flex;
  max-width: 100%;
  padding: 4px;
  gap: 4px;
  border: 1px solid #ddd0b4;
  border-radius: 999px;
  background: #fff;
}

.ga-tabs .la-tab {
  min-width: 0;
  white-space: nowrap;
  overflow-wrap: normal;
}

#galShownLabel {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: #7a745f;
}

/* Secciones */
.ga-section {
  width: 100%;
  padding-right: 44px;
  padding-left: 44px;
}

.ga-section--photos {
  padding-top: 44px;
  padding-bottom: 30px;
  background: #F6EFE1;
}

.ga-section--videos {
  padding-top: 52px;
  padding-bottom: 44px;
  border-top: 1px solid #e4d9c2;
  border-bottom: 1px solid #e4d9c2;
  background: #efe6d2;
}

.ga-section__heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 26px;
}

/* Mosaico fotográfico */
.ga-page .la-masonry {
  column-count: 4;
  column-gap: 18px;
}

.ga-page .la-card {
  min-width: 0;
  break-inside: avoid;
  margin-bottom: 18px;
}

.ga-page .la-card:hover .la-ov {
  opacity: 1 !important;
}

.ga-page .la-card:hover .la-media {
  transform: scale(1.04);
}

.ga-page .la-media {
  max-width: 100%;
  transition: transform .4s ease;
}

.ga-video-grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(min(320px, 100%), 1fr)
  );
  gap: 20px;
}

.ga-video-grid .la-card {
  margin-bottom: 0;
}

.ga-empty {
  padding: 48px 24px;
  border: 1px dashed #d8c9a8;
  border-radius: 16px;
  background: #fffdf8;
  color: #9a8f74;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

/* Botón cargar más */
.ga-page .la-more-wrap {
  display: none;
  margin-top: 30px;
  text-align: center;
}

.ga-page .la-more {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 26px;
  border: 1px solid #ddd0b4;
  border-radius: 999px;
  background: #fff;
  color: #0E3D22;
  cursor: pointer;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14.5px;
  font-weight: 600;
  transition:
    background .18s,
    border-color .18s,
    color .18s,
    transform .18s;
}

.ga-page .la-more:hover {
  border-color: #0E3D22;
  background: #0E3D22;
  color: #fff;
  transform: translateY(-1px);
}

.ga-page .la-more__ico {
  color: #9a8f74;
  font-size: 12px;
  line-height: 1;
  transition: color .18s;
}

.ga-page .la-more:hover .la-more__ico {
  color: #EE9A1C;
}

.ga-page .la-more__note {
  margin-top: 12px;
  color: #9a8f74;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11.5px;
}

/* Lightbox */
.ga-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: rgba(8, 26, 15, .92);
  backdrop-filter: blur(6px);
  animation: ga_fade .2s ease both;
}

.ga-lightbox__close,
.ga-lightbox__nav {
  position: absolute;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #2c5a3d;
  border-radius: 50%;
  background: rgba(14, 61, 34, .6);
  color: #fff;
  cursor: pointer;
}

.ga-lightbox__close {
  top: 24px;
  right: 28px;
  z-index: 3;
  width: 46px;
  height: 46px;
}

.ga-lightbox__nav {
  top: 50%;
  width: 52px;
  height: 52px;
  transform: translateY(-50%);
}

.ga-lightbox__nav--prev {
  left: 28px;
}

.ga-lightbox__nav--next {
  right: 28px;
}

.ga-lightbox__panel {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 1fr);
  grid-template-rows: minmax(0, 1fr);
  width: 100%;
  max-width: 1040px;
  height: min(84vh, 720px);
  gap: 0;
  overflow: hidden;
  border: 1px solid #1f5a3e;
  border-radius: 18px;
  background: #0a2a17;
  animation: ga_pop .26s ease both;
}

.ga-lightbox__panel > * {
  min-width: 0;
  min-height: 0;
}

.ga-lightbox__media {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow: hidden;
  background: #06170d;
}

.ga-lightbox__media img,
.ga-lightbox__media video,
.ga-lightbox__media iframe {
  max-width: 100%;
  max-height: 100%;
}

.ga-lightbox__content {
  display: flex;
  overflow-y: auto;
  flex-direction: column;
  padding: 38px 34px;
}

/* CTA */
.ga-cta {
  padding: 64px 44px;
  background: #0E3D22;
  color: #eae3d2;
  text-align: center;
}

.ga-cta__inner {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
}

.ga-cta__actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

@keyframes ga_fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes ga_pop {
  from {
    opacity: 0;
    transform: scale(.96);
  }

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

/* Tablet */
@media (max-width: 1100px) {
  .ga-page .la-masonry {
    column-count: 3;
  }
}

@media (max-width: 920px) {
  .ga-lightbox {
    padding: 24px;
  }

  .ga-lightbox__panel {
    grid-template-columns: minmax(0, 1fr) !important;
    grid-template-rows: auto auto !important;
    width: min(100%, 720px);
    height: auto !important;
    max-height: calc(100dvh - 48px);
    overflow-y: auto;
  }

  .ga-lightbox__media {
    aspect-ratio: 4 / 3;
    min-height: 0;
    padding: 10px;
  }

  .ga-lightbox__content {
    overflow-y: visible;
  }

  .ga-lightbox .la-lb-nav {
    display: none !important;
  }
}

/* Móvil */
@media (max-width: 760px) {
  .ga-hero {
    padding: 54px 20px 36px;
  }

  .ga-hero__glow {
    top: -120px;
    right: -210px;
    width: 420px;
    height: 420px;
  }

  .ga-hero__layout {
    align-items: flex-start;
    flex-direction: column;
    gap: 30px;
  }

  .ga-title {
    font-size: clamp(38px, 11vw, 48px);
  }

  .ga-hero p {
    font-size: 16px !important;
  }

  .ga-stats {
    width: 100%;
    gap: 36px;
  }

  .ga-toolbar {
    top: 64px;
    padding: 10px 20px;
  }

  .ga-toolbar__inner {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .ga-tabs {
    width: 100%;
  }

  .ga-tabs .la-tab {
    justify-content: center;
    flex: 1 1 0;
    padding-right: 10px !important;
    padding-left: 10px !important;
  }

  #galShownLabel {
    width: 100%;
    font-size: 10.5px;
    text-align: center;
  }

  .ga-section {
    padding-right: 20px;
    padding-left: 20px;
  }

  .ga-section--photos {
    padding-top: 38px;
    padding-bottom: 28px;
  }

  .ga-section--videos {
    padding-top: 44px;
    padding-bottom: 40px;
  }

  .ga-section__heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .ga-section__heading h2 {
    font-size: clamp(29px, 8vw, 36px) !important;
  }

  .ga-page .la-masonry {
    column-count: 2;
    column-gap: 12px;
  }

  .ga-page .la-card {
    margin-bottom: 12px;
  }

  .ga-video-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .ga-empty {
    padding: 38px 20px;
  }

  .ga-lightbox {
    align-items: flex-start;
    padding: 12px;
    overflow-y: auto;
  }

  .ga-lightbox__close {
    position: fixed;
    top: 12px;
    right: 12px;
    width: 42px;
    height: 42px;
  }

  .ga-lightbox__panel {
    margin: auto 0;
    max-height: calc(100dvh - 24px);
    border-radius: 14px;
  }

  .ga-lightbox__media {
    aspect-ratio: 4 / 3;
    padding: 8px;
  }

  .ga-lightbox__content {
    padding: 26px 20px 24px;
  }

  #galTitle {
    font-size: 24px !important;
  }

  .ga-cta {
    padding: 52px 20px;
  }

  .ga-cta__actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ga-cta__actions a {
    width: 100%;
  }
}

/* Teléfonos estrechos */
@media (max-width: 430px) {
  .ga-hero,
  .ga-section,
  .ga-cta {
    padding-right: 16px;
    padding-left: 16px;
  }

  .ga-toolbar {
    padding-right: 12px;
    padding-left: 12px;
  }

  .ga-tabs .la-tab {
    gap: 6px !important;
    font-size: 12.5px !important;
  }

  .ga-page .la-masonry {
    column-count: 1;
  }
}

/* En pantallas sin hover la ficha debe ser legible directamente. */
@media (hover: none) {
  .ga-page .la-card .la-ov {
    opacity: 1 !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ga-page *,
  .ga-page *::before,
  .ga-page *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}