/* =========================================================
   TR BAU, Projekte Version 4
   Startseite: drei Projekte, eins groß, zwei daneben (.pgrid).
   Vergleich Rohbau und fertig (.ba): Linie folgt der Maus, am Handy ziehen,
   per Tastatur über den versteckten Schieberegler. Gesteuert von projekte-v4.js.
   Projektseite projekte.html: Raster mit Filter und Großansicht (.parchive, .lb).
   Hover der Projektbilder (Zoom, Ecken) steht in animation-v4.css.
   ========================================================= */

/* ---------- Platzhalter: gelb, damit nichts davon live geht ---------- */
.ph { background: #ffe27a; color: var(--tinte); padding: 1px 6px; border-radius: 4px; font-weight: 600; }
.ph--badge {
  position: absolute; z-index: 4; top: 14px; left: 14px;
  padding: 5px 10px; border-radius: 999px; font-size: 12.5px; pointer-events: none;
}

.cta--dark .cta__label { background: var(--tinte); color: #fff; }
.cta--dark:hover .cta__label { background: #000; }

/* ---------- Startseite: Raster ---------- */
.projects--v4 .projects__head { margin-bottom: clamp(32px, 4vw, 52px); }
.pgrid {
  display: grid;
  grid-template-columns: 1.55fr 1fr;
  gap: clamp(28px, 3vw, 40px) clamp(20px, 2.4vw, 32px);
}
.pgrid .pcard { display: flex; flex-direction: column; min-width: 0; }
.pgrid__lead { grid-row: 1 / span 2; }
.pgrid .pcard__media { aspect-ratio: 16 / 10; }
.pgrid__lead .pcard__media { aspect-ratio: auto; flex: 1; min-height: 420px; }
.pgrid .pcard__media > img,
.ba__before img {
  position: absolute; inset: 0;
  width: 100%; height: 100%; aspect-ratio: auto;
  object-fit: cover; border-radius: 0;
}
.pgrid__lead figcaption { font-size: 22px; }
.pcard__meta { display: block; margin-top: 6px; font-size: 14px; font-weight: 500; color: var(--grau-text); }

@media (max-width: 900px) {
  .pgrid { grid-template-columns: 1fr 1fr; }
  .pgrid__lead { grid-column: 1 / -1; grid-row: auto; }
  .pgrid__lead .pcard__media { flex: none; min-height: 0; aspect-ratio: 4 / 3; }
}
@media (max-width: 600px) {
  .pgrid { grid-template-columns: 1fr; }
  .pgrid__lead figcaption { font-size: 19px; }
}

/* ---------- Vergleich Rohbau und fertig ---------- */
.ba { --x: 50%; position: relative; cursor: ew-resize; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.ba > .ba__after { position: absolute; inset: 0; }
.ba__before {
  position: absolute; inset: 0; z-index: 1;
  clip-path: inset(0 calc(100% - var(--x)) 0 0);
}
.ba__line {
  position: absolute; z-index: 2; top: 0; bottom: 0; left: var(--x);
  width: 2px; margin-left: -1px;
  background: #fff;
  box-shadow: 0 0 12px rgba(13, 27, 38, .35);
  pointer-events: none;
}
.ba__knob {
  position: absolute; top: 50%; left: 50%;
  display: flex; align-items: center; justify-content: center; gap: 2px;
  width: 54px; height: 54px; border-radius: 50%;
  background: #fff; color: var(--tinte);
  box-shadow: 0 6px 20px rgba(13, 27, 38, .25);
  transform: translate(-50%, -50%);
  transition: transform .35s var(--rv-ease, ease);
}
.ba__knob svg { width: 15px; height: 15px; }
.ba.is-active .ba__knob { transform: translate(-50%, -50%) scale(.86); }
.ba__tag {
  position: absolute; z-index: 2; bottom: 16px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(13, 27, 38, .62); color: #fff;
  font-size: 13px; font-weight: 600; letter-spacing: .01em;
  pointer-events: none;
  transition: opacity .25s;
}
.ba__tag--before { left: 16px; opacity: var(--tb, 1); }
.ba__tag--after { right: 16px; opacity: var(--ta, 1); }
.ba .pcard__corners { z-index: 3; }
/* Schieberegler nur für Tastatur und Screenreader, unsichtbar */
.ba__range {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); border: 0; opacity: 0;
}
.ba:has(.ba__range:focus-visible) { outline: 3px solid var(--blau); outline-offset: 4px; }
/* Zoom beim Darüberfahren würde die Linie verfälschen, beim Vergleich daher ohne */
@media (hover: hover) and (pointer: fine) {
  .pcard:hover .ba img { transform: none; }
}

/* =========================================================
   Projektseite projekte.html
   ========================================================= */
.page-head { padding: calc(var(--nav-h) + clamp(70px, 9vw, 120px)) 0 clamp(40px, 5vw, 64px); }
.page-head .h2 { font-size: clamp(2.6rem, 6vw, 5.4rem); }
.page-head p { max-width: 52ch; margin-top: 22px; font-size: 18px; color: var(--grau-text); }

.filter { display: flex; flex-wrap: wrap; gap: 8px; margin-top: clamp(28px, 3vw, 40px); padding: 0; list-style: none; }
.filter button {
  min-height: 44px; padding: 0 18px;
  border: 1.5px solid var(--linie); border-radius: 999px;
  background: #fff; color: var(--tinte);
  font-weight: 600; font-size: 15px; cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.filter button:hover { border-color: var(--tinte); }
.filter button[aria-pressed="true"] { background: var(--tinte); border-color: var(--tinte); color: #fff; }
.filter__count { margin-left: 4px; font-weight: 500; opacity: .6; }

.parchive {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(28px, 3vw, 40px) clamp(18px, 2vw, 28px);
  padding-bottom: clamp(90px, 11vw, 150px);
}
.parchive .pcard { min-width: 0; }
.parchive .pcard[hidden] { display: none; }
.parchive .pcard__media { aspect-ratio: 4 / 3; }
.parchive .pcard__media > img { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; object-fit: cover; border-radius: 0; }
.pcard__open {
  position: absolute; inset: 0; z-index: 3;
  padding: 0; border: 0; background: none; cursor: zoom-in;
}
.pcard__open:focus-visible { outline: 3px solid var(--blau); outline-offset: -3px; border-radius: 22px; }
@media (max-width: 1000px) { .parchive { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) {
  .parchive { grid-template-columns: 1fr; }
}

.parchive__empty { grid-column: 1 / -1; padding: 40px 0; color: var(--grau-text); }

.cta-band { background: var(--blau); color: #fff; padding: clamp(70px, 9vw, 120px) 0; }
.cta-band .wrap { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 28px; }
.cta-band p { max-width: 44ch; margin-top: 18px; font-size: 18px; color: rgba(255, 255, 255, .9); }

/* ---------- Großansicht ---------- */
.lb {
  width: 100%; max-width: none; height: 100vh; height: 100dvh; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: rgba(10, 17, 23, .94); color: #fff;
}
.lb::backdrop { background: rgba(10, 17, 23, .6); }
.lb[open] { display: grid; grid-template-rows: 1fr auto; }
.lb__stage { position: relative; display: grid; place-items: center; min-height: 0; overflow: hidden; padding: 72px 84px 12px; }
/* Höhe ausdrücklich begrenzen: Abstand oben plus Bildunterschrift unten */
.lb__stage img { width: auto; height: auto; max-width: 100%; max-height: calc(100dvh - 190px); object-fit: contain; border-radius: 12px; }
.lb__bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 32px 26px; }
.lb__cap { font-size: 18px; font-weight: 600; }
.lb__cap span { display: block; font-size: 14px; color: #8cc0e0; font-weight: 600; }
.lb__count { font-variant-numeric: tabular-nums; color: rgba(255, 255, 255, .7); white-space: nowrap; }
.lb .round-btn { border-color: rgba(255, 255, 255, .55); color: #fff; }
.lb .round-btn:hover:not(:disabled) { background: #fff; color: var(--tinte); }
.lb__close { position: absolute; top: 16px; right: 16px; }
.lb__prev, .lb__next { position: absolute; top: 50%; transform: translateY(-50%); }
.lb__prev { left: 16px; } .lb__next { right: 16px; }
.lb :focus-visible { outline-color: #fff; }
@media (max-width: 760px) {
  .lb__stage { padding: 64px 12px 8px; }
  /* Pfeile unten in der Leiste, über dem Bild wäre kein Platz */
  .lb__prev, .lb__next { position: fixed; top: auto; bottom: 20px; transform: none; }
  .lb__prev { left: 20px; } .lb__next { left: 84px; right: auto; }
  .lb__bar { padding: 16px 20px 92px; }
}
@media (prefers-reduced-motion: no-preference) {
  .lb[open] .lb__stage img { animation: lb-in .45s var(--rv-ease, ease) both; }
}
@keyframes lb-in { from { opacity: 0; transform: scale(.97); } }
