/*
 * Galería común de las webs del stack (con /_stack/ui/gallery.js; docs/NUEVA_WEB.md).
 * Tema por variables en la web: --sg-bg (fondo del escenario), --sg-accent, --sg-text,
 * --sg-ratio (proporción del escenario en escritorio), --sg-radius, --sg-font.
 */
.sg { --sg-bg: #121a16; --sg-accent: #b0894f; --sg-text: #fff; --sg-ratio: 16 / 10; --sg-radius: 0px; position: relative; outline: none; }
.sg-track { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.sg-track::-webkit-scrollbar { display: none; }
.sg-slide { flex: 0 0 86%; margin: 0; scroll-snap-align: start; position: relative; }
.sg-zoom { display: block; cursor: zoom-in; overflow: hidden; border-radius: var(--sg-radius); background: var(--sg-bg); }
.sg-zoom img { width: 100%; height: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
.sg-slide figcaption { font-size: .85rem; opacity: .75; margin-top: 8px; }

/* Con JavaScript: una foto por pantalla, contador y puntos (móvil); escenario, flechas y miniaturas (escritorio). */
.sg-on .sg-stage { position: relative; }
.sg-on .sg-track { gap: 0; }
.sg-on .sg-slide { flex-basis: 100%; scroll-snap-align: center; }
.sg-dragging { scroll-snap-type: none; cursor: grabbing; }
.sg-dragging .sg-zoom { cursor: grabbing; }
.sg-counter { position: absolute; right: 12px; bottom: 12px; padding: 6px 11px; background: rgba(0,0,0,.55); color: var(--sg-text); font: 600 .72rem/1 system-ui, sans-serif; letter-spacing: .12em; border-radius: 999px; pointer-events: none; }
.sg-prev, .sg-next { display: none; }
.sg-dots { display: flex; justify-content: center; gap: 7px; margin-top: 14px; }
.sg-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .22; transition: opacity .3s, transform .3s; }
.sg-dot.sg-active { opacity: .9; transform: scale(1.25); background: var(--sg-accent); }
.sg-thumbs { display: none; }
.sg-single .sg-slide { flex-basis: 100%; }

@media (min-width: 760px) {
    .sg-on .sg-zoom { aspect-ratio: var(--sg-ratio); }
    .sg-on .sg-zoom img { aspect-ratio: auto; object-fit: contain; }
    .sg-single .sg-zoom { aspect-ratio: var(--sg-ratio); }
    .sg-single .sg-zoom img { aspect-ratio: auto; object-fit: contain; }
    .sg-dots { display: none; }
    .sg-prev, .sg-next { display: grid; place-items: center; position: absolute; top: 50%; transform: translateY(-50%); width: 52px; height: 52px; border: 0; border-radius: 50%; background: rgba(255,255,255,.92); color: #111; font: 300 2rem/1 Georgia, serif; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.25); transition: opacity .25s, transform .25s, background .25s; }
    .sg-prev { left: 18px; }
    .sg-next { right: 18px; }
    .sg-prev:hover, .sg-next:hover { background: #fff; transform: translateY(-50%) scale(1.06); }
    .sg-prev:disabled, .sg-next:disabled { opacity: 0; pointer-events: none; }
    .sg-counter { right: 18px; bottom: 18px; }
    .sg-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: thin; padding-bottom: 4px; }
    .sg-thumb { flex: 0 0 auto; width: 104px; aspect-ratio: 4 / 3; padding: 0; border: 0; background: #ddd; cursor: pointer; opacity: .55; transition: opacity .25s, box-shadow .25s; border-radius: var(--sg-radius); overflow: hidden; }
    .sg-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
    .sg-thumb:hover { opacity: .85; }
    .sg-thumb.sg-active { opacity: 1; box-shadow: 0 0 0 2px var(--sg-accent); }
}

/* Visor a pantalla completa */
.sg-locked, .sg-locked body { overflow: hidden; }
.sg-lightbox { border: 0; padding: 0; margin: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: rgba(8,10,9,.97); color: #fff; overscroll-behavior: contain; }
.sg-lightbox::backdrop { background: rgba(8,10,9,.97); }
.sg-lightbox[open] { animation: sg-fade .22s ease-out; }
@keyframes sg-fade { from { opacity: 0; } }
.sg-lb-figure { margin: 0; height: 100%; display: grid; place-items: center; align-content: center; padding: 56px 12px; }
.sg-lb-img { max-width: 100%; max-height: calc(100dvh - 130px); object-fit: contain; opacity: 0; transform: scale(.985); transition: opacity .25s, transform .25s; user-select: none; -webkit-user-drag: none; }
.sg-lb-img.sg-ready { opacity: 1; transform: none; }
.sg-lb-cap { margin-top: 14px; font-size: .95rem; color: rgba(255,255,255,.75); text-align: center; max-width: 60ch; }
.sg-lb-count { position: absolute; top: 22px; left: 22px; font: 600 .72rem/1 system-ui, sans-serif; letter-spacing: .2em; color: rgba(255,255,255,.65); }
.sg-lightbox button { position: absolute; background: none; border: 0; color: #fff; font: 300 2.4rem/1 Georgia, serif; cursor: pointer; padding: 14px 18px; opacity: .8; }
.sg-lightbox button:hover { opacity: 1; }
.sg-lb-close { top: 4px; right: 6px; }
.sg-lb-prev { left: 4px; top: 50%; transform: translateY(-50%); }
.sg-lb-next { right: 4px; top: 50%; transform: translateY(-50%); }
@media (hover: none) { .sg-lb-prev, .sg-lb-next { display: none; } }
@media (min-width: 760px) { .sg-lb-figure { padding: 64px 80px; } }
@media (prefers-reduced-motion: reduce) { .sg-lightbox[open], .sg-lb-img { animation: none; transition: none; } }
