.project-gallery {
  margin-top: 24px;
  padding-top: 21px;
  border-top: 1px solid var(--line);
}

.project-gallery header { margin-bottom: 14px; }
.project-gallery h4 { margin: 0; color: var(--ink); font-size: 18px; font-weight: 600; }
.project-gallery header p { font-size: 15px; }

.project-gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.project-gallery-grid-single { grid-template-columns: minmax(0, 450px); }

.project-shot {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0e1c17;
  color: var(--ink);
}

.project-shot img {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #14231d;
}

.project-shot-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding: 10px 13px;
  font-size: 15px;
  line-height: 1.5;
}

.project-shot-label > span:last-child { color: var(--accent); }
.project-shot:hover, .project-shot:focus-visible { border-color: var(--accent); }

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

.project-viewer {
  width: min(1180px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  margin: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: #102019;
  color: var(--ink);
  box-shadow: 0 24px 80px #0008;
}

.project-viewer[open] {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.project-viewer::backdrop { background: #030b08e8; }

.viewer-header, .viewer-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
}

.viewer-header { border-bottom: 1px solid var(--line); }
.viewer-header p { flex: 1; min-width: 0; font-size: 15px; line-height: 1.35; }
.viewer-footer { border-top: 1px solid var(--line); }

.viewer-control {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  font-size: 23px;
  line-height: 1;
}

.viewer-control[hidden] { display: none; }
.viewer-control:hover, .viewer-control[aria-pressed="true"] { background: #223830; border-color: var(--accent); }
.viewer-control:focus-visible { outline-offset: 2px; }
.viewer-status { flex: 1; min-width: 0; text-align: center; }
.viewer-caption { font-size: 16px; line-height: 1.35; }
.viewer-count { display: block; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.viewer-count[hidden] { display: none; }

.viewer-stage {
  min-width: 0;
  min-height: 0;
  max-height: min(72dvh, 760px);
  display: grid;
  place-items: center;
  overflow: auto;
  overscroll-behavior: contain;
  background: #080f0c;
}

.viewer-stage img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: min(72dvh, 760px);
  object-fit: contain;
}

.viewer-stage.zoomed {
  display: block;
  height: min(72dvh, 760px);
}

.viewer-stage.zoomed img {
  width: max(100%, var(--source-width));
  height: auto;
  max-width: none;
  max-height: none;
}

@media (max-width: 600px) {
  .project-gallery-grid { grid-template-columns: minmax(0, 1fr); }
  .viewer-header, .viewer-footer { gap: 8px; padding-inline: 10px; }
}

@media (max-height: 500px) {
  .viewer-stage, .viewer-stage img { max-height: calc(100dvh - 156px); }
}

@media print {
  .project-viewer[open] { display: none; }
}
