/* Festgelegte Projektgalerie 1: neue quadratische Ergebnisbilder, bestehende FLINK-Form. */
#reference-world > .subpage-shell {
  width: min(calc(100% - 48px), 1400px);
  padding: 125px 0;
}

#reference-world .reference-world-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 22px;
}

#reference-world .subpage-reference-card {
  display: flex;
  grid-column: span 2;
  flex-direction: column;
  background: #fff;
  clip-path: polygon(0 0, calc(100% - 16px) 0, 100% 16px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
}

#reference-world .subpage-reference-card:nth-child(13) {
  grid-column: 2 / span 2;
}

#reference-world .subpage-reference-card figure {
  flex: 0 0 auto;
  aspect-ratio: 1;
}

#reference-world .subpage-reference-card figure a {
  display: block;
  height: 100%;
  overflow: hidden;
}

#reference-world .subpage-reference-card figure img {
  display: block;
  transition: transform .45s cubic-bezier(.2, .7, .2, 1);
}

#reference-world .subpage-reference-card figure a:is(:hover, :focus-visible) img {
  transform: scale(1.025);
}

#reference-world .subpage-reference-card figure a:focus-visible {
  outline: 4px solid #c6e300;
  outline-offset: -4px;
}

#reference-world .subpage-reference-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 28px;
}

#reference-world .subpage-reference-copy > span {
  color: #007f8a;
  letter-spacing: .5px;
}

#reference-world .subpage-reference-copy h3 {
  margin: 12px 0;
  line-height: 1.25;
}

#reference-world .subpage-reference-copy p {
  margin: 0 0 24px;
  color: #435159;
  line-height: 1.5;
}

#reference-world .reference-project-open {
  align-self: flex-start;
  margin-top: auto;
  font-size: 16px;
}

.reference-project-fallback {
  display: inline-block;
  margin-top: 14px;
  color: #007f8a;
  text-decoration: underline;
}

html.has-reference-gallery {
  overflow: hidden;
}

.reference-gallery {
  width: min(1160px, calc(100% - 40px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  color: #fff;
  background: #242d33;
  border: 1px solid #4a565d;
  box-shadow: 0 24px 90px rgba(0, 0, 0, .4);
}

.reference-gallery::backdrop {
  background: rgba(12, 17, 21, .84);
  backdrop-filter: blur(5px);
}

.reference-gallery[open] {
  animation: flinkGalleryIn .25s ease-out;
}

.reference-gallery-header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: space-between;
  padding: 28px 32px;
  background: #242d33;
  border-bottom: 1px solid #46545b;
}

.reference-gallery-header h2 {
  margin: 0 0 10px;
  color: #c6e300;
  font-size: 28px;
  line-height: 1.2;
}

.reference-gallery-header p {
  margin: 0;
  color: #d0dade;
  font-size: 18px;
}

.reference-gallery-header form {
  flex: 0 0 auto;
  margin: 0;
}

.reference-gallery .button {
  font-size: 16px;
}

.reference-gallery-body {
  padding: 28px 32px 32px;
}

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

.reference-gallery-images figure {
  min-width: 0;
  margin: 0;
}

.reference-gallery-images img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  background: #1e252b;
}

.reference-gallery-images figcaption {
  margin-top: 10px;
  color: #c1ced3;
  font-size: 14px;
}

.reference-gallery-summary {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 30px;
}

.reference-gallery-summary p,
.reference-gallery-summary li,
.reference-gallery-action p {
  margin: 0;
  color: #d3dce0;
  font-size: 18px;
  line-height: 1.65;
}

.reference-gallery-summary ul {
  margin: 0;
  padding-left: 22px;
}

.reference-gallery-summary li + li {
  margin-top: 7px;
}

.reference-gallery-summary li::marker {
  color: #00b7c7;
}

.reference-gallery-action {
  display: flex;
  gap: 28px;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
  padding-top: 24px;
  border-top: 1px solid #46545b;
}

.reference-gallery-action .button {
  flex: 0 0 auto;
}

@keyframes flinkGalleryIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1100px) {
  #reference-world .reference-world-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #reference-world .subpage-reference-card,
  #reference-world .subpage-reference-card:nth-child(13) { grid-column: auto; }
}

@media (max-width: 900px) {
  #reference-world .reference-world-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  #reference-world .subpage-reference-card,
  #reference-world .subpage-reference-card:nth-child(13) { grid-column: span 2; }
  #reference-world .subpage-reference-card:last-child { grid-column: 2 / span 2; }
  .reference-gallery-summary { grid-template-columns: 1fr; gap: 22px; }
  .reference-gallery-action { align-items: flex-start; flex-direction: column; }
}

@media (max-width: 680px) {
  #reference-world > .subpage-shell { width: calc(100% - 28px); }
  #reference-world .subpage-title,
  #reference-world .subpage-copy { text-align: center; }
  #reference-world .reference-world-grid { grid-template-columns: 1fr; gap: 20px; }
  #reference-world .subpage-reference-card,
  #reference-world .subpage-reference-card:nth-child(13),
  #reference-world .subpage-reference-card:last-child { grid-column: auto; }
  #reference-world .subpage-reference-copy { padding: 24px; }
  #reference-world .reference-project-open { width: 100%; min-height: 56px; font-size: 18px; }
  .reference-gallery { width: calc(100% - 20px); max-height: calc(100dvh - 20px); }
  .reference-gallery-header { gap: 18px; align-items: flex-start; padding: 20px; }
  .reference-gallery-header h2 { font-size: 21px; }
  .reference-gallery-header p { font-size: 16px; }
  .reference-gallery-header .reference-gallery-close { min-height: 40px; padding: 10px 12px; font-size: 14px; }
  .reference-gallery-body { padding: 20px; }
  .reference-gallery-images { grid-template-columns: 1fr; gap: 24px; }
  .reference-gallery-action { text-align: center; }
  .reference-gallery-action .button { width: 100%; min-height: 56px; font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .reference-gallery[open] { animation: none; }
  #reference-world .subpage-reference-card figure img { transition: none; }
}
