/* ==========================================================================
   Physio Plus AW – Rundgang-Video im Kopfbereich
   Wird nur von index.html (Startseite) eingebunden und
   ergänzt style.css, ohne dort etwas zu ändern.
   ========================================================================== */

/* Rahmen: Rundbogen wie ein Durchgang – hier beginnt der Rundgang.
   Die Prozentwerte ergeben bei 4:5 oben einen exakten Halbkreis. */
.hero__media--tour {
  --arch: 50% 50% var(--radius-lg) var(--radius-lg) / 40% 40% var(--radius-lg) var(--radius-lg);
  container: tour-media / inline-size;
  width: 100%;
  max-width: 32rem;
  margin-inline: auto;
}
@media (min-width: 62rem) { .hero__media--tour { max-width: none; } }

.hero__media--tour::before {
  inset: 6% -5% -4% 10%;
  border-radius: var(--arch);
  transform: rotate(4deg);
}

.tour {
  position: relative;
  margin: 0;
  aspect-ratio: 4 / 5;
  border-radius: var(--arch);
  overflow: hidden;
  isolation: isolate;
  background: var(--forest);
  box-shadow: var(--shadow-lg);
  color: #fff;
}

/* Die Rundung sitzt auch direkt auf Video und Intro: Ein Video liegt im Browser
   auf einer eigenen Zeichenebene und übernähme die Rundung des Rahmens sonst
   erst beim nächsten Neuzeichnen (oben kurz eckig). */
.tour__video,
.tour__intro {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: inherit;
}
.tour__video { object-fit: cover; background: var(--forest); }

/* Abdunklung unten, damit die Beschriftung immer lesbar bleibt */
.tour::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: auto 0 0 0;
  height: 48%;
  background: linear-gradient(to top, rgb(12 18 13 / 0.86) 0%, rgb(12 18 13 / 0.5) 45%, rgb(12 18 13 / 0) 100%);
  pointer-events: none;
}

/* Großer Start-Knopf (sichtbar, solange das Video nicht läuft) */
.tour__play {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 42%;
  translate: -50% -50%;
  display: inline-flex;
  align-items: center;
  gap: 0.875rem;
  min-height: 4rem;
  padding: 0.5rem 1.5rem 0.5rem 0.5rem;
  border: 0;
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--ink);
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 0 0 8px rgb(255 255 255 / 0.22), 0 18px 40px -12px rgb(0 0 0 / 0.55);
  transition: transform 0.25s var(--ease), opacity 0.25s, visibility 0.25s;
}
.tour__play:hover { transform: scale(1.04); }
.tour__play-icon {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--brand);
}
.tour__play-icon .icon { width: 1.375rem; height: 1.375rem; fill: currentColor; margin-left: 0.2rem; }
.tour.is-playing .tour__play {
  opacity: 0;
  visibility: hidden;
  transform: scale(0.85);
}

/* Beschriftung mit Stationen */
.tour__bar {
  position: absolute;
  z-index: 2;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  gap: 0.375rem;
  padding: 1rem clamp(1rem, 0.75rem + 1vw, 1.5rem) 1.125rem;
}
.tour__head { display: flex; align-items: center; gap: 0.875rem; }
.tour__mark {
  width: 1.5rem;
  height: 2.875rem;
  flex: none;
  color: var(--brand);
  fill: #fff;
}
.tour__now { flex: 1; min-width: 0; line-height: 1.25; }
.tour__kicker {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--brand);
}
.tour__station {
  display: block;
  font-size: clamp(1.1875rem, 1.05rem + 0.5vw, 1.4375rem);
  font-weight: 750;
  letter-spacing: -0.015em;
  color: #fff;
  text-shadow: 0 1px 12px rgb(0 0 0 / 0.35);
}
.tour__count { color: var(--brand); font-variant-numeric: tabular-nums; margin-right: 0.25rem; }
.tour__name { display: inline-block; }
.tour__name.is-new { animation: tour-name 0.45s var(--ease); }
@keyframes tour-name { from { opacity: 0; transform: translateY(0.4em); } }

