/* ═══════════════════════════════════════════════════════════
   PÁGINA VÍDEOS — Reciprocidalismo
   ═══════════════════════════════════════════════════════════ */

/* ── HERO ── */
.videos-hero {
    padding: 7rem 0 4rem;
    text-align: center;
}

.videos-hero-inner {
    max-width: 640px;
    margin: 0 auto;
}

.videos-hero-title {
    font-family: var(--font-serif);
    font-size: clamp(2.25rem, 5vw, 3.5rem);
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: -0.03em;
    color: var(--color-primary);
    margin: var(--s-3) 0 var(--s-5);
    margin-bottom: 10px;
}

.videos-hero-desc {
    font-size: var(--fs-base);
    line-height: var(--lh-relaxed);
    color: var(--color-text-soft);
    margin: 0;
}

/* ── FILTROS ── */
.videos-filters-wrap {
    padding: 0 0 var(--s-8);
    margin-bottom: var(--s-8);
    position: relative;
    z-index: 30;
}

.videos-filters {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: var(--s-7);
    flex-wrap: wrap;
    position: relative;
}

.videos-filter-group {
    display: flex;
    align-items: center;
    gap: var(--s-3);
    flex-wrap: wrap;
    position: relative;
}

.videos-filter-pills {
    display: flex;
    align-items: center;
    gap: var(--s-2);
    flex-wrap: wrap;
}

/* Botão de filtro */
.videos-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 1rem;
    font-family: var(--font-sans);
    font-size: var(--fs-xs);
    font-weight: 500;
    color: var(--color-text-soft);
    background: #ffffffcc;
    border: 1px solid var(--color-line-soft);
    border-radius: 8px;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
    transition: all var(--dur-fast) var(--ease-out);
}

.videos-pill:hover {
    color: var(--color-primary);
    border-color: var(--color-line-strong);
    background: var(--color-surface-alt);
}

.videos-pill.is-active {
    color: var(--color-bg-cream);
    background: var(--color-primary);
    border-color: var(--color-primary);
}

.videos-pill.is-active:hover {
    background: var(--color-primary-800);
    border-color: var(--color-primary-800);
    color: var(--color-bg-cream);
}

.videos-pill:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ═══════════════════════════════════════════════════════════
   SELECT CUSTOM (escondido no desktop)
   ═══════════════════════════════════════════════════════════ */
.videos-mobile-select-wrap {
    display: none;
}

/* ═══════════════════════════════════════════════════════════
   GRID DE VÍDEOS + LOADING
   ═══════════════════════════════════════════════════════════ */
.videos-posts-section {
    position: relative;
    padding-top: 0;
    min-height: 500px;
}

.videos-posts-container {
    transition: opacity 200ms var(--ease-out);
    will-change: opacity;
}

/* ── LOADING OVERLAY ── */
.videos-loading-overlay {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    padding-top: 4rem;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    z-index: 10;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 240ms var(--ease-out),
                visibility 240ms var(--ease-out);
}

.videos-posts-section.is-loading .videos-loading-overlay {
    opacity: 1;
    visibility: visible;
}

.videos-posts-section.is-loading .videos-posts-container {
    opacity: 0.35;
    pointer-events: none;
}

.videos-loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--color-line-soft);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: videos-spin 0.8s linear infinite;
}

@keyframes videos-spin {
    to { transform: rotate(360deg); }
}

/* ── ESTADO VAZIO ── */
.videos-empty {
    text-align: center;
    padding: var(--s-12) 0;
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.videos-empty svg,
.videos-empty .icon {
    color: var(--color-text-light);
    margin-bottom: var(--s-5);
}

.videos-empty h2 {
    font-family: var(--font-serif);
    font-size: var(--fs-lg);
    color: var(--color-primary);
    margin-bottom: var(--s-3);
}

.videos-empty p {
    font-size: var(--fs-sm);
    color: var(--color-text-muted);
    margin-bottom: var(--s-6);
}

/* ═══════════════════════════════════════════════════════════
   CARD DE VÍDEO — Overlay de play
   ═══════════════════════════════════════════════════════════ */

/* Tag de tipo no meta */
.card-meta-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.15rem 0.55rem;
    font-family: var(--font-sans);
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-primary);
    background: rgba(27, 54, 41, 0.08);
    border: 1px solid rgba(27, 54, 41, 0.15);
    border-radius: var(--radius-full);
    line-height: 1.4;
    white-space: nowrap;
    flex-shrink: 0;
}

