.gallery-page {
  --gallery-gutter: var(--gutter, 56px);
}
.gallery-wrap {
  width: min(var(--content-width, 1240px), calc(100% - 2 * var(--gallery-gutter)));
  margin-inline: auto;
}
.gallery-intro {
  padding-block: clamp(50px, 7vw, 84px) clamp(32px, 5vw, 56px);
  background: var(--color-surface);
}
.gallery-intro .company-kicker { margin-bottom: 16px; }
.gallery-intro h1 {
  max-width: 16ch;
  color: var(--color-brand-navy);
  font-size: clamp(42px, 6vw, 68px);
}
.gallery-intro > .gallery-wrap > p:last-child {
  max-width: 56ch;
  margin: 18px 0 0;
  color: var(--color-text-muted);
  font-size: 18px;
}
.gallery-content {
  padding-block: 0 clamp(64px, 9vw, 112px);
  background: var(--color-surface);
}
.gallery-closing {
  padding-block: clamp(40px, 6vw, 72px);
  background: var(--color-surface-soft);
}
.gallery-closing p { max-width: 55ch; margin-block: 18px 24px; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: clamp(230px, 28vw, 390px);
  gap: clamp(12px, 1.6vw, 20px);
}
.gallery-photo {
  display: block;
  min-width: 0;
  overflow: hidden;
  background: var(--color-surface-cool);
  outline-offset: 4px;
}
.gallery-photo-wide { grid-column: span 2; }
.gallery-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .32s ease, filter .2s ease;
}
.gallery-photo:hover img { transform: scale(1.018); filter: saturate(1.04); }
.gallery-photo:focus-visible { outline: 3px solid var(--color-focus); }
.gallery-dialog[hidden] { display: none; }
.gallery-dialog {
  position: fixed;
  z-index: 1400;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(12px, 3vw, 36px);
  background: rgb(14 28 45 / 88%);
}
.gallery-dialog-panel {
  display: grid;
  width: min(1200px, 100%);
  max-height: min(94dvh, 1100px);
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  overflow: hidden;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 20px 70px rgb(0 0 0 / 24%);
}
.gallery-dialog-top, .gallery-dialog-bottom {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px clamp(14px, 2vw, 26px);
  background: var(--color-surface);
}
.gallery-dialog-top { border-bottom: 1px solid var(--color-border); }
.gallery-dialog-top h2 {
  margin: 0;
  color: var(--color-brand-navy);
  font: 500 16px/1.4 var(--font-body);
  letter-spacing: 0;
}
.gallery-dialog-count { margin: 0 auto 0 0; color: var(--color-text-muted); font-size: 14px; }
.gallery-control {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid #9ba8b8;
  border-radius: var(--radius-control, 4px);
  background: var(--color-surface);
  color: var(--color-brand-navy);
  font: 500 14px/1.35 var(--font-body);
}
.gallery-control:hover { border-color: var(--color-action); background: var(--color-surface-soft); color: var(--color-action); }
.gallery-control:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 3px; }
.gallery-close span { font-size: 20px; line-height: 1; }
.gallery-dialog-image {
  display: grid;
  min-height: 0;
  place-items: center;
  padding: clamp(10px, 2vw, 24px);
  background: #e7ebf0;
}
.gallery-dialog-image img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: calc(94dvh - 150px);
  object-fit: contain;
}
.gallery-dialog-image img.is-loading,
.gallery-dialog-image img.is-failed { visibility: hidden; }
.gallery-image-error {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px clamp(14px, 2vw, 26px);
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
}
.gallery-image-error p { margin: 0 auto 0 0; color: var(--color-text-muted); font-size: 14px; }
.gallery-image-error a { text-decoration: none; }
.gallery-dialog-bottom { border-top: 1px solid var(--color-border); }
@media (max-width: 760px) {
  .gallery-page { --gallery-gutter: 24px; }
  .gallery-grid { grid-template-columns: 1fr; grid-auto-rows: auto; gap: 12px; }
  .gallery-photo, .gallery-photo-wide { grid-column: auto; aspect-ratio: 3 / 2; }
  .gallery-intro > .gallery-wrap > p:last-child { font-size: 16px; }
  .gallery-page .gallery-dialog, .construction-page .gallery-dialog { padding: 0; }
  .gallery-page .gallery-dialog-panel, .construction-page .gallery-dialog-panel { width: 100%; height: 100dvh; max-height: 100dvh; }
  .gallery-dialog-top { flex-wrap: wrap; }
  .gallery-dialog-image img { max-height: calc(100dvh - 150px); }
}
body.gallery-dialog-open { overflow: hidden; }
@media (prefers-reduced-motion: reduce) {
  .gallery-page *, .gallery-dialog * { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
