.rail-gallery {
  background: var(--navy);
  color: #fff;
  padding-block: clamp(38px, 5vw, 70px);
}

.rail-gallery-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin-bottom: 26px;
}

.rail-gallery-heading .eyebrow { color: #ffadc5; }
.rail-gallery-heading h2 { font-size: clamp(2rem, 4vw, 3.15rem); }
.rail-gallery-heading > p { color: #d6e4f2; margin: 0; }

.rail-photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-auto-rows: clamp(170px, 16vw, 220px);
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rail-photo-grid li:first-child { grid-area: span 2 / span 2; }
.rail-photo-grid li:nth-last-child(-n+2) { grid-column: span 2; }

.rail-photo {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 9px;
  background: #173953;
  color: #fff;
  text-align: left;
  cursor: zoom-in;
}

.rail-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .35s ease;
}

.rail-photo-grid li:nth-child(3) img { object-position: 50% 33%; }
.rail-photo-grid li:last-child img { object-position: 50% 36%; }
.rail-photo:hover img { transform: scale(1.035); }

.rail-photo-caption {
  position: absolute;
  inset: auto 0 0;
  padding: 30px 14px 12px;
  background: linear-gradient(transparent, #071622ed);
  font-size: .9rem;
  font-weight: 700;
}

.rail-photo-expand {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #071622d9;
  font-size: 1.15rem;
}

.rail-photo-dialog {
  width: min(1120px, calc(100% - 24px));
  padding: clamp(12px, 2vw, 23px);
  background: #071c32;
  color: #fff;
}

.rail-photo-dialog-header,
.rail-photo-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rail-photo-dialog-header h2 { font-size: clamp(1rem, 3vw, 1.3rem); }
.rail-photo-dialog figure { margin: 12px 0 0; }

.rail-photo-full {
  width: 100%;
  height: min(68svh, 66vw);
  object-fit: contain;
  background: #031121;
  border-radius: 6px;
}

.rail-photo-dialog figcaption {
  margin-block: 12px 8px;
  color: #e4ebf2;
  text-align: center;
  font-size: .9rem;
}

.rail-photo-controls { justify-content: center; }
.rail-photo-dialog button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #74889b;
  border-radius: 50%;
  background: #173953;
  color: #fff;
  font-size: 1.4rem;
  line-height: 1;
}

.rail-photo-dialog button:hover { background: #285272; }

@media (max-width: 700px) {
  .rail-gallery-heading { display: block; }
  .rail-gallery-heading > p { margin-top: 8px; }
  .rail-photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: auto;
    gap: 8px;
  }
  .rail-photo-grid li:first-child { grid-area: auto / span 2; }
  .rail-photo-grid li:nth-last-child(-n+2) { grid-column: auto; }
  .rail-photo { aspect-ratio: 1.25; }
  .rail-photo-grid li:first-child .rail-photo { aspect-ratio: 1.6; }
  .rail-photo-caption { padding: 25px 10px 8px; font-size: .8rem; }
}

@media (prefers-reduced-motion: reduce) {
  .rail-photo img { transition: none; }
}
