/* ══════════════════════════════════════════════════════════════════
   Referenzen & Vorlagen – Karten, Filter, Live-Vorschau (Overlay),
   Startseiten-Teaser und Hervorhebung im Kontaktformular.
   Genutzt von: referenzen.html, index.html, kontakt.html · Logik: js/referenzen.js
   ══════════════════════════════════════════════════════════════════ */

/* ── Karten-Grid ── */
.ref-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}
@media (max-width: 1000px) { .ref-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px)  { .ref-grid { grid-template-columns: 1fr; } }

.ref-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid rgba(17,17,17,0.1);
  border-radius: 14px;
  overflow: hidden;
  transition: box-shadow 0.25s ease, transform 0.25s ease;
}
.ref-card:hover { box-shadow: 0 14px 34px rgba(17,17,17,0.09); transform: translateY(-2px); }
.ref-card[hidden] { display: none; }
.ref-card__body { display: flex; flex-direction: column; flex: 1; padding: 1.25rem 1.25rem 1.4rem; }
.ref-card__title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #111;
  margin: 0.6rem 0 0.35rem;
}
.ref-card__desc { font-size: 14px; color: rgba(17,17,17,0.62); line-height: 1.6; margin: 0; }
.ref-card__list { list-style: none; margin: 0.9rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.ref-card__list li { display: flex; gap: 0.5rem; align-items: flex-start; font-size: 13.5px; color: #111; line-height: 1.45; }
.ref-card__list svg { flex-shrink: 0; margin-top: 2px; }
.ref-card__actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: auto; padding-top: 1.25rem; }
.ref-card__actions .ref-btn { flex: 1 1 auto; }
.ref-card--project .ref-card__actions .ref-btn { flex: 0 0 auto; }

/* Kundenprojekt: breite Karte, Bild links */
.ref-card--project { flex-direction: row; }
.ref-card--project .ref-thumb { flex: 0 0 52%; aspect-ratio: auto; min-height: 100%; }
.ref-card--project .ref-card__body { padding: 1.75rem 2rem; }
.ref-card--project .ref-card__title { font-size: 1.5rem; }
.ref-facts { margin: 0.9rem 0 0; display: grid; gap: 0.75rem; }
.ref-facts dt { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgb(224,49,33); margin: 0 0 0.15rem; }
.ref-facts dd { margin: 0; font-size: 14px; color: rgba(17,17,17,0.68); line-height: 1.6; }
@media (max-width: 860px) {
  .ref-card--project { flex-direction: column; }
  .ref-card--project .ref-thumb { flex: none; aspect-ratio: 16 / 10; }
  .ref-card--project .ref-card__body { padding: 1.25rem 1.25rem 1.4rem; }
}

/* ── Vorschaubild + Platzhalter ── */
.ref-thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  background: rgb(245,245,246);
  overflow: hidden;
  border-bottom: 1px solid rgba(17,17,17,0.06);
}
.ref-card--project .ref-thumb { border-bottom: 0; border-right: 1px solid rgba(17,17,17,0.06); }
.ref-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top center; display: block; }
.ref-thumb__ph {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 1rem;
  text-align: center;
  background:
    radial-gradient(circle at 80% 15%, rgba(224,49,33,0.10), rgba(224,49,33,0) 55%),
    linear-gradient(160deg, rgb(250,250,251) 0%, rgb(241,241,243) 100%);
}
.ref-thumb__ph svg { width: 40px; height: 40px; opacity: 0.9; }
.ref-thumb__ph span { font-family: 'Instrument Serif', serif; font-style: italic; font-size: 1.35rem; color: rgba(17,17,17,0.55); }

/* ── Tags, Buttons ── */
.ref-tag {
  align-self: flex-start;
  display: inline-block;
  padding: 4px 10px;
  border: 1px solid rgba(17,17,17,0.1);
  background: rgb(239,239,240);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(17,17,17,0.7);
}
.ref-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 44px;
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
#app-root .ref-btn--primary { background: rgb(224,49,33); color: #fff; border: 1px solid rgb(224,49,33); }
#app-root .ref-btn--primary:hover { background: rgb(190,38,24); border-color: rgb(190,38,24); transform: translateY(-1px); }
#app-root .ref-btn--outline { background: transparent; color: #111; border: 1px solid rgba(17,17,17,0.18); }
#app-root .ref-btn--outline:hover { background: rgba(17,17,17,0.05); }
#app-root .ref-link { color: rgb(205,42,28); font-size: 14px; font-weight: 600; text-decoration: none; }
#app-root .ref-link:hover { text-decoration: underline; }

