/* =========================================================
   Vorlage "Gallerie" - Referenzprojekte
   ========================================================= */

.ref-wrap {
  --r-navy: var(--lp-navy);
  --r-navy-dark: var(--lp-navy-dark);
  --r-muted: var(--lp-muted);
  --r-label: var(--lp-label);
  --r-border: var(--lp-border);
  --r-accent: var(--lp-accent);

  padding-top: 1.5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html:has(.ref-wrap) {
    scroll-behavior: smooth;
  }
}

/* Kopfbereich */
.ref-header {
  padding-bottom: clamp(1.5rem, 1rem + 2vw, 2.5rem);
}

.ref-title {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 0;
  font-family: var(--font-heading);
  font-size: clamp(2rem, 1.35rem + 2vw, 3rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--r-navy-dark);
  text-wrap: balance;
}

/* Rote Akzentlinie wie auf den übrigen Unterseiten */
.ref-title::before {
  content: "";
  width: 2.5rem;
  height: 2px;
  background-color: var(--r-accent);
}

.ref-lead {
  max-width: 46rem;
  margin: 1.25rem 0 0;
  font-size: 1.08rem;
  line-height: 1.7;
  color: var(--r-muted);
}

/* Sprungmarken zu den Projektgruppen */
.ref-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.75rem;
}

.ref-jump__link {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  border: 1px solid var(--lp-rule);
  border-radius: var(--lp-radius-ui);
  background-color: #fff;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--r-navy-dark);
  text-decoration: none;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.ref-jump__link:hover {
  border-color: var(--r-navy);
  background-color: var(--r-navy);
  color: #fff;
}

/* Projektgruppen */
.ref-section {
  padding-block: clamp(2.5rem, 1.5rem + 3vw, 4rem);
  border-top: 1px solid var(--r-border);
  scroll-margin-top: 6.5rem;
}

.ref-section__head {
  max-width: 48rem;
  margin-bottom: 1.75rem;
}

.ref-section__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 1.15rem + 1vw, 2.05rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--r-navy-dark);
  text-wrap: balance;
}

.ref-section__text p {
  margin: 0 0 0.75rem;
  line-height: 1.7;
  color: var(--r-muted);
}

.ref-section__text p:empty {
  display: none;
}

.ref-section__text > :last-child {
  margin-bottom: 0;
}

/* Bildraster */
.ref-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ref-grid.is-collapsed .ref-item--extra {
  display: none;
}

.ref-item__link {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: var(--lp-radius);
  background-color: var(--r-border);
}

.ref-item__link:focus-visible {
  outline: 2px solid var(--r-navy);
  outline-offset: 2px;
}

.ref-item__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.2, 0.6, 0.2, 1);
}

@media (hover: hover) {
  .ref-item__link:hover .ref-item__img {
    transform: scale(1.03);
  }
}

.ref-more {
  display: inline-flex;
  align-items: center;
  margin-top: 1.25rem;
  padding: 0.65rem 1.1rem;
  border: 1px solid var(--r-navy);
  border-radius: var(--lp-radius-ui);
  background-color: transparent;
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--r-navy);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.ref-more:hover,
.ref-more:focus-visible {
  background-color: var(--r-navy);
  color: #fff;
}

.ref-more[hidden] {
  display: none;
}

/* Tastaturfokus */
.ref-jump__link:focus-visible,
.ref-more:focus-visible {
  outline: 2px solid var(--r-navy);
  outline-offset: 3px;
}

/* Projekte im Detail: Filter nach Ort und Produkt */
.ref-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1.5rem;
}

.ref-filter[hidden] {
  display: none;
}

.ref-filter__group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ref-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--lp-rule);
  border-radius: var(--lp-radius-ui);
  background-color: #fff;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--r-navy-dark);
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.ref-chip:hover {
  border-color: var(--r-navy);
}

.ref-chip[aria-pressed="true"] {
  border-color: var(--r-navy);
  background-color: var(--r-navy);
  color: #fff;
}

.ref-filter__select select {
  min-width: 15rem;
  padding: 0.45rem 2.25rem 0.45rem 0.9rem;
  border: 1px solid var(--lp-rule);
  border-radius: var(--lp-radius-ui);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%232C3E50' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 0.85rem center / 12px 8px;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--r-navy-dark);
  appearance: none;
  cursor: pointer;
}

.ref-filter__select select:hover {
  border-color: var(--r-navy);
}

.ref-chip:focus-visible,
.ref-filter__select select:focus-visible {
  outline: 2px solid var(--r-navy);
  outline-offset: 3px;
}

.ref-filter__empty {
  margin: 1rem 0 0;
  color: var(--r-muted);
}

.ref-filter__empty[hidden] {
  display: none;
}

/* Kopf mit Link rechts (z. B. "Alle Referenzprojekte") */
.ref-section__head--split {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  max-width: none;
}

.ref-section__head--split .ref-section__title {
  margin-bottom: 0;
}

/* =========================================================
   Einzelnes Referenzprojekt
   ========================================================= */

.ref-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1rem 2rem;
  max-width: 52rem;
  margin: clamp(1.5rem, 1rem + 1.5vw, 2.25rem) 0 0;
  padding-top: 1.25rem;
  border-top: 1px solid var(--r-border);
}

.ref-facts dt {
  margin-bottom: 0.15rem;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--r-label);
}

.ref-facts dd {
  margin: 0;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--r-navy-dark);
}

.ref-single__lead {
  margin: 0;
}

.ref-single__lead-link {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--lp-radius);
  background-color: var(--r-border);
}

.ref-single__lead-link:focus-visible {
  outline: 2px solid var(--r-navy);
  outline-offset: 3px;
}

.ref-single__lead-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Projektseiten: beschreibende H1 ("Allwetter-Schirme für …") ist länger als ein Seitentitel */
.ref-single .ref-title {
  font-size: clamp(1.6rem, 1.2rem + 1.3vw, 2.25rem);
  line-height: 1.2;
}

/* Produkt in den Projektdaten verlinkt auf die Produktseite */
.ref-facts dd a {
  color: var(--r-navy-dark);
  text-decoration: underline;
  text-decoration-color: rgba(44, 62, 80, 0.35);
  text-underline-offset: 3px;
}

.ref-facts dd a:hover {
  color: var(--r-navy);
  text-decoration-color: currentColor;
}

/* Weitere Bilder direkt unter dem Titelbild */
.ref-single__gallery {
  margin-top: 0.75rem;
  padding-bottom: clamp(2.5rem, 1.5rem + 3vw, 4rem);
  scroll-margin-top: 6.5rem;
}

.ref-single__lead + .ref-section {
  margin-top: clamp(2.5rem, 1.5rem + 3vw, 4rem);
}

/* Responsive */
@media (max-width: 991.98px) {
  .ref-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 575.98px) {
  /* Sprungmarken kompakter, damit der Kopf nicht fünf Zeilen hoch wird */
  .ref-jump {
    gap: 0.4rem;
  }

  .ref-jump__link {
    padding: 0.35rem 0.7rem;
    font-size: 0.85rem;
  }

  .ref-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }

  .ref-filter__select,
  .ref-filter__select select {
    width: 100%;
  }

  .ref-single__lead-link {
    aspect-ratio: 4 / 3;
  }
}
