@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Misma paleta que index.html */
    --color-fondo-1: #E4C76D;
    --color-rojo-oscuro: #8C182A;
    --color-fondo-3: #C0392B;
    --color-fondo-4: #A16A46;
    --color-primario: #8C182A;
    /* alias para compatibilidad */
    --sombra-suave: 0 4px 15px rgba(0, 0, 0, 0.15);
    --sombra-hover: 0 10px 25px rgba(0, 0, 0, 0.25);
    --transicion-suave: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent; /* Quita el flash azul en móviles */
    -webkit-text-size-adjust: 100%;           /* Evita que el navegador cambie el tamaño del texto al girar el cel */
    box-sizing: border-box;                   /* Evita problemas con el padding y el tamaño */
    user-select: none;                        /* Evita que el usuario seleccione el texto */
    -webkit-user-select: none;                /* Safari y Chrome móvil */
    -webkit-touch-callout: none;              /* Evita el menú de "Copiar" en iOS */
}

@keyframes gradienteVivo {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

body {
    font-family: 'Poppins', sans-serif;
    background: linear-gradient(-45deg, #E4C76D, #DDB85A, #CDA84A, #EDD27A);
    background-size: 400% 400%;
    animation: gradienteVivo 15s ease infinite;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

main {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.contenedor_titulo {
    background: #FFF9F2;
    border-radius: 12px;
    width: 80%;
    max-width: 1200px;
    margin: 30px auto 10px;
    padding: 18px 24px;
    text-align: center;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
    border: 2px solid transparent;
}

.contenedor_titulo h1 {
    font-size: 1.8rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    line-height: 1.3;
    color: var(--color-rojo-oscuro);
}

.contenedor_card {
    max-width: 1200px;
    width: 100%;
    margin: auto;
    margin-top: 100px;
    perspective: 1000px;
    border-radius: 20px;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
}

.card_padre {
    margin: 20px;
    perspective: 1000px;
}

.card_padre:hover .card {
    transform: rotateY(180deg);
}

.card {
    width: 350px;
    height: 400px;
    background-color: #847e7e;
    position: relative;
    transform-style: preserve-3d;
    transition: all 0.6s;
    border-radius: 20px;
}

.card_frente {
    background-size: cover;
    background-position: center;
}

.card_frente,
.card_fondo {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    backface-visibility: hidden;
    transform-style: preserve-3d;
    border-radius: 20px;
}

.card_fondo {
    transform: rotateY(180deg);
    background-color: #FFF9F2;
}

.body_card_frente {
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-family: 'Poppins', sans-serif;
    padding: 40px;
    color: #fff;
    transform: translateZ(60px);
}

.body_card_frente h2 {
    font-size: 1.4rem;
    font-weight: 600;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
    font-family: 'Poppins', sans-serif;
}

.bg {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    background-color: rgba(0,0,0,0.5);
    border-radius: 20px;
}

.body_card_fondo {
    padding: 40px;
    text-align: center;
    font-family: 'Poppins', sans-serif;
    transform: translateZ(60px);
}

.body_card_fondo h2 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-rojo-oscuro);
    font-family: 'Poppins', sans-serif;
}

.body_card_fondo p {
    margin-top: 30px;
    font-size: 18px;
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: #3b2a24;
}

.body_card_fondo input {
    position: relative;
    padding: 10px 20px;
    margin-top: 20px;
    border-radius: 999px;
    border: 2px solid var(--color-rojo-oscuro);
    font-size: 0.85rem;
    letter-spacing: 2px;
    background: #FFF9F2;
    color: var(--color-rojo-oscuro);
    box-shadow: 0 0 0 0 transparent;
    transition: var(--transicion-suave);
    text-transform: uppercase;
    font-weight: 600;
    overflow: hidden;
    cursor: pointer;
    -webkit-transition: all 0.2s ease-in;
    -moz-transition: all 0.2s ease-in;
    font-family: 'Poppins', sans-serif;
}

.body_card_fondo input:hover {
    background: var(--color-rojo-oscuro);
    box-shadow: var(--sombra-hover);
    -webkit-transition: all 0.2s ease-out;
    -moz-transition: all 0.2s ease-out;
    transition: all 0.2s ease-out;
    color: #ffffff;
}

.body_card_fondo input:hover::before {
    -webkit-animation: sh02 0.5s 0s linear;
    -moz-animation: sh02 0.5s 0s linear;
    animation: sh02 0.5s 0s linear;
}

.body_card_fondo input::before {
    content: '';
    display: block;
    width: 0px;
    height: 86%;
    position: absolute;
    top: 7%;
    left: 0%;
    opacity: 0;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 0 50px 30px #fff;
    -webkit-transform: skewX(-20deg);
    -moz-transform: skewX(-20deg);
    -ms-transform: skewX(-20deg);
    -o-transform: skewX(-20deg);
    transform: skewX(-20deg);
}

@keyframes sh02 {
    from {
        opacity: 0;
        left: 0%;
    }

    50% {
        opacity: 1;
    }

    to {
        opacity: 0;
        left: 100%;
    }
}

.body_card_fondo input:active {
    box-shadow: 0 0 0 0 transparent;
    -webkit-transition: box-shadow 0.2s ease-in;
    -moz-transition: box-shadow 0.2s ease-in;
    transition: box-shadow 0.2s ease-in;
}

/* Animaciones */
@keyframes entradaSuave {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Botón Inicio */
.item_boton {
    display: flex;
    justify-content: center; 
    margin: 40px 0;
    animation: entradaSuave 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    animation-delay: 0.6s;
    opacity: 0;
}

.item_boton a {
    display: flex;
    align-items: center;
    text-decoration: none;
    background: #FFF9F2;
    padding: 15px 30px;
    border-radius: 50px;
    box-shadow: var(--sombra-suave);
    transition: var(--transicion-suave);
    border: 2px solid transparent;
}

.item_boton a:hover {
    transform: translateY(-5px);
    box-shadow: var(--sombra-hover);
    border-color: var(--color-rojo-oscuro);
    background: #FFFFFF;
}

.boton_inicio {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    margin-right: 15px;
}

.boton_inicio img {
    width: 40px;
    height: auto;
    transition: transform 0.3s ease;
    filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
}

.item_boton a:hover .boton_inicio img {
    transform: translateX(-5px);
}

.item_boton span {
    color: var(--color-rojo-oscuro);
    font-weight: 600;
    font-size: 1.2rem;
    font-family: 'Poppins', sans-serif;
}


/* === RESPONSIVE: TABLET (1024px) === */
@media (max-width: 1024px) {
    .contenedor_titulo {
        width: 90%;
        padding: 16px 20px;
        margin-top: 30px;
    }

    .contenedor_titulo h1 {
        font-size: 1.8rem;
        line-height: 1.3;
    }

    .contenedor_titulo p {
        font-size: 1rem;
        margin-top: 10px;
    }

    .card {
        width: 320px;
        height: 380px;
    }
}

/* === RESPONSIVE: MÓVIL / TABLET PEQUEÑA (768px) === */
/* Estrategia: desactivar completamente el 3D flip y usar
   opacidad para mostrar/ocultar las caras de la tarjeta */
@media (max-width: 768px) {
    .contenedor_titulo {
        width: 95%;
        margin-top: 20px;
    }

    .contenedor_titulo h1 {
        font-size: 1.4rem;
        letter-spacing: 1px;
    }

    .contenedor_titulo p {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .contenedor_card {
        max-width: 100%;
        margin-top: 40px;
        flex-direction: column;
        align-items: center;
        gap: 16px;
        perspective: none;
    }

    .card_padre {
        width: 100%;
        max-width: 340px;
        margin: 10px auto;
        perspective: none;
    }

    /* Desactivar el hover flip en móvil */
    .card_padre:hover .card {
        transform: none;
    }

    .card {
        width: 100%;
        height: 240px;
        border-radius: 16px;
        position: relative;
        transform-style: flat;
        transform: none;
        background-color: transparent;
    }

    /* ── Desactivar 3D: ambas caras se posicionan una sobre otra ── */
    .card_frente,
    .card_fondo {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        backface-visibility: visible;
        transform-style: flat;
        transform: none;
        border-radius: 16px;
        transition: opacity 0.4s ease;
    }

    /* Frente: visible por defecto */
    .card_frente {
        opacity: 1;
        z-index: 2;
    }

    /* Fondo: oculto por defecto */
    .card_fondo {
        opacity: 0;
        z-index: 1;
        transform: none;
        background-color: #FFF9F2;
    }

    /* Al tocar: ocultar frente, mostrar fondo */
    .card_padre.flipped .card_frente {
        opacity: 0;
        z-index: 1;
    }

    .card_padre.flipped .card_fondo {
        opacity: 1;
        z-index: 2;
    }

    /* Eliminar todos los translateZ que causan problemas */
    .body_card_frente,
    .body_card_fondo {
        transform: none;
        padding: 20px 18px;
    }

    .body_card_frente {
        width: 100%;
        height: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        text-align: center;
    }

    .body_card_frente h2 {
        font-size: 1.05rem;
        font-weight: 600;
        line-height: 1.35;
        color: #fff;
        text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    }

    .bg {
        border-radius: 16px;
    }

    .body_card_fondo {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        height: 100%;
    }

    .body_card_fondo h2 {
        font-size: 1rem;
        font-weight: 700;
    }

    .body_card_fondo p {
        font-size: 0.88rem;
        line-height: 1.45;
        margin-top: 12px;
        text-align: center;
    }

    .body_card_fondo input[type="button"] {
        width: 100%;
        max-width: 220px;
        padding: 10px 0;
        margin-top: 14px;
        font-size: 0.82rem;
    }

    .item_boton {
        margin: 25px 0 40px;
    }

    .item_boton span {
        font-size: 1rem;
    }

    /* Indicador visual: "Toca para ver" */
    .card_frente::after {
        content: "Toca para ver ▸";
        position: absolute;
        bottom: 14px;
        left: 50%;
        transform: translateX(-50%);
        color: rgba(255, 255, 255, 0.9);
        font-size: 0.75rem;
        font-family: 'Poppins', sans-serif;
        font-weight: 500;
        background: rgba(0, 0, 0, 0.4);
        padding: 5px 16px;
        border-radius: 20px;
        z-index: 3;
        pointer-events: none;
    }

    /* Ocultar indicador una vez volteada */
    .card_padre.flipped .card_frente::after {
        opacity: 0;
    }
}

/* === RESPONSIVE: CELULAR (480px) === */
@media (max-width: 480px) {
    .contenedor_titulo {
        width: 92%;
        padding: 12px 10px;
        margin-top: 20px;
    }

    .contenedor_titulo h1 {
        font-size: 1.15rem;
        letter-spacing: 0.5px;
    }

    .contenedor_titulo p {
        font-size: 0.78rem;
        line-height: 1.4;
    }

    .card_padre {
        max-width: 92%;
        padding: 0;
    }

    .card {
        height: 220px;
    }

    .card_frente,
    .card_fondo,
    .bg {
        border-radius: 14px;
    }

    .body_card_frente {
        padding: 16px 14px;
    }

    .body_card_frente h2 {
        font-size: 0.92rem;
        line-height: 1.3;
    }

    .body_card_fondo {
        padding: 16px 14px;
    }

    .body_card_fondo h2 {
        font-size: 0.9rem;
    }

    .body_card_fondo p {
        font-size: 0.8rem;
        margin-top: 8px;
        line-height: 1.35;
    }

    .body_card_fondo input[type="button"] {
        max-width: 180px;
        padding: 8px 0;
        margin-top: 10px;
        font-size: 0.75rem;
    }

    .card_frente::after {
        font-size: 0.7rem;
        bottom: 10px;
        padding: 4px 12px;
    }

    .item_boton a {
        padding: 10px 20px;
    }

    .boton_inicio img {
        width: 32px;
    }

    .item_boton span {
        font-size: 0.9rem;
    }
}

/* ─── FOOTER ─── */
.pie_pagina {
    width: 100%;
    max-width: 1200px;
    text-align: center;
    padding: 18px 20px 24px;
    margin-top: 30px;
    border-top: 1px solid rgba(140, 24, 42, 0.15);
}

.pie_pagina p {
    color: #8a7060;
    font-size: 0.78rem;
    font-weight: 400;
    font-style: italic;
    font-family: 'Poppins', sans-serif;
    letter-spacing: 0.3px;
    line-height: 1.6;
}
