/* static/css/video.css */
/*
 * Видео-карточки и модальное окно.
 * CSP: без inline styles в JS — управляем состояниями через классы.
 */

/* ─── Video Card ──────────────────────────────────────────── */

.video-card {
    display: block;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.video-card:hover {
    transform: translateY(-4px);
}

.video-card__poster {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-primary-light) 0%, var(--color-secondary-light) 100%);
    aspect-ratio: 9 / 16;
}

.video-card__poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-card__poster-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
}

.video-card__poster-placeholder i {
    width: 3rem;
    height: 3rem;
    color: var(--color-muted);
    opacity: 0.5;
}

.video-card__play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, 0.1);
    opacity: 1;
    transition: all 0.3s ease;
}

.video-card:hover .video-card__play {
    background: rgba(17, 24, 39, 0.2);
}

.video-card__play-btn {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(229, 231, 235, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-lg);
    transition: all 0.3s ease;
}

.video-card:hover .video-card__play-btn {
    transform: scale(1.1);
    box-shadow: var(--shadow-xl);
}

.video-card__play-btn i {
    width: 1.25rem;
    height: 1.25rem;
    color: var(--color-text);
    margin-left: 2px;
}

.video-card__badge {
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 5;
}

.video-card__content {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.video-card__kicker {
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--color-muted);
    margin-bottom: 0.375rem;
}

.video-card__title {
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--color-text);
    line-height: 1.4;
    transition: color 0.2s ease;
}

.video-card:hover .video-card__title {
    color: var(--color-primary);
}

.video-card__desc {
    font-size: 0.75rem;
    color: var(--color-muted);
    line-height: 1.5;
    margin-top: 0.375rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ─── Video Modal (CSP-safe loader) ───────────────────────── */

.video-modal__loading {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(17, 24, 39, 0.8);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);

    /* Loader never blocks clicks on player */
    pointer-events: none;

    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.video-modal__loading.is-visible {
    opacity: 1;
    visibility: visible;
}

.video-modal__loading-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.video-modal__spinner {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: white;
    animation: videoSpinner 0.8s linear infinite;
}

.video-modal__loading-text {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
}

@keyframes videoSpinner {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ─── Modal Base Styles ───────────────────────────────────── */

.video-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 80;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.video-modal.is-open {
    display: flex;
}

.video-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17, 24, 39, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    cursor: pointer;
    animation: modalFadeIn 0.25s ease-out;
}

.video-modal__panel {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: 90vh;
    background: var(--color-text);
    border-radius: 1.5rem;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.5);
    animation: modalSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.video-modal__panel.is-vertical {
    max-width: 400px;
}

.video-modal__close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 30;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.video-modal__close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.video-modal__media {
    position: relative;
    width: 100%;
    background: #000;
    flex-grow: 1;
}

.video-modal__media.is-horizontal {
    aspect-ratio: 16 / 9;
}

.video-modal__media.is-vertical {
    aspect-ratio: 9 / 16;
}

.video-modal__video,
.video-modal__iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: none;
    background: #000;
    z-index: 1;
}

.video-modal__meta {
    padding: 1.25rem;
    background: var(--color-text);
}

.video-modal__title {
    font-family: 'Oswald', sans-serif;
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    margin-bottom: 0.25rem;
}

.video-modal__desc {
    font-size: 0.875rem;
    color: rgba(255, 255, 255, 0.6);
    line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
    .video-modal__backdrop,
    .video-modal__panel,
    .video-modal__spinner {
        animation: none !important;
    }
}