/* ==========================================================================
   ESTILO PRINCIPAL - ESTUDIO JURÍDICO (CSS PURO)
   ========================================================================== */

:root {
    /* Paleta de Colores Soberana y Elegante */
    --color-primary: #0a1128;      /* Azul Noche Profundo */
    --color-secondary: #1c2541;    /* Azul Marino Institucional */
    --color-accent: #c5a059;       /* Dorado Imperial */
    --color-accent-hover: #e5be75; /* Dorado Radiante */
    --color-text-dark: #1e293b;    /* Gris Oscuro Tipográfico */
    --color-text-light: #94a3b8;   /* Gris Neutro Texto */
    --color-bg-light: #f8fafc;     /* Blanco Humo */
    --color-white: #ffffff;
    
    /* Fuentes */
    --font-heading: 'Playfair Display', Georgia, serif;
    --font-body: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
    
    /* Estructura y Sombras */
    --transition-smooth: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
    --shadow-soft: 0 10px 30px rgba(10, 17, 40, 0.05);
    --shadow-hover: 0 20px 40px rgba(10, 17, 40, 0.12);
}

/* Reset Global */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg-light);
    color: var(--color-text-dark);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

/* Tipografía Básica */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    color: var(--color-primary);
    line-height: 1.25;
}

p {
    color: #475569;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-smooth);
}

/* Contenedor Genérico */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* ==========================================================================
   NAVEGACIÓN
   ========================================================================== */
.navbar {
    position: sticky;
    top: 0;
    background: rgba(10, 17, 40, 0.96);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(197, 160, 89, 0.2);
    z-index: 1000;
    padding: 1.2rem 0;
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-logo {
    font-size: 2rem;
    color: var(--color-accent);
}

.brand-text {
    display: flex;
    flex-direction: column;
}

.brand-title {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--color-white);
}

.brand-subtitle {
    font-size: 0.65rem;
    letter-spacing: 3px;
    color: var(--color-accent);
    text-transform: uppercase;
}

.nav-menu {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-link {
    color: #e2e8f0;
    font-size: 0.95rem;
    font-weight: 500;
    position: relative;
}

.nav-link:hover {
    color: var(--color-accent);
}

.btn-nav {
    background-color: transparent;
    border: 1px solid var(--color-accent);
    color: var(--color-accent) !important;
    padding: 0.6rem 1.4rem;
    border-radius: 2px;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 1px;
}

.btn-nav:hover {
    background-color: var(--color-accent);
    color: var(--color-primary) !important;
}

/* ==========================================================================
   HERO SECTION (ESTILOS ORIGINALES + ANIMACIÓN DE FONDO BUCLE 3S)
   ========================================================================== */

.hero {
    position: relative;
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: var(--color-white);
    padding: 9rem 0 7rem;
    overflow: hidden;
}

/* Pseudo-elemento para aplicar las imágenes animadas por debajo de tus capas */
.hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    opacity: 0.35; /* Ajusta este valor si deseas las imágenes más claras u oscuras */
    z-index: 0;
    animation: heroBackgroundLoop 12s infinite ease-in-out;
}

