/* /projekte/: Fallstudien, Regler und Bühne */

/* Einstieg: Shop-Screenshot im Browser, Handy davor */
.projekte-kopf {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.projekte-buehne {
  position: relative;
  margin: 0;
  padding-left: 48px;
}

.buehne-browser {
  position: relative;
}

.buehne-fenster {
  height: clamp(260px, 26vw, 380px);
  overflow: hidden;
}

.buehne-fenster img {
  width: 100%;
  height: auto;
  transition: transform 6s cubic-bezier(0.45, 0, 0.55, 1);
}

@media (hover: hover) {
  .projekte-buehne:hover .buehne-fenster img {
    transform: translateY(calc(-100% + clamp(260px, 26vw, 380px)));
  }
}

.buehne-handy {
  position: absolute;
  left: 0;
  bottom: -8px;
  width: 24%;
  max-width: 150px;
}

.projekte-buehne figcaption {
  margin: 16px 0 0 26%;
  color: var(--ink-3);
  font-size: 0.875rem;
  text-align: right;
}

/* Fallstudie */
.fall-ueberblick {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 64px);
  align-items: start;
}

.fall-zahlen {
  padding: clamp(20px, 2.5vw, 32px);
  border-radius: var(--r-md);
  background: var(--bg);
}

.fall-zahlen-titel {
  color: var(--ink-3);
  font-size: 0.875rem;
  font-weight: 550;
}

