/* All rules are scoped to the viewer; NYFE shared chrome remains the last stylesheet. */
dialog.nyfe-gallery {
  box-sizing: border-box;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  border: 0;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  background: rgb(8 10 13 / 97%);
  color: #f5f5f5;
  font: 16px/1.45 var(--nyfe-font, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);
  overscroll-behavior: contain;
}
dialog.nyfe-gallery::backdrop { background: rgb(8 10 13 / 85%); }
dialog.nyfe-gallery[open] { display: grid; place-items: center; animation: nyfe-gallery-in 120ms ease-out; }
.nyfe-gallery *, .nyfe-gallery *::before, .nyfe-gallery *::after { box-sizing: border-box; }
.nyfe-gallery [hidden] { display: none !important; }
.nyfe-gallery .nyfe-gallery__shell {
  width: min(100%, 1440px);
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
}
.nyfe-gallery .nyfe-gallery__toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.nyfe-gallery .nyfe-gallery__counter { margin: 0; color: var(--nyfe-gold, #ffd700); font-variant-numeric: tabular-nums; letter-spacing: .08em; }
.nyfe-gallery button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  min-height: 48px;
  margin: 0;
  border: 1px solid var(--nyfe-line, #303030);
  border-radius: 10px;
  padding: 8px 16px;
  background: #16191e;
  color: var(--nyfe-gold, #ffd700);
  font: 600 16px/1.2 var(--nyfe-font, sans-serif);
  cursor: pointer;
  touch-action: manipulation;
}
.nyfe-gallery button:hover { border-color: var(--nyfe-gold, #ffd700); background: var(--nyfe-gold-tint, #211d0d); }
.nyfe-gallery button:focus-visible, .nyfe-gallery a:focus-visible { outline: 3px solid var(--nyfe-gold, #ffd700); outline-offset: 4px; }
.nyfe-gallery .nyfe-gallery__body { display: grid; grid-template-columns: 56px minmax(0, 1fr) 56px; gap: 20px; min-height: 0; align-items: center; }
.nyfe-gallery .nyfe-gallery__nav { width: 56px; height: 56px; padding: 0; border-radius: 50%; font-size: 28px; }
.nyfe-gallery .nyfe-gallery__figure { grid-column: 2; grid-row: 1; display: grid; grid-template-rows: minmax(0, 1fr) auto; gap: 14px; height: 100%; min-height: 0; margin: 0; }
.nyfe-gallery .nyfe-gallery__previous { grid-column: 1; grid-row: 1; }
.nyfe-gallery .nyfe-gallery__next { grid-column: 3; grid-row: 1; }
.nyfe-gallery .nyfe-gallery__media { display: grid; place-items: center; height: 100%; min-height: 0; touch-action: pan-y pinch-zoom; }
.nyfe-gallery .nyfe-gallery__image { display: block; width: auto; height: auto; min-width: 0; min-height: 0; max-width: 100%; max-height: 100%; object-fit: contain; border: 0; border-radius: 0; user-select: none; }
.nyfe-gallery .nyfe-gallery__caption { max-height: 26dvh; overflow-y: auto; padding: 2px 4px 6px; text-align: center; color: #f5f5f5; font-size: 16px; line-height: 1.5; overflow-wrap: anywhere; }
.nyfe-gallery .photo-credit { color: var(--nyfe-muted, #b8c0cc); font-size: 14px; }
.nyfe-gallery a { color: var(--nyfe-gold, #ffd700); text-decoration: underline; text-underline-offset: 3px; }
.nyfe-gallery .nyfe-gallery__hint { margin: 0; color: var(--nyfe-muted, #b8c0cc); text-align: center; font-size: 13px; }
.nyfe-gallery .nyfe-gallery__status { margin: 0; padding: 24px; max-width: 38em; text-align: center; color: var(--nyfe-muted, #b8c0cc); }
@keyframes nyfe-gallery-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 600px) {
  dialog.nyfe-gallery { padding-inline: max(12px, env(safe-area-inset-left)) max(12px, env(safe-area-inset-right)); }
  .nyfe-gallery .nyfe-gallery__shell { gap: 8px; }
  .nyfe-gallery .nyfe-gallery__body { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) 48px; gap: 10px 16px; }
  .nyfe-gallery .nyfe-gallery__figure { grid-column: 1 / -1; gap: 10px; }
  .nyfe-gallery .nyfe-gallery__nav { width: 48px; height: 48px; font-size: 25px; }
  .nyfe-gallery .nyfe-gallery__previous { grid-column: 1; grid-row: 2; justify-self: end; }
  .nyfe-gallery .nyfe-gallery__next { grid-column: 2; grid-row: 2; justify-self: start; }
  .nyfe-gallery .nyfe-gallery__caption { max-height: 24dvh; font-size: 15px; }
  .nyfe-gallery .nyfe-gallery__hint { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  dialog.nyfe-gallery[open] { animation: none; }
}