/* ── Filter-Chips ── */
.ref-filter { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin: 0 0 1.75rem; }
.ref-chip {
  min-height: 40px;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(17,17,17,0.15);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #111;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.ref-chip:hover { background: rgba(17,17,17,0.05); }
.ref-chip[aria-pressed="true"] { background: rgba(224,49,33,0.08); border-color: rgb(224,49,33); color: rgb(224,49,33); }

/* ── Leerzustand ── */
.ref-empty {
  max-width: 36rem;
  margin: 0 auto;
  padding: 2.25rem 1.5rem;
  text-align: center;
  background: rgb(245,245,246);
  border: 1px dashed rgba(17,17,17,0.15);
  border-radius: 14px;
}
.ref-empty p { margin: 0; font-size: 15px; color: rgba(17,17,17,0.62); line-height: 1.6; }
.ref-empty p + p { margin-top: 0.6rem; }

/* ── Startseiten-Teaser ── */
.ref-teaser-grid { display: grid; gap: 1.25rem; grid-template-columns: repeat(3, 1fr); }
.ref-teaser-grid[data-cards="1"] { grid-template-columns: 1fr; max-width: 30rem; margin: 0 auto; }
.ref-teaser-grid[data-cards="2"] { grid-template-columns: repeat(2, 1fr); max-width: 48rem; margin: 0 auto; }
@media (max-width: 860px) { .ref-teaser-grid, .ref-teaser-grid[data-cards="2"] { grid-template-columns: 1fr; max-width: 30rem; margin: 0 auto; } }
.ref-teaser-grid .ref-card__list { display: none; }

/* ── Live-Vorschau (Overlay) ── */
.ref-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  padding: 1.25rem;
  background: rgba(17,17,17,0.55);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.ref-overlay[hidden] { display: none; }
.ref-overlay__panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,0.25);
}
.ref-overlay__bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.6rem 0.75rem 0.6rem 1.25rem;
  border-bottom: 1px solid rgba(17,17,17,0.08);
}
.ref-overlay__title { flex: 1; min-width: 0; margin: 0; font-size: 15px; font-weight: 600; color: #111; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ref-overlay__views { display: inline-flex; padding: 3px; background: rgb(241,241,243); border-radius: 10px; }
.ref-overlay__views button {
  min-height: 34px;
  padding: 0.3rem 0.9rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: rgba(17,17,17,0.6);
  cursor: pointer;
}
.ref-overlay__views button[aria-pressed="true"] { background: #fff; color: #111; box-shadow: 0 1px 3px rgba(17,17,17,0.12); }
#app-root .ref-overlay__newtab { font-size: 13px; font-weight: 600; color: #111; text-decoration: none; white-space: nowrap; padding: 0.5rem 0.6rem; border-radius: 8px; }
#app-root .ref-overlay__newtab:hover { background: rgba(17,17,17,0.05); }
.ref-overlay__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #111;
  cursor: pointer;
}
.ref-overlay__close:hover { background: rgba(17,17,17,0.06); }
.ref-overlay__stage {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: stretch;
  min-height: 0;
  background: rgb(241,241,243);
}
.ref-overlay__device { flex: 1; display: flex; min-height: 0; }
.ref-overlay__device iframe { flex: 1; width: 100%; height: 100%; border: 0; background: #fff; }
.ref-overlay__stage[data-view="mobile"] { padding: 1.25rem; align-items: center; overflow: auto; }
.ref-overlay__stage[data-view="mobile"] .ref-overlay__device {
  flex: none;
  width: 414px;               /* 390px Inhalt + 2 × 12px Rahmen */
  height: min(868px, 100%);
  padding: 12px;
  background: #111;
  border-radius: 44px;
  box-shadow: 0 20px 50px rgba(17,17,17,0.3);
}
.ref-overlay__stage[data-view="mobile"] iframe { width: 390px; flex: none; border-radius: 32px; }
.ref-overlay a:focus-visible,
.ref-overlay button:focus-visible,
.ref-chip:focus-visible,
.ref-btn:focus-visible,
.ref-link:focus-visible { outline: 2px solid rgb(224,49,33); outline-offset: 2px; }
@media (max-width: 900px) { .ref-overlay__newtab span { display: none; } }

/* ── Kontaktformular: vorausgewählte Vorlage kurz hervorheben ── */
@keyframes ref-highlight {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,49,33,0); }
  20%, 70% { box-shadow: 0 0 0 4px rgba(224,49,33,0.25); }
}
.vorlage-field.is-highlighted select { border-color: rgb(224,49,33); animation: ref-highlight 2.4s ease; }

@media (prefers-reduced-motion: reduce) {
  .ref-card, .ref-btn { transition: none; }
  .ref-card:hover { transform: none; }
  .vorlage-field.is-highlighted select { animation: none; }
}