.card-play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: rgba(27, 54, 41, 0.85);
    border-radius: 50%;
    color: var(--color-bg-cream);
    opacity: 0;
    transition: opacity var(--dur-fast) var(--ease-out),
                transform var(--dur-fast) var(--ease-out);
    pointer-events: none;
    z-index: 2;
}

.card:hover .card-play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVO
   ═══════════════════════════════════════════════════════════ */

/* ── Tablet / Desktop pequeno (até 1024px) ── */
@media (max-width: 1024px) {
    .videos-hero {
        padding: 7rem 0 3rem;
    }

    .videos-filters {
        gap: var(--s-5);
    }
}

/* ── Mobile landscape / Tablet portrait (até 768px) ── */
@media (max-width: 768px) {
    .section {
        padding-top: 0 !important;
    }

    .videos-hero {
        padding: 5.5rem 0 2rem;
    }

    .videos-hero-title {
        font-size: clamp(1.6rem, 6vw, 2.25rem);
        margin-bottom: 8px;
    }

    .videos-hero-desc {
        font-size: var(--fs-sm);
        max-width: 480px;
    }

    .videos-filters-wrap {
        padding-bottom: var(--s-5);
        margin-bottom: var(--s-5);
    }

    .videos-filters {
        flex-direction: row;
        align-items: flex-start;
        gap: var(--s-3);
    }

    .videos-filter-group {
        width: auto;
        flex: 1;
        justify-content: center;
    }

    .videos-filter-pills {
        justify-content: center;
    }

    /* Esconde pills, mostra selects no mobile */
    .videos-filter-group-pills .videos-filter-pills {
        display: none;
    }

    .videos-mobile-select-wrap {
        display: block;
        width: 100%;
        position: relative;
        z-index: 40;
    }

    .videos-mobile-label {
        display: block;
        font-family: var(--font-sans);
        font-size: 0.6rem;
        font-weight: 600;
        letter-spacing: 0.06em;
        text-transform: uppercase;
        color: var(--color-text-muted);
        margin-bottom: 4px;
    }

    .videos-select-custom {
        position: relative;
        width: 100%;
        background: var(--color-bg-cream);
        border: 1.5px solid var(--color-line-soft);
        border-radius: var(--radius);
        cursor: pointer;
        user-select: none;
        transition: border-color var(--dur-fast) var(--ease-out);
        z-index: 40;
    }

    .videos-select-custom:hover {
        border-color: var(--color-line-strong);
    }

    .videos-select-custom.is-open {
        border-color: var(--color-primary);
        box-shadow: 0 0 0 3px rgba(27, 54, 41, 0.1);
        z-index: 100;
    }

    .videos-select-current {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.55rem 0.75rem;
        font-family: var(--font-sans);
        font-size: var(--fs-xs);
        font-weight: 500;
        color: var(--color-text);
        line-height: 1.3;
    }

    .videos-select-arrow {
        position: absolute;
        right: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--color-text-muted);
        pointer-events: none;
        transition: transform var(--dur-fast) var(--ease-out);
    }

    .videos-select-custom.is-open .videos-select-arrow {
        transform: translateY(-50%) rotate(180deg);
    }

    .videos-select-options {
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        margin: 4px 0 0;
        padding: 4px 0;
        background: var(--color-surface);
        border: 1px solid var(--color-line-soft);
        border-radius: var(--radius);
        box-shadow: var(--shadow-lg);
        list-style: none;
        z-index: 200;
        opacity: 0;
        visibility: hidden;
        transform: translateY(-6px);
        transition: opacity var(--dur-fast) var(--ease-out),
                    visibility var(--dur-fast) var(--ease-out),
                    transform var(--dur-fast) var(--ease-out);
        max-height: 260px;
        overflow-y: auto;
    }

    .videos-select-custom.is-open .videos-select-options {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

    .videos-select-option {
        padding: 0.5rem 0.75rem;
        font-family: var(--font-sans);
        font-size: var(--fs-xs);
        color: var(--color-text-soft);
        cursor: pointer;
        transition: background var(--dur-fast) var(--ease-out),
                    color var(--dur-fast) var(--ease-out);
    }

    .videos-select-option:hover {
        background: var(--color-surface-alt);
        color: var(--color-primary);
    }

    .videos-select-option.is-selected {
        font-weight: 600;
        color: var(--color-primary);
        background: rgba(27, 54, 41, 0.06);
    }

    .videos-posts-section {
        min-height: 400px;
    }

    /* Cards horizontais no mobile */
    .cards-grid {
        grid-template-columns: 1fr;
    }

    .card-video {
        flex-direction: row;
    }

    .card-video .card-media {
        width: 140px;
        min-height: 100px;
        aspect-ratio: auto;
        flex-shrink: 0;
    }

    .card-video .card-body {
        flex: 1;
        min-width: 0;
        padding: var(--s-4) var(--s-5);
        display: flex;
        flex-direction: column;
        gap: 4px;
    }

    .card-video .card-excerpt {
        display: none;
    }

    .card-video .card-title {
        font-size: 0.9rem !important;
        line-height: 1.35;
    }

    .card-video .card-footer {
        margin-top: auto;
        padding-top: 4px;
    }
}

