/* вынесен из inline-<style> страницы gallery.html (SEC-11: style-src без unsafe-inline) */
    /* «Б2» (волна 3, claude/AUDIT-SITE-WIDE-B2-2026-11-14.md): цвета — токены --ui-* (были
       неоновые голубой/фиолетовый/розовый, свечения, радиальные пятна и градиентный текст);
       кнопки — .ui-btn-primary / .ui-btn-secondary / .ui-btn-icon в разметке и шаблонах
       gallery.js; чипы — как .filter-chip каталога. Плитки галереи — фото с подписью поверх,
       без тела карточки: им поверхность и рамка «Б2» токенами, а не .ui-card (его отступ
       28px сломал бы плитку). Логика показа (сетка, чипы, лайтбокс) не менялась. */
    * { box-sizing: border-box; }
    body { background: var(--ui-bg); color: var(--ui-text); margin: 0; min-height: 100vh; overflow-x: hidden; }
    .container { max-width: 1320px; margin: 0 auto; padding: 0 24px; }

    /* PAGE HEAD */
    .page-head { padding: 60px 0 30px; text-align: center; position: relative; overflow: hidden; }
    .page-head-inner { position: relative; z-index: 1; }
    .page-eyebrow {
      display: inline-flex; align-items: center; gap: 6px; padding: 6px 16px;
      background: rgba(201,166,255,0.14);
      border: 1px solid rgba(201,166,255,0.35);
      border-radius: 99px;
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.7rem; font-weight: 700;
      letter-spacing: 0.16em; text-transform: uppercase;
      color: var(--ui-accent); margin-bottom: 22px;
    }
    .page-title {
      font-size: clamp(2rem, 4.2vw, 3rem);
      font-weight: 800; letter-spacing: -0.025em;
      margin: 0 0 14px; line-height: 1.1; color: var(--ui-text);
    }
    .page-title .grad { color: var(--ui-accent); }
    .page-sub {
      font-size: 1.02rem; color: var(--ui-text-2);
      max-width: 620px; margin: 0 auto;
      line-height: 1.55;
    }

    /* FILTERS */
    .filters {
      padding: 22px 0;
      /* top: 0, а не 64px — как в каталоге: шапка «Б2» (nav.js) липнет только внутри #nav-root и
         уходит при прокрутке; с прежним отступом над фильтрами оставалась пустая полоса 64px. */
      position: sticky; top: 0; z-index: 50;
      background: rgba(13,12,20,0.85);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border-bottom: 1px solid var(--ui-line);
    }
    .filters-inner { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
    .filter-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
    .filter-label {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.66rem; font-weight: 700;
      letter-spacing: 0.16em; text-transform: uppercase;
      color: var(--ui-text-4);
      margin-right: 6px;
    }
    /* Чипов «Всё»/«Только фото» больше нет (после удаления видео они ничего не фильтровали) —
       вместо них пояснение .filter-label «Показаны только фото». */
    .filter-count {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.78rem; color: var(--ui-text-3);
      margin-left: auto;
    }

    /* PINTEREST-STYLE MASONRY */
    .gallery { padding: 40px 0 80px; }
    .gallery-masonry {
      column-count: 4;
      column-gap: 16px;
    }
    @media (max-width: 1100px) { .gallery-masonry { column-count: 3; } }
    @media (max-width: 720px)  { .gallery-masonry { column-count: 2; column-gap: 10px; } }
    @media (max-width: 420px)  { .gallery-masonry { column-count: 1; } }

    .gallery-item {
      display: block;
      width: 100%;
      margin-bottom: 16px;
      break-inside: avoid;
      position: relative;
      border-radius: 16px;
      overflow: hidden;
      cursor: pointer;
      background: var(--ui-surface);
      border: 1px solid var(--ui-line-hi);
      transition: transform 0.25s, border-color 0.25s;
      text-decoration: none;
    }
    .gallery-item:hover {
      transform: translateY(-3px);
      border-color: var(--ui-accent);
    }
    .gallery-item img {
      width: 100%; height: auto;
      display: block;
      transition: transform 0.5s;
    }
    .gallery-item:hover img {
      transform: scale(1.04);
    }

    .gallery-item-overlay {
      position: absolute;
      inset: 0;
      background: linear-gradient(to top, rgba(13,12,20,0.95) 0%, rgba(13,12,20,0.3) 40%, transparent 70%);
      opacity: 0;
      transition: opacity 0.25s;
      display: flex;
      flex-direction: column;
      justify-content: flex-end;
      padding: 20px;
      z-index: 2;
    }
    .gallery-item:hover .gallery-item-overlay { opacity: 1; }
    @media (hover: none) {
      .gallery-item-overlay { opacity: 1; }
    }

    .gallery-item-film {
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.66rem; font-weight: 800;
      letter-spacing: 0.16em; text-transform: uppercase;
      color: var(--ui-accent);
      margin-bottom: 4px;
    }
    .gallery-item-title {
      font-size: 0.95rem; font-weight: 800;
      color: var(--ui-text); letter-spacing: -0.01em;
      margin-bottom: 12px;
    }
    /* «Примерить такую же» — .ui-btn-primary .ui-btn--sm (вся плитка кликабельна, это подпись-призыв) */
    .gallery-item-try { width: fit-content; border-radius: 999px; }

    .gallery-empty {
      padding: 100px 30px;
      text-align: center;
      color: var(--ui-text-3);
      grid-column: 1 / -1;
    }
    .gallery-empty-icon {
      width: 80px; height: 80px;
      border-radius: 50%;
      background: var(--ui-surface);
      border: 1px solid var(--ui-line-hi);
      color: var(--ui-accent);
      display: inline-flex; align-items: center; justify-content: center;
      font-size: 2.4rem;
      margin-bottom: 22px;
    }
    .gallery-empty-title {
      font-size: 1.3rem; font-weight: 800;
      color: var(--ui-text);
      margin-bottom: 10px;
    }
    .gallery-empty-text {
      font-size: 0.95rem;
      line-height: 1.55;
      max-width: 480px;
      margin: 0 auto 26px;
      color: var(--ui-text-2);
    }
    /* «Создать первую визуализацию» — .ui-btn-primary */
    .gallery-empty-cta { padding: 14px 30px; font-size: 0.94rem; }

    /* Skeleton during load */
    .gallery-skeleton {
      width: 100%;
      margin-bottom: 16px;
      break-inside: avoid;
      border-radius: 16px;
      background: linear-gradient(90deg,
        var(--ui-surface) 0%,
        var(--ui-line-hi) 50%,
        var(--ui-surface) 100%);
      background-size: 200% 100%;
      animation: shimmer 1.6s ease-in-out infinite;
    }
    @keyframes shimmer {
      0%   { background-position: -200% 0; }
      100% { background-position: 200% 0; }
    }

    /* LIGHTBOX */
    .lightbox {
      position: fixed; inset: 0;
      background: rgba(13,12,20,0.94);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      z-index: 200; display: none;
      align-items: center; justify-content: center;
      padding: 24px;
    }
    .lightbox.visible { display: flex; }
    .lightbox-content {
      max-width: 1100px;
      max-height: 92vh;
      position: relative;
      display: flex;
      flex-direction: column;
      gap: 16px;
    }
    .lightbox-media {
      max-height: 78vh;
      border-radius: 16px;
      overflow: hidden;
      border: 1px solid var(--ui-line-hi);
      box-shadow: 0 40px 100px rgba(0,0,0,0.7);
    }
    .lightbox-media img {
      max-width: 100%;
      max-height: 78vh;
      display: block;
    }
    .lightbox-actions {
      display: flex;
      gap: 12px;
      justify-content: center;
      flex-wrap: wrap;
    }
    /* Кнопки лайтбокса — .ui-btn-primary / .ui-btn-secondary; закрытие — .ui-btn-icon (круг) */
    .lightbox-btn { font-size: 0.92rem; }
    .lightbox-close {
      position: absolute;
      top: -50px; right: 0;
      width: 40px; height: 40px;
      border-radius: 50%;
      font-size: 1.2rem;
      transition: border-color 0.15s, transform 0.15s;
    }
    .lightbox-close:hover { transform: rotate(90deg); }

    /* BACK TO TOP — кнопку «наверх» создаёт global.js (.back-to-top), а её стиль лежит в общем
       styles.css, который галерея не подключает (и подключать целиком нельзя: там свои
       .gallery-item, .gallery-skeleton, .container и правила body/h1/button в старой палитре).
       Поэтому — точечно, геометрия и поведение как в styles.css, цвета токенами «Б2». */
    .back-to-top {
      position: fixed; bottom: 28px; right: 24px; z-index: 500;
      width: 46px; height: 46px; border-radius: 50%;
      display: flex; align-items: center; justify-content: center;
      background: var(--ui-gradient); color: var(--ui-bg);
      border: none; cursor: pointer; font-size: 1.1rem;
      opacity: 0; transform: translateY(16px); pointer-events: none;
      transition: opacity .3s, transform .3s, filter .15s;
    }
    .back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
    .back-to-top:hover { transform: translateY(-2px); filter: brightness(1.08); }

    /* FOOTER */
    .nv-footer {
      padding: 40px 0 30px;
      border-top: 1px solid var(--ui-line);
      font-size: 0.86rem; color: var(--ui-text-4);
    }
    .nv-footer-inner {
      display: flex; flex-wrap: wrap; gap: 24px;
      justify-content: space-between; align-items: center;
    }
    .nv-footer-links { display: flex; gap: 22px; }
    .nv-footer-links a {
      color: var(--ui-text-3); text-decoration: none;
      transition: color 0.15s;
    }
    .nv-footer-links a:hover { color: var(--ui-text); }
