/* --- VARIABLES Y RESET --- */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

:root {
    --primary-blue: #0a2947;
    --soft-blue: #5084a6;
    --cream: #f1efe7;
    --white: #ffffff;
}

html { 
    scroll-behavior: smooth; 
    scroll-padding-top: 80px; 
}

body { 
    font-family: 'Inter', sans-serif; 
    background-color: var(--primary-blue); 
    color: var(--white); 
    overflow-x: hidden; 
}

/* --- HEADER Y NAVEGACIÓN --- */
header {
    width: 100%;
    padding: 10px 8%;
    position: fixed; 
    top: 0;
    z-index: 1000;
    background: rgba(10, 40, 71, 0.9); 
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(241, 239, 231, 0.1);
    transition: 0.3s;
}

nav {
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}

.logo img {
    height: 55px;
    width: auto; 
}

/* Menú Desktop */
.nav-links { 
    display: flex;
    list-style: none; 
}

.nav-links li {
    margin-left: 35px; 
}

.nav-links a {
    text-decoration: none;
    color: var(--cream);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    opacity: 0.8;
    transition: 0.3s;
}

.nav-links a:hover { color: var(--white); opacity: 1; }

/* Botón Hamburguesa (Oculto en Desktop) */
.mobile-menu-btn {
    display: none;
    cursor: pointer;
    background: none;
    border: none;
}

.mobile-menu-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: var(--cream);
    margin: 5px 0;
    transition: 0.4s;
}

/* --- HERO SECTION --- */
.hero {
    min-height: 100vh;
    background: linear-gradient(rgba(10, 41, 71, 0.5), rgba(10, 41, 71, 0.5)), 
                url('img/FOTOPORTADA.jpeg') no-repeat center center/cover;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center; 
    padding: 20px;
}

.main-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 8vw, 4.5rem); /* Ajuste automático de tamaño */
    line-height: 1.1;
    margin-bottom: 20px;
    color: var(--cream); 
}

.main-title span {
    font-weight: 400;
    font-style: italic;
    color: var(--white); 
}

.sub-text {
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: 300;
    max-width: 800px;
    margin: 0 auto 40px auto;
    color: var(--cream); 
}

.btn-elegant {
    padding: 15px 40px;
    border: 1px solid var(--cream);
    color: var(--cream);
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    display: inline-block;
    transition: 0.4s;
}

.btn-elegant:hover {
    background: var(--cream);
    color: var(--primary-blue);
    transform: translateY(-3px); 
}

/* --- SERVICIOS --- */
.services-section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 100px 20px;
    background: linear-gradient(rgba(10, 41, 71, 0.7), rgba(10, 41, 71, 0.8)), 
    url('img/fondoservicios.png') no-repeat center center/cover;
    background-attachment: fixed;
    text-align: center;
}

.section-title {
     font-family: 'Playfair Display', serif;
     font-size: clamp(2rem, 5vw, 3rem);
     margin-bottom: 40px;
     color: var(--cream); 
}

.cards-grid {
    display: flex;
    justify-content: center;
    flex-wrap: wrap; /* Importante para responsive */
    gap: 30px; 
}

.card-item-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 280px; 
}

.scene {
    width: 100%;
    height: 400px;
    perspective: 1500px;
    cursor: pointer; 
} 

.card {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.8s;
    transform-style: preserve-3d; 
}

.card.is-flipped { transform: rotateY(180deg); }

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5); 
}

.card-face img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
}

.face-back { transform: rotateY(180deg); }

.button-container {
    margin-top: 20px;
    opacity: 0;
    transform: translateY(-10px);
    transition: 0.5s;
    pointer-events: none; 
}

.button-container.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto; 
}

.btn-card {
    padding: 10px 25px;
    border-radius: 50px;
    border: 1px solid var(--soft-blue);
    color: var(--cream);
    text-decoration: none;
    font-weight: 700;
    transition: 0.3s;
}

.btn-card:hover {
    background-color: var(--soft-blue);
    color: var(--white); 
}

/* --- NOSOTROS --- */
.about-section {
    padding: 80px 8%;
    background-color: var(--white);
    color: var(--primary-blue); 
}

.about-main-container {
    max-width: 1100px;
    margin: 0 auto; 
}

.section-title-alt {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2rem, 5vw, 3rem);
    margin-bottom: 60px;
    text-align: center; 
}

.about-block {
    display: flex;
    align-items: center;
    gap: 60px;
    margin-bottom: 100px; 
}

.about-block.reverse { flex-direction: row-reverse; }

.about-image-side { flex: 1; }

.about-image-side img {
    width: 100%;
    height: 400px;
    object-fit: cover;
    border-radius: 15px;
    box-shadow: 15px 15px 0 var(--soft-blue); 
}

.about-content-side { flex: 1; }

.block-number {
    font-family: 'Playfair Display', serif;
    font-size: 4rem;
    color: var(--soft-blue);
    opacity: 0.2;
    display: block;
    margin-bottom: -15px; 
}

.about-content-side h3 {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    margin-bottom: 20px; 
}

.about-content-side p {
    font-size: 1rem;
    line-height: 1.7;
    color: #444;
    margin-bottom: 15px; 
}

/* --- POR QUÉ ELEGIRNOS --- */
.why-section {
    padding: 80px 8%;
    background-color: var(--white);
    color: var(--primary-blue); 
}

