/* The file page (pages/file.html.twig). */

/* File viewer */
.stage-img { position: relative; flex: 1; display: flex; align-items: center; justify-content: center; padding: 8px 72px; min-height: 520px; }
.stage-img .pic { width: 100%; max-width: 980px; aspect-ratio: 4 / 3; border-radius: var(--ld-radius-sm); box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: ld-unblur .3s ease-out both; }
.stage-img.is-large .pic { max-width: none; aspect-ratio: auto; height: 100%; min-height: 640px; }
.filmstrip { display: flex; gap: 6px; padding: 12px 16px 16px; overflow-x: auto; scrollbar-width: thin; }
.filmstrip a { position: relative; flex: none; width: 64px; height: 64px; border-radius: var(--ld-radius-sm); overflow: hidden; opacity: .55; transition: opacity var(--ld-ease), transform var(--ld-ease); }
.filmstrip a:hover { opacity: 1; transform: translateY(-2px); }
.filmstrip a[aria-current="true"] { opacity: 1; box-shadow: 0 0 0 2px var(--ld-green); }
.filmstrip a span { position: absolute; inset: 0; }

/* Password gate */
@media (max-width: 760px) {
  .stage-img { padding: 0; min-height: 0; }
  .stage-img .pic { border-radius: 0; }
  .filmstrip { display: none !important; }
}

/* Listing viewer: strips above and below, the picture fitted between them; nothing overlaps it */
.stage-view { position: relative; display: flex; flex-direction: column; }
.stage-arrows { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.stage-arrow { position: absolute; top: 0; bottom: 0; width: 88px; display: block; cursor: pointer; pointer-events: auto; }
.stage-arrow.is-prev { left: 0; } .stage-arrow.is-next { right: 0; }
/* Beside a video the arrows keep clear of the player's bar along its bottom. */
.stage-view:has(.pic-box.is-video) .stage-arrow { bottom: 88px; }
.stage-arrow .lv3-arrow { pointer-events: none; }
.stage-arrow.is-prev .lv3-arrow { left: 16px; } .stage-arrow.is-next .lv3-arrow { right: 16px; }
.stage-arrow:hover .lv3-arrow { background: rgba(11,13,16,.85); border-color: rgba(255,255,255,.3); }
.stage-arrow:focus-visible { outline: none; } .stage-arrow:focus-visible .lv3-arrow { background: rgba(11,13,16,.85); outline: 2px solid var(--ld-green); outline-offset: 2px; }
.stage-arrow:active .lv3-arrow { transform: translateY(-50%) scale(.92); }
.viewer.is-large .stage-arrow { width: 72px; }
@media (max-width: 760px) { .stage-arrow { width: 56px; } .stage-arrow.is-prev .lv3-arrow { left: 8px; } .stage-arrow.is-next .lv3-arrow { right: 8px; } }

/* On a computer the picture has the height below the site header: the stage's bar floats over it
   on a soft shade and fades after a pause with the arrows (data-idle, viewer/idle.ts). Phones keep the bar above. */
@media (min-width: 761px) {
  .stage[data-idle] .stage-img, .stage[data-idle] .stage-arrow { cursor: none; }
}
.stage-img { padding: 8px 24px; flex: none; height: calc(var(--stage-h) + 16px); min-height: 0; overflow: hidden; touch-action: pan-y; }
.stage-img .pic-box { position: relative; flex: none; margin: auto; width: min(100%, var(--w), calc(var(--stage-h) * var(--wr))); aspect-ratio: var(--ar); border-radius: var(--ld-radius-sm); background: var(--ld-surface-2); box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.stage-img .pic-media { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.stage-img .pic-full { opacity: 0; transition: opacity .2s ease-out; }
.stage-img .pic-box.is-full .pic-full { opacity: 1; }
.viewer.is-large .stage-img { overflow: auto; overscroll-behavior: contain; scrollbar-width: none; touch-action: pan-x pan-y; }
.viewer.is-large .stage-img::-webkit-scrollbar { display: none; }
.viewer.is-large .stage-img.can-pan { cursor: grab; }
.viewer.is-large .stage-img.is-panning { cursor: grabbing; }
.viewer.is-large .stage-img .pic-box { border-radius: 0; box-shadow: none; }
/* An NSFW file held back for this viewer: its note in the stage, no picture until Show (FileNsfw); on phones clear of
   the arrows over the stage's sides. */
.stage-withheld { margin: auto; width: min(100%, 560px); }
@media (max-width: 760px) { .stage-withheld { padding: 12px 56px; } }
.stage-top .zoomseg { margin: 0 4px; }
.stage-img .pic-box { transition: transform .2s ease-out, opacity .2s ease-out; }
.stage-img.is-in-next .pic-box, .stage-img.is-in-prev .pic-box { transition: none; opacity: 0; transform: translateX(40%); }
.stage-img.is-in-prev .pic-box { transform: translateX(-40%); }
.stage-below { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 12px; padding: 4px 16px; }
.stage-note { margin: 0; text-align: center; }
.filmstrip img { display: block; width: 100%; height: 100%; object-fit: cover; }
.filmstrip a[aria-current="page"] { opacity: 1; box-shadow: 0 0 0 2px var(--ld-green); }
.filmstrip-more { display: inline-flex !important; align-items: center; justify-content: center; width: auto !important; padding: 0 14px; opacity: 1 !important; color: var(--ld-text-muted); font: 600 12px/16px var(--font-sans); border: 1px solid var(--ld-line); }

/* Requested: waiting for the member's answer; hover offers to take the request back. */
@media (max-width: 760px) {
  .stage-img { padding: 0; height: auto; touch-action: pan-y pinch-zoom; }
  .stage-img .pic-box { width: min(100%, var(--w), calc(var(--stage-h) * var(--wr))); border-radius: 0; box-shadow: none; }
}
.stage-img.is-removing .pic-media { animation: ld-tile-out 420ms ease-in both; }
.stage-pos { margin-left: 4px; white-space: nowrap; }
@media (prefers-reduced-motion: reduce) {
  .stage-img .pic-full { transition: none; }
}

/* The file page: one framed block under the site header, the same grid */
.page-file .viewer.ld-fd { --stage-h: calc(var(--fd-h) - 64px); }
.page-file .viewer.ld-fd:has(.filmstrip) { --stage-h: calc(var(--fd-h) - 64px - 92px); }
.page-file .viewer.ld-fd:has(.stage-below) { --stage-h: calc(var(--fd-h) - 64px - 44px); }
.page-file .viewer.ld-fd:has(.filmstrip):has(.stage-below) { --stage-h: calc(var(--fd-h) - 64px - 136px); }
/* Room above the picture for the Fit/Large bar; only a hair below it */
.viewer.ld-fd .stage-img { padding: 56px 72px 8px; height: calc(var(--stage-h) + 64px); }
.viewer.ld-fd.is-large .stage-img { padding: 0; }
.viewer.ld-fd .stage-img .pic-box { border-radius: 4px; box-shadow: none; }
.viewer.ld-fd .filmstrip { flex: none; }
@media (max-width: 760px) {
  .page-file .viewer.ld-fd, .page-file .viewer.ld-fd:has(.filmstrip), .page-file .viewer.ld-fd:has(.stage-below), .page-file .viewer.ld-fd:has(.filmstrip):has(.stage-below) { --stage-h: 125vw; }
  .viewer.ld-fd .stage-img { padding: 0; height: auto; aspect-ratio: 4 / 5; }
  .viewer.ld-fd .stage-img .pic-box { border-radius: 0; }
}
