/* The image remains inside its original gallery tile and keeps its hover treatment. */
.dc-page .gal > .project-gallery-trigger {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: inherit;
  overflow: hidden;
  appearance: none;
  background: transparent;
  color: inherit;
  line-height: 0;
  cursor: zoom-in;
}
.dc-page .gal > .project-gallery-trigger:focus-visible {
  outline: 3px solid var(--orange, #f28519);
  outline-offset: -5px;
}
.dc-page .gal.project-gallery-item > figcaption { pointer-events: none; }
.dc-page .gal.project-gallery-item:focus-within > figcaption {
  opacity: 1;
  transform: none;
}
body.project-gallery-open { overflow: hidden; }

.project-gallery-lightbox {
  box-sizing: border-box;
  width: min(1440px, calc(100vw - 32px));
  height: calc(100vh - 32px);
  height: calc(100dvh - 32px);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  border-radius: 16px;
  overflow: hidden;
  background: var(--navy, #031a30);
  color: var(--paper, #f7f1eb);
  font-family: inherit;
}
.project-gallery-lightbox::backdrop { background: #031a30d9; }
.project-gallery-lightbox [hidden] { display: none; }
.project-gallery-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  min-height: 0;
}
.project-gallery-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 12px 16px;
}
.project-gallery-lightbox .project-gallery-control {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  margin: 0;
  padding: 12px;
  border: 0;
  border-radius: 50%;
  background: var(--paper, #f7f1eb);
  color: var(--navy, #031a30);
  cursor: pointer;
  transition: background-color .18s ease;
}
.project-gallery-lightbox .project-gallery-control[hidden] { display: none; }
.project-gallery-lightbox .project-gallery-control:hover { background: var(--orange, #f28519); }
.project-gallery-lightbox .project-gallery-control:focus-visible {
  outline: 3px solid var(--orange, #f28519);
  outline-offset: 4px;
}
.project-gallery-control svg {
  display: block;
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.project-gallery-stage {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 16px;
  min-height: 0;
  padding: 0 16px;
}
.project-gallery-image-frame {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  min-height: 0;
  height: 100%;
}
.project-gallery-lightbox .project-gallery-image {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: contain;
}
.project-gallery-previous { grid-column: 1; grid-row: 1; }
.project-gallery-next { grid-column: 3; grid-row: 1; }
.project-gallery-single .project-gallery-stage { grid-template-columns: minmax(0, 1fr); }
.project-gallery-single .project-gallery-image-frame { grid-column: 1; }
.project-gallery-lightbox .project-gallery-caption {
  max-width: 75ch;
  margin: 0 auto;
  padding: 20px 24px;
  color: inherit;
  font-size: var(--type-body, 16px);
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
}
@media (max-width: 640px) {
  .project-gallery-lightbox {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }
  .project-gallery-toolbar { padding: max(12px, env(safe-area-inset-top)) 16px 12px; }
  .project-gallery-stage {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 16px;
    padding: 0 12px;
  }
  .project-gallery-image-frame { grid-column: 1 / -1; }
  .project-gallery-previous { grid-column: 1; grid-row: 2; justify-self: end; }
  .project-gallery-next { grid-column: 2; grid-row: 2; justify-self: start; }
  .project-gallery-single .project-gallery-stage { grid-template-rows: minmax(0, 1fr); }
  .project-gallery-lightbox .project-gallery-caption {
    padding: 16px 20px max(20px, env(safe-area-inset-bottom));
  }
}
@media (prefers-reduced-motion: reduce) {
  .project-gallery-lightbox .project-gallery-control { transition: none; }
}

html:has(.project-gallery-lightbox[open]) { overflow: hidden; }
