/* ==========================================================================
   Pet Gallery (pet-gallery.php, public_pet_gallery.php)
   Hero · category chips · masonry grid · pager · full-screen viewer.
   Tokens from tokens.css; no external fonts or images.
   ========================================================================== */
.pb-gal { display: flex; flex-direction: column; gap: var(--pb-gap, 18px); max-width: 1320px; margin: 0 auto; padding: 14px 12px calc(96px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .pb-gal { padding: 20px 28px 56px; } }

/* ── Hero ──────────────────────────────────────────────────────────────── */
.pb-gal-hero {
  position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; gap: 14px 22px;
  padding: clamp(18px, 4vw, 30px); border-radius: var(--pb-r-xl, 20px);
  background: linear-gradient(100deg, #fffaf0 0%, #fef3dc 55%, #fde9bd 100%); border: 1px solid #f1e6cc;
}
.pb-gal-hero::after { content: "\f1b0"; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; right: 18px; top: 4px; font-size: 84px; color: #f8dfa8; transform: rotate(16deg); pointer-events: none; }
.pb-gal-hero__ico { flex: none; width: 56px; height: 56px; display: grid; place-items: center; border-radius: 18px; background: #fff; color: var(--pb-primary); font-size: 24px; box-shadow: 0 4px 14px rgba(120, 80, 0, .12); }
.pb-gal-hero__txt { flex: 1 1 260px; min-width: 0; position: relative; z-index: 1; }
.pb-gal-hero h1 { margin: 0; font-family: var(--pb-font-head); font-weight: 800; font-size: clamp(24px, 6vw, 34px); line-height: 1.1; color: var(--pb-text); }
.pb-gal-hero p { margin: 6px 0 0; color: var(--pb-text-2); font-size: clamp(14px, 3.6vw, 16px); }
.pb-gal-hero__act { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; position: relative; z-index: 1; }
.pb-gal-count { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px; background: #fff; border: 1px solid #ecdfbf; font-weight: 800; font-size: 14px; color: var(--pb-primary); }
.pb-gal-link { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; background: #fff; border: 1px solid #ecdfbf; font-weight: 800; font-size: 14px; color: var(--pb-text-2); text-decoration: none; transition: background .15s; }
.pb-gal-link:hover { background: #fffaf0; }

/* ── Category chips ───────────────────────────────────────────────────── */
.pb-gal-cats { display: flex; gap: 8px; overflow-x: auto; margin: 0 -12px; padding: 2px 12px 4px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.pb-gal-cats::-webkit-scrollbar { display: none; }
@media (min-width: 900px) { .pb-gal-cats { margin: 0; padding: 2px 0 4px; flex-wrap: wrap; overflow: visible; } }
.pb-gal-cat {
  flex: none; display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: 999px;
  background: #fff; border: 1px solid var(--pb-border-3, #e8e3d3); font-weight: 700; font-size: 14.5px; color: var(--pb-text-2); text-decoration: none; white-space: nowrap;
  transition: background .15s, border-color .15s;
}
.pb-gal-cat:hover { background: #faf6ec; }
.pb-gal-cat.is-active { background: var(--pb-primary); border-color: var(--pb-primary); color: #fff; }
.pb-gal-cat__em { font-size: 16px; line-height: 1; }

/* ── Grid (masonry via columns: no layout JS, no reflow while images stream in) ─────── */
.pb-gal-grid { column-width: 168px; column-gap: 10px; }
@media (min-width: 900px) { .pb-gal-grid { column-width: 210px; column-gap: 14px; } }
.pb-gal-tile {
  display: block; width: 100%; padding: 0; margin: 0 0 10px; border: 0; border-radius: 14px; overflow: hidden; cursor: zoom-in;
  background: linear-gradient(110deg, #f1ece0 8%, #f8f4ea 18%, #f1ece0 33%); background-size: 200% 100%;
  break-inside: avoid; position: relative; -webkit-tap-highlight-color: transparent;
  content-visibility: auto; contain-intrinsic-size: 200px 220px;
}
@media (min-width: 900px) { .pb-gal-tile { margin-bottom: 14px; } }
.pb-gal-tile img { display: block; width: 100%; height: auto; min-height: 90px; transition: transform .35s ease, opacity .25s; }
.pb-gal-tile:hover img, .pb-gal-tile:focus-visible img { transform: scale(1.035); }
.pb-gal-tile:focus-visible { outline: 3px solid var(--pb-primary); outline-offset: 2px; }
.pb-gal-tile::after {
  content: "\f002"; font-family: "Font Awesome 6 Free"; font-weight: 900; position: absolute; right: 10px; bottom: 10px;
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, .92); color: var(--pb-text-2); font-size: 13px;
  opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s; pointer-events: none;
}
.pb-gal-tile:hover::after, .pb-gal-tile:focus-visible::after { opacity: 1; transform: none; }
@media (hover: none) { .pb-gal-tile::after { display: none; } }

/* ── Empty / error ────────────────────────────────────────────────────── */
.pb-gal-empty { text-align: center; padding: 56px 20px; color: var(--pb-text-muted); }
.pb-gal-empty i { display: block; font-size: 44px; color: #e2d6b8; margin-bottom: 14px; }
.pb-gal-empty strong { display: block; color: var(--pb-text); font-size: 18px; margin-bottom: 6px; }
.pb-gal-empty .pb-btn { margin-top: 16px; }

/* ── Pager ────────────────────────────────────────────────────────────── */
.pb-gal-pager { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 6px; }
.pb-gal-pager a, .pb-gal-pager span {
  min-width: 42px; height: 42px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; border-radius: 12px;
  background: #fff; border: 1px solid var(--pb-border-3, #e8e3d3); font-weight: 800; font-size: 14.5px; color: var(--pb-text-2); text-decoration: none;
}
.pb-gal-pager a:hover { background: #faf6ec; }
.pb-gal-pager .is-current { background: var(--pb-primary); border-color: var(--pb-primary); color: #fff; }
.pb-gal-pager .is-gap { border: 0; background: none; min-width: 20px; padding: 0; }

/* ── Viewer ───────────────────────────────────────────────────────────── */
html.pb-gv-open { overflow: hidden; }
.pb-gv { position: fixed; inset: 0; z-index: 1200; background: rgba(12, 10, 6, .94); display: flex; align-items: center; justify-content: center; animation: pb-gv-in .18s ease; }
.pb-gv[hidden] { display: none; }
@keyframes pb-gv-in { from { opacity: 0; } to { opacity: 1; } }
.pb-gv__top { position: absolute; left: 0; right: 0; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 12px 10px; background: linear-gradient(180deg, rgba(0, 0, 0, .55), transparent); }
.pb-gv__count { color: #fff; font-weight: 800; font-size: 14px; padding: 0 6px; text-shadow: 0 1px 4px rgba(0, 0, 0, .5); }
.pb-gv__tools { display: flex; align-items: center; gap: 8px; }
.pb-gv__btn {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border: 0; border-radius: 999px;
  background: rgba(255, 255, 255, .16); color: #fff; font: 800 14px var(--pb-font-body, inherit); text-decoration: none; cursor: pointer; backdrop-filter: blur(6px);
}
.pb-gv__btn:hover { background: rgba(255, 255, 255, .28); }
.pb-gv__btn--edit { background: var(--pb-primary); }
.pb-gv__btn--edit:hover { background: var(--pb-primary-hover, #7d5f02); }
.pb-gv__btn--icon { width: 42px; padding: 0; justify-content: center; font-size: 18px; }
.pb-gv__stage { flex: 1; align-self: stretch; display: flex; align-items: center; justify-content: center; padding: 64px 12px 24px; position: relative; min-width: 0; touch-action: pan-y; }
.pb-gv__stage img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 10px; box-shadow: 0 10px 50px rgba(0, 0, 0, .5); transition: opacity .2s; }
.pb-gv.is-loading .pb-gv__stage img { opacity: .25; }
.pb-gv__spin { position: absolute; color: #fff; font-size: 26px; opacity: 0; transition: opacity .2s; pointer-events: none; }
.pb-gv.is-loading .pb-gv__spin { opacity: 1; }
.pb-gv__nav {
  flex: none; width: 52px; height: 52px; margin: 0 8px; border: 0; border-radius: 50%; background: rgba(255, 255, 255, .14); color: #fff; font-size: 20px; cursor: pointer; z-index: 2; backdrop-filter: blur(6px);
}
.pb-gv__nav:hover { background: rgba(255, 255, 255, .28); }
@media (max-width: 700px) {
  .pb-gv__nav { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom)); width: 46px; height: 46px; margin: 0; }
  .pb-gv__nav--prev { left: 16px; } .pb-gv__nav--next { right: 16px; }
  .pb-gv__stage { padding: 64px 0 80px; }
  .pb-gv__stage img { border-radius: 0; }
  .pb-gv__lbl { display: none; }
  .pb-gv__btn { padding: 0 14px; }
}
@media (prefers-reduced-motion: reduce) { .pb-gv { animation: none; } .pb-gal-tile img { transition: none; } }
