/* Galería (cuatro páginas hermanas con una sola plantilla): pestañas, muro y visor.
   El muro no se anima (como 619). Refinamiento del 14 de octubre: pestañas con el filete que se dibuja, rótulos con aire
   (--ls-caps), 44 px de toque en el desplegable, primera foto a todo el ancho en el teléfono, visor a la medida del
   teléfono con contador y la foto que funde al llegar. */

/* ---------- fila ---------------------------------------------------------- */
.page-galeria .gal-row { --row-pb: 90px; }
@media (max-width: 600px) { .page-galeria .gal-row { --row-pb: 40px; } }

/* ---------- pestañas ------------------------------------------------------ */
.gal-nav { margin: 20px 20px 40px; }   /* 20 + 20: los márgenes de dos módulos no se funden */
.gal-tabs {
  display: flex; flex-direction: row; justify-content: center; align-items: center; gap: 50px;
  margin: 0; padding: 0; list-style: none;
}
.gal-tabs li { margin: 0; padding: 0; }
.gal-tabs a, .gal-tabs a:hover, .gal-tabs a:focus,
.gal-drop__btn {
  display: block;
  font-family: var(--font-serif); font-weight: var(--fw-text);
  font-size: 16px; line-height: 24px; letter-spacing: var(--ls-caps); word-spacing: normal;
  text-transform: uppercase; text-decoration: none; white-space: nowrap;
  color: var(--c-ink); cursor: pointer;
}
/* filete de 1 px: fijo bajo la categoría actual; en las demás se dibuja desde el centro al pasar (como el menú, F09) */
.gal-tabs a {
  position: relative; padding: 10px 0;
  background: linear-gradient(currentColor, currentColor) 50% calc(100% - 9px) / 0 1px no-repeat;
  transition: background-size .45s var(--ease-fine), color .3s ease;
}
.gal-tabs li.is-current a { background-size: 100% 1px; }
.gal-tabs li:not(.is-current) a { color: rgba(43, 43, 39, .62); }
@media (hover: hover) {
  .gal-tabs li:not(.is-current) a:hover { background-size: 100% 1px; color: var(--c-ink); }
}
.gal-tabs li:not(.is-current) a:focus-visible { background-size: 100% 1px; color: var(--c-ink); }
@media (prefers-reduced-motion: reduce) { .gal-tabs a { transition: none; } }

/* desplegable (solo bajo 768) */
.gal-drop { display: none; position: relative; justify-content: center; }
.gal-drop__btn {
  -webkit-appearance: none; appearance: none; margin: 0; padding: 10px 12px;
  display: inline-flex; align-items: center; min-height: 44px;
  border: 0; border-radius: 0; background: transparent;
}
.gal-drop__btn::after {
  content: ""; display: inline-block; margin-left: 8px;
  border-top: 4.5px solid var(--c-ink); border-left: 4.5px solid transparent; border-right: 4.5px solid transparent;
  transition: transform .25s var(--ease-fine);
}
.gal-drop__btn[aria-expanded="true"]::after { transform: rotate(180deg); }
.gal-drop__menu {
  position: absolute; top: 100%; left: 50%; z-index: 1000; transform: translateX(-50%);
  min-width: 200px; margin: 2px 0 0; padding: 6px 0;
  background: var(--c-paper-alt); border: 1px solid rgba(0, 0, 0, .12); text-align: center;
}
.gal-drop__menu a, .gal-drop__menu a:hover {
  display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 24px;
  font-size: 16px; line-height: 24px; letter-spacing: var(--ls-fix-text);
  text-transform: none; text-decoration: none; white-space: nowrap; color: var(--c-ink);
}
.gal-drop__menu a[aria-current="page"] { color: var(--c-accent-text); }
@media (max-width: 767px) {
  .gal-nav { margin-bottom: 30px; }
  .gal-drop { display: flex; }
  .gal-tabs { display: none; }
}

/* ---------- muro ---------------------------------------------------------- */
.gal-wall { margin: 0 20px 40px; }
/* sin JS: columnas CSS (el orden cambia, pero nada se pierde) */
.gal-wall:not(.is-ready) { columns: 3; column-gap: 20px; }
.gal-wall:not(.is-ready) .gal-item { margin-bottom: 20px; break-inside: avoid; }
@media (max-width: 768px) { .gal-wall:not(.is-ready) { columns: 2; } }

/* filas justificadas (js/galeria.js): cada fila llena el ancho; una fila limitada en altura se centra */
.gal-wall.is-ready { display: flex; flex-direction: column; gap: 20px; }
.gal-jrow { display: flex; justify-content: center; gap: 20px; min-width: 0; }
.gal-jrow > .gal-item { flex: 0 1 auto; min-width: 0; }
.gal-jrow > .gal-item img { width: 100%; height: 100%; object-fit: cover; object-position: var(--pos, 50% 50%); }
.gal-jrow > .gal-item--crop img { aspect-ratio: auto; }
@media (max-width: 599.98px) {
  .gal-wall.is-ready, .gal-jrow { gap: 12px; }
}