.tour__toggle {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--tap);
  height: var(--tap);
  border: 1.5px solid rgb(255 255 255 / 0.55);
  border-radius: 50%;
  background: rgb(255 255 255 / 0.14);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  transition: background-color 0.2s, color 0.2s;
}
.tour__toggle:hover { background: #fff; color: var(--ink); }
.tour__toggle .icon { width: 1.375rem; height: 1.375rem; fill: currentColor; }
.tour__toggle .icon--play { margin-left: 0.15rem; }
.tour__toggle .icon--pause,
.tour.is-playing .tour__toggle .icon--play { display: none; }
.tour.is-playing .tour__toggle .icon--pause { display: block; }

/* Zeitleiste über der Beschriftung: ein Abschnitt je Station, Breite = Länge der Station.
   Der Stationsname beim Überfahren schwebt so frei über dem Video. */
.tour__steps {
  display: grid;
  grid-template-columns: 1.8fr 3.96fr 5.92fr 2.72fr 2.6fr 4fr;
  gap: 0.375rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.tour__steps li { min-width: 0; }
.tour__step {
  position: relative;
  display: block;
  width: 100%;
  padding: 0.6875rem 0;
  border: 0;
  border-radius: 4px;
  background: none;
  color: inherit;
}
.tour__track {
  display: block;
  height: 5px;
  border-radius: 5px;
  background: rgb(255 255 255 / 0.3);
  overflow: hidden;
  transition: background-color 0.2s;
}
.tour__fill {
  display: block;
  height: 100%;
  background: var(--brand);
  transform: scaleX(var(--p, 0));
  transform-origin: left center;
}
.tour__step:hover .tour__track { background: rgb(255 255 255 / 0.55); }

/* Stationsname als Hinweis beim Überfahren oder per Tastatur */
.tour__step::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% - 0.125rem);
  left: 50%;
  translate: -50% 0;
  padding: 0.25rem 0.625rem;
  border-radius: var(--radius-pill);
  background: #fff;
  color: var(--ink);
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.tour__steps li:first-child .tour__step::after { left: 0; translate: none; }
.tour__steps li:last-child .tour__step::after { left: auto; right: 0; translate: none; }
.tour__step:hover::after,
.tour__step:focus-visible::after { opacity: 1; }

/* Ohne JavaScript bleiben nur Standbild und Beschriftung */
.tour:not(.is-ready) :is(.tour__play, .tour__toggle, .tour__steps) { visibility: hidden; }

/* „Klimatisiert“-Karte auf die Schulter des Bogens – dort zeigt das Video nur Decke */
.hero__media--tour .float-card--tour { top: 5%; left: -1rem; bottom: auto; right: auto; }
@media (min-width: 62rem) { .hero__media--tour .float-card--tour { left: -3rem; } }

/* Schmaler Rahmen (z. B. Laptop mit 1024 px): kürzere Überschrift, kleinere Karte.
   Auf dem Handy und bei gewählter großer Schrift (A+/A++) bleibt die Karte groß. */
@container tour-media (max-width: 25rem) {
  .tour__kicker-more { display: none; }
}
@media (min-width: 34.01rem) {
  @container tour-media (max-width: 26rem) {
    :root:not([data-font]) .hero__media--tour .float-card--tour { left: -1.5rem; gap: 0.625rem; padding: 0.5rem 0.875rem 0.5rem 0.5rem; }
    :root:not([data-font]) .float-card--tour .icon-badge { width: 2.5rem; height: 2.5rem; border-radius: 0.75rem; }
    :root:not([data-font]) .float-card--tour .icon-badge .icon { width: 1.25rem; height: 1.25rem; }
    :root:not([data-font]) .float-card--tour strong { font-size: 1.125rem; }
    :root:not([data-font]) .float-card--tour span { font-size: 0.8125rem; }
  }
}

/* --------------------------------------------------------------------------
   Intro: Die Physio-Plus-Figur öffnet den Rundgang.
   1) Figur erscheint auf dunkler Fläche  2) das Video läuft in der Figur
   3) Flug durch den Pinselstrich, das ganze Video wird sichtbar.
   Nur bei html.tour-intro (einmal pro Sitzung, nie bei „Bewegung reduzieren“
   oder Datensparmodus – das entscheidet das Skript im <head>).
   -------------------------------------------------------------------------- */
.tour__intro { display: none; z-index: 4; pointer-events: none; }
.tour-intro .tour__intro { display: block; }
.tour.is-revealed .tour__intro { display: none; }

/* Beschriftung und Knöpfe erst nach dem Intro – sonst schimmern sie durch die Figur */
.tour::after,
.tour__bar { transition: opacity 0.6s ease, visibility 0.6s; }
.tour-intro .tour:not(.is-revealed)::after,
.tour-intro .tour:not(.is-revealed) .tour__bar,
.tour-intro .tour:not(.is-revealed) .tour__play { opacity: 0; visibility: hidden; }
/* Notbremse: Lädt rundgang.js nicht, verschwindet das Intro von selbst */
.tour-intro .tour:not(.is-ready) .tour__intro { animation: tour-fade 0.5s ease 3s both; }

.tour__cover { fill: var(--forest); }
.tour__cut { stroke-width: 0; }
.tour__ink {
  color: var(--brand);
  fill: #dfe6dc;
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: tour-ink-in 0.8s var(--ease) both;
}
/* Mittelpunkt des Flugs: im Arm der Figur (Figur-Koordinate 59/50 → 211/140) */
.tour__zoom { transform-origin: 211px 140px; }

.tour.is-revealing .tour__ink { animation: tour-fade 0.5s ease both; }
.tour.is-revealing .tour__cut { animation: tour-cut 2.05s both; }
.tour.is-revealing .tour__zoom { animation: tour-zoom 1.05s cubic-bezier(0.6, 0, 0.9, 0.35) 0.95s both; }
.tour.is-revealing .tour__shade { animation: tour-fade 0.35s ease 1.7s both; }

@keyframes tour-ink-in { from { opacity: 0; transform: translateY(14px) scale(0.92); } }
@keyframes tour-fade { to { opacity: 0; visibility: hidden; } }
/* Striche: erst kräftig (Video wird in der Figur sichtbar), dann beim Flug immer breiter */
@keyframes tour-cut {
  0% { stroke-width: 0; animation-timing-function: cubic-bezier(0.2, 0.7, 0.2, 1); }
  29% { stroke-width: 4.5; }
  46% { stroke-width: 4.5; animation-timing-function: cubic-bezier(0.6, 0, 0.9, 0.35); }
  100% { stroke-width: 26; }
}
@keyframes tour-zoom { to { transform: scale(60); } }

/* Großes Rundgang-Video im Abschnitt „Unsere Räumlichkeiten“ */
.tour-film { margin: 0; }
.tour-film video {
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  background: var(--forest);
  box-shadow: var(--shadow);
}
.tour-film figcaption { margin-top: 0.75rem; font-size: 0.9375rem; color: var(--ink-soft); }

@media print {
  .hero__media--tour, .tour-film { display: none !important; }
}
