#productos {
    padding: 40px 20px;
    background-color: #fff;
    text-align: center;
}

#productos h2 {
    /* antes: 50px */
    font-size: clamp(28px, 5vw, 50px);
    font-family: 'Edwardian Script ITC', cursive;
    font-weight: 100;
    margin-bottom: 30px;
    color: #333;
}

#contenedor-productos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: clamp(5px, 2vw, 10px);
    padding-bottom: 1.25rem;
}

.tarjeta-productos {
    aspect-ratio: 9 / 9.5;
    max-width: 450px;
    background-color: white;
    border: 1px solid #ddd;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    overflow: hidden;
    position: relative;
    transition: box-shadow 0.3s ease;
}

.tarjeta-productos:hover {
    box-shadow: 0 8px 20px rgba(0,0,0,0.2);
}

.tarjeta-productos img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    opacity: 0;
    transform: scale(1.2);
    transition: transform 0.5s ease, opacity 0.5s ease, filter 0.3s ease;
}

.tarjeta-productos img.zoom-in {
    opacity: 1;
    transform: scale(1);
}

.tarjeta-productos:hover img.zoom-in {
    transform: scale(1.4);
    filter: brightness(0.75);
}

.tarjeta-productos p {
    position: absolute;
    bottom: 0;
    left: 5px;
    width: calc(100% - 10px);
    margin: 0;
    padding: 10px 0;
    font-size: 20px;
    font-family: 'Jomolhari', serif;
    color: #fff;
    background-color: transparent;
    text-align: left;
    box-sizing: border-box;
    z-index: 1;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.6);
}

.tarjeta-productos:hover p {
    text-decoration: underline;
}

/* Portada */
.portada {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.portada-contenido {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #fff;
    z-index: 2;
}

/* Títulos portada */
.h1PagProductos {
    /* antes: 100px */
    font-size: clamp(32px, 8vw, 80px);
    font-family: 'Edwardian Script ITC', cursive;
    font-weight: 100;
    margin: 0;
    color: #fff;
    text-shadow: 2px 2px 8px rgba(0,0,0,0.5);
}

.pTPagProductos {
    /* antes: 20px */
    font-size: clamp(14px, 2.5vw, 22px);
    font-family: 'Jomolhari', serif;
    margin-top: 10px;
    color: #ddd;
    text-shadow: 1px 1px 6px rgba(0,0,0,0.5);
}

.subPPagProductos {
    font-family: 'Jomolhari', serif;
    /* antes: 20px */
    font-size: clamp(14px, 2.2vw, 20px);
    text-align: center;
    color: #444;
    max-width: 1200px;
    margin: 20px auto;
    padding: 50px 20px;
    text-shadow: 1px 1px 4px rgba(0,0,0,0.3);
    box-sizing: border-box;
}

/* Overlay galería */
.overlay-galeria {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.3);
    backdrop-filter: blur(2px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.overlay-galeria img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

.overlay-galeria.mostrar {
    opacity: 1;
    pointer-events: auto;
}

/* Flechas galería */
.flecha {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,0.7);
    border: none;
    font-size: 40px;
    padding: 10px 20px;
    cursor: pointer;
    z-index: 10000;
    transition: background 0.3s;
}

.flecha:hover {
    background: rgba(255,255,255,1);
}

#anterior {
    left: 20px;
}

#siguiente {
    right: 20px;
}

/* Video e Imagen de Portada */
.portadaVideo,
.portadaImagen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    object-fit: cover;
    filter: brightness(0.75);
    z-index: 1;
    display: none;
}

/* Mostrar video en celular */
@media (max-width: 767px), (orientation: portrait) {
    .portadaVideo {
        display: block;
    }
}

/* Mostrar imagen en escritorio */
@media (min-width: 768px) and (orientation: landscape) {
    .portadaImagen {
        display: block;
    }
}

/* Diseño RESPONSIVE */

/* Móvil: 2 tarjetas una debajo de otra (portrait) */
@media (max-width: 767px) and (orientation: portrait) {
    #contenedor-productos {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: clamp(10px, 2vw, 20px);
    }

    .tarjeta-productos {
        width: 90%;
        max-width: 500px;
        aspect-ratio: 9 / 9.5;
    }

    .tarjeta-productos img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        opacity: 1;
        transform: scale(1);
        transition: filter 0.3s ease, transform 0.3s ease;
    }

    .tarjeta-productos:hover img {
        transform: scale(1.05);
        filter: brightness(0.85);
    }

    .tarjeta-productos p {
        font-size: 18px;
        padding: 10px;
        background: rgba(0, 0, 0, 0.5);
        position: absolute;
        bottom: 0;
        width: 100%;
        text-align: left;
    }
}

/* Móvil: 2 tarjetas por fila en landscape */
@media (max-width: 767px) and (orientation: landscape) {
    #contenedor-productos {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: clamp(5px, 2vw, 10px);
    }

    .tarjeta-productos {
        flex: 1 1 calc(50% - clamp(5px, 2vw, 10px));
        max-width: calc(50% - clamp(5px, 2vw, 10px));
        height: auto;
    }
}

/* Landscape en dispositivos móviles o pantallas pequeñas */
@media (max-height: 500px) and (orientation: landscape) {
    #contenedor-productos {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: clamp(5px, 2vw, 10px);
    }

    .tarjeta-productos {
        flex: 1 1 calc(50% - clamp(5px, 2vw, 10px));
        max-width: calc(50% - clamp(5px, 2vw, 10px));
        aspect-ratio: 9 / 9.5;
    }
}

/* Escritorio: 4 tarjetas por fila */
@media (min-width: 1024px) {
    #contenedor-productos {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: clamp(10px, 2vw, 20px);
    }

    .tarjeta-productos {
        width: calc((100% - 3 * clamp(10px, 2vw, 20px)) / 4);
        height: auto;
    }

    #contenedor-productos.productos-internos .tarjeta-productos {
        width: calc((100% - 2 * clamp(10px, 2vw, 20px)) / 3);
    }
}

/* Ajuste títulos para celulares
   (quitamos tamaños fijos para no pisar el clamp) */
@media (max-width: 767px) {
    /* .h1PagProductos: ahora usa clamp */
    /* .pTPagProductos: ahora usa clamp */
    /* .subPPagProductos: ahora usa clamp */
    .pTPagProductos {
        text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.4);
    }
    .subPPagProductos {
        padding: 30px 15px;
        text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
    }
}
