/* GALERÍA — módulo independiente, v129 */
.gallery-page .page{width:100%;}
.gallery-page .topbar,
.gallery-page .site-footer{width:min(1580px,calc(100% - 28px));margin-left:auto;margin-right:auto;}

.gallery-page .gallery-main{
  --gallery-frame-edge:max(14px,calc((100vw - 1580px)/2));
  --gallery-inner-edge:calc(var(--gallery-frame-edge) + 1px);
  position:relative;
  flex:1 1 auto;
  min-height:0;
  width:100%;
  margin-top:10px;
  padding:0;
  border:0;
  overflow:hidden;
}
.gallery-page .gallery-main::before{
  content:"";
  position:absolute;
  z-index:5;
  top:0;
  bottom:0;
  left:var(--gallery-frame-edge);
  right:var(--gallery-frame-edge);
  border:1px solid var(--accent);
  pointer-events:none;
}

.gallery-content,
.gallery-lightbox{
  position:absolute;
  left:var(--gallery-inner-edge);
  right:var(--gallery-inner-edge);
  top:1px;
  bottom:1px;
}
.gallery-content{
  z-index:1;
  overflow-y:auto;
  overflow-x:hidden;
  padding:0 clamp(18px,2.1vw,36px);
  scrollbar-width:thin;
  scrollbar-color:var(--accent) transparent;
  scrollbar-gutter:stable;
}
.gallery-content::-webkit-scrollbar{width:7px;}
.gallery-content::-webkit-scrollbar-thumb{background:var(--accent);}
.gallery-content.is-viewer-locked{overflow-y:hidden;}

.gallery-photo-group{
  height:50%;
  min-height:50%;
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:clamp(12px,1.7vw,28px);
  align-items:stretch;
  padding:clamp(4px,.7vh,8px) 0;
}
.gallery-variant-card{
  margin:0;
  min-width:0;
  min-height:0;
  height:100%;
  display:grid;
  grid-template-rows:minmax(0,1fr) 25px;
  gap:2px;
  align-items:center;
}
.gallery-variant-stage{
  min-width:0;
  min-height:0;
  width:100%;
  height:100%;
  background-repeat:no-repeat;
  background-position:center;
  background-size:contain;
  opacity:0;
  transition:opacity .18s ease;
}
.gallery-variant-stage.is-loaded{opacity:1;}
.gallery-variant-stage.is-error{opacity:1;}
.gallery-variant-actions{display:flex;justify-content:center;align-items:center;gap:8px;min-height:23px;}
.gallery-action{
  appearance:none;
  border:0;
  background:transparent;
  padding:1px;
  width:22px;
  height:22px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  color:var(--accent);
  cursor:pointer;
}
.gallery-action svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.35;stroke-linecap:round;stroke-linejoin:round;}
.gallery-action:hover,
.gallery-action:focus-visible{color:var(--ink);outline:none;}

