/* ============================================================
   (C) PEP – Bewegung mit Inhalt (09.10.2026)
   Vier Ideen, je eine eigene Mechanik, alle aus der Praxis:
     1 Acht Gesichter   Startseite, Zahlenband     Menge
     2 Zeitband         Sprechzeiten               Zeit, live
     3 Rundgang         Unsere Praxis, Galerie     Reihenfolge eines Besuchs
     4 Weg              Gewichtsreduktion, Schritte Reihenfolge, keiner übersprungen
     5 Rezept-Woche     Rezept-Hinweise            Zeit, nur Praxistage zählen
   Grundzustand = Endzustand. Versteckt wird nur unter html.pep-an
   (setzt js/pep.js, nie bei reduzierter Bewegung). Ohne JS, mit
   reduzierter Bewegung und im Druck steht alles.
   Kurven: weich = ankommen, sanft = absenken. Keine Federn, kein Shake.
   ============================================================ */
:root {
  --weich: cubic-bezier(0.22, 1, 0.36, 1);
  --sanft: cubic-bezier(0.65, 0, 0.35, 1);
}

/* ============================================================
   1 · ACHT GESICHTER
   „8 Ärzte" ist keine Zahl, sondern diese acht Menschen. Die Porträts
   fallen nacheinander in die Reihe, dann steigt die 8 aus dem Boden.
   ============================================================ */
.stats-inner {
  grid-template-columns: minmax(0, 2.5fr) repeat(3, minmax(0, 1fr));
  align-items: end;
}

/* Acht Porträts nebeneinander, ohne Überlappung: ein Team, kein
   Avatar-Stapel. 8 × 54 + 7 × 6 = 474 px, Zelle ab 1200 px ≥ 483 px. */
.stat-gesichter {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 1.25rem;
}

.stat-gesichter > * {
  width: 54px;
  height: 54px;
  border-radius: 50%;
}

.stat-gesichter img {
  object-fit: cover;
  object-position: center 22%;
  background: var(--papier);
}

/* Achte Ärztin ohne Porträt: Initialen statt Clipart, bis ein Foto da ist.
   Papier auf Rot 5,41:1, darum ohne getönte Füllung. */
.gesicht-initialen {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  border: 1.5px solid var(--papier);
  background: transparent;
  color: var(--papier);
  font: 600 1rem / 1 var(--font-heading);
}

/* Die 8 steigt aus der Bodenlinie: Polster unten, damit nichts abgeschnitten wird. */
.stat-item-team .stat-number {
  overflow: hidden;
  padding-bottom: 0.14em;
  margin-bottom: calc(0.5rem - 0.14em);
  height: 1.14em;
}

.stat-hub {
  display: inline-block;
}

.pep-an .stat-gesichter > * {
  opacity: 0;
  transform: translateY(-26px);
}

.pep-an .stat-item-team .stat-hub {
  transform: translateY(140%);
}

.pep-an .stat-item-team.ist-da .stat-gesichter > * {
  animation: gesicht-setzt 0.6s var(--weich) both;
}

.stat-gesichter > :nth-child(1) { --i: 0; }
.stat-gesichter > :nth-child(2) { --i: 1; }
.stat-gesichter > :nth-child(3) { --i: 2; }
.stat-gesichter > :nth-child(4) { --i: 3; }
.stat-gesichter > :nth-child(5) { --i: 4; }
.stat-gesichter > :nth-child(6) { --i: 5; }
.stat-gesichter > :nth-child(7) { --i: 6; }
.stat-gesichter > :nth-child(8) { --i: 7; }

.pep-an .stat-item-team.ist-da .stat-gesichter > * {
  animation-delay: calc(var(--i) * 95ms);
}

.pep-an .stat-item-team.ist-da .stat-hub {
  animation: hub-steigt 0.55s var(--weich) 0.95s both;
}

@keyframes gesicht-setzt {
  from { opacity: 0; transform: translateY(-26px); }
  40%  { opacity: 1; }
  to   { opacity: 1; transform: none; }
}

@keyframes hub-steigt {
  from { transform: translateY(140%); }
  to   { transform: none; }
}

@media (max-width: 1199px) {
  /* Ungleich gewichtet: das Team über die volle Breite, darunter drei.
     Bis 1199 px: vierspaltig passt die Reihe der acht dort nicht. */
  /* stretch statt end: bricht nur eine der drei Beschriftungen zweizeilig
     (545–615 px), stünden Zahlen und Haarlinien sonst versetzt. */
  .stats-inner {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
  }

  .stats-inner .stat-item,
  .stats-inner .stat-item:first-child,
  .stats-inner .stat-item:nth-child(odd),
  .stats-inner .stat-item:nth-child(n+3) {
    padding: 1.25rem 0.5rem;
    border-top: 0;
    border-left: 1px solid var(--papier-15);
  }

  /* Zwei Klassen (0,3,0): sonst gewinnt :first-child oben und zieht eine
     Haarlinie links an die Team-Zelle, die nichts trennt. */
  .stats-inner .stat-item.stat-item-team {
    grid-column: 1 / -1;
    padding-bottom: 1.5rem;
    border-left: 0;
    border-bottom: 1px solid var(--papier-15);
  }

  .stats-inner .stat-item:nth-child(2) {
    border-left: 0;
  }

  .stat-gesichter > * {
    width: 46px;
    height: 46px;
  }
}