/* ── Mobile pequeno (até 480px) ── */
@media (max-width: 480px) {
    .video-modal {
        padding: 0.75rem;
    }

    .video-modal-dialog {
        max-height: calc(100vh - 1.5rem);
        border-radius: 10px;
    }

    .video-modal-info {
        padding: 0.85rem 1rem 1rem;
        max-height: 30vh;
    }

    .video-modal-title {
        font-size: 1rem;
        margin-bottom: 0.4rem;
    }

    .video-modal-desc {
        font-size: 0.8rem;
        line-height: 1.55;
    }

    .video-modal-close {
        top: 6px;
        right: 6px;
        width: 32px;
        height: 32px;
    }

    .video-modal-close svg {
        width: 16px;
        height: 16px;
    }
}

/* ── Mobile muito pequeno (até 360px) ── */
@media (max-width: 360px) {
    .videos-hero {
        padding: 4rem 0 1.25rem;
    }

    .videos-hero-title {
        font-size: 1.3rem;
    }

    .videos-filter-pills {
        gap: 4px;
    }

    .videos-pill {
        padding: 0.3rem 0.6rem;
        font-size: 0.65rem;
    }

    .card-video .card-media {
        width: 95px;
        min-height: 75px;
    }
}

/* ═══════════════════════════════════════════════════════════
   MODAL DE VÍDEO
   ═══════════════════════════════════════════════════════════ */

/* ── Reset botões do card (modal trigger) ── */
.card-media-btn {
    all: unset;
    display: block;
    width: 100%;
    cursor: pointer;
    position: relative;
}

.card-media-btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.card-title-btn {
    all: unset;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.card-title-btn:hover {
    color: var(--color-accent-dark);
}

.card-title-btn:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

.card-link-btn {
    all: unset;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-family: var(--font-sans);
    font-size: var(--fs-sm);
    font-weight: 600;
    color: var(--color-primary);
}

.card-link-btn:hover {
    color: var(--color-accent-dark);
}

.card-link-btn svg {
    transition: transform 0.2s ease;
}

.card-link-btn:hover svg {
    transform: translateX(3px);
}

/* ── Modal ── */
.video-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 260ms var(--ease-out),
                visibility 0s linear 260ms;
}

.video-modal.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity 260ms var(--ease-out),
                visibility 0s linear 0s;
}

/* ── Fundo escurecido ── */
.video-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 16, 12, 0.88);
    pointer-events: none;
}

/* ── Dialog ── */
.video-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 900px;
    max-height: calc(100vh - 3rem);
    display: flex;
    flex-direction: column;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    transform: scale(0.94) translateY(12px);
    transition: transform 320ms var(--ease-out);
    will-change: transform;
    /* CORREÇÃO: força altura pelo conteúdo */
    height: auto;
    align-self: center;
}

.video-modal.is-open .video-modal-dialog {
    transform: scale(1) translateY(0);
}

/* ── Frame do vídeo ── */
.video-modal-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    flex-shrink: 0;
}

.video-modal-player {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-modal-player iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
    touch-action: manipulation;
}

.video-modal-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    outline: none;
    touch-action: manipulation;
}

/* ── Info (título + descrição) ── */
.video-modal-info {
    padding: 1.25rem 1.5rem 1.5rem;
    overflow-y: auto;
    /* CORREÇÃO: NÃO estica, ocupa só o conteúdo */
    flex: 0 0 auto;
    max-height: 40vh;
    background: #fff;
}
.video-modal-title {
    font-family: var(--font-serif);
    font-size: clamp(1.05rem, 2vw, 1.3rem);
    font-weight: 700;
    line-height: 1.25;
    color: var(--color-primary);
    margin: 0 0 0.6rem;
}