/* sin el hover de enlace de la base; el cursor de lupa y el acercamiento de 1.03 los pone la base (F09) */
.gal-item, .gal-item:hover { display: block; line-height: 0; text-decoration: none; }
.gal-item img { display: block; width: 100%; height: auto; color: transparent; }   /* sin texto alt a la vista mientras carga */
.gal-item--crop img { aspect-ratio: var(--ar); object-fit: cover; object-position: var(--pos, 50% 50%); }
/* al cerrar el visor abierto con ratón, la miniatura recupera el foco sin marco */
.gal-item.is-quiet:focus, .gal-item.is-quiet:focus-visible { outline: 0; }

/* ---------- visor --------------------------------------------------------- */
.lb {
  position: fixed; inset: 0; z-index: 1100; overflow: hidden;
  background: #1A1A1A; color: #fff; cursor: zoom-out; outline: 0;
  overscroll-behavior: contain; touch-action: none;
  transition: opacity .2s ease;
}
.lb.is-entering { opacity: 0; transition: none; }
.lb__stage {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  padding: 0 8px;
}
.lb__figure { position: relative; margin: 0; line-height: 0; cursor: pointer; }
.lb__loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; margin: 0;
  font-family: var(--font-caption); font-size-adjust: var(--fsa-caption); font-size: 11px; line-height: 1;
  letter-spacing: .2em; text-transform: uppercase; color: rgba(246, 246, 243, .6);
}
.lb__loading[hidden] { display: none; }
.lb__img {
  position: relative; display: block; max-width: none; margin: 0 auto; padding: 0;
  object-fit: cover; cursor: pointer; background: #222;
  opacity: 0; transition: opacity .35s ease;
}
.lb__img.is-in { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
  .lb, .lb__img { transition: none; }
}
.lb__dots {
  position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  display: flex; justify-content: center; margin: 16px 0 0; padding: 0; list-style: none; cursor: default;
}
.lb__dots li { margin: 0; padding: 3px; font-size: 0; line-height: 0; }
.lb__dots li::before { content: ""; display: block; width: 6px; height: 6px; border-radius: 6px; background: #fff; opacity: .25; transition: opacity .25s ease; }
.lb__dots li.is-active::before { opacity: 1; }
.lb__count { display: none; }

.lb__arrow, .lb__close {
  -webkit-appearance: none; appearance: none; position: absolute; z-index: 2; margin: 0; padding: 0;
  border: 0; border-radius: 0; background: transparent; color: #fff; opacity: .65; cursor: pointer;
  transition: opacity .25s ease;
}
.lb__arrow:hover, .lb__arrow:focus-visible, .lb__close:hover, .lb__close:focus-visible { opacity: 1; }
.lb__arrow:focus-visible, .lb__close:focus-visible { outline: 1px solid #fff; outline-offset: 0; }
.lb__arrow { top: 50%; width: 90px; height: 110px; margin-top: -55px; }
.lb__arrow:active { margin-top: -54px; }
.lb__arrow--prev { left: env(safe-area-inset-left, 0px); transform-origin: 0 50%; }
.lb__arrow--next { right: env(safe-area-inset-right, 0px); transform-origin: 100% 50%; }
.lb__arrow svg { position: absolute; top: 43px; width: 15px; height: 25px; overflow: visible; transition: transform .3s var(--ease-fine); }
.lb__arrow--prev svg { left: 31px; }
.lb__arrow--next svg { left: 37px; }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .lb__arrow--prev:hover svg { transform: translateX(-3px); }
  .lb__arrow--next:hover svg { transform: translateX(3px); }
}
.lb__close { top: 32px; right: 32px; width: 44px; height: 44px; }
.lb__close svg { position: absolute; top: 10px; left: 10px; width: 24px; height: 24px; overflow: visible; }
.lb svg path { fill: none; stroke: #fff; stroke-width: 1px; vector-effect: non-scaling-stroke; }

@media (max-width: 900px) {
  .lb__stage { padding: 0 6px; }
  .lb__arrow { transform: scale(.75); }
}
/* teléfono: la foto ocupa todo el ancho; flechas de 56 px abajo y el contador entre ellas */
@media (max-width: 767px) {
  .lb__stage { padding: 0; }
  .lb__close { top: calc(6px + env(safe-area-inset-top, 0px)); right: calc(6px + env(safe-area-inset-right, 0px)); }
  .lb__dots { display: none; }
  .lb__arrow {
    top: auto; bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    width: 56px; height: 56px; transform: none; margin: 0; opacity: .85;
  }
  .lb__arrow:active { margin: 0; opacity: 1; }
  .lb__arrow--prev { left: calc(14px + env(safe-area-inset-left, 0px)); }
  .lb__arrow--next { right: calc(14px + env(safe-area-inset-right, 0px)); }
  .lb__arrow svg { top: 16px; width: 14px; height: 23px; }
  .lb__arrow--prev svg { left: 20px; }
  .lb__arrow--next svg { left: 22px; }
  .lb__count {
    display: flex; align-items: center; justify-content: center;
    position: absolute; left: 50%; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
    height: 56px; margin: 0;
    font-family: var(--font-caption); font-size-adjust: var(--fsa-caption); font-size: 12px; line-height: 1;
    letter-spacing: .14em; font-variant-numeric: tabular-nums; color: rgba(246, 246, 243, .7); cursor: default;
  }
}
