/* Full width parent required: each heading uses the existing .container geometry. */
.project-rails {
  --rail-image-height: 400px;
  --rail-start: max(var(--gutter, 24px), calc((100% - var(--max, 1248px)) / 2));
  width: 100%;
  min-width: 0;
  color: #20262a;
  background: #fff;
}
.project-rail + .project-rail { margin-top: 42px; }
.project-rails .project-rail-heading {
  display: block;
  margin-bottom: 22px;
}
.project-rails .project-rail-heading > div:first-child { min-width: 0; }
.project-rails h3 {
  margin: 0;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -.02em;
  color: #20262a;
}
.project-rails .project-rail-intro {
  margin: 8px 0 0;
  max-width: 690px;
  font-size: 16px;
  line-height: 1.6;
  color: #353a3e;
}
.project-rail-stage { position: relative; width: 100%; min-width: 0; }
.project-rail-controls {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}
.project-rail-controls[hidden] { display: none; }
.project-rail-arrow {
  display: grid;
  place-items: center;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 50px;
  height: 50px;
  padding: 0;
  border: 1px solid #aab3b9;
  border-radius: 2px;
  background: #fff;
  color: #20262a;
  cursor: pointer;
  pointer-events: auto;
}
.project-rail-prev { left: calc(var(--rail-start) + 14px); }
.project-rail-next { right: var(--gutter, 24px); }
.project-rail-arrow .icon { width: 18px; height: 18px; fill: currentColor; stroke: none; }
.project-rail-prev .icon { transform: rotate(180deg); }
.project-rail-arrow:hover:not(:disabled) { border-color: #20262a; background: #f1f3f4; }
.project-rail-arrow:disabled { color: #939da4; border-color: #d5dade; cursor: default; }
.project-rail-arrow:focus-visible { outline: 2px solid #20262a; outline-offset: 3px; }
.project-rail-track {
  display: flex;
  align-items: center;
  gap: 22px;
  width: calc(100% - var(--rail-start));
  margin-left: var(--rail-start);
  min-width: 0;
  box-sizing: border-box;
  padding: 0 var(--gutter, 24px) 0 0;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  /* Keep the released position exact; only explicit arrow/key actions animate. */
  scroll-snap-type: none;
  scroll-behavior: auto;
  scroll-padding-left: 0;
  scrollbar-width: none;
}
.project-rail-track::-webkit-scrollbar { display: none; width: 0; height: 0; }
.project-rail-track:focus:not(:focus-visible),
.project-rails .project-rail-photo:focus:not(:focus-visible),
.project-rail-arrow:focus:not(:focus-visible) { outline: none; }
.project-rail-track:focus-visible { outline: 2px solid #20262a; outline-offset: -2px; }
.project-rail-card {
  flex: 0 0 auto;
  width: calc(var(--rail-image-height) * var(--rail-photo-ratio, 1));
  min-width: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid #d5dade;
  border-radius: 2px;
  background: #fff;
  overflow: hidden;
}
.project-rails .project-rail-photo {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #f1f3f4;
  cursor: pointer;
}
.project-rails .project-rail-photo img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--rail-photo-ratio, 1);
  object-fit: cover;
  object-position: 50% 50%;
  transform: none;
  transition: none;
}
.project-rails .project-rail-photo:hover img { transform: none; }
.project-rails .project-rail-photo:focus-visible { outline: 2px solid #20262a; outline-offset: -3px; }
/* Positions verified against the existing source photographs, not inferred locations. */
.project-rails .project-rail-photo .rail-image-uziemienie-podstawa-slupa { object-position: 50% 60%; }
.project-rails .project-rail-photo .rail-image-szafa-zasilajaca { object-position: 50% 60%; }
.project-rails .project-rail-photo .rail-image-szafa-wejscie-przewodow { object-position: 50% 60%; }
.project-rails .project-rail-photo .rail-image-rozdzielnica-zabezpieczenia { object-position: 50% 57%; }
.project-rails .project-rail-photo .rail-image-odgromowa-przewod-elewacja { object-position: 50% 0%; }
.project-rails .project-rail-photo .rail-image-odgromowa-uchwyty-dom { object-position: 50% 35%; }
.project-rails .project-rail-card figcaption {
  margin: 0;
  padding: 13px 15px 15px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
  color: #20262a;
}
.project-rail-track.is-dragging {
  cursor: grabbing;
  user-select: none;
}
.project-rail-track.is-dragging .project-rail-photo { cursor: grabbing; }
@media (max-width: 690px) {
  .project-rails { --rail-image-height: 360px; }
  .project-rail-card { max-width: min(84vw, 360px); }
  .project-rail + .project-rail { margin-top: 32px; }
  .project-rails .project-rail-heading { margin-bottom: 18px; }
  .project-rails h3 { font-size: 26px; }
  .project-rails .project-rail-intro { font-size: 15px; }
  .project-rail-arrow { width: 48px; height: 48px; }
  .project-rail-track { gap: 16px; }
  .project-rails .project-rail-card figcaption { padding: 12px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .project-rail-track { scroll-behavior: auto; }
}