/* Bis 400 px: weniger Seitenpolster in den drei kleinen Zellen, damit
   „Gelbfieber-" und „Persönliche" ganz in ihre Spalte passen. Gemessen
   bei 320 px: „Persönliche" braucht 82,4 px, mit 4 px Polster bleiben
   81,7 px, mit 2 px 85,7 px. Muss nach dem 1199er-Block stehen
   (gleiche Spezifität). */
@media (max-width: 400px) {
  /* Ohne senkrechte Haarlinien: mit ihnen stießen die Beschriftungen auf
     1–2 px an die Linie. Der Abstand steht als Spaltenlücke; bei 320 px
     bleiben (272 − 16) / 3 = 85,3 px je Spalte. Die Querlinie unter dem
     Team bleibt. */
  .stats-inner {
    column-gap: 0.5rem;
  }

  .stats-inner .stat-item:not(.stat-item-team) {
    padding-left: 0;
    padding-right: 0;
    border-left: 0;
  }
}

/* Ab 1200 px: alle drei Beschriftungen einzeilig (185 px Inhalt), damit
   die vier Zahlen bei align-items:end auf einer Linie stehen. */
@media (min-width: 1200px) {
  .stats-inner .stat-item {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

/* Handy: zwei Reihen zu vier (4 × 52 + 3 × 8 = 232 px, Platz ab 320 px 256 px). */
@media (max-width: 480px) {
  .stat-gesichter {
    display: grid;
    grid-template-columns: repeat(4, 52px);
    justify-content: center;
    gap: 8px;
  }

  .stat-gesichter > * {
    width: 52px;
    height: 52px;
  }
}

/* ============================================================
   3 · RUNDGANG
   Die Fotos in der Reihenfolge eines Besuchs: Eingang, Empfang,
   Wartezimmer … Sprechzimmer.
     ruhig (ohne JS, reduzierte Bewegung): Raster mit Beschriftung
     .ist-buehne (ab 1024 px): Bühne klebt, jedes nächste Zimmer
        öffnet sich als Tür im vorigen, man geht hindurch
     .ist-streifen (darunter): waagrechter Streifen zum Wischen,
        jedes Zimmer öffnet sich, wenn es einrastet
   ============================================================ */
.practice-gallery.rundgang {
  display: block;
}

.rundgang-stationen {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1.25rem 0.875rem;
}

.rundgang-station figure {
  margin: 0;
}

.rundgang-station figcaption {
  margin-top: 0.5rem;
  font-size: var(--text-sm);
  line-height: 1.35;
  color: var(--tinte);
}

.rundgang-liste {
  display: none;
}

@media (max-width: 1023px) {
  .rundgang-stationen { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .rundgang-stationen { grid-template-columns: minmax(0, 1fr); }
}

/* ── Bühne ── */
.rundgang.ist-buehne {
  --kopf: 72px;                         /* Sticky-Kopf */
  --schritte: 7;
  height: calc(100svh + var(--schritte) * 40svh);
}

/* Die Bühne ist so hoch wie ihr Inhalt (keine leeren Flächen über und
   unter dem Bild im Fluss) und klebt trotzdem mittig im Bildschirm: die
   Mitte kommt aus dem Klebe-Versatz. --buehne-h misst pep.js. */
.ist-buehne .rundgang-buehne {
  position: sticky;
  top: calc(var(--kopf) + max(1rem, (100svh - var(--kopf) - var(--buehne-h, 0px)) / 2));
  height: auto;
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.5fr);
  align-items: center;
  column-gap: clamp(2rem, 5vw, 5rem);
}

.ist-buehne .rundgang-liste {
  display: grid;
  gap: 0.375rem;
  counter-reset: none;
}

.rundgang-liste li {
  position: relative;
  padding: 0.25rem 0 0.25rem 1.25rem;
  font-family: var(--font-heading);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.3;
  color: var(--tinte-70);
  transition: color var(--transition);
}

/* Die eine Marke der Seite: wo man gerade steht. */
.rundgang-liste li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.3rem;
  bottom: 0.3rem;
  width: 4px;
  border-radius: 2px;
  background: var(--rot);
  transform: scaleY(0);
  transition: transform 0.3s var(--weich);
}

.rundgang-liste li.ist-hier {
  color: var(--tinte);
}

.rundgang-liste li.ist-hier::before {
  transform: none;
}

.ist-buehne .rundgang-stationen {
  position: relative;
  display: block;
  width: min(100%, (100svh - var(--kopf) - 6rem) * 4 / 3);
  aspect-ratio: 4 / 3;
  justify-self: center;
  overflow: hidden;
  border-radius: var(--radius-l);
  background: var(--tinte);
}

.ist-buehne .rundgang-station {
  position: absolute;
  inset: 0;
}

.ist-buehne .rundgang-station:nth-child(1) { z-index: 1; }
.ist-buehne .rundgang-station:nth-child(2) { z-index: 2; }
.ist-buehne .rundgang-station:nth-child(3) { z-index: 3; }
.ist-buehne .rundgang-station:nth-child(4) { z-index: 4; }
.ist-buehne .rundgang-station:nth-child(5) { z-index: 5; }
.ist-buehne .rundgang-station:nth-child(6) { z-index: 6; }
.ist-buehne .rundgang-station:nth-child(7) { z-index: 7; }
.ist-buehne .rundgang-station:nth-child(8) { z-index: 8; }

.ist-buehne .rundgang-station figure,
.ist-buehne .rundgang-station .gallery-img {
  width: 100%;
  height: 100%;
}

.ist-buehne .rundgang-station .gallery-img {
  aspect-ratio: auto;
  border-radius: 0;
  will-change: transform, clip-path;
}

/* Name steht links in der Liste; die Bildunterschrift bleibt für Vorleser. */
.ist-buehne .rundgang-station figcaption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* Vor dem ersten Rechnen: alle Türen zu, damit nichts aufblitzt. */
.ist-buehne .rundgang-station:not(:first-child) .gallery-img {
  clip-path: inset(22% 50% 8% 50%);
}

/* ── Streifen ── */
.ist-streifen .rundgang-buehne {
  margin: 0 calc(-1 * max(1.5rem, env(safe-area-inset-right))) 0 calc(-1 * max(1.5rem, env(safe-area-inset-left)));
  padding: 0 max(1.5rem, env(safe-area-inset-right)) 0.75rem max(1.5rem, env(safe-area-inset-left));
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 max(1.5rem, env(safe-area-inset-left));
  scrollbar-width: thin;
}

.ist-streifen .rundgang-buehne:focus-visible {
  outline-offset: -3px;
}

.ist-streifen .rundgang-stationen {
  display: flex;
  gap: 0.875rem;
  width: max-content;
}

/* 72vw: vom nächsten Zimmer bleiben bei 390 px ≈ 70 px sichtbar, genug,
   dass seine Tür (links in der Wand) hereinschaut. */
.ist-streifen .rundgang-station {
  flex: 0 0 auto;
  width: min(72vw, 520px);
  scroll-snap-align: start;
}

.ist-streifen .rundgang-station .gallery-img {
  will-change: clip-path;
}

/* Die Wand, in der die Tür sitzt: das nächste Zimmer lugt als Tür herein. */
.ist-streifen .rundgang-station:not(:first-child) figure {
  position: relative;
}

.ist-streifen .rundgang-station:not(:first-child) figure::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-s);
  background: rgb(var(--tinte-rgb) / 0.09);   /* Wand, dunkler als der Abschnitt */
}

