/* css/photo-viewer.css - the public photo viewer (js/core/photo-viewer.js): a full-viewport modal <dialog> with a grid of all photos and a one-photo view. */
.pv-dialog { width: 100vw; max-width: none; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; overflow: hidden; background: rgba(3, 14, 22, 0.97); color: #fff; }
.pv-dialog:not([open]) { display: none; }
.pv-dialog::backdrop { background: rgba(3, 14, 22, 0.97); }
.pv-dialog [hidden] { display: none !important; }
html.pv-open { overflow: hidden; }

.pv-top { position: absolute; z-index: 3; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: linear-gradient(180deg, rgba(3, 14, 22, 0.96), rgba(3, 14, 22, 0)); }
.pv-title { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.05rem; font-weight: 700; }
.pv-count { margin-left: auto; font-size: 0.9rem; font-weight: 600; color: rgba(255, 255, 255, 0.85); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pv-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 48px; height: 48px; padding: 0 14px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.12); color: #fff; font: inherit; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: background-color 0.15s ease; }
.pv-btn:hover { background: rgba(255, 255, 255, 0.26); }
.pv-btn:disabled { opacity: 0.35; cursor: default; }
.pv-btn:focus-visible, .pv-thumb:focus-visible { outline: 3px solid var(--accent, #94d2bd); outline-offset: 2px; }
.pv-close { padding: 0; width: 48px; }
.pv-back { margin-right: auto; }

.pv-grid { position: absolute; inset: 0; padding: 72px 16px 24px; overflow-y: auto; overscroll-behavior: contain; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: max-content; gap: 10px; }
.pv-thumb { display: block; align-self: start; width: 100%; height: auto; padding: 0; border: 0; border-radius: 10px; overflow: hidden; background: rgba(255, 255, 255, 0.08); aspect-ratio: var(--pv-thumb-ratio, 4 / 3); cursor: pointer; transition: transform 0.2s ease, box-shadow 0.2s ease; }
.pv-thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pv-thumb:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45); }

.pv-stage { position: absolute; inset: 0; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 68px 10px 20px; }
.pv-nav { width: 48px; padding: 0; }
.pv-fig { margin: 0; min-width: 0; min-height: 0; height: 100%; display: flex; align-items: center; justify-content: center; touch-action: pan-y; }
.pv-fig img { flex: 0 1 auto; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; border-radius: 8px; user-select: none; -webkit-user-drag: none; }

@media (min-width: 640px) { .pv-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; padding: 76px 28px 28px; } }
@media (min-width: 1000px) { .pv-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); padding-inline: 48px; } .pv-stage { padding-inline: 24px; gap: 16px; } }
@media (max-width: 560px) {
    .pv-back span { display: none; }
    .pv-back { padding: 0; width: 48px; }
    /* one photo with the previous / next buttons centered under it (thumb-reachable) */
    .pv-stage { grid-template-areas: "fig fig" "prev next"; grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) auto; padding: 64px 8px 14px; gap: 10px 0; }
    .pv-fig { grid-area: fig; }
    .pv-prev { grid-area: prev; justify-self: end; margin-right: 6px; }
    .pv-next { grid-area: next; justify-self: start; margin-left: 6px; }
}
@media (prefers-reduced-motion: reduce) { .pv-thumb, .pv-btn { transition: none; } .pv-thumb:hover { transform: none; } }