.hero-overlay {
    position: absolute;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background: radial-gradient(circle at 80% 20%, rgba(197, 160, 89, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 1; /* Mantiene tu destello radial por encima de las imágenes */
}

.hero-content {
    max-width: 850px;
    position: relative;
    z-index: 2; /* Mantiene tus textos y botones siempre al frente */
}

/* ==========================================================================
   ANIMACIÓN KEYFRAMES (CICLO DE 4 IMÁGENES .JPG CADA 3 SEGUNDOS)
   ========================================================================== */
@keyframes heroBackgroundLoop {
    /* Imagen 1: CAL LIMA (0s - 3s) */
    0%, 20% {
        background-image: url('CAL LIMA.jpg');
    }
    
    /* Transición e Imagen 2: YO (3s - 6s) */
    25%, 45% {
        background-image: url('YO.jpg');
    }
    
    /* Transición e Imagen 3: CAL LIMA2 (6s - 9s) */
    50%, 70% {
        background-image: url('CAL LIMA2.jpg');
    }
    
    /* Transición e Imagen 4: PAPA1 (9s - 12s) */
    75%, 95% {
        background-image: url('PAPA1.jpg');
    }
    
    /* Volver al inicio */
    100% {
        background-image: url('CAL LIMA.jpg');
    }
}
}

.badge {
    display: inline-block;
    padding: 0.4rem 1rem;
    background: rgba(197, 160, 89, 0.15);
    border: 1px solid var(--color-accent);
    color: var(--color-accent);
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    border-radius: 2px;
}

.hero-title {
    font-size: 3.5rem;
    color: var(--color-white);
    margin-bottom: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.hero-description {
    font-size: 1.2rem;
    color: #cbd5e1;
    margin-bottom: 2.5rem;
    max-width: 700px;
    font-weight: 300;
    text-align: justify; /* Justifica el texto igual que en Word */
    text-justify: inter-word; /* Ajusta el espaciado entre palabras de forma equilibrada */
}
}

.hero-actions {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

/* Botones */
.btn {
    display: inline-block;
    padding: 1rem 2.2rem;
    font-size: 0.95rem;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 2px;
    cursor: pointer;
    transition: var(--transition-smooth);
}

.btn-primary {
    background-color: var(--color-accent);
    color: var(--color-primary);
    border: 1px solid var(--color-accent);
}

.btn-primary:hover {
    background-color: var(--color-accent-hover);
    border-color: var(--color-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(197, 160, 89, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--color-white);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.btn-secondary:hover {
    border-color: var(--color-white);
    background: rgba(255, 255, 255, 0.05);
}

/* ==========================================================================
   FEATURES (NOSOTROS)
   ========================================================================== */
.features {
    padding: 5rem 0;
    margin-top: -3rem;
    position: relative;
    z-index: 10;
}

/* ==========================================================================
   TARJETAS CON GIRO 180° Y FONDOS DE IMAGEN INDIVIDUALES (.PNG)
   ========================================================================== */

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.feature-card {
    background-color: transparent;
    height: 350px;
    perspective: 1000px;
}

.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
}

.feature-card:hover .card-inner {
    transform: rotateY(180deg);
}

.card-front, .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

/* CARA FRONTAL */
.card-front {
    background: var(--color-white);
    border-top: 4px solid var(--color-accent);
    padding: 2.5rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: justify;
    text-justify: inter-word;
}

.feature-logo {
    width: 65px;
    height: auto;
    margin-bottom: 1rem;
    object-fit: contain;
}

.card-front h3 {
    font-size: 1.25rem;
    margin-bottom: 0.8rem;
    text-align: center;
    color: var(--color-primary);
}

.card-front p {
    font-size: 0.95rem;
    color: #475569;
    line-height: 1.6;
}

/* CARA TRASERA - BASE */
.card-back {
    transform: rotateY(180deg);
    border: 1px solid var(--color-accent);
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Imagen 1: Dominio del Marco Peruano */
.card-back-1 {
    background-image: linear-gradient(rgba(10, 17, 40, 0.75), rgba(10, 17, 40, 0.75)), url('IMAGEN 1.png');
}

/* Imagen 2: Estrategia Preventiva */
.card-back-2 {
    background-image: linear-gradient(rgba(10, 17, 40, 0.75), rgba(10, 17, 40, 0.75)), url('IMAGEN 2.png');
}

/* Imagen 3: Ética e Integridad */
.card-back-3 {
    background-image: linear-gradient(rgba(10, 17, 40, 0.75), rgba(10, 17, 40, 0.75)), url('IMAGEN 3.png');
}

/* Contenido dentro de la cara trasera */
.card-back-content {
    padding: 2rem;
    text-align: center;
    z-index: 2;
}

.back-logo {
    width: 100px;
    height: auto;
    margin-bottom: 1rem;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
}

.card-back h4 {
    font-family: var(--font-heading);
    color: var(--color-accent);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    letter-spacing: 1px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.back-motto {
    color: #ffffff !important;
    font-size: 0.95rem;
    font-style: italic;
    font-weight: 400;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}
}
}

/* ==========================================================================
   SERVICIOS / ÁREAS
   ========================================================================== */
.services {
    padding: 6rem 0;
    background-color: var(--color-white);
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-subtitle {
    text-transform: uppercase;
    letter-spacing: 3px;
    color: var(--color-accent);
    font-size: 0.85rem;
    font-weight: 600;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-top: 0.5rem;
}

.divider {
    width: 60px;
    height: 3px;
    background-color: var(--color-accent);
    margin: 1.2rem auto 0;
}

.grid-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--color-bg-light);
    padding: 2.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 2px;
    position: relative;
    transition: var(--transition-smooth);
}

.card:hover {
    background: var(--color-white);
    border-color: var(--color-accent);
    box-shadow: var(--shadow-hover);
    transform: translateY(-4px);
}

.card-number {
    font-family: var(--font-heading);
    font-size: 2rem;
    color: rgba(197, 160, 89, 0.3);
    font-weight: 700;
    margin-bottom: 1rem;
}

.card h3 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
}

/* ==========================================================================
   CTA SECTION
   ========================================================================== */
.cta-section {
    padding: 6rem 0;
    background: linear-gradient(rgba(10, 17, 40, 0.95), rgba(10, 17, 40, 0.95));
    color: var(--color-white);
    text-align: center;
}

.cta-box {
    max-width: 800px;
}

.cta-box h2 {
    color: var(--color-white);
    font-size: 2.3rem;
    margin-bottom: 1rem;
}

.cta-box p {
    color: #94a3b8;
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
}

.btn-gold {
    background-color: var(--color-accent);
    color: var(--color-primary);
}

.btn-gold:hover {
    background-color: var(--color-accent-hover);
    box-shadow: 0 10px 25px rgba(197, 160, 89, 0.4);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.footer {
    background-color: #050814;
    color: var(--color-text-light);
    padding: 4rem 0 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    text-align: center;
}

.footer-brand h3 {
    color: var(--color-white);
    letter-spacing: 2px;
    margin-bottom: 0.3rem;
}

.footer-latin {
    margin: 3rem 0;
    padding: 2rem;
    border-top: 1px solid rgba(197, 160, 89, 0.15);
    border-bottom: 1px solid rgba(197, 160, 89, 0.15);
    display: inline-block;
    max-width: 750px;
}

.latin-quote {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-style: italic;
    color: var(--color-accent);
    margin-bottom: 0.5rem;
}

.footer-latin cite {
    font-size: 0.85rem;
    color: #64748b;
    font-style: normal;
}

.footer-bottom {
    margin-top: 2rem;
    font-size: 0.85rem;
    color: #475569;
}

/* ==========================================================================
   BOTÓN FLOTANTE WHATSAPP (CSS PURO)
   ========================================================================== */
.whatsapp-float {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: #25d366;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(37, 211, 102, 0.4);
    z-index: 9999;
    transition: var(--transition-smooth);
}

.whatsapp-icon {
    width: 32px;
    height: 32px;
    fill: currentColor;
}

.whatsapp-float:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 30px rgba(37, 211, 102, 0.6);
}

.whatsapp-tooltip {
    position: absolute;
    right: 70px;
    background-color: var(--color-primary);
    color: var(--color-white);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.8rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
    pointer-events: none;
    box-shadow: var(--shadow-soft);
    border: 1px solid var(--color-accent);
}

.whatsapp-float:hover .whatsapp-tooltip {
    opacity: 1;
    visibility: visible;
    right: 75px;
}

/* ==========================================================================
   RESPONSIVE DESIGN (ADAPTABILIDAD MOBILE)
   ========================================================================== */
@media (max-width: 768px) {
    .nav-container {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-menu {
        gap: 1rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .hero {
        padding: 6rem 0 5rem;
        text-align: center;
    }

    .hero-title {
        font-size: 2.2rem;
    }

    .hero-actions {
        justify-content: center;
    }

    .btn {
        width: 100%;
    }

    .whatsapp-tooltip {
        display: none; /* Se oculta tooltip en móviles para despejar pantalla */
    }
}