/* ==========================================================================
   Grid de pastillas — CSS Grid puro, mobile-first, sin frameworks.
   ========================================================================== */

.gpv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr));
    gap: 12px;
    padding: 12px;
    max-width: 1400px;
    margin: 0 auto;
}

@media (min-width: 360px) {
    .gpv-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

@media (min-width: 480px) {
    .gpv-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 600px) and (orientation: landscape) {
    .gpv-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 768px) {
    .gpv-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; padding: 20px; }
}

@media (min-width: 1024px) {
    .gpv-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 1280px) {
    .gpv-grid { grid-template-columns: repeat(5, 1fr); gap: 20px; }
}





/* ==========================================================================
   Pastilla (Tarjeta)
   ========================================================================== */

.gpv-card {
    background: #111318;
    border-radius: 8px;
    overflow: hidden;
    /* Eliminamos el transform de la tarjeta para que se quede 100% quieta */
    transition: box-shadow 0.15s ease;
    content-visibility: auto;
    contain-intrinsic-size: 300px;
}

/* Solo le dejamos la sombra, quitamos el salto hacia arriba */
.gpv-card:hover,
.gpv-card:focus-within {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.gpv-card__link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.gpv-card__media {
    position: relative;
    margin: 0;
    aspect-ratio: 16 / 9;
    background: #1c1f26;
    overflow: hidden;
}

/* ==========================================================================
   Imagen de la pastilla y Efecto de Exploración Multidireccional
   ========================================================================== */

.gpv-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    
    /* Estado inicial: tamaño normal y centrado */
    transform: scale(1) translate(0, 0); 
    transform-origin: center; 
    transition: transform 0.4s ease-out, filter 0.3s ease; 
}

/* Hover: Se estira 20% y luego empieza a explorar */
.gpv-card:hover .gpv-card__img,
.gpv-card:focus-within .gpv-card__img {
    filter: brightness(0.90);
    /* 1. Zoom inicial suave del 20% */
    transform: scale(1.2) translate(0, 0); 
    /* 2. Dispara el recorrido en bucle después de 0.4s */
    animation: exploracion-visual 12s ease-in-out infinite 0.4s; 
}

/* Ruta de animación (Bucle infinito) */
@keyframes exploracion-visual {
    0%   { transform: scale(1.2) translate(0, 0); }
    20%  { transform: scale(1.2) translate(7%, 0); }   /* Derecha */
    40%  { transform: scale(1.2) translate(-7%, 0); }  /* Izquierda */
    60%  { transform: scale(1.2) translate(0, -7%); }  /* Arriba */
    80%  { transform: scale(1.2) translate(0, 7%); }   /* Abajo */
    100% { transform: scale(1.2) translate(0, 0); }    /* Centro */
}

/* ==========================================================================
   Botón Play SVG (Estilo YouTube)
   ========================================================================== */

.gpv-card__media::after {
    content: ""; 
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    width: 41px;
    height: 29px;
    background-color: #ff3c3c; 
    border-radius: 8px; 
    
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23ffffff'%3E%3Cpath d='M9 6v12l9-6z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px; 
    
    opacity: 0;
    z-index: 3;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2); 
    pointer-events: none; 
}

/* MAGIA AQUÍ: rgba(Rojo, Verde, Azul, Opacidad) 
       0.85 significa que es 85% color sólido y 15% transparente. 
       Si lo quieres más transparente, bájalo a 0.70 o 0.60 */
    background-color: rgba(255, 60, 60, 0.85);
    
    
    
.gpv-card:hover .gpv-card__media::after,
.gpv-card:focus-within .gpv-card__media::after {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

@media (max-width: 480px) {
    .gpv-card__media::after {
        width: 32px;
        height: 20px;
        border-radius: 6px;
        background-size: 14px; 
    }
}

/* ==========================================================================
   Placeholder y Duración
   ========================================================================== */

.gpv-card__placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #23262e, #1a1d23);
}

.gpv-card__duration {
    position: absolute;
    right: 6px;
    bottom: 6px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    color: #fff;
    background: rgba(0, 0, 0, 0.75);
    border-radius: 4px;
    z-index: 4; 
}

/* ==========================================================================
   Cuerpo de la tarjeta
   ========================================================================== */

.gpv-card__body {
    padding: 8px 10px 10px;
}

.gpv-card__title {
    margin: 0 0 4px;
    font-size: clamp(13px, 1.6vw, 15px);
    font-weight: 500;
    line-height: 1.35;
    color: #e8eaed;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gpv-card__cat {
    font-size: 11px;
    color: #8ab4f8;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

/* Paginación */
.gpv-pagination {
    padding: 20px;
    text-align: center;
}

@media (prefers-reduced-motion: reduce) {
    .gpv-card { transition: none; }
}