/* The ONE photo viewer — pairs with assets/pt-photo-viewer.js (PHOTO-VIEWER-SPEC
   slice 1, 2026-10-29). Pages load this file and the script with plain tags and
   open the viewer through PTViewer.open(...); a page never builds its own.

   Placement per page is the --pt-viewer-z token (crew.html sets 92); the module
   carries no page placement. The stage's size has ONE owner: this file. Nothing
   in the script measures or sets the picture's box (DO NOT 13).

   Design tokens: declared on .ptv the way site-gallery.css declares them on
   .jv-gal (identical values), so the module renders the same on every page.
   No bare colour outside this block (DO NOT 24). */
.ptv {
  --green-dark: #2c372c;
  --green-deep: #232b23;
  --gold: #b2b17d;
  --gold-deep: #8f8d5f;
  --cream: #f5f0e8;
  --paper: #f4f0e7;
  --card: #fbf9f3;
  --ink: #23291f;
  --ink-soft: #5b6455;
  --rule: rgba(124,122,78,0.26);
  --bad: #c1613f;
  --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --ptv-bg: rgb(20,24,18); /* opaque: nothing behind the viewer shows through (the proposal's countdown bar ghosted through the old 0.96) */
  --ptv-strip: rgba(20,24,18,0.72);
  /* Controls (arrows, close): cream circle, dark-green glyph, a soft shadow so they
     read on the dark stage AND over a pale photo (owner, 2026-10-30: the dark
     translucent circles were hard to see). */
  --ptv-ctl: var(--cream);
  --ptv-ctl-ink: var(--green-dark);
  --ptv-ctl-shadow: 0 2px 10px rgba(0,0,0,0.45);
  --ptv-sat: env(safe-area-inset-top, 0px);
  --ptv-sab: env(safe-area-inset-bottom, 0px);
}

.ptv { display: none; position: fixed; inset: 0; z-index: var(--pt-viewer-z, 97); flex-direction: column; background: var(--ptv-bg); color: var(--cream); font-family: var(--sans); touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overscroll-behavior: contain; }
.ptv.show { display: flex; }
html.ptv-open, html.ptv-open body { overflow: hidden; }

/* Top strip: counter centred, close top-right. */
.ptv-top { position: relative; flex: 0 0 auto; display: flex; align-items: center; justify-content: center; box-sizing: border-box; min-height: calc(52px + var(--ptv-sat)); padding-top: var(--ptv-sat); background: var(--ptv-strip); }
.ptv-count { font-size: 15px; font-weight: 700; letter-spacing: 0.02em; }
.ptv-x { position: absolute; right: 8px; top: calc(var(--ptv-sat) + 4px); width: 44px; height: 44px; padding: 0; border: none; border-radius: 10px; background: var(--ptv-ctl); color: var(--ptv-ctl-ink); box-shadow: var(--ptv-ctl-shadow); font-size: 22px; line-height: 1; font-family: inherit; cursor: pointer; }

/* Stage: the whole area between the strips. The track holds three slides. */
.ptv-stage { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; }
.ptv-track { position: absolute; top: 0; bottom: 0; left: 0; width: 300%; display: flex; transform: translateX(-33.3333%); will-change: transform; }
.ptv-track.ptv-anim { transition: transform 220ms ease-out; }
/* Stable box: the slide is the stage; nothing about the picture's natural size
   reaches layout. The sharpen swap is img.src = full on this same element. */
.ptv-slide { position: relative; flex: 0 0 33.3333%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.ptv-slide img { width: 100%; height: 100%; object-fit: contain; display: block; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ptv-video { width: 100%; max-height: 100%; aspect-ratio: 16 / 9; }
.ptv-video iframe { width: 100%; height: 100%; border: none; display: block; }

.ptv-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 48px; height: 48px; padding: 0; border: none; border-radius: 999px; background: var(--ptv-ctl); color: var(--ptv-ctl-ink); box-shadow: var(--ptv-ctl-shadow); font-size: 30px; line-height: 1; font-family: inherit; cursor: pointer; }
/* Desktop and iPad: bigger arrows (the picture is not swiped there). Phones keep 48px so the buttons cover less of the photo. */
@media (min-width: 700px) { .ptv-arrow { width: 56px; height: 56px; font-size: 34px; } }
.ptv-prev { left: 10px; }
.ptv-next { right: 10px; }
.ptv-arrow:disabled { opacity: 0.25; pointer-events: none; }
.ptv-single .ptv-arrow { display: none; }

/* Bottom strip: caption, optional host panel, optional action buttons. */
.ptv-bottom { flex: 0 0 auto; box-sizing: border-box; padding: 10px 14px calc(10px + var(--ptv-sab)); background: var(--ptv-strip); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.ptv-bottom[hidden] { display: none; }
.ptv-caption { max-width: 960px; font-size: 14px; text-align: center; color: var(--cream); }
.ptv-caption:empty { display: none; }
.ptv-panel { width: 100%; max-width: 960px; max-height: 36vh; overflow-y: auto; touch-action: pan-y; }
.ptv-panel:empty { display: none; }
.ptv-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.ptv-actions:empty { display: none; }
.ptv-btn { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 0 14px; background: var(--card); border: 1px solid var(--rule); border-radius: 999px; font-size: 13px; font-weight: 700; color: var(--ink); font-family: inherit; cursor: pointer; }
.ptv-btn:disabled { opacity: 0.4; }
.ptv-btn-danger { color: var(--bad); border-color: var(--bad); }
.ptv-btn-primary { background: var(--green-dark); color: var(--cream); border-color: var(--green-dark); }
