/* ========== VISTA MEMORIAL ========== */
.section-memorial {
    background: #030408;
    padding: 6rem 0 8rem;
    position: relative;
    overflow: hidden;
}

/* ========== MURO CONMEMORATIVO (GRID 3 COLUMNAS) ========== */
.memorial-wall {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2.5rem;
    margin-top: 3rem;
}

/* 3D FLIP CARD STYLES */
.memorial-card {
    height: 420px;
    perspective: 1000px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    user-select: none;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.memorial-card:hover {
    transform: translateY(-8px);
}

.memorial-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    -webkit-transition: -webkit-transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s ease;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.4s ease;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: 1rem;
}

.memorial-card.flipped .memorial-card-inner {
    -webkit-transform: rotateY(180deg);
    transform: rotateY(180deg);
}

.memorial-card-front,
.memorial-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 1rem;
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border-soft);
}

/* ========== CARA FRONTAL: FRASE + NICK ========== */
.memorial-card-front {
    background: linear-gradient(180deg, #131722 0%, #0c0f16 100%);
    border-top: 4px solid var(--accent-red);
}

.memorial-cross {
    font-size: 2.5rem;
    color: var(--accent-red);
    margin-bottom: 1.5rem;
    text-shadow: 0 0 15px rgba(215, 38, 61, 0.5);
    line-height: 1;
}

.memorial-card-front .memorial-quote {
    font-style: italic;
    font-size: 1.15rem;
    line-height: 1.7;
    color: #dcdfe8;
    max-width: 90%;
    flex-grow: 1;
    display: flex;
    align-items: center;
}

.memorial-card-front .separator-line {
    width: 50px;
    height: 3px;
    background: var(--accent-red);
    margin: 1.5rem auto;
    box-shadow: 0 0 10px var(--accent-red);
    flex-shrink: 0;
}

.memorial-card-front .memorial-nick {
    font-size: 1.6rem;
    font-weight: 800;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-shadow: 0 2px 10px rgba(215, 38, 61, 0.5);
    margin-bottom: 1rem;
}

/* ========== CARA TRASERA: IMAGEN + NOMBRE REAL + AÑO ========== */
.memorial-card-back {
    background: linear-gradient(180deg, #090b10 0%, #05060a 100%);
    color: white;
    -webkit-transform: rotateY(180deg);
    transform: rotateY(180deg);
    border-top: 4px solid var(--accent-red);
    justify-content: center;
    gap: 0.5rem;
}

.memorial-card-back .memorial-img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--bg-card);
    box-shadow: 0 0 0 2px var(--accent-red), 0 10px 20px rgba(0, 0, 0, 0.5);
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.memorial-card-back .memorial-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.memorial-card-back h3 {
    font-size: 1.4rem;
    font-weight: 800;
    color: #ffffff;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.memorial-card-back .memorial-role {
    color: var(--accent-red);
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.memorial-card-back .memorial-dates {
    font-size: 1.1rem;
    color: var(--accent-red);
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* ========== ELEMENTOS COMUNES ========== */
.flip-instruction {
    margin-top: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 1rem;
    width: 100%;
    flex-shrink: 0;
}

.memorial-card-inner:hover {
    box-shadow: 0 15px 40px rgba(215, 38, 61, 0.3);
}

/* Modal Cleanup */
.memorial-overlay,
.memorial-modal,
.close-btn {
    display: none !important;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 992px) {
    .memorial-wall {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem;
    }
}

@media (max-width: 576px) {
    .memorial-wall {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .memorial-card {
        height: 440px; /* Taller height to allow narrow text to fit */
    }

    .memorial-card-back .memorial-img {
        width: 100px;
        height: 100px;
        margin-bottom: 0.5rem;
    }
    
    .memorial-card-front, .memorial-card-back {
        padding: 1rem 0.5rem; 
    }
    
    .memorial-nick {
        font-size: 1.1rem !important; 
        margin-bottom: 0.5rem !important;
        word-wrap: break-word;
    }
    
    .memorial-quote {
        font-size: 0.85rem !important; 
        line-height: 1.3 !important;
    }
    
    .memorial-card-front .separator-line {
        margin: 0.5rem auto;
    }
    
    .memorial-card-back h3 {
        font-size: 1rem; 
        word-wrap: break-word;
    }
    
    .memorial-role {
        font-size: 0.8rem;
    }
    
    .memorial-dates {
        font-size: 0.85rem !important;
    }
    
    .memorial-cross {
        font-size: 1.5rem;
        margin-bottom: 0.5rem;
    }
    
    .flip-instruction {
        font-size: 0.65rem;
        padding-top: 0.5rem;
        margin-top: 0.5rem;
    }
}