.why-container {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 40px;
    align-items: center; 
}

.why-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.8rem, 4vw, 3rem);
    margin-bottom: 30px; 
}

.why-item {
    display: flex;
    gap: 20px;
    margin-bottom: 30px; 
}

.why-number { 
    width: 40px;
    height: 40px;
    background-color: var(--soft-blue);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 700;
    flex-shrink: 0; 
}

.why-text p { color: #555; }

.why-image img {
    width: 100%;
    height: 450px;
    object-fit: cover;
    border-radius: 20px;
}

/* --- FOOTER --- */
.main-footer {
    background-color: var(--primary-blue);
    padding: 60px 8%;
    border-top: 1px solid rgba(241, 239, 231, 0.1); 
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center; 
}

.logo-wrapper img { height: 100px; }

.footer-info {
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: flex-end; 
}

.info-item {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--white);
    transition: 0.3s;
}

.info-item img { width: 20px; height: 20px; filter: invert(1); }

/* --- PÁGINAS DE DETALLE (Servicios) --- */
.page-header-spacer { height: 80px; }

.detail-section {
    padding: 40px 5%;
    min-height: 80vh;
}

.detail-container {
    max-width: 1000px;
    margin: 0 auto;
    background: var(--white);
    padding: clamp(20px, 5vw, 60px);
    border-radius: 20px;
    color: #333;
}

.detail-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(1.5rem, 4vw, 2.5rem);
    color: var(--primary-blue);
    border-bottom: 2px solid var(--soft-blue);
    padding-bottom: 10px;
    margin-bottom: 30px;
}

.detail-main-flex {
    display: flex;
    gap: 40px;
    flex-direction: row;
}

.detail-image { flex: 1; }
.detail-text { flex: 1.2; }

/* --- MEDIA QUERIES (RESPONSIVE FINAL) --- */

@media (max-width: 900px) {
    /* Navegación Móvil */
    .mobile-menu-btn { display: block; z-index: 1001; }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        height: 100vh;
        background: var(--primary-blue);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        transition: 0.5s;
        box-shadow: -10px 0 30px rgba(0,0,0,0.5);
    }

    .nav-links.active { right: 0; }
    
    .nav-links li { margin: 20px 0; }

    /* Secciones generales */
    .about-block, .about-block.reverse {
        flex-direction: column;
        gap: 30px;
    }

    .about-image-side img { height: 300px; }

    .why-container { grid-template-columns: 1fr; }
    
    .why-image { order: -1; }
    .why-image img { height: 300px; }

    .footer-container {
        flex-direction: column;
        gap: 40px;
        text-align: center;
    }
    
    .footer-info { align-items: center; }

    .detail-main-flex { flex-direction: column; }
}

@media (max-width: 600px) {
    header { padding: 10px 5%; }
    .logo img { height: 40px; }
    .btn-elegant { width: 100%; padding: 15px 20px; }
}

/* --- ARREGLO ESPECÍFICO PARA PÁGINAS DE SERVICIOS --- */

/* Evita que la sección de detalle se desborde */
.detail-section {
    width: 100%;
    overflow: hidden;
    padding: 100px 5% 40px 5%; /* Ajuste de espacio superior */
}

/* Controla el contenedor blanco */
.detail-container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    display: block; /* Asegura que no se comporte como flex si no es necesario */
}

/* Controla la imagen lateral para que no sea gigante */
.detail-image {
    max-width: 450px; /* Limita el ancho de la imagen */
    width: 100%;
    margin: 0 auto;
}

.img-side {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: cover;
    border-radius: 15px;
}

/* Ajuste del Flexbox para que no se "enloquezca" */
.detail-main-flex {
    display: flex;
    gap: 40px;
    align-items: flex-start;
    flex-wrap: wrap; /* Si no entra la imagen, la manda abajo */
}

.detail-text {
    flex: 1;
    min-width: 300px; /* Evita que el texto se haga un fideo */
}

/* --- RESPONSIVE ESPECÍFICO PARA DETALLE --- */
@media (max-width: 850px) {
    .detail-main-flex {
        flex-direction: column; /* Imagen arriba o abajo del texto */
    }
    
    .detail-image {
        max-width: 100%; /* En móviles que use todo el ancho */
        order: -1; /* Pone la imagen arriba del texto */
        margin-bottom: 20px;
    }
    
    .detail-container {
        padding: 20px;
    }
    
    .detail-title {
        font-size: 1.8rem;
        text-align: center;
    }
}

/* --- RESTAURACIÓN DEL BOTÓN VOLVER A SERVICIOS --- */
.btn-back {
    display: inline-block;
    margin-top: 30px;
    background-color: var(--primary-blue); /* Tu azul oscuro */
    color: var(--white) !important;
    padding: 12px 25px;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.3s ease;
    border: none;
    text-transform: none; /* Para que no salga todo en mayúsculas si no quieres */
    letter-spacing: normal;
}

.btn-back:hover {
    background-color: var(--soft-blue); /* El azul más claro al pasar el mouse */
    transform: translateX(-5px); /* Efecto de flecha moviéndose */
    color: var(--white) !important;
}

/* Ajuste para que no se pegue al texto en móviles */
@media (max-width: 600px) {
    .btn-back {
        width: 100%;
        text-align: center;
        margin-top: 20px;
    }
}