.ist-streifen .rundgang-station figure > .gallery-img {
  position: relative;
}

/* Tür links in der Wand, damit sie im sichtbaren Anriss liegt. Die
   Öffnung startet genau dort (eigener Keyframe), sonst sprünge sie erst
   in die Mitte. */
.ist-streifen .rundgang-station:not(:first-child):not(.ist-da) .gallery-img {
  clip-path: inset(22% 52% 8% 6% round 6px);
}

.ist-streifen .rundgang-station.ist-da .gallery-img {
  animation: tuer-auf-links 1s var(--sanft) both;
}

@keyframes tuer-auf-links {
  from { clip-path: inset(22% 52% 8% 6% round 6px); }
  to   { clip-path: inset(0 0 0 0 round 0); }
}

/* ============================================================
   4 · WEG (Gewichtsreduktion)
   „Vier Schritte – keiner davon wird übersprungen." Eine Linie läuft
   beim Lesen durch alle vier; ein Schritt füllt sich, wenn sie ihn
   erreicht.
   ============================================================ */
.steps.ist-weg {
  position: relative;
}

.steps.ist-weg::before,
.steps.ist-weg::after {
  content: '';
  position: absolute;
  left: 17px;                           /* Mitte der 36-px-Nummer */
  top: var(--weg-oben, 18px);
  height: var(--weg-laenge, 0px);
  width: 2px;
  border-radius: 1px;
}

.steps.ist-weg::before {
  background: var(--tinte-15);
}

.steps.ist-weg::after {
  background: var(--rot);
  transform-origin: top;
  transform: scaleY(var(--weg, 1));
}

.steps.ist-weg .step-number {
  position: relative;
  z-index: 1;
  border: 2px solid var(--rot);
  transition: background-color 0.3s var(--weich), color 0.3s var(--weich);
}

.pep-an .steps.ist-weg .step:not(.ist-erreicht) .step-number {
  background: var(--papier);
  color: var(--rot);
}

/* ============================================================
   RUHIG UND DRUCK
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .stat-gesichter > *,
  .stat-hub,
  .rundgang-station .gallery-img {
    animation: none !important;
    transform: none !important;
    clip-path: none !important;
    opacity: 1 !important;
  }
}

@media print {
  .stat-gesichter > *,
  .stat-hub {
    animation: none !important;
    transform: none !important;
    clip-path: none !important;
    opacity: 1 !important;
  }

  .rundgang.ist-buehne {
    height: auto;
  }
}
