/* ============================================================================
 * tc-media-viewer - Vollbild-Medien-Betrachter mit Info-Panel
 * ----------------------------------------------------------------------------
 * Generische Shell: grosses Bild links (Stage) + scrollbares Info-Panel rechts
 * (auf Mobile gestapelt). Die Buttons nutzen die tc-gallery-Lightbox-Klassen
 * (tc-gallery__close / tc-gallery__nav). Was ins Panel kommt, ist frei
 * komponierbar (z.B. tc-like-button + tc-comment-thread + tc-member-chips).
 * Ergaenzt die einfache tc-gallery-Lightbox (nur Bild + Nav) um Engagement.
 *
 * Slots:
 *   __inner · __stage (+ <img>) · __panel · __head (+ __head-info/__author/
 *   __date) · __body · __note · __section-label · __actions
 *   __close · __nav (--prev/--next) · __zaehler   (seit 16.09.2026, #681)
 *
 * Geoeffnet wird er ueber TC.Betrachter (js/ui/betrachter.js) — der eine
 * Betrachter fuer Galerie UND Werkbank-Album. Kreuz und Pfeile tragen seit
 * #681 eigene Klassen statt der geliehenen tc-gallery__close/__nav: Sonst
 * haengt der Betrachter an gallery.css, und die liegt nicht auf jeder Seite,
 * die ein Album oeffnet.
 * ============================================================================ */

.tc-media-viewer {
  position: fixed;
  inset: 0;
  z-index: var(--tc-z-modal, 1400);
  background: rgba(0,0,0,0.92);
  display: flex;
  animation: tc-media-viewer-fade 0.2s ease;
}
.tc-media-viewer__inner {
  display: flex;
  width: 100%;
  height: 100%;
}
.tc-media-viewer__stage {
  position: relative;
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--tc-space-4);
}
.tc-media-viewer__stage img {
  max-width: 100%;
  max-height: 92vh;
  object-fit: contain;
  border-radius: var(--tc-radius-md);
  box-shadow: 0 0 60px rgba(0,0,0,0.5);
  cursor: zoom-in;
}

/* Kreuz, Pfeile, Zaehler (#681, 16.09.2026).
   ⚠️ DIE PFEILE STEHEN AUF EINER DUNKLEN SCHEIBE. Tim am Werkbank-Album:
   „(nicht erkennbare) Chevrons (weiss auf weiss?)" — nackte Zeichen
   verschwinden auf einem hellen Foto. Die Scheibe ist dieselbe wie bei der
   Lupe (bild-zoom.css), damit alle Bedienelemente auf dem Bild gleich
   aussehen. Trefferflaeche 44px (Heuristik 5, am Bildrand eher mehr). */
.tc-media-viewer__close,
.tc-media-viewer__nav {
  -webkit-appearance: none;
  appearance: none;
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--tc-radius-full, 999px);
  background: rgba(20, 20, 20, 0.72);
  color: var(--tc-text-strong);
  font-family: inherit;
  line-height: 1;
  cursor: pointer;
  transition: background var(--tc-motion-fast), border-color var(--tc-motion-fast), color var(--tc-motion-fast);
}
.tc-media-viewer__close { top: var(--tc-space-3); right: var(--tc-space-3); font-size: 1.8rem; }
.tc-media-viewer__nav { top: 50%; transform: translateY(-50%); font-size: 1.9rem; }
.tc-media-viewer__nav--prev { left: var(--tc-space-3); }
.tc-media-viewer__nav--next { right: var(--tc-space-3); }
.tc-media-viewer__close:hover,
.tc-media-viewer__nav:hover {
  background: rgba(0, 0, 0, 0.88);
  border-color: var(--tc-highlight);
  color: var(--tc-highlight);
}
.tc-media-viewer__close:focus-visible,
.tc-media-viewer__nav:focus-visible {
  outline: 2px solid var(--tc-highlight);
  outline-offset: 2px;
}
.tc-media-viewer__zaehler {
  position: absolute;
  left: var(--tc-space-3);
  bottom: var(--tc-space-3);
  z-index: 1;
  padding: 4px 10px;
  border-radius: var(--tc-radius-full, 999px);
  background: rgba(20, 20, 20, 0.72);
  color: var(--tc-text-default);
  font-size: var(--tc-text-xs);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

/* Die Lupe auf der Buehne (14.09.2026). Gestalt: .tc-zoom-lupe in
   bild-zoom.css — derselbe Knopf wie im Werkbank-Album und in der
   Pathfinder-Chronik. Hier nur der groessere Abstand der Buehne. */
.tc-media-viewer__stage .tc-zoom-lupe {
  right: var(--tc-space-4);
  bottom: var(--tc-space-4);
}

/* Info-Panel rechts */
.tc-media-viewer__panel {
  flex: 0 0 372px;
  max-width: 372px;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--tc-bg-surface-2);
  border-left: 1px solid var(--tc-border-default);
}
.tc-media-viewer__head {
  display: flex;
  align-items: center;
  gap: var(--tc-space-3);
  padding: var(--tc-space-4);
  border-bottom: 1px solid var(--tc-border-subtle);
}
.tc-media-viewer__head-info { flex: 1; min-width: 0; }
.tc-media-viewer__author {
  font-family: var(--tc-font-display);
  font-size: var(--tc-text-base);
  color: var(--tc-text-strong);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tc-media-viewer__date { font-size: var(--tc-text-xs); color: var(--tc-text-muted); margin-top: 2px; }

.tc-media-viewer__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--tc-space-4);
  display: flex;
  flex-direction: column;
  gap: var(--tc-space-4);
}
.tc-media-viewer__note {
  font-size: var(--tc-text-sm);
  color: var(--tc-text-default);
  line-height: var(--tc-leading-normal);
  white-space: pre-wrap;
  word-break: break-word;
}
.tc-media-viewer__section-label {
  font-size: var(--tc-text-2xs);
  text-transform: uppercase;
  letter-spacing: var(--tc-tracking-wide);
  color: var(--tc-text-muted);
  margin-bottom: var(--tc-space-2);
}
.tc-media-viewer__actions {
  display: flex;
  gap: var(--tc-space-2);
  padding: var(--tc-space-3) var(--tc-space-4);
  border-top: 1px solid var(--tc-border-subtle);
  border-bottom: 1px solid var(--tc-border-subtle);
}

@keyframes tc-media-viewer-fade { from { opacity: 0; } to { opacity: 1; } }

/* Mobile: Bild oben, Panel darunter */
@media (max-width: 860px) {
  .tc-media-viewer__inner { flex-direction: column; }
  .tc-media-viewer__stage { flex: none; height: 46vh; padding: var(--tc-space-2); }
  .tc-media-viewer__stage img { max-height: 46vh; }
  .tc-media-viewer__panel {
    flex: 1;
    max-width: none;
    border-left: none;
    border-top: 1px solid var(--tc-border-default);
    min-height: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .tc-media-viewer__close,
  .tc-media-viewer__nav { transition-duration: 0.01ms; }
  .tc-media-viewer { animation-duration: 0.01ms;
 animation-iteration-count: 1;
 animation-delay: -1ms; }
}
