/* «Включи систему» — просмотр фотографий (лайтбокс). Подключать вместе с gallery.js.
   Открывается на любом [data-file] (оригинал фото) — на странице «О создателе» это все фото-рамки.
   Тёмная плита с брекетами как у HUD-панелей, счётчик и подпись моноширинным, стрелки на широких
   экранах, свайп и тап по краям — на телефоне. */

html.gallery-visible { overflow: hidden; }

.gl-zoom { cursor: zoom-in; }
.gl-zoom:focus-visible { outline: 2px solid var(--holo); outline-offset: 2px; }

.gl {
  position: fixed; inset: 0; z-index: 1200;
  display: flex; flex-direction: column;
  background: rgba(4, 6, 13, 0.94);
  -webkit-backdrop-filter: blur(0.625rem); backdrop-filter: blur(0.625rem);
  color: var(--text);
  opacity: 0; transition: opacity var(--t-base) var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: pan-y pinch-zoom;
}
.gl.is-open { opacity: 1; }
.gl[hidden] { display: none; }
.gl button { font: inherit; }

/* верхняя полоса: счётчик слева, закрыть справа */
.gl__bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.125rem 1.5rem; }
.gl__count { font-family: var(--font-mono); font-size: 0.625rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--mono-dim); }
.gl__count b { font-weight: 500; color: #D6EEFD; }

.gl__btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  width: 2.75rem; height: 2.75rem; padding: 0;
  border: 1px solid #2A3A55; border-radius: 0.5625rem;
  background: rgba(8, 16, 30, 0.55); color: #DCE7F4;
  cursor: pointer;
  transition: border-color var(--t-micro) var(--ease), background var(--t-micro) var(--ease), opacity var(--t-micro) var(--ease);
}
.gl__btn:hover { border-color: rgba(94, 200, 248, 0.5); background: rgba(94, 200, 248, 0.08); }
.gl__btn:focus-visible { outline: 2px solid var(--holo); outline-offset: 2px; }
.gl__btn svg { display: block; width: 1rem; height: 1rem; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.gl__btn:disabled { opacity: 0.3; cursor: default; }

/* сцена: картинка по центру, стрелки по бокам */
.gl__stage { position: relative; flex: 1 1 auto; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 5.25rem; }
.gl__frame { position: relative; max-width: 100%; max-height: 100%; display: flex; }
.gl__img {
  display: block; max-width: min(100%, 87.5rem); max-height: calc(100dvh - 11.875rem);
  width: auto; height: auto; object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 1.875rem 5rem rgba(0, 0, 0, 0.5);
  opacity: 0; transition: opacity var(--t-base) var(--ease);
}
.gl.is-ready .gl__img { opacity: 1; }
.gl__frame > i { position: absolute; z-index: 3; width: 0.875rem; height: 0.875rem; border: 0 solid var(--holo-bracket); pointer-events: none; opacity: 0; transition: opacity var(--t-base) var(--ease); }
.gl.is-ready .gl__frame > i { opacity: 1; }
.gl__frame > i:nth-of-type(1) { top: -0.375rem; left: -0.375rem; border-top-width: 1.5px; border-left-width: 1.5px; }
.gl__frame > i:nth-of-type(2) { top: -0.375rem; right: -0.375rem; border-top-width: 1.5px; border-right-width: 1.5px; }
.gl__frame > i:nth-of-type(3) { bottom: -0.375rem; left: -0.375rem; border-bottom-width: 1.5px; border-left-width: 1.5px; }
.gl__frame > i:nth-of-type(4) { bottom: -0.375rem; right: -0.375rem; border-bottom-width: 1.5px; border-right-width: 1.5px; }

.gl__spin {
  position: absolute; left: 50%; top: 50%; width: 1.75rem; height: 1.75rem; margin: -0.875rem 0 0 -0.875rem;
  border-radius: 50%; border: 2px solid rgba(94, 200, 248, 0.2); border-top-color: var(--holo);
  animation: glSpin .8s linear infinite;
}
.gl.is-ready .gl__spin { display: none; }
@keyframes glSpin { to { transform: rotate(360deg); } }

.gl__nav { position: absolute; top: 50%; margin-top: -1.375rem; }
.gl__nav--prev { left: 1.5rem; }
.gl__nav--next { right: 1.5rem; }

/* подпись */
.gl__cap { flex: none; min-height: 4rem; padding: 1rem 1.5rem 1.375rem; text-align: center; }
.gl__cap-text { margin: 0 auto; max-width: 45rem; font-size: 0.875rem; line-height: 1.5; color: var(--text-dim); text-wrap: pretty; }

/* телефон и планшет: стрелки прячем, листание — свайп и тап по краям; картинка на всю ширину */
@media (max-width: 760px) {
  .gl__bar { padding: 0.75rem 1rem; }
  .gl__stage { padding: 0 0.75rem; }
  .gl__nav { display: none; }
  .gl__img { max-height: calc(100dvh - 9.375rem); border-radius: 0.375rem; }
  .gl__cap { min-height: 3.25rem; padding: 0.75rem 1rem 1rem; }
  .gl__cap-text { font-size: 0.8125rem; }
}

@media (prefers-reduced-motion: reduce) {
  .gl, .gl__img, .gl__frame > i { transition: none; }
}
