photo-gallery { display:block; scroll-margin-top:calc(var(--pg-nav-height,52px) + 16px); color:var(--color-primary-dark); --pg-line:#cdd1c4; }
photo-gallery [hidden] { display:none!important; }
.pg-heading, .pg-tools, .pg-options, .pg-albums, .pg-top, .pg-actions, .pg-ident { display:flex; align-items:center; }
.pg-heading { justify-content:space-between; gap:16px; margin:0 0 18px; }
.pg-heading h2 { margin:0; font:500 clamp(2.65rem,6vw,4.5rem)/.98 var(--font-display); letter-spacing:-.04em; color:var(--color-primary-dark); }
.pg-count,.pg-position { white-space:nowrap; font-variant-numeric:tabular-nums; }
.pg-count { font-size:.78rem; color:var(--color-text-light); }
.pg-collection { display:none; }
.pg-tools { justify-content:space-between; gap:10px; flex-wrap:wrap; padding:8px 0; background:var(--color-background); border-block:1px solid var(--pg-line); margin-bottom:12px; position:sticky; top:var(--pg-nav-height,52px); z-index:4; }
.pg-albums { gap:4px; }
.pg-albums a { padding:10px 14px; display:inline-flex; align-items:center; min-height:44px; border-radius:3px; font:600 .84rem var(--font-body); color:var(--color-primary); text-decoration:none; }
.pg-albums a:hover, .pg-icon:hover { background:#72876a19; }
.pg-albums a[aria-current] { background:var(--color-primary); color:white; }
.pg-options { gap:6px; }
.pg-options select { min-height:42px; font:500 .8rem var(--font-body); color:inherit; background:transparent; border:0; border-bottom:1px solid var(--pg-line); padding:4px 6px; margin-right:6px; }
.pg-icon { display:inline-grid; place-items:center; flex:none; width:44px; height:44px; padding:0; border:0; border-radius:50%; background:transparent; color:inherit; cursor:pointer; text-decoration:none; }
.pg-icon svg { width:21px; height:21px; stroke:currentColor; stroke-width:1.65; fill:none; stroke-linecap:round; stroke-linejoin:round; }
.pg-icon[aria-pressed=true] { background:#62785c22; }
.pg-icon[aria-pressed=true] svg { fill:currentColor; }
.pg-icon:disabled { opacity:.35; }
photo-gallery :focus-visible { outline:2px solid #aa7323; outline-offset:2px; }
.pg-grid { position:relative; width:100%; contain:layout style; overflow-anchor:none; }
.pg-row { display:flex; position:absolute; inset-inline:0; }
.pg-row a { display:block; position:relative; height:100%; overflow:hidden; background:#e2e3d8; }
.pg-row img { display:block; width:100%; height:100%; object-fit:cover; }
.pg-row a:focus-visible { z-index:1; }
.pg-row a[data-favorite]::after { content:'♥'; color:white; position:absolute; top:6px; right:9px; text-shadow:0 1px 5px #0009; }
.pg-notice:not(:empty) { padding:30px 0; font-size:.9rem; }
.pg-notice button { padding:10px 16px; border:1px solid var(--pg-line); border-radius:3px; background:transparent; color:inherit; font:inherit; cursor:pointer; }
body:has(.pg-viewer[open]) { overflow:hidden; }
.pg-viewer { box-sizing:border-box; position:fixed; inset:0; width:100%; max-width:none; height:100dvh; max-height:none; margin:0; padding:0; border:0; background:#151916; color:#f5f3ec; }
.pg-viewer[open] { display:grid; grid-template-rows:auto minmax(0,1fr) auto; }
.pg-viewer::backdrop { background:#151916; }
.pg-top { justify-content:space-between; padding:max(6px,env(safe-area-inset-top)) max(16px,env(safe-area-inset-right)) 6px max(20px,env(safe-area-inset-left)); }
.pg-ident { gap:14px; }
.pg-album { font:500 1.4rem var(--font-display); }
.pg-position,.pg-feedback { font-size:.78rem; color:#c6cbbf; }
.pg-stage { position:relative; min-height:0; display:grid; grid-template-columns:56px minmax(0,1fr) 56px; align-items:center; justify-items:center; padding:0 8px; }
.pg-picture { width:100%; height:100%; min-height:0; }
.pg-picture img { display:block; width:100%; height:100%; object-fit:contain; user-select:none; -webkit-user-drag:none; }
.pg-viewer .pg-icon:hover,.pg-viewer .pg-icon[aria-pressed=true] { color:white; background:#ffffff20; }
.pg-actions { justify-content:center; gap:6px; }
.pg-bottom { position:relative; padding:7px 14px max(7px,env(safe-area-inset-bottom)); }
.pg-feedback:not(:empty) { position:absolute; bottom:100%; left:50%; transform:translateX(-50%); max-width:90%; background:#151916eb; border-radius:4px; padding:5px 12px; }
.pg-feedback input { width:min(320px,72vw); }
@media (max-width:650px) {
  .pg-heading { margin-bottom:14px; }
  .pg-tools { position:static; flex-wrap:nowrap; gap:4px; padding:3px 0; }
  .pg-albums { display:none; }
  .pg-collection, .pg-options select {
    display:block; min-width:0; min-height:44px; border:0; border-radius:0;
    padding:0 2px; background:transparent; color:inherit; font:500 .78rem var(--font-body);
  }
  .pg-collection { flex:0 1 98px; font-weight:650; }
  .pg-options { flex:1; min-width:0; justify-content:flex-end; gap:0; }
  .pg-options select { flex:1; width:0; max-width:154px; margin-right:auto; }
  .pg-stage { grid-template-columns:minmax(0,1fr); padding:0; }
  .pg-stage .pg-icon { position:absolute; bottom:8px; background:#101510bd; z-index:1; }
  .pg-stage [data-action=prev] { left:8px; }
  .pg-stage [data-action=next] { right:8px; }
  .pg-actions { gap:10px; }
}
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  .pg-row img { transition:filter .14s ease; }
  .pg-row a:hover img { filter:brightness(.93); }
}
