/**
 * FONDAZIONE ARMANDO - ARMANDO PAGE VIDEO ARCHIVE STYLES
 * 
 * Stili per l'archivio video nella pagina Armando
 */

/* Page Layout */
.armando-page-layout {
    padding: 40px 0 60px 0;
}

.armando-section-header {
    margin-bottom: 2rem;
    text-align: center;
}

.armando-section-header h2 {
    margin-bottom: 0.5rem;
    font-size: 2rem;
    font-weight: 600;
    color: #000;
}

.armando-section-subtitle {
    color: #666;
    font-size: 0.95rem;
    margin-bottom: 0;
}

/* Gallery Section */
.armando-gallery-section {
    margin-bottom: 80px;
}

.armando-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 2rem;
}

/* Stili specifici per le immagini della galleria Armando */
.armando-gallery-grid .gallery-thumb {
    border: none !important;
    padding: 0 !important;
    margin: 0 !important;
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #000;
    width: 100%;
    display: block;
    aspect-ratio: 1 / 1; /* Card quadrate uniformi */
    position: relative;
    outline: none;
}

.armando-gallery-grid .gallery-thumb img {
    width: 100% !important;
    height: 100% !important;
    display: block;
    transition: transform 0.3s ease;
    object-fit: cover;
    object-position: center;
    position: absolute;
    top: 0;
    left: 0;
    border: none !important;
    border-radius: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
}

.armando-gallery-grid .gallery-thumb:hover,
.armando-gallery-grid .gallery-thumb:focus-visible {
    transform: translateY(-4px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}

.armando-gallery-grid .gallery-thumb:hover img,
.armando-gallery-grid .gallery-thumb:focus-visible img {
    transform: scale(1.05);
}

/* Video Archive Section */
.armando-videos-section {
    margin-top: 60px;
    margin-bottom: 80px;
}

.armando-videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 30px;
}

/* Responsive grid per video */
@media (max-width: 768px) {
    .armando-videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
}

@media (max-width: 480px) {
    .armando-videos-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Video Item */
.video-item {
    cursor: pointer;
    transition: transform 0.3s ease;
}

.video-item:hover {
    transform: translateY(-4px);
}

.video-thumbnail-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    transition: box-shadow 0.3s ease;
    aspect-ratio: 16 / 9; /* Supporto moderno per aspect ratio */
}

.video-item:hover .video-thumbnail-wrapper {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.video-thumbnail {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s ease;
}

.video-item:hover .video-thumbnail {
    opacity: 0;
}

.video-preview-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    visibility: hidden;
    border: none;
    object-fit: cover;
}

.video-item:hover .video-preview-iframe {
    opacity: 1;
    visibility: visible;
}

.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease, opacity 0.3s ease;
    z-index: 2;
    /* Solo effetto visivo: lascia passare i clic all'iframe/thumbnail sotto */
    pointer-events: none;
}

.video-item:hover .video-overlay {
    background: rgba(0, 0, 0, 0.1);
    opacity: 0;
}

.video-play-icon {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, background 0.3s ease;
    color: #333;
}

.video-play-icon i {
    font-size: 22px;
    margin-left: 3px; /* Offset per centrare visivamente */
}

.video-item:hover .video-play-icon {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 1);
}

.video-title {
    margin-top: 1rem;
    margin-bottom: 0;
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.4;
    color: #333;
}

/* Video Modal */
.armando-video-modal[aria-hidden="false"] {
    display: block;
}

.armando-video-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: none; /* Nascosta di default */
}

.armando-video-modal[hidden],
.armando-video-modal[style*="display: none"] {
    display: none !important;
}

/* Assicura che il backdrop sia nascosto quando la modale è nascosta */
.armando-video-modal[hidden] .video-modal-backdrop,
.armando-video-modal[style*="display: none"] .video-modal-backdrop {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
}

.video-modal-backdrop {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(5, 12, 26, 0.85);
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    /* Non intercettare i clic: così l'iframe del video (e la progress bar) li riceve */
    pointer-events: none;
}

.armando-video-modal[aria-hidden="false"] .video-modal-backdrop {
    opacity: 1;
    visibility: visible;
}

.video-modal-dialog {
    position: absolute;
    inset: 40px 60px;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.video-modal-content {
    position: relative;
    width: 100%;
    max-width: 1200px;
    background: #000;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.5);
}

.video-modal-player-wrapper {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: #000;
    /* Cursore pointer: evita l'icona "divieto" del browser sugli iframe cross-origin */
    cursor: pointer;
}

.video-modal-player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    pointer-events: auto;
    /* Forza cursore pointer anche sull'iframe (override icona divieto su Firefox/Chrome) */
    cursor: pointer;
}

.video-modal-info {
    padding: 24px 32px;
    background: #fff;
}

.video-modal-title {
    margin: 0 0 12px 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #333;
}

.video-modal-description {
    color: #666;
    line-height: 1.6;
    font-size: 1rem;
}

.video-modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    z-index: 10;
}

.video-modal-close:hover,
.video-modal-close:focus-visible {
    background: rgba(0, 0, 0, 0.8);
}

.video-modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s ease;
    z-index: 10;
}

.video-modal-nav:hover,
.video-modal-nav:focus-visible {
    background: rgba(0, 0, 0, 0.85);
}

.video-modal-prev {
    left: 20px;
}

.video-modal-next {
    right: 20px;
}

/* Responsive */
@media (max-width: 768px) {
    .armando-videos-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 20px;
    }
    
    .video-modal-dialog {
        inset: 20px;
    }
    
    .video-modal-info {
        padding: 20px;
    }
    
    .video-modal-title {
        font-size: 1.25rem;
    }
    
    .video-modal-nav {
        width: 42px;
        height: 42px;
    }
    
    .video-modal-prev {
        left: 10px;
    }
    
    .video-modal-next {
        right: 10px;
    }
    
    .video-play-icon {
        width: 48px;
        height: 48px;
    }
    
    .video-play-icon i {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .armando-videos-grid {
        grid-template-columns: 1fr;
    }
    
    .armando-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .armando-gallery-grid .gallery-thumb {
        aspect-ratio: 1 / 1; /* Mantiene card quadrate anche su mobile */
    }
    
    .video-modal-dialog {
        inset: 10px;
    }
    
    .video-modal-info {
        padding: 16px;
    }
}
