/* One full-width capture per slide; the original pixels remain available in the viewer. */
.screenshot-gallery { margin-top: 2.25rem; min-width: 0; scroll-margin-top: 88px; }
.gallery-toolbar:not([hidden]) { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.gallery-toolbar b { display: block; font-size: 1.2rem; letter-spacing: -.02em; }
.gallery-toolbar p { margin: .25rem 0 0; color: var(--ink-dim); font-size: .95rem; }
.gallery-arrows { display: flex; align-items: center; gap: .75rem; flex-shrink: 0; }
.gallery-arrows > span { min-width: 3.5rem; text-align: center; color: var(--ink-dim); font: 600 .875rem var(--font-mono); }
.gallery-button { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-width: 48px; min-height: 48px; padding: .55rem .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--ink); font: 600 1rem var(--font-body); cursor: pointer; touch-action: manipulation; transition: background .2s, border-color .2s; }
.gallery-arrows .gallery-button { border-radius: 50%; font-size: 1.4rem; }
.gallery-button:hover:not(:disabled) { border-color: var(--accent); background: var(--panel); }
.gallery-button:disabled { opacity: .4; cursor: default; }
.gallery-track { display: grid; gap: 1.25rem; border-radius: 18px; }
.screenshot-gallery.is-ready .gallery-track { display: flex; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; }
.screenshot-gallery.is-ready .gallery-track::-webkit-scrollbar { display: none; }
.screenshot-gallery .gallery-slide { flex: 0 0 100%; width: 100%; min-width: 0; scroll-snap-align: start; scroll-snap-stop: always; box-shadow: none; }
.gallery-track:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.gallery-open { display: block; color: var(--ink); text-decoration: none; cursor: zoom-in; -webkit-user-drag: none; }
.gallery-open:focus-visible { outline-offset: -4px; }
.gallery-image-bar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; padding: .8rem 1.2rem; border-bottom: 1px solid var(--line); font-size: .85rem; font-weight: 650; background: var(--panel-2); }
.gallery-image-bar > span:last-child { color: var(--accent); }
.gallery-detail-label { display: none; }
.gallery-image { display: block; overflow: hidden; background: #f7f8fa; aspect-ratio: 1600 / 950; border-bottom: 1px solid var(--line); }
.screenshot-gallery .gallery-image img { display: block; width: 100%; height: auto; max-width: none; aspect-ratio: auto; object-fit: contain; border: 0; }
.screenshot-gallery .gallery-slide figcaption { padding: 1.25rem; }
.screenshot-gallery .gallery-slide figcaption b { font-size: 1.125rem; }
.screenshot-gallery .gallery-slide figcaption p { font-size: 1rem; max-width: 65ch; }
.gallery-picker:not([hidden]) { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin-top: 1rem; }
.gallery-picker button { position: relative; display: flex; align-items: center; gap: .65rem; justify-content: center; min-height: 52px; padding: .6rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-2); color: var(--ink-dim); font: 650 1rem var(--font-body); cursor: pointer; transition: background .2s, color .2s; touch-action: manipulation; }
.gallery-picker button span { font: 500 .75rem var(--font-mono); }
.gallery-picker button[aria-pressed="true"] { background: #6252d9; color: #fff; border-color: #6252d9; box-shadow: 0 5px 18px color-mix(in srgb, var(--accent) 22%, transparent); }
.gallery-disclosure { margin: 1rem 0 0; color: var(--ink-dim); font-size: .85rem; }
.gallery-track.is-dragging { scroll-snap-type: none !important; cursor: grabbing; user-select: none; }
.gallery-track.is-dragging .gallery-open { cursor: grabbing; }

/* Native dialog provides focus containment and Escape-to-close. */
.screenshot-viewer { padding: 0; width: calc(100% - 2rem); max-width: 1800px; height: calc(100dvh - 2rem); max-height: none; margin: auto; border: 1px solid var(--line); border-radius: 20px; background: var(--panel-2); color: var(--ink); box-shadow: 0 24px 100px #0007; overflow: hidden; }
.screenshot-viewer[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.screenshot-viewer::backdrop { background: #080b18bf; backdrop-filter: blur(8px); }
body.screenshot-viewer-open { overflow: hidden; }
.viewer-header { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: .6rem 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.viewer-header h2 { margin: 0; font: 750 clamp(1.1rem, 2vw, 1.5rem)/1.3 var(--font-body); letter-spacing: -.025em; }
.viewer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; grid-column: 1 / -1; }
.viewer-tools .viewer-percent { font: 600 .875rem var(--font-mono); min-width: 3.4rem; text-align: center; }
.viewer-hint { color: var(--ink-dim); font-size: .85rem; margin-left: auto; }
.viewer-stage { min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; background: #e4e7ed; cursor: grab; touch-action: pan-x pan-y pinch-zoom; }
.viewer-stage:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.viewer-stage.is-dragging { cursor: grabbing; user-select: none; }
.viewer-canvas { display: grid; place-items: center; min-width: 100%; min-height: 100%; width: max-content; }
.viewer-canvas img { display: block; max-width: none; height: auto; user-select: none; -webkit-user-drag: none; }
.viewer-footer { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1.25rem; border-top: 1px solid var(--line); }
.viewer-status { text-align: center; color: var(--ink-dim); font-size: .875rem; }
.viewer-loading { opacity: .3; }
@media (max-width: 900px) {
  .gallery-image { height: 360px; aspect-ratio: auto; }
  .screenshot-gallery .gallery-image img { width: 1600px; height: auto; transform: translate(var(--detail-x), var(--detail-y)); }
  .gallery-preview-label { display: none; }
  .gallery-detail-label { display: inline; }
}
@media (max-width: 600px) {
  .gallery-toolbar:not([hidden]) { gap: .85rem; }
  .gallery-arrows { width: 100%; justify-content: space-between; }
  .gallery-image { height: 320px; aspect-ratio: auto; }
  .gallery-image-bar { padding: .8rem; font-size: .8rem; }
  .screenshot-gallery .gallery-slide figcaption { padding: 1rem; gap: .65rem; }
  .gallery-picker:not([hidden]) { gap: .5rem; }
  .gallery-picker button { flex-direction: column; gap: .2rem; font-size: .85rem; min-height: 64px; }
  .screenshot-viewer { width: 100%; height: 100dvh; max-width: 100%; border: 0; border-radius: 0; }
  .viewer-header { padding: max(.75rem, env(safe-area-inset-top)) .75rem .75rem; }
  .viewer-footer { padding: .75rem .75rem max(.75rem, env(safe-area-inset-bottom)); }
  .viewer-tools { gap: .35rem; }
  .viewer-tools .gallery-button { min-width: 44px; min-height: 44px; padding: .5rem; font-size: .875rem; }
  .viewer-hint { flex-basis: 100%; margin: .25rem 0 0; }
  .viewer-footer .gallery-button { padding: .5rem .65rem; font-size: .875rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .screenshot-viewer[open] { animation: viewer-enter .2s ease-out; }
  @keyframes viewer-enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
}
