:root {
  --project-image-width: 1280px;
  color-scheme: dark;
  background: #272727;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
  background: #272727;
}

body {
  overflow-x: hidden;
}

.project-gallery {
  display: grid;
  width: min(var(--project-image-width), calc(100vw - 40px));
  margin-inline: auto;
  padding-block: 20px;
  gap: 20px;
}

.project-gallery__image {
  display: block;
  width: 100%;
  height: auto;
  background: #202020;
}

.project-gallery__error {
  margin: 0;
  padding: 40px;
  color: #fff;
  font: 500 18px/1.5 sans-serif;
  text-align: center;
}

/* "← Back" button copied from the apply-form modal's back button; pinned
   top-left with its right edge 40px left of the image stream. The
   translateX(-100%) trick makes the gap independent of the button width. */
.project-back {
  position: fixed;
  top: 20px;
  left: calc(50% - min(var(--project-image-width), 100vw - 40px) / 2 - 40px);
  transform: translateX(-100%);
  z-index: 30;
  padding: 18px 40px;
  border-radius: 4px;
  /* Dark-theme variant: translucent panel + light text so the control sits
     quietly on the #272727 gallery background instead of a light chip. */
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.72);
  font: 500 16px/1.2 system-ui, -apple-system, "Segoe UI", sans-serif;
  text-decoration: none;
  white-space: nowrap;
  transition: background 200ms ease, color 200ms ease, border-color 200ms ease;
}

.project-back:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.32);
  color: #fff;
}

@media (min-width: 3200px) {
  :root {
    --project-image-width: 1440px;
  }
}

@media (max-width: 1359px) {
  .project-back {
    left: 16px;
    transform: none;
  }
}

@media (max-width: 767px) {
  .project-gallery {
    width: calc(100vw - 24px);
    padding-block: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .project-gallery__image[data-animated="true"] {
    animation: none;
  }
}
