/* Base — Body als Flex-Column, füllt den Viewport exakt */
* { box-sizing: border-box; }

html { height: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 1rem;
    background-color: #f4f7fa;
    color: #333;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.back-link {
    display: inline-block;
    color: #2c3e50;
    text-decoration: none;
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    flex: 0 0 auto;
}
.back-link:hover { color: #3498db; }

h1 {
    text-align: center;
    margin: 0 0 0.3rem;
    font-size: 1.35rem;
    flex: 0 0 auto;
}

.collection-description {
    text-align: center;
    color: #555;
    margin: 0 auto 0.75rem;
    max-width: 820px;
    white-space: pre-line;
    font-size: 0.85rem;
    flex: 0 0 auto;
    max-height: 18vh;
    overflow-y: auto;
}

/* Status bar */
.status-bar {
    background-color: #fff8e6;
    border-bottom: 1px solid #ffd54f;
    padding: 0.4rem 1rem;
    text-align: center;
    margin: 0 0 0.75rem;
    flex: 0 0 auto;
}
.status-bar p {
    margin: 0;
    font-weight: 500;
    color: #e65100;
    font-size: 0.85rem;
}

/* ============================================================ */
/* Grid — füllt den restlichen Platz, JS setzt Spalten/Maße     */
/* ============================================================ */

#collection-grid {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

/* ============================================================ */
/* Tile                                                          */
/* ============================================================ */

.video-tile {
    position: relative;
    overflow: hidden;
    border-radius: 6px;
    cursor: pointer;
    background: #111;
    box-shadow: 0 1px 3px rgba(0,0,0,0.12);
    aspect-ratio: 9 / 16;      /* Fallback vor JS-Layout */
}
.video-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}
.video-tile:focus-visible {
    outline: 2px solid #3498db;
    outline-offset: 2px;
}

/* Poster (bleibt sichtbar, bis Video spielt) */
.video-poster-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    z-index: 0;
    user-select: none;
    -webkit-user-drag: none;
}

.video-tile.no-poster {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
}

/* Hover-Preview-Video */
.video-el {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
    display: block;
    z-index: 1;
    opacity: 0;
    transition: opacity 200ms ease-out;
}
.video-el.is-playing {
    opacity: 1;
}

/* Info-Overlay */
.video-info {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    padding: 0.3rem 0.4rem 1.4rem;
    background: linear-gradient(to bottom,
        rgba(0,0,0,0.85) 0%,
        rgba(0,0,0,0.35) 55%,
        transparent 100%);
    color: #fff;
    z-index: 2;
    pointer-events: none;
    max-height: 60%;          /* sehr lange Titel bleiben scrollbar */
    overflow-y: auto;
}
/* >>> SPEZIAL-MARKIERUNG: Titel nicht abschneiden <<<
   Vorher: -webkit-line-clamp: 2  → lange Titel wurden nach 2 Zeilen gekappt.
   Jetzt:  vollständige Anzeige, damit auch längere Titel sichtbar bleiben.
   Der gemeinsame Präfix "Der Ausgangspunkt" wird bereits in collection.js
   entfernt, sodass die verbleibenden Titel kompakt bleiben. */
.video-title {
    margin: 0;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1.25;
    text-shadow: 0 1px 2px rgba(0,0,0,0.7);
    word-break: break-word;
    overflow-wrap: anywhere;
    /* kein -webkit-line-clamp, kein overflow: hidden mehr */
}

.video-duration {
    display: inline-block;
    margin-top: 0.15rem;
    font-size: 0.62rem;
    background: rgba(0,0,0,0.65);
    padding: 0.05rem 0.3rem;
    border-radius: 3px;
    font-variant-numeric: tabular-nums;
}

/* ============================================================ */
/* Modal (Klick auf Kachel)                                      */
/* ============================================================ */

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0,0,0,0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-video {
    max-width: 100%;
    max-height: 100%;
    display: block;
    background: #000;
    border-radius: 4px;
}

.modal-close {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 10001;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255,255,255,0.92);
    border: none;
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.4);
    color: #111;
}
.modal-close:hover {
    background: #fff;
}

/* Fehler / leer */
.error-msg {
    text-align: center;
    color: #e74c3c;
    font-style: italic;
    margin-top: 2rem;
}

.video-info::after {
  margin-left: 0.3rem;
  font-size: 0.6rem;
  opacity: 0.7;
}

/* Responsive */
@media (max-width: 640px) {
    body { padding: 0.6rem; }
    h1 { font-size: 1.1rem; }
    .video-title { font-size: 0.62rem; }
    .collection-description { font-size: 0.8rem; max-height: 14vh; }

    .modal-backdrop { padding: 0.5rem; }
    .modal-close {
        width: 38px; height: 38px;
        font-size: 1.3rem;
        top: 10px; right: 10px;
    }
}