.video-modal-desc {
    font-family: var(--font-sans);
    font-size: var(--fs-sm);
    line-height: 1.65;
    color: var(--color-text-muted);
    margin: 0;
}

/* ── Loader ── */
.video-modal-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 42px;
    height: 42px;
    margin: -21px 0 0 -21px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--color-accent, #E0B44A);
    animation: vmodal-spin 800ms linear infinite;
    z-index: 1;
    opacity: 0;
    transition: opacity 200ms;
}

.video-modal.is-loading .video-modal-loader {
    opacity: 1;
}

@keyframes vmodal-spin {
    to { transform: rotate(360deg); }
}

/* ── Botão fechar ── */
.video-modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    transition: background 200ms var(--ease-out),
                transform 200ms var(--ease-out);
}

.video-modal-close:hover,
.video-modal-close:focus-visible {
    background: var(--color-accent, #E0B44A);
    color: var(--color-primary, #1a2f22);
    transform: rotate(90deg);
    outline: none;
}

/* ── Bloqueia scroll ── */
body.video-modal-open {
    overflow: hidden;
}

/* ── Responsivo ── */
@media (max-width: 768px) {
    .video-modal {
        padding: 4rem 1rem 1rem;   /* espaço no topo para o botão */
        align-items: center;
    }

    .video-modal-dialog {
        max-width: 100%;
        max-height: calc(100vh - 5rem);
        height: auto;
        border-radius: 12px;
        overflow: visible;         /* permite o botão sair do dialog */
    }

    /* Botão FORA do dialog, no topo direito da tela */
    .video-modal-close {
        position: fixed;
        top: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
        background: rgba(255, 255, 255, 0.15);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        border: 1.5px solid rgba(255, 255, 255, 0.25);
        color: #fff;
        z-index: 10;
    }

    .video-modal-close:hover,
    .video-modal-close:focus-visible {
        background: rgba(255, 255, 255, 0.25);
        border-color: rgba(255, 255, 255, 0.5);
        color: #fff;
    }

    /* Frame precisa manter o border-radius já que overflow foi para visible */
    .video-modal-frame {
        border-radius: 12px 12px 0 0;
        overflow: hidden;
    }

    .video-modal-info {
        padding: 1rem 1.25rem 1.25rem;
        max-height: 35vh;
        border-radius: 0 0 12px 12px;
    }
}

@media (max-width: 480px) {
    .video-modal {
        padding: 3.5rem 0.75rem 0.75rem;   /* topo maior para o botão */
    }

    .video-modal-dialog {
        max-height: calc(100vh - 4.5rem);
        border-radius: 10px;
    }

    .video-modal-frame {
        border-radius: 10px 10px 0 0;
    }

    .video-modal-info {
        padding: 0.85rem 1rem 1rem;
        max-height: 30vh;
        border-radius: 0 0 10px 10px;
    }

    .video-modal-title {
        font-size: 1rem;
        margin-bottom: 0.4rem;
    }

    .video-modal-desc {
        font-size: 0.8rem;
        line-height: 1.55;
    }

    /* Botão fixo no canto superior direito da tela */
    .video-modal-close {
        top: 0.65rem;
        right: 0.65rem;
        width: 40px;
        height: 40px;
    }

    .video-modal-close svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-height: 500px) and (orientation: landscape) {
    .video-modal {
        padding: 0.5rem;
        align-items: center;
    }

    .video-modal-dialog {
        max-height: calc(100vh - 1rem);
        max-width: min(700px, 82vh * (16 / 9));
        flex-direction: row;   /* vídeo à esquerda, info à direita */
    }

    .video-modal-frame {
        flex: 1 1 auto;
        aspect-ratio: 16 / 9;
        max-width: 60%;
    }

    .video-modal-info {
        flex: 0 0 40%;
        max-height: none;
        padding: 0.75rem 1rem;
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .video-modal-title {
        font-size: 0.95rem;
        margin-bottom: 0.4rem;
    }

    .video-modal-desc {
        font-size: 0.75rem;
        line-height: 1.45;
    }
}


/* ═══════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    .videos-loading-spinner {
        animation-duration: 2s;
    }

    .videos-posts-container,
    .videos-loading-overlay {
        transition: none;
    }

    .card-play-icon {
        transition: none;
    }

    .video-modal,
    .video-modal-dialog,
    .video-modal-close {
        transition: none;
    }

    .video-modal-loader {
        animation: none;
    }
}