.fall-zahlen .case-number {
  margin-top: 8px;
  color: var(--green);
  font-size: clamp(3rem, 2.2rem + 3.4vw, 5rem);
  font-weight: 650;
  letter-spacing: -0.05em;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.fall-zahlen .case-label {
  margin-top: 8px;
  font-size: 1.1875rem;
  font-weight: 550;
  letter-spacing: -0.02em;
}

.fall-zahlen .case-metrics {
  display: grid;
  margin: 24px 0 0;
  border-top: 1px solid var(--line);
}

.fall-zahlen .case-metrics div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.fall-zahlen .case-metrics dt {
  color: var(--ink-2);
}

.fall-zahlen .case-metrics dd {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.fall-zahlen .case-source {
  margin-top: 12px;
  color: var(--ink-3);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.fall-vergleich {
  margin: 24px 0 0;
}

.fall-vergleich figcaption {
  margin-top: 12px;
  color: var(--ink-3);
  font-size: 0.875rem;
  text-align: center;
}

.fall-ausgangslage {
  margin-top: 24px;
}

.fall-ausgangslage p {
  max-width: 72ch;
}

/* Vorher-nachher-Regler: Trennlinie mit Griff zeigt links den alten, rechts den
   heutigen Stand (Logik in /assets/basis/basis.js). --p ist die Position in Prozent
   ohne Einheit; bewegt wird nur per transform. */
.compare {
  --p: 50;
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  container-type: inline-size;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.compare img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* Rahmen und Bild gegenläufig verschieben: der Rahmen schneidet, das Bild bleibt stehen. */
.compare-before {
  position: absolute;
  inset: 0;
  overflow: hidden;
  transform: translateX(calc((var(--p) - 100) * 1%));
}

.compare-before img {
  transform: translateX(calc((100 - var(--p)) * 1%));
}

.compare-tag {
  position: absolute;
  z-index: 1;
  top: 14px;
  left: 14px;
  padding: 5px 12px;
  border-radius: 999px;
  background: oklch(20% 0.02 170 / 0.72);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: var(--on-dark);
  font-size: 0.8125rem;
  font-weight: 550;
  line-height: 1.4;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}

.compare-tag-after {
  left: auto;
  right: 14px;
}

.compare-tag.is-verdeckt {
  opacity: 0;
}

/* Trennlinie: 2 px weiß mit weichem Schatten */
.compare-handle {
  position: absolute;
  z-index: 2;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 2px;
  background: var(--surface);
  box-shadow:
    0 0 0 1px oklch(0% 0 0 / 0.06),
    0 0 14px oklch(0% 0 0 / 0.28);
  transform: translateX(calc(var(--p) * 1cqw));
  pointer-events: none;
}

/* Griff: weißer Kreis … */
.compare-handle::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  margin: -21px 0 0 -21px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow:
    0 0 0 1px oklch(20% 0.02 170 / 0.08),
    0 2px 4px oklch(20% 0.02 170 / 0.12),
    0 10px 24px -8px oklch(20% 0.02 170 / 0.4);
  transition:
    transform 0.25s var(--ease),
    box-shadow 0.25s var(--ease);
}

/* … mit sechs Punkten (zwei Spalten à drei) als Griffsymbol */
.compare-handle::before {
  content: "";
  position: absolute;
  z-index: 1;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 18px;
  margin: -9px 0 0 -6px;
  background: radial-gradient(circle, var(--ink-2) 1.4px, transparent 1.9px) 0 0 / 6px 6px;
  transition: transform 0.25s var(--ease);
}

.compare.is-gezogen .compare-handle::before,
.compare:has(input:focus-visible) .compare-handle::before {
  transform: scale(1.12);
}

.compare.is-gezogen .compare-handle::after,
.compare:has(input:focus-visible) .compare-handle::after {
  transform: scale(1.12);
  box-shadow:
    0 0 0 3px var(--green),
    0 2px 4px oklch(20% 0.02 170 / 0.12),
    0 12px 28px -8px oklch(20% 0.02 170 / 0.45);
}

.compare input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: ew-resize;
}

/* Mit Skript zieht man auf der Fläche; der Range-Input bleibt für Tastatur und Screenreader. */
.compare.is-bereit {
  cursor: ew-resize;
}

.compare.is-bereit input {
  pointer-events: none;
}

/* Teilprojekte: Text und Bild abwechselnd */
.teile {
  display: grid;
  gap: clamp(48px, 7vw, 96px);
  margin-top: clamp(48px, 7vw, 96px);
}

.teil {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: center;
  gap: clamp(28px, 5vw, 72px);
}

.teil-gespiegelt .teil-text {
  order: 2;
}

.teil-text h3 {
  margin-top: 18px;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
}

.teil-text > p {
  margin-top: 14px;
  color: var(--ink-2);
}

.teil-bild {
  position: relative;
}

.teil-bild-paar {
  padding-bottom: 40px;
}

.teil-bild-paar .teil-handy {
  position: absolute;
  right: -12px;
  bottom: 0;
  width: 26%;
  max-width: 170px;
}

.teil-bild-stapel {
  display: grid;
}

.teil-bild-stapel .teil-versetzt {
  width: 82%;
  margin: -18% 0 0 auto;
}

.vorher-heute {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.vorher-heute > div {
  padding: 18px 20px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.vorher-heute > div:nth-child(even) {
  background: var(--tint);
  box-shadow: none;
}

.vorher-heute dt {
  color: var(--ink-3);
  font-size: 0.8125rem;
  font-weight: 600;
}

.vorher-heute > div:nth-child(even) dt {
  color: var(--green-ink);
}

.vorher-heute dd {
  margin: 4px 0 0;
}

.datenfluss {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.datenfluss li {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  column-gap: 16px;
  align-items: center;
  padding: 18px 22px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.datenfluss li + li::before {
  content: "";
  position: absolute;
  left: 49px;
  top: -12px;
  width: 2px;
  height: 12px;
  background: var(--green);
}

.datenfluss img {
  grid-row: span 2;
  width: 56px;
  height: 56px;
}

.datenfluss span {
  color: var(--ink-2);
  font-size: 0.9375rem;
}

.fall-fuss {
  display: grid;
  gap: 20px;
  margin-top: clamp(40px, 5vw, 64px);
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

/* Foltas: drei Karten, im Ergebnis zwei Handys */
.fall-geschichte {
  margin-top: 24px;
  align-items: start;
}

.handy-paar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.handy-paar figure {
  margin: 0;
}

.handy-paar figcaption {
  margin-top: 8px;
  color: var(--ink-3);
  font-size: 0.8125rem;
  text-align: center;
}

/* Weitere Projekte */
.karte > .feld-typ {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 0.875rem;
}

.feld .chips {
  margin-top: 18px;
}

.feld-link {
  margin-top: 16px;
}

.technik .chips {
  margin-top: 14px;
}

@media (max-width: 1080px) {
  .projekte-kopf {
    grid-template-columns: minmax(0, 1fr);
  }
  .fall-ueberblick,
  .teil {
    grid-template-columns: minmax(0, 1fr);
  }
  .teil-gespiegelt .teil-text {
    order: 0;
  }
}

@media (max-width: 860px) {
  .fall-geschichte {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 560px) {
  .projekte-buehne {
    padding-left: 28px;
  }
  .projekte-buehne figcaption {
    margin-left: 22%;
  }
  .vorher-heute {
    grid-template-columns: minmax(0, 1fr);
  }
  .compare {
    aspect-ratio: 4 / 3;
  }
  .teil-bild-paar .teil-handy {
    right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .buehne-fenster img {
    transition: none;
  }
}
