/* Opt-in image viewer shared by Home and Portfolio. Native dialog supplies
   modal semantics and makes the background inert while the gallery is open. */
html.gallery-open { overflow: hidden; }
.studio-page .project-gallery {
  position: fixed;
  inset: 0;
  width: min(1280px, calc(100% - 40px));
  max-width: none;
  max-height: calc(100dvh - 40px);
  margin: auto;
  padding: 24px;
  overflow: auto;
  border: 1px solid var(--studio-border);
  border-radius: 22px;
  color: var(--ink);
  background: #081525;
  box-shadow: 0 30px 120px #0009;
}
.project-gallery::backdrop { background: rgba(0, 6, 16, .9); backdrop-filter: blur(8px); }
.gallery-header { display: flex; align-items: start; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.gallery-header h2 { font-size: clamp(1.15rem, 2.5vw, 1.7rem); line-height: 1.2; }
.gallery-header p { margin-top: 7px; font-size: .8rem; color: var(--studio-light); }
.gallery-control {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-width: 48px; min-height: 48px; padding: 10px 16px;
  flex-shrink: 0; border: 1px solid #3b5879; border-radius: 12px;
  color: var(--ink); background: #122840; font: inherit; font-size: .85rem; cursor: pointer;
  transition: background 160ms ease;
}
.gallery-control:hover:not(:disabled) { background: #1c3d61; }
.gallery-control:disabled { opacity: .35; cursor: default; }
.gallery-figure { margin: 0; }
.gallery-viewport { position: relative; display: grid; place-items: center; min-height: 180px; border-radius: 12px; overflow: hidden; background: #040c18; touch-action: pan-y pinch-zoom; }
.gallery-viewport img { display: block; width: 100%; height: auto; max-height: max(220px, calc(100dvh - 275px)); object-fit: contain; }
.gallery-viewport img[hidden] { display: none; }
.gallery-status { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; color: var(--ink-70); text-align: center; pointer-events: none; }
.gallery-figure figcaption { margin-top: 14px; min-height: 2.8em; color: var(--ink-70); font-size: .86rem; line-height: 1.5; }
.gallery-controls { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 16px; }
.gallery-counter { color: var(--studio-light); font-size: .9rem; font-variant-numeric: tabular-nums; letter-spacing: .1em; }
.studio-page [data-gallery] { cursor: zoom-in; }
.studio-page .featured-project-media > a { display: block; height: 100%; }
.studio-page .featured-project-media > a img { width: 100%; height: 100%; object-fit: cover; }
.studio-page .featured-project-media > span { pointer-events: none; }
.studio-page .featured-project-media:focus-within { outline: 3px solid var(--studio-cyan); outline-offset: 4px; }
@media (max-width: 620px) {
  .studio-page .project-gallery { width: calc(100% - 20px); max-height: calc(100dvh - 20px); padding: 16px; border-radius: 16px; }
  .gallery-header { gap: 12px; }
  .gallery-header p { font-size: .72rem; }
  .gallery-control { padding: 10px 13px; }
  .gallery-control-label { display: none; }
  .gallery-figure figcaption { font-size: .8rem; }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-control { transition: none; }
}