.gallery-lightbox[hidden],
.gallery-share-fallback[hidden]{display:none!important;}
.gallery-lightbox{
  --gallery-viewer-control:#604E43;
  z-index:4;
  overflow:hidden;
  display:grid;
  grid-template-rows:minmax(0,1fr) 40px;
  background:rgba(232,221,213,.88);
}
.gallery-lightbox-scroll{
  position:relative;
  min-width:0;
  min-height:0;
  overflow:hidden;
  background:transparent;
  overscroll-behavior:contain;
  scrollbar-width:thin;
  scrollbar-color:var(--accent) transparent;
}
.gallery-lightbox-scroll::-webkit-scrollbar{width:7px;height:7px;}
.gallery-lightbox-scroll::-webkit-scrollbar-thumb{background:var(--accent);}
.gallery-lightbox-slide{
  position:absolute;
  inset:0;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  padding:clamp(10px,1.15vw,18px) clamp(16px,2vw,30px) 0;
  transform:translateX(0);
  will-change:transform;
}
.gallery-lightbox-slide[aria-hidden="true"]{pointer-events:none;}
.gallery-lightbox.is-sliding .gallery-lightbox-slide{
  transition:transform .5s cubic-bezier(.4,0,.2,1);
}
.gallery-lightbox.is-sliding .gallery-lightbox-toolbar{pointer-events:none;}
.gallery-lightbox-image{
  display:block;
  max-width:100%;
  max-height:120%;
  width:auto;
  height:auto;
  object-fit:contain;
  object-position:center bottom;
  cursor:zoom-in;
  user-select:none;
  -webkit-user-drag:none;
  flex:0 1 auto;
}
.gallery-lightbox.is-actual .gallery-lightbox-scroll{overflow:auto;display:block;}
.gallery-lightbox.is-actual .gallery-lightbox-slide.is-current{
  position:relative;
  inset:auto;
  width:max-content;
  height:max-content;
  min-width:100%;
  min-height:100%;
  display:block;
  padding:0;
  transform:none!important;
}
.gallery-lightbox.is-actual .gallery-lightbox-slide:not(.is-current){display:none;}
.gallery-lightbox.is-actual .gallery-lightbox-slide.is-current .gallery-lightbox-image{
  max-width:none;
  max-height:none;
  width:auto;
  height:auto;
  cursor:zoom-out;
  margin:0;
}
.gallery-lightbox-nav{
  display:none;
  position:absolute;
  z-index:4;
  top:calc(50% - 20px);
  transform:translateY(-50%);
  width:44px;
  height:72px;
  padding:0;
  border:0;
  background:transparent;
  color:var(--accent);
  align-items:center;
  justify-content:center;
  cursor:pointer;
}
.gallery-lightbox-prev{left:6px;}
.gallery-lightbox-next{right:6px;}
.gallery-lightbox-nav svg{
  width:26px;
  height:42px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.8;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.gallery-lightbox-nav:hover,
.gallery-lightbox-nav:focus-visible{color:var(--ink);outline:none;}
.gallery-lightbox-nav:disabled{opacity:.3;cursor:default;}
.gallery-lightbox-toolbar{
  position:relative;
  z-index:3;
  display:flex;
  flex-direction:row;
  align-items:center;
  justify-content:center;
  gap:10px;
  min-height:40px;
  padding:3px 0 5px;
  background:var(--paper);
  border-top:1px solid rgba(184,155,101,.26);
}
.gallery-lightbox-toolbar .gallery-action{width:30px;height:30px;color:var(--gallery-viewer-control);}
.gallery-lightbox-toolbar .gallery-lightbox-zoom-in,
.gallery-lightbox-toolbar .gallery-lightbox-zoom-out{color:var(--accent);}
.gallery-lightbox-toolbar .gallery-action svg{width:22px;height:22px;stroke-width:1.5;}
.gallery-lightbox-toolbar .gallery-lightbox-zoom-in svg,
.gallery-lightbox-toolbar .gallery-lightbox-zoom-out svg{stroke-width:1.72;}
.gallery-lightbox-toolbar .gallery-action:hover,
.gallery-lightbox-toolbar .gallery-action:focus-visible{color:var(--ink);}
.gallery-lightbox-toolbar .gallery-action:disabled,
.gallery-lightbox-toolbar .gallery-action:disabled:hover,
.gallery-lightbox-toolbar .gallery-action:disabled:focus-visible{color:var(--accent);opacity:.34;cursor:default;}
.gallery-lightbox-toolbar .gallery-lightbox-close{font:34px/.85 Archivo,sans-serif;padding:0 0 3px;color:var(--gallery-viewer-control);}
.gallery-share-fallback{
  position:fixed;
  z-index:1400;
  border:1px solid var(--accent);
  background:var(--paper);
  color:var(--ink);
  padding:6px 9px;
  font:12px/1.15 Archivo,sans-serif;
  white-space:nowrap;
  cursor:pointer;
  box-shadow:0 2px 8px rgba(67,56,47,.10);
}

/* GALERÍA no utiliza herramientas contextuales de footer. */
.gallery-page .site-footer{grid-template-columns:auto 1fr!important;}
.gallery-page .footer-meta{grid-column:2!important;justify-self:end!important;}

@media(min-width:1046px) and (hover:hover) and (pointer:fine){
  .gallery-lightbox-nav{display:flex;}
}

@media(max-width:1045px) and (orientation:portrait){
  .gallery-page .gallery-main{--gallery-frame-edge:8px;--gallery-inner-edge:9px;}
  .gallery-content{padding:0;}
  .gallery-photo-group{
    height:auto;
    min-height:0;
    grid-template-columns:1fr;
    justify-items:center;
    gap:0;
    padding:clamp(8px,1.7vh,16px) 0;
  }
  .gallery-variant-card{
    width:90%;
    height:auto;
    grid-template-rows:auto 25px;
    gap:2px;
  }
  .gallery-variant-stage{width:100%;height:auto;aspect-ratio:1672/941;}
  .gallery-variant-actions{gap:10px;}
  .gallery-variant-actions [data-gallery-action="expand"]{display:none!important;}
  .gallery-action{width:24px;height:24px;}
  .gallery-action svg{width:19px;height:19px;}
  .gallery-lightbox{display:none!important;}
}

@media(max-width:520px) and (orientation:portrait){
  .gallery-page .topbar,
  .gallery-page .site-footer{width:calc(100% - 10px);}
  .gallery-page .gallery-main{--gallery-frame-edge:5px;--gallery-inner-edge:6px;}
  .gallery-variant-card{width:95%;}
}

