/*
 * HostKlar — Erklärclip-Player (eigene Datei, style.css bleibt unberührt).
 *
 * Kontrakt-Markup aus engine/clips.py: .clip > .clip-video? > .clip-stage >
 * .clip-step (figure + figcaption.clip-caption) / .clip-nav / .clip-auto /
 * .clip-transcript. Farben über die Bestands-Variablen (mit Fallbacks).
 *
 * Didaktik 45–70: Schrift >= 1.125rem, Buttons >= 48px, sichtbare Fokus-Ringe,
 * Fade-Übergang NUR ohne prefers-reduced-motion, Druck ohne Navigation.
 */

.clip {
  max-width: 860px;
  margin: 0 auto;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--c-ink, #1b2a24);
}

/* --- Video-Slot (Stufe B): erscheint automatisch, wenn MP4 vorliegt --- */
.clip-video {
  margin: 0 0 16px;
}
.clip-video video {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--r-md, 10px);
  background: var(--c-ink, #1b2a24);
}

/* --- Bühne: 16:9, Schritte übereinander gestapelt --- */
.clip-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--c-surface, #ffffff);
  border: 1px solid var(--c-line, #e4e7e1);
  border-radius: var(--r-md, 10px);
  overflow: hidden;
}

.clip-step {
  position: absolute;
  inset: 0;
  margin: 0;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  opacity: 0;
  pointer-events: none;
}
.clip-step.is-active {
  opacity: 1;
  pointer-events: auto;
}
.clip-step[hidden] {
  display: flex; /* hidden-Attribut steuert nur a11y/JS; Sichtbarkeit macht opacity */
}
.clip-step:not(.is-active) {
  visibility: hidden;
}

.clip-step svg {
  flex: 1 1 auto;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: block;
}

.clip-caption {
  flex: 0 0 auto;
  font-size: 1.125rem;
  line-height: 1.5;
  padding: 10px 6px 2px;
  color: var(--c-ink, #1b2a24);
  background: var(--c-surface, #ffffff);
}

/* Fade NUR, wenn keine reduzierte Bewegung gewünscht ist. */
@media (prefers-reduced-motion: no-preference) {
  .clip-step {
    transition: opacity 0.45s ease;
  }
}

/* --- Navigation: Wörter statt Icons, grosse Ziele --- */
.clip-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.clip-prev,
.clip-next {
  min-height: 48px;
  min-width: 110px;
  padding: 10px 22px;
  font-size: 1.125rem;
  font-weight: 600;
  border-radius: var(--r-sm, 6px);
  border: 1px solid var(--c-brand, #1f5c46);
  background: var(--c-brand, #1f5c46);
  color: #ffffff;
  cursor: pointer;
}
.clip-prev:hover,
.clip-next:hover {
  background: var(--c-brand-600, #184a38);
}
.clip-prev:disabled,
.clip-next:disabled {
  background: var(--c-surface-alt, #f0ece2);
  border-color: var(--c-line-strong, #c7d0c7);
  color: var(--c-muted, #566459);
  cursor: default;
}

/* Fortschrittspunkte: je Schritt ein Button, >= 48px Touch-Ziel */
.clip-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
}
.clip-dots li {
  display: block;
}
.clip-dot {
  display: block;
  width: 48px;
  height: 48px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.clip-dot::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--c-line-strong, #c7d0c7);
}
.clip-dot:hover::after {
  background: var(--c-brand-600, #184a38);
}
.clip-dot[aria-current="step"]::after {
  background: var(--c-brand, #1f5c46);
  width: 18px;
  height: 18px;
}

/* --- Autoplay-Toggle (default AUS; bei reduced-motion per JS versteckt) --- */
.clip-auto {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  min-height: 48px;
  font-size: 1.125rem;
  color: var(--c-ink-soft, #46554d);
  cursor: pointer;
  width: fit-content;
}
.clip-auto input[type="checkbox"] {
  width: 24px;
  height: 24px;
  accent-color: var(--c-brand, #1f5c46);
  cursor: pointer;
}
.clip-auto[hidden] {
  display: none;
}

/* --- Transkript --- */
.clip-transcript {
  margin-top: 14px;
  border: 1px solid var(--c-line, #e4e7e1);
  border-radius: var(--r-sm, 6px);
  background: var(--c-surface-alt, #f0ece2);
  padding: 4px 14px;
}
.clip-transcript summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--c-brand, #1f5c46);
  cursor: pointer;
}
.clip-transcript p {
  font-size: 1.125rem;
  line-height: 1.7;
  margin: 6px 0 12px;
}

/* --- Fokus-Ringe: deutlich sichtbar (Tastatur-Nutzung) --- */
.clip button:focus-visible,
.clip input:focus-visible,
.clip summary:focus-visible {
  outline: 3px solid var(--c-brand, #1f5c46);
  outline-offset: 2px;
  border-radius: var(--r-sm, 6px);
}

/* --- Druck: Navigation/Toggle ausblenden, alle Schritte untereinander --- */
@media print {
  .clip-nav,
  .clip-auto,
  .clip-video {
    display: none !important;
  }
  .clip-stage {
    aspect-ratio: auto;
    border: none;
    overflow: visible;
  }
  .clip-step,
  .clip-step:not(.is-active) {
    position: static;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    page-break-inside: avoid;
    padding: 0 0 18px;
  }
  .clip-step svg {
    max-height: 45vh;
  }
  .clip-transcript {
    border: none;
    background: none;
    padding: 0;
  }
  .clip-transcript summary {
    display: none;
  }
  .clip-transcript p {
    display: block;
  }
}

/* --- Schmale Screens: Nav bleibt bedienbar --- */
@media (max-width: 560px) {
  .clip-nav {
    justify-content: center;
  }
  .clip-dots {
    order: -1;
    flex-basis: 100%;
  }
  .clip-prev,
  .clip-next {
    flex: 1 1 40%;
  }
}

/* --- Schmale Screens: Bühne entclippen (Chairman-Plan Nr. 12, 2026-07-05) ---
   Untertitel laufen mobil nicht mehr ins overflow:hidden; der Crossfade wird
   dort bewusst geopfert (Lesbarkeit > Animation). Ab 561px alles unverändert. */
@media (max-width: 560px) {
  .clip-stage {
    aspect-ratio: auto;
    overflow: visible;
  }
  .clip-step {
    position: static;
  }
  .clip-step:not(.is-active),
  .clip-step[hidden] {
    display: none;
  }
  .clip-step svg {
    aspect-ratio: 16 / 9;
    flex: none;
    height: auto;
  }